text
stringlengths
14
410k
label
int32
0
9
protected void print() { System.out.println("Print for " + prototype + "------------------"); cfg.visit(new PrintVisitor() { Phi phi = null; public void visitBlock(final Block block) { phi = exprPhiAtBlock(block); super.visitBlock(block); } public void visitLabelStmt(final LabelStmt s...
2
private Type parseType() { //System.out.println("parseType"); Type node; switch(showNext().getKind()) { case "ident": node = new NamedType(new Identifier(acceptIt())); break; case "array": node = parseArrayType(); break; case "record": node = parseRecordType(); break; default: node = ...
3
public static void insertFonction(String libelle) throws SQLException { String query = ""; try { query = "INSERT INTO FONCTION (FONCLIBELLE) VALUES (?); "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement(query); pStatement.setStrin...
1
public static void selectRightText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; int currentPosition = textArea.getCaretPosition(); if (currentPosition == textArea.getText().length()) { return; } // Update Preferred Caret Position ...
2
public static final int getMaxHit(Player player, int weaponId, int attackStyle, boolean ranging, boolean usingSpec, double specMultiplier) { if (!ranging) { int strengthLvl = player.getSkills().getLevel(Skills.STRENGTH); double xpStyle = CombatDefinitions .getXpStyle(weaponId, attackStyle); double...
8
public static long appendIncrementalUpdate( Document document, OutputStream out, long documentLength) throws IOException { // Iterate over StateManager entries, writing changed objects // (like Annotation, Page, Annots array) to output stream via // IncrementalUpdater ...
4
public void setId(Integer id) { this.id = id; }
0
/* */ protected RIFCSElement(Node n, String name) /* */ throws RIFCSException /* */ { /* 56 */ if (n == null) /* */ { /* 58 */ throw new RIFCSException("Null Node passed to constructor"); /* */ } /* */ /* 61 */ if ((n instanceof Element)) /* */ { /* 63 ...
3
@SuppressWarnings("deprecation") @EventHandler public void VillagerSpawn(CreatureSpawnEvent event){ ArrayList<String> firstNames = new ArrayList<String>(); OfflinePlayer[] oln = Bukkit.getOfflinePlayers(); if(event.getEntityType().getName().equalsIgnoreCase("Villager")){ for(OfflinePlayer y : oln){ fi...
3
public void render(Graphics2D g) { g.drawImage(RL.stone, x, y, width, height, null); if (up) { g.drawImage(RL.stoneVC, x, y - height / 2, 64, 64, null); } if (down) { g.drawImage(RL.stoneVC, x, y + height / 2, 64, 64, null); } if (left) { g.drawImage(RL.stoneHC, x - width / 2, y, 64, 64, null); ...
4
public void dealerHit() { System.out.println(">Dealer's hidden card was: " + dealerHand.getHand().get(0).toString()); while (dealerHand.getHandValue() < 21) { if (dealerHand.getHandValue() < 17 && !dealerHand.getHValues().contains(11)) { dealerHand.addCard(shoe.dealCard()); System.out.printl...
9
private void memory_stage() { InstructionType type = current_instruction.get_type(); int rt; switch (type) { case lw: memory_result = memory_unit.load_word(alu_result); break; case lh: memory_result = memory_unit.load_half_word(alu_result); break; case lhu: memory_result = memory_unit.load...
8
private static void fillArray(int[] array, int actualDataSpots){ for (int x = 0; x <= array.length -1; x++){ //fills in starting elements if(x <= actualDataSpots -1){ array[x] = x; } else { //fills the rest with -1 array[x] = -1; } } }
2
public static String rTrim(final String value) { if (value == null) { return null; } String trimmed = value; int offset = value.length() - 1; while (offset > -1 && (value.charAt(offset) == ' ' || value.charAt(offset) == '\t')) { offset--; } ...
5
public void unpackDat( File datFile, File outFolder ) throws IOException { log.trace("Unpacking dat file " + datFile.getPath() + " into " + outFolder.getPath()); InputStream in = new FileInputStream(datFile); outFolder.mkdirs(); int[] header = readHeader(in); int i = 0; while( i < header.leng...
2
public LineSplitterBrackets(String delimiter, String theBracketLeft, String theBracketRight) { super(delimiter); this.bracketLeft = theBracketLeft; this.bracketRight = theBracketRight; if (bracketLeft.equals(bracketRight)) { bracketFinder = new BracketFinder() { public int...
5
public OdigoiAdd(int editId) { /* * parathiro gia thn prosthiki i tin epe3ergasia odigou, an to editId einai 0 tote kanei prosthiki alliws epexergasia */ con = new Mysql(); id=editId; if(id==0) // vazei ton katallhlo titlo analoga thn leitourgia pou exei epilex8ei setTitle("Prosthiki Odigou"); else ...
4
@Test public void deleteWorksAtEnd() { initializeWithABC(); l.delete(c); assertEquals(b, l.max()); assertEquals(null, l.succ(b)); }
0
@Override public void run(){ if(state == GameState.Running){ while(true){ robot.update(); if(robot.isJumped()){ currentSprite = characterJumped; } else if (robot.isJumped() == false && robot.isDucked() == false){ currentSprite = anim.getImage(); } ArrayList projectiles = robot.g...
9
private void paintTiles(Graphics g) { for (int i = 0; i < tilearray.size(); i++) { Tile t = (Tile) tilearray.get(i); g.drawImage(t.getTileImage(), t.getTileX(), t.getTileY(), this); } }
1
private void writeXML(String xml) { String resourceName = System.getProperty(CONFIG_FILENAME_KEY); if (resourceName == null) { return; } else { URL rUrl = ClassLoader.getSystemResource(resourceName); if (rUrl != null) { File file = new File(rUr...
6
private Map<String, Object> saveMap() { Map<String, Object> map = new HashMap<String, Object>(); map.put("name", name); map.put("main", main); map.put("version", version); map.put("database", database); map.put("order", order.toString()); map.put("default-permiss...
9
@Override public Integer getIdFromDataBase() throws SQLException { Integer id = null; if(numGroup == null){ return id; } else if(yearSupply == null){ return id; } else if (faculty == null || faculty.getIdFaculty() == null){ return id; } ...
5
public void setAccountTypes(AccountTypes accountTypes) { this.accountTypes = accountTypes; if (accountTypes != null) { selectedAccountTypes.clear(); for (AccountType type : accountTypes.getBusinessObjects()) { selectedAccountTypes.put(type, Boolean.TRUE); ...
3
public StringBuffer getOOXML() { StringBuffer cooxml = new StringBuffer(); cooxml.append( "<c:view3D>" ); cooxml.append( "\r\n" ); // rotX == anElev if( anElev != 0 ) // default { cooxml.append( "<c:rotX val=\"" + anElev + "\"/>" ); } // hPercent -- a height percent between 5 and 500. // rotY == a...
6
protected Tuple fetchNext() throws TransactionAbortedException, DbException { /*while (hasMoreChild1Tuples) { while (hasMoreChild2Tuples) { // Loop through every child1 tuple in the cached page for (int i = child1Index; i < child1Max; i++) { Tuple...
8
protected void runTestOnData(Instances data) { // count numeric atts int numeric = 0; for (int n = 0; n < data.numAttributes(); n++) { if (data.attribute(n).isNumeric()) numeric++; } // perform tests for (int n = 0; n < data.numInstances(); n++) { try { AlgVector v = new AlgVe...
9
public void process(ByteBuffer _buffer) { int messageType = _buffer.getInt(); Response response; switch (messageType) { case Response.MSG_CLIENT_REGISTER: _LOGGER.log(Level.FINE, "MSG_CLIENT_REGISTER"); response = registerClient(_buffer.getInt()); ...
8
protected static Inet6Address getScopedInetAddress(Inet6Address addr) { if(addr == null) return null; Enumeration<NetworkInterface> en; List<InetAddress> retval=new ArrayList<>(); try { en=NetworkInterface.getNetworkInterfaces(); ...
9
public static commandReturn findCommand(String data){ commandReturn RETURN = new commandReturn(); if(data.indexOf("{COMMAND}") != -1){ String[] commandSplit; String commandNum; String[] commandParams = new String[0]; String commandOther; comma...
7
private static String docidFromURL(URL url) throws HostNoGV, NoQuery, NoDocId, DocIdInvalid { /** Google Video */ String queryURL; int startDocId, endDocId; if ((url.getHost() == null) || (url.getHost().indexOf("video.google.com") == -1)) { throw new HostNoGV(); ...
9
protected static Ptg calcQuartile( Ptg[] operands ) { Ptg[] aveoperands = new Ptg[1]; aveoperands[0] = operands[0]; Ptg[] allVals = PtgCalculator.getAllComponents( aveoperands ); CompatibleVector t = new CompatibleVector(); double retval = 0; for( Ptg p : allVals ) { try { Double d = new Double...
9
public void visit_dup_x1(final Instruction inst) { // 0 1 -> 1 0 1 if (Tree.USE_STACK) { saveStack(); final StackExpr s1 = (StackExpr) stack.pop1(); final StackExpr s0 = (StackExpr) stack.pop1(); final StackExpr[] s = new StackExpr[] { s0, s1 }; manip(s, new int[] { 1, 0, 1 }, StackManipStmt.DUP_X...
3
public List<Book> displayAll() { List<Book> bookList = new ArrayList<Book>(); try { // Erforderlicher SQL-Befehl String sqlStatement = "SELECT * FROM bookworm_database.books;"; // SQL-Befehl wird ausgeführt myResultSet = mySQLDatabase.executeSQLQuery(sqlStatement); while (myResultSet.next()) { ...
2
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...
6
protected int getAddressingMethod(String code) { if (this.register.equalsIgnoreCase("0")) { this.isIndexed = false; } else { this.isIndexed = true; } if (code.indexOf("*") == -1) { this.isIndirect = false; } else { this.isIndir...
6
public void affectEntity(EntityLiving par1EntityLiving, EntityLiving par2EntityLiving, int par3, double par4) { int var6; if ((this.id != heal.id || par2EntityLiving.isEntityUndead()) && (this.id != harm.id || !par2EntityLiving.isEntityUndead())) { if (this.id == harm.id && !par...
9
public void addPalavra(String palavra, int numLinha) { int existepalavra = 0; for (Palavra listaPalavra : listaPalavras) { if (listaPalavra.getPalavra().equalsIgnoreCase(palavra)) { listaPalavra.addLinha(numLinha); existepalavra++; } ...
3
public static DocumentInfo getDocumentInfo(String pathname) { // Handle an invalid pathname if (pathname == null) { return null; } // Check all the recent files for (int i = 0, limit = frameInfoList.size(); i < limit; i++) { DocumentInfo docInfo = (DocumentInfo) frameInfoList.get(i); if (docIn...
4
public void addTemplateFields(String initial, String rule, String encoding) throws IOException { LinkedHashMap<String, String> updatingRequestField = requestFields .get(initial); if (updatingRequestField == null) throw new IOException(); if (rule.split("=").length == 1 || encoding.split(":").length == 1...
3
public int[] retornarCoordenadaDe(int idObjeto){ int[] posicion=null; for(int i=0;i<dimension;i++){ for(int j=0;j<dimension;j++){ if(matriz[i][j]==idObjeto){ posicion=new int[2]; posicion[0]=i; posicion[1]=j; ...
9
public static int determineSeed(Output output, ParameterDatabase parameters, Parameter seedParameter, long currentTime, int offset, boolean auto) { int seed = 1; // have to initialize to make the compiler happy String tmp_s = parameters.getString(seedParameter,null); if (tmp_s==null && ...
9
private static void subarray(int i, int j) { // TODO Auto-generated method stub int l=0,m=0; int k=1,n=1; int whowin = none; for(l = 3*i-2 ;l<3*i+1;l++ ){ n=1; for(m = 3*j-2;m<3*j+1;m++){ currentarray[k][n] = totalarray[l][m]; n++; } k++; } whowin = checkarray(currentarray,cross);...
2
@Override public Screen respondToUserInput(KeyEvent key) { switch (key.getKeyCode()) { case KeyEvent.VK_NUMPAD4: player.moveBy(-1,0); break; case KeyEvent.VK_NUMPAD6: player.moveBy(1,0); break; case Key...
8
public InfoRequest addEmail(String email) { emails.add(new EmailContainer(email)); return this; }
0
void generate() { if (rootDoc == null || outputdir == null) { return; } PackageDoc[] pds = rootDoc.specifiedPackages(); for (int i = 0; i < pds.length; i++) { // If -nodeprecated option is set and the package is marked as deprecated, // do not convert ...
9
private void finalizarLlegada(int input, int output) { TorniqueteDAO dao = new TorniqueteDAO(); boolean verif = dao.registrarActualizar(GUI2.torniquete_id); boolean verifHora = dao.registrarActualizarHora(GUI2.torniquete_id); boolean verifDia = dao.registrarActualizarDia(GUI2.torniquete_...
9
public void transform(InputStream xmlSourceStream, InputStream xslSourseStream, OutputStream resultStream) { try { Source xmlSource = new StreamSource(xmlSourceStream); Source xsltSource = new StreamSource(xslSourseStream); TransformerFactory transFact = TransformerFactory.newInstance(); Tra...
1
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
7
private int getScore(Point[] points) { int playerone=0; int playertwo=0; for(int i=0;i<points.length;i++) { if(points[i].getState()==Board.PLAYER_ONE) { playerone++; } else if(points[i].getState()==Board.PLAYER_TWO) ...
7
public void run(){ try{ Display.setDisplayMode(new DisplayMode(800,600)); Display.setVSyncEnabled(true); Display.create(); Display.setFullscreen(true); Camera.setCurrentCamera(new Camera(0, 2, 0, 0,0,0)); initGL(); getDelta(); // call once before loop to initialise lastFrame lastFPS = getTime(...
7
public void mouseReleased(MouseEvent mouseEvent) { if (treePane.getDragRectangle() != null) { Set<Node> selectedNodes = treePane.getNodesAt((Graphics2D) treePane.getGraphics(), treePane.getDragRectangle().getBounds()); if (!mouseEvent.isShiftDown()) { treePane.clearSelec...
9
private static String getDir(String paramString) { if (paramString == null) { return null; } File localFile = new File(paramString); if ((localFile.isDirectory()) && (localFile.canRead())) { return localFile.getAbsolutePath(); } return null; }
3
public static void main(String[] args){ EntityManagerFactory emf; EntityManager em; emf= Persistence.createEntityManagerFactory("colectivos.odb"); em= emf.createEntityManager(); //A CONTINUACION SE CARGAN CIUDADES Ciudad ciu; int i; String[] ciudades = {"Y...
7
@Override protected boolean process(Token token) { // start tag, end tag, doctype, comment, character, eof switch (token.type) { case StartTag: insert(token.asStartTag()); break; case EndTag: popStackToClose(token.asEndTag()); ...
6
public void calculate_pcm_samples(Obuffer buffer) { compute_new_v(); compute_pcm_samples(buffer); actual_write_pos = (actual_write_pos + 1) & 0xf; actual_v = (actual_v == v1) ? v2 : v1; // initialize samples[]: //for (register float *floatp = samples + 32; floatp > samples; ) // *--floatp = 0.0f; ...
2
public void drawModel(Graphics2D graphics, Actor actor, Color color) { Model model = actor.getModel(); if (model == null || !model.isValid()) return; Vec3[][] vectors = model.getVectors(); graphics.setColor(color); int gx = actor.getLocation().getGx(); int gy = actor.getLocation().getGy(); for (Vec3[] ...
6
@Override protected void inspectContents(File file, String contents) { StringBuffer buf = new StringBuffer(); // Split it into lines StringSplitter splitter = new StringSplitter(contents, getLineEnding()); // Scan each line int totalMatchesForThisFile = 0; int lineCount = 1; while (splitter.hasMore...
5
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String[] cards = {"2","3","4","5","6","7","8","9","10","J","Q","K","A"}; String[] faces = {"♣","♦","♥","♠"}; String[] allCards = new String[52]; int caunt = 0; Random random = new Random(51); int randomNu...
4
public Iterable<String> keysWithPrefix(String prefix) { Queue<String> queue = new Queue<String>(); Node<Value> x = get(root, prefix, 0); if (x == null) return queue; if (x.val != null) queue.enqueue(prefix); collect(x.mid, new StringBuilder(prefix), queue); return queue; ...
2
private int setToBeHuffed(){ FactoryOfPlays factory = new FactoryOfPlaysForPlayer(player); if (factory.isEmpty()) return 0; AbstractPlay bestPlay = factory.getBest(); int max = bestPlay.eatNumber(); if (max > 0) player.getBoard().getPiece(bestPlay.getStart()).setHuff(true); return max; }
2
private void pathRek(int x, int y,String path) { if(matrix[y][x]==0) { alignmentPrint(path, y, x); //System.out.println(path); } else { if(y==0) { String temp=path+"I"; pathRek(x-1,y,temp); } if(x==0) { String temp=path+"D"; pathRek(x,y-1,temp); } else { if(m...
9
public void setRows(int rows) { this.rows = rows; }
0
public EFontAlign mirror(boolean h, boolean v) { return pos[x == 1 ? 1 : (h ? (x == 0 ? 2 : 0) : x)][y == 1 ? 1 : (v ? (y == 0 ? 2 : 0) : y)]; }
6
@RequestMapping(value = "/login", method = RequestMethod.POST) public ModelAndView loginUser(@RequestParam String userId, @RequestParam String password, @RequestParam int department, HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView(); String result = service.login(userId, password...
1
public void testPropertyAddNoWrapMinute() { TimeOfDay test = new TimeOfDay(10, 20, 30, 40); TimeOfDay copy = test.minuteOfHour().addNoWrapToCopy(9); check(test, 10, 20, 30, 40); check(copy, 10, 29, 30, 40); copy = test.minuteOfHour().addNoWrapToCopy(39); check(co...
2
public void backspace() { TextGrid.DataGridCel cel; // Do nothing if we are at the beginning if (rowOffset + colOffset + currentCol + currentRow == 0) { return; } if ((currentCol + colOffset) == 0 && (currentRow + rowOffset) != 0) { // Get a \n in the pr...
7
public TransformsType getTransforms() { return transforms; }
0
public void creat(List[] input,String strFileName) throws RowsExceededException, WriteException, DocumentException{ try { String newFile = strFileName.substring(0, strFileName.length()-4); System.out.println("newfile"+newFile); WritableWorkbook book = Workbook.createWorkbook(new File(newFile+...
8
public void writeFile(){ try{ PrintWriter output = new PrintWriter(fileName); output.println(scores.size()); output.println(madeMoney); for(PlayerPanel p: scores){ boolean gg[] = p.getGoodG(); output.println(p.getName()); ...
9
public Construct readNext() throws SyntaxError { patternSearch: for (LanguagePattern lp : LanguagePattern.searchValues()) { Symbol symbol = lexer.nextToken(); int start = lexer.getIndex(); for (;;) { switch (lp.tryNextToken(symbol)) { case LanguagePattern.PATTERN_ENDED: return lp.fetchProduct()...
5
public void renInven() { int index; String oldName, newName; InventoryListObject inventoryListObject; if ( tpContent.getTabCount() > 0 ) { index = tpContent.getSelectedIndex(); oldName = tpContent.getTitleAt( index ); newName = JOptionPane.showInputDialog( Data.getView(), "New ...
5
public java.lang.Object get(int field$) { switch (field$) { case 0: return to; case 1: return from; case 2: return body; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } }
3
private void asetaVoittoteksti(String teksti){ char[] voittaja = teksti.toCharArray(); char[] voittoteksti = new char[pelinVoitti.length + voittaja.length]; for (int i=0; i<pelinVoitti.length; i++){ voittoteksti[i]=pelinVoitti[i]; } for (int j=0; j<voittaja.l...
2
public static Class<?> getClass(Type type) { if (type instanceof Class) { return (Class<?>)type; } if (type instanceof ParameterizedType) { ParameterizedType paramType = (ParameterizedType)type; return getClass(paramType.getRawType()); } else if (type instanceof WildcardType) { WildcardType wil...
9
public void passaTudoPraWait() { lockS.remove(0); if (waitList.isEmpty()) { ArrayList<String> aux = (ArrayList<String>) lockS.clone(); waitList = aux; } else { for (int i = 0; i < lockS.size(); i++) { waitList.add(lockS.get(i)); } ...
2
@Test public void newBoardTest() throws IOException { Server server = makeServer(); //board1 adds correctly assertTrue(server.newBoard("board1")); assertTrue(server.getBoardsHashtable().containsKey("board1") && server.getBoardsHashtable().size() == 1); //board...
5
private void solve() { Scanner scanner = new Scanner(System.in); a = scanner.nextInt(); m = scanner.nextInt(); seed = scanner.nextInt(); scanner.nextLine(); String line = scanner.nextLine(); while (line != null) { char[] encryptedText = line.toCharArray(); for (int i = 0; i < encryptedText.length; i...
5
public static StatisticalSummaryValues aggregate(Collection<SummaryStatistics> statistics) { if (statistics == null) { return null; } Iterator<SummaryStatistics> iterator = statistics.iterator(); if (!iterator.hasNext()) { return null; } SummarySta...
9
public final void removeBlock() { if (outer instanceof SequentialBlock) { if (outer.getSubBlocks()[1] == this) { if (jump != null) outer.getSubBlocks()[0].moveJump(jump); outer.getSubBlocks()[0].replace(outer); } else outer.getSubBlocks()[1].replace(outer); return; } EmptyBlock eb = ne...
3
@Override public List<String> getGroups() { return (List<String>) groups.clone(); }
0
@Override protected void initiate_constraint_feature(int label) { m_phi_Z_x = new double[C][CONT_SIZE]; m_b = new double[CONT_SIZE]; m_q = new double[C]; //Arrays.fill(m_b, 5e-2); if(label == 0) { m_phi_Z_x[0][0] = -1; m_phi_Z_x[1][0] = 1; m_phi_Z_x[1][1] = -1; m_phi_Z_x[2][1] = 1; ...
5
public void findSum(TreeNode root,int sum,int curSum,LinkedList<Integer> col){ if(root == null){ return ; } curSum += root.data; col.add(root.data); if(root.left==null&&root.right==null&&curSum == sum){ print(col); } if(root.left!=null) findSum(root.left,sum,curSum,col); if(root.right!=null) ...
6
public void act() { // sends information to expandImage method where it stretches the paddle if(enlarge > -1) { expandImage(getImage().getWidth()+1); // expand by 1 more animation enlarge++; // stop expansion when reached 25 times if(enlarg...
4
private com.authy.api.User userFromXml(int status, String content) { com.authy.api.User user = new com.authy.api.User(); try { Error error = errorFromXml(status, content); if(error == null) { JAXBContext context = JAXBContext.newInstance(Hash.class); Unmarshaller unmarshaller = context.createUn...
2
public void drawUniverseSchematic(){ schematicContainer.getChildren().clear(); // x and y location to draw components, xt is used to reset x back to original value int x, y, xt; // Positions to start drawing x = 50 + (int)mouseInfo.offX(); y = 50 + (int)mouseInfo.offY(); xt = x; //Draw some...
9
public final void unpush() { // First, move 'back' one position backwards. if (back_pos > 0) back_pos--; else { back_pos = size - 1; back_chunk = back_chunk.prev; } // Now, move 'end' position backwards. Note that obsolete end chunk ...
2
private TextBlock getCircledCharacter(ILeaf entity, ISkinParam skinParam) { final Stereotype stereotype = entity.getStereotype(); if (stereotype != null && stereotype.getSprite() != null) { return skinParam.getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor()); } final UFont font = SkinPar...
9
public FilledContainer(String name,String containerType, String baseType , HashMap<String, Double> liquids, double... parameters ) { this.parameters = parameters; this.name = name; this.containerType = containerType; this.baseType = baseType; if( containerType.equalsIgnoreCase("straitght") ) { ...
7
@Override public boolean event(QEvent e) { if (e.type() == Type.Enter) { over.emit(row, col); } return super.event(e); }
1
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getLHS()); // buffer.append("->"); buffer.append('\u2192'); String rhs = getRHS(); buffer.append(rhs.length() == 0 ? Universe.curProfile.getEmptyString() : rhs); // buffer.append('\n'); return buffer.toString(); }
1
public void communicate(String host, int port) { // Geranate a socket to conect a server. try (Socket socket = new Socket(host, port)) { // reading thread Thread readT = new Thread(new Runnable() { public void run() { try (BufferedReader sbr = new BufferedReader( new InputStreamReader(socket...
7
public static void main(String[] args) { try { access = CycAccess.getNewCycAccessInteractively(); helloWorldExample(); exampleConnectingToCyc(); exampleContantsManipulations(); exampleNartManipulations(); exampleAssertionManipulations(); exampleSynchronousQueries(); e...
2
private boolean notDelegated(String name) { if (notDefinedHere.get(name) != null) return true; int n = notDefinedPackages.size(); for (int i = 0; i < n; ++i) if (name.startsWith((String)notDefinedPackages.elementAt(i))) return true; return false;...
3
public String getRequests() { String res = ""; for (Iterator<String> e = requests.iterator(); e.hasNext();) { res += e.next(); } return res; }
1
private void calculateStudentFines(Book book, User user, int monthBack, int dayBack, int yearBack) { int daysInMonth = 31; int monthsInYear = 12; int daysInYear = 366; double totalDaysOut = 0; int yearDiff = yearBack - book.getYearOut(); int monthDiff = monthBack - book.getMonthOut(); int dayDiff =...
5
public Floor(DataBuffer buffer) { while (true) { int attributeId = buffer.getUnsigned(); if (attributeId == 0) { break; } else if (attributeId == 1) { rgbColor = buffer.getTribyte(); rgbToHSL(rgbColor); } else if (attributeId == 2) { textureID = buffer.getUnsigned(); ...
8
public void sortTheList(String mode) { Vector<Track> sortedList = new Vector<Track>(); int smallest = -1; float smallestValue = 0; while (tracksList.size() > 0) { for (int i = 0; i < tracksList.size(); i++) { float relevantValue = 0; if (mode.equals("bpm")) relevantValue = tracksList.get(i).getB...
9
private void createGrid(int m, int n, boolean edges) { double dy = 20 + 50 / Math.sqrt(m); double dx = 20 + 50 / Math.sqrt(n); System.out.println(dx + " " + dy); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { createVertex(j * dx, i * dy, getNewVer...
7
public String getTitle() { return title; }
0