]]> ]]> Myrrix Serving Layer String maxMapSizeParam = request.getParameter("maxMapSize"); int maxMapSize = maxMapSizeParam == null ? 40 : Integer.parseInt(maxMapSizeParam); int nodeMaxSize = 9; boolean userMatrix = "user".equalsIgnoreCase(request.getParameter("matrix")); ServerRecommender rec = (ServerRecommender) application.getAttribute(AbstractMyrrixServlet.RECOMMENDER_KEY); Generation generation = rec.getGenerationManager().getCurrentGeneration(); if (generation != null) { FastByIDMap<float[]> matrix = userMatrix ? generation.getX() : generation.getY(); if (matrix != null && !matrix.isEmpty()) { Node[][] map = new SelfOrganizingMaps().buildSelfOrganizedMap(userMatrix ? generation.getX() : generation.getY(), maxMapSize); for (Node[] mapRow : map) { for (Node node : mapRow) { float[] projection3D = node.getProjection3D(); String hexColor = '#' + percentageToHexByte(projection3D[0]) + percentageToHexByte(projection3D[1]) + percentageToHexByte(projection3D[2]); pageContext.setAttribute("hexColor", hexColor); } }
List<Pair<Double,Long>> contentIDs = node.getAssignedIDs(); int n = FastMath.min(nodeMaxSize, contentIDs.size()); if (n > 0) { int rowSize = (int) FastMath.round(FastMath.sqrt(n));
Iterator<Pair<Double,Long>> it = contentIDs.iterator(); int k = 0; while (k < nodeMaxSize && it.hasNext()) { out.write(String.valueOf(it.next().getSecond())); out.write(' '); if ((k+1) % rowSize == 0 && k != n-1) { out.write("<br/>"); } k++; } if (it.hasNext()) { out.write("..."); }
k = 0; while (k < n) { out.write('ยท'); if ((k+1) % rowSize == 0 && k != n-1) { out.write("<br/>"); } k++; } }
} } 255) { value = 255; } if (value < 16) { return "0" + byteToHexChar(value); } return String.valueOf(byteToHexChar(value / 16)) + byteToHexChar(value % 16); } private static char byteToHexChar(int value) { if (value < 10) { return (char) ('0' + value); } return (char) ('A' + (value - 10)); } ]]>