id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
67d3709d-b675-4f8c-af95-db63933c6676 | public String[] getGroupMembers() {
return getPersons("groups.getMembers").split(",");
} |
a6e0914a-0448-44c2-ad68-985da7fcd62d | public Downloader(String _id) {
id = _id;
} |
60d5e9cc-3bb8-4987-9f6d-a131a0b4eefa | protected String requestGET(String address) {
String result = "";
try {
URL url = new URL(address);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent", "Java bot");
conn.connect();
int code =... |
f3c1ecf7-7a92-41ad-a97a-e1d7c6ce87df | protected String getPersons(String request) {
String response = requestGET(BASE_URI + request + "?uid=" + id);
int start = response.indexOf('[');
int end = response.indexOf(']');
return response.substring(start + 1, end);
} |
2fcbfc2e-d905-4c7b-a80c-614a85f31540 | public String[] getPersonFriends() {
return getPersons("friends.get").split(",");
} |
5a97dd74-f9b0-4612-b393-0c8044ea2dcf | public String getPersonXMLData() {
StringBuilder request = new StringBuilder(BASE_URI);
request = request.append("users.get.xml?uid=");
request = request.append(id);
request = request.append("&fields=");
request = request.append("sex");
request = request.append(",bdate");... |
99a7dd29-9fa9-4ac5-a5b8-88c0e82a52cc | public DBFillerGroup (String groupId, int level) {
super(groupId, level);
registerShutdownHook(graphDb);
Transaction tx = graphDb.beginTx();
nodeIndex = graphDb.index().forNodes("uids");
tx.success();
tx.close();
} |
8989ceca-b70d-4a21-97ef-b6d8e72738c6 | @Override
public void fillDB() {
Transaction tx = graphDb.beginTx();
fillFromGroup();
tx.success();
tx.close();
} |
668471c9-2801-4990-b5cb-d353e6fb9511 | private void fillFromGroup() {
DownloaderGroup group = new DownloaderGroup(baseId);
String[] ids = group.getGroupMembers();
for(String id : ids){
fillDB_Snowball(id);
}
} |
814b2476-8cf1-4fa8-bae0-75e1f332c13e | protected void registerShutdownHook(final GraphDatabaseService graphDb) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
graphDb.shutdown();
}
});
} |
4acbcba8-c66b-44c6-a787-70dcc91c835f | @Override
public void run() {
graphDb.shutdown();
} |
ab6aecef-ed5d-4b68-9d31-d71d92bc1d84 | public DBFiller (String startId, int level) {
MAX_LEVEL = level;
baseId = startId;
registerShutdownHook(graphDb);
Transaction tx = graphDb.beginTx();
nodeIndex = graphDb.index().forNodes("uids");
tx.success();
tx.close();
} |
0abb745c-4013-4277-8e78-046e05d86034 | protected String getOneField(String name, Element e) {
if (e.getChild(name) != null) {
String temp = e.getChild(name).getText().replaceAll("\'", "");
if (!temp.equals("")) {
return temp;
}
}
return "?";
} |
6c42e647-d06b-4208-881e-f6d6fac8a0df | protected HashMap<String, Object> parsePersonXML(String xml) {
HashMap<String, Object> personData = new HashMap<String, Object>();
try {
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(new InputSource(new StringReader(xml)));
Element root = doc.get... |
5c705d4e-694c-44ac-8c1b-2c399670ac57 | protected void setRelationship(Node curPerson, Node parentPerson) {
Iterable<Relationship> relationships = curPerson.getRelationships(Direction.BOTH);
boolean relationAlreadyExist = false;
for (Relationship tempRel : relationships) {
if (tempRel.getOtherNode(curPerson).getId() == par... |
427bb118-f146-4201-bda9-005875c697e0 | protected Node addPersonToDB(HashMap<String, Object> personProperties) {
Transaction tx = graphDb.beginTx();
Node curPerson = null;
Node existingNode = nodeIndex.get("uid", personProperties.get("uid")).getSingle();
try {
if (existingNode == null) {
curPerson =... |
1a3fbf3b-954e-4ace-b673-adfc36060bba | protected Node addPersonToDB(HashMap<String, Object> personProperties, String parentUid) {
Node curPerson = addPersonToDB(personProperties);
Node parentPerson = nodeIndex.get("uid", parentUid).getSingle();
Transaction tx = graphDb.beginTx();
try {
if (curPerson == null) {
... |
4db2268e-d4f8-4ff2-947a-4eefc3696cbd | public void fillDB() {
Transaction tx = graphDb.beginTx();
fillDB_Snowball(baseId);
tx.success();
tx.close();
} |
3e3d0ca8-e571-4c1e-a8d2-4e115b8b62af | protected void fillDB_Snowball(String id) {
Downloader person = new Downloader(id);
HashMap<String, Object> personData = parsePersonXML(person.getPersonXMLData());
String[] friendUids = person.getPersonFriends();
personData.put(FRIEND_LIST_KEY, friendUids);
addPersonToDB(personDa... |
c86ff975-5ba4-4d2e-9e12-afd2a5faaba7 | protected void recFillingDB(String curUid, String parentUid, int lvl) {
if (lvl == MAX_LEVEL) {
return;
}
Downloader person = new Downloader(curUid);
System.out.println("Parsing uid = " + curUid + " parentUid = " + parentUid);
String[] friendsUids = person.getPersonFr... |
a0022058-4bf3-4253-b6af-df3ebf57669c | protected void setOneNodeRelations(Node curNode) {
if (curNode.hasProperty(FRIEND_LIST_KEY)) {
String[] friendsUidList = (String[]) curNode.getProperty(FRIEND_LIST_KEY);
for (String tempFriendUid : friendsUidList) {
Node tempFriend = nodeIndex.get("uid", tempFriendUid).ge... |
a974af47-5cb4-42bc-8759-d3233d5dd773 | public void setAllRelations() {
Transaction tx = graphDb.beginTx();
try {
GlobalGraphOperations glOper = GlobalGraphOperations.at(graphDb);
Iterator<Node> allNodes = glOper.getAllNodes().iterator();
while (allNodes.hasNext()) {
setOneNodeRelations(allN... |
675664e9-2d2b-4843-aa2f-77cba8d944a5 | public Line(Color c, int x, int y, int x1, int y1) {
super(c);
this.x = x;
this.y = y;
this.x1 = x1;
this.y1 = y1;
} |
d7758ef5-f294-4648-b301-90ee61074ab0 | public void paintLine(Graphics g){
g.setColor(getColor());
g.drawLine(x, y, x1, y1);
} |
ea2d5878-7e6d-47c0-bcc3-ff2521ffe8a7 | public InputSaver(String phrase, String xCoord, String yCoord, String var1, String var2) {
this.phrase = phrase;
this.xCoord = xCoord;
this.yCoord = yCoord;
this.var1 = var1;
this.var2 = var2;
} |
1662c8a2-7c33-4f8c-bb04-b9e5a7876d7e | public void remove(){
phrase = "";
xCoord = "";
yCoord = "";
var1 = "";
var2 = "";
} |
285af2d2-495b-4c54-af79-b784f3f41b54 | public TheColor(Color color){
this.color = color;
} |
849190bf-2aae-4a4b-9d67-9a277a3afc94 | public OrigOutput(String phrase){
p=phrase;
} |
dc8bc984-8b0f-4ba4-9291-33f286605925 | public FilledCircle(Color color, int x, int y, int radius) {
super(color);
this.x = x;
this.y = y;
this.radius = radius;
} |
870e2832-7462-45fd-a7c8-f5bf1a974e9e | public void paintCircle(Graphics g) {
g.setColor(getColor());
g.fillOval(x, y, radius*2, radius*2);
} |
d6492225-8d55-4cef-98da-1f47e34f47d2 | public Rectangle(Color color, int x, int y, int width, int height) {
super(color);
this.x = x;
this.y = y;
this.width = width;
this.height = height;
} |
42b4c5fa-6b23-4b0a-a344-0b51bea788eb | public void paintRectangle(Graphics g) {
g.setColor(getColor());
g.drawRect(x, y, width, height);
} |
7dc90b1d-ddde-43f5-8b7b-e8af411ef012 | public Painting(Opener opener){
setSize(800, 600);
this.opener = opener;
addMouseListener(this);
} |
f5021553-b141-4e16-8851-eab0ad387431 | public void paint(Graphics g){
TheColor TC = new TheColor(Color.black); // Set initial color of TheColor class to a default black
for(InputSaver s : opener.newPhrase){
// If statements to draw proper shapes on to canvas
if(s.phrase.equals("line")){
int x = Integer.parseInt(s.xCoord);
int y = Integer.pa... |
71c2e81c-a206-4a8e-9e51-ea0c1924685d | @Override
public void mouseClicked(MouseEvent arg0) {;} |
f02a2f38-cc6f-4c2b-a8a3-d1c665dd59b5 | @Override
public void mouseEntered(MouseEvent arg0) {;} |
13f03c35-b4a7-4a8d-9ba9-d8a47ff97c84 | @Override
public void mouseExited(MouseEvent arg0) {;} |
09ce63df-364b-4972-896c-e942025113bb | @Override
public void mousePressed(MouseEvent me) {
//Assign variables to get location of mouse click
int mouseX = me.getX();
int mouseY = me.getY();
//For loop ran every time user clicks mouse to determine if mouse click is on a shape
/*
* Canvas is redrawn if one of these if statements is true becaus... |
4e7dc668-cd53-43e0-8f5c-696b1a99b79a | @Override
public void mouseReleased(MouseEvent arg0) {;} |
6d7f0854-61e4-4f4c-adcb-220ca61e90a7 | @Override
public void windowActivated(WindowEvent arg0) {;} |
502fe1ea-d6a0-4e2c-95c0-877ea5479f17 | @Override
public void windowClosed(WindowEvent arg0) {;} |
6ed299b7-52b9-498e-bd05-47d56adb83fd | @Override
public void windowClosing(WindowEvent arg0) {
System.exit(0);;} |
6d40add7-1710-4dd3-a1c6-50d5f448aceb | @Override
public void windowDeactivated(WindowEvent arg0) {;} |
e25923d5-4275-47ff-8c3e-03e742b29a0a | @Override
public void windowDeiconified(WindowEvent arg0) {;} |
4702f687-2e77-480f-951b-b83bbc114551 | @Override
public void windowIconified(WindowEvent arg0) {;} |
56f63c47-416b-46b2-82ad-6d868ecc21b3 | @Override
public void windowOpened(WindowEvent arg0) {;} |
c9007d4e-d61f-417e-9c79-e68a2aff841c | public FilledSquare(Color c, int x, int y, int width) {
super(c, x, y, width, width);
} |
7166875f-19a3-426d-aa7a-33063b042d1a | public static void main(String[] args) {
// Show application
f.setSize(800,600);
f.setVisible(true);
f.setLocationRelativeTo(null);
// MenuBar can be seen as the MODEL
MenuBar bar = new MenuBar(); //create new menu bar
f.setMenuBar(bar); //add the menu bar to the frame
Menu fileMenu = new... |
1e54f42d-50be-4f02-8300-0976917ad310 | public FilledRectangle(Color color, int x, int y, int width, int height) {
super(color);
this.x = x;
this.y = y;
this.width = width;
this.height = height;
} |
0eb2ee6e-b496-4fd0-b4ad-07253b9b9bca | public void paintRectangle(Graphics g) {
g.setColor(getColor());
g.fillRect(x, y, width, height);
} |
0eeedb2b-35f4-4f07-8e2c-f642304154ee | public Opener(Frame app) {
this.app = app;
} |
bfb12bb5-0371-42b7-8568-0c5e56bf2b8a | @Override
public void actionPerformed(ActionEvent ae) {
// Pop up a file dialog
FileDialog open = new FileDialog(app);
open.setVisible(true);
// Get the received file + dir and save it as a single string for convenience
String path = open.getDirectory() + open.getFile();
try{
// Open the fil... |
93e8ca62-d791-4e86-9028-01003b615bae | public Circle(Color color, int x, int y, int radius) {
super(color);
this.x = x;
this.y = y;
this.radius = radius;
} |
78492c4c-f353-43d7-a5ab-6d2514c63537 | public void paintCircle(Graphics g) {
g.setColor(getColor());
g.drawOval(x, y, radius*2, radius*2);
} |
02acf27f-97d0-44b6-a69b-431eb9fcc829 | public Shape(Color color) {
this.color = color;
} |
36beee1f-d658-4229-880d-362c67b81533 | public Color getColor(){
return this.color;
} |
083f129e-1c51-46e5-a9d8-1c3a9b320150 | public Saver(Frame app, Opener o) {
this.app = app;
op = o;
} |
3e4fb90b-963d-4baf-9a07-fc1ae18566f9 | @Override
public void actionPerformed(ActionEvent ae) {
// Pop up a file dialog
FileDialog open = new FileDialog(app);
open.setVisible(true);
// Assign directory and file to single variable for convenience
String path = open.getDirectory() + open.getFile();
try{
// Create file
FileWriter... |
90b5f4cd-5662-4062-863b-cc076f356e5d | public Square(Color color, int x, int y, int width) {
super(color, x, y, width, width);
} |
fb0ab7b5-02d7-4a6f-9a4c-c1e9efb3bf32 | public static void main(String[] args) {
final Ruang2D R2D = new Ruang2D("data/model.xls", WINDOW_WIDTH, WINDOW_HEIGHT);
frame.setContentPane(R2D);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
// Use ... |
27636f83-db6c-4944-b185-972262bf2bc5 | @Override
public void windowClosing(WindowEvent e) {
// Use a dedicate thread to run the stop() to ensure that the
// animator stops before program exits.
new Thread() {
@Override
public void run() {
... |
49a2c5fe-5c32-4531-ab17-5b29c6621a4a | @Override
public void run() {
R2D.animator.stop(); // stop the animator loop
System.exit(0);
} |
b47184b0-19a8-454c-8759-0824b3dc8c96 | public Camera () {
width = 800;
height = 600;
camx = 0;
camy = 0;
} |
e342d511-8168-4532-a9a1-3d0fc73a0938 | public Camera (int _lx, int _ly, float _cx, float _cy, float _jarak) {
width = _lx;
height = _ly;
camx = _cx;
camy = _cy;
jarak = _jarak;
} |
8605da6c-0b70-4812-9f7c-14ec106ac425 | public float getJarak () {
return jarak;
} |
d9cdaef4-a6e2-4842-a0c0-f3e1c26b7384 | public void refreshWidthHeight(int x, int y) {
width = x;
height = y;
} |
2ebe05ac-fc22-47c7-a670-b24e836f813c | public void initCamera(GL gl, GLU glu) {
// Change to projection matrix.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
// Perspective.
float widthHeightRatio = (float) width / (float) height;
glu.gluPerspective(45, widthHeightRatio, 1, 1000);
glu.gluLook... |
d6e92879-17be-4057-9ff0-b9bc3612a945 | public void zoom(GL gl, GLU glu, int x) {
jarak += x;
} |
4685d27a-bb0e-4a3d-999a-5c46358594cb | public void geser(GL gl, GLU glu, float x, float y) {
camx += x;
camy += y;
} |
e216fa6a-b364-4c1f-a73c-12c9bfb80dab | public void setInputFile(String inputFile) {
this.inputFile = inputFile;
} |
c105a371-620d-4d21-954f-0359df5c4fed | public void read() throws IOException {
int nomor = 1;
File inputWorkbook = new File(inputFile);
Workbook w;
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet
Sheet sheet = w.getSheet(0);
// Loop over first 10 column and lines
MatriksKecepatan MV = new ... |
45a8be21-4078-4403-9ca5-d516d83e7a84 | public MatriksKecepatan readtomv() throws IOException {
int nomor = 1;
File inputWorkbook = new File(inputFile);
Workbook w;
MatriksKecepatan MV = new MatriksKecepatan(1,1);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet
Sheet sheet = w.getSheet(0);
//... |
21376e1e-ce38-4983-87ef-299b839792db | public MatriksKecepatan() {
M = 1;
N = 1;
data = new String[M][N];
for (int i=0;i<M;i++){
for(int j=0;j<N;j++){
data[i][j]="0";
}
}
} |
10518120-510a-424f-824e-e89c9c23c77f | public MatriksKecepatan(int a, int b) {
M=a;
N=b;
data = new String[M][N];
for (int i=0;i<M;i++){
for(int j=0;j<N;j++){
data[i][j]=Float.toString(0f);
}
}
} |
d4f18f6b-c2cb-4cd6-ac10-a3cbf499a1a1 | public MatriksKecepatan(MatriksKecepatan _mk) {
M=_mk.M;
N=_mk.N;
data = new String[M][N];
for (int i=0;i<M;i++){
for(int j=0;j<N;j++){
isiMatriks(i,j, Float.toString(_mk.getFloatData(i, j)));
}
}
} |
619db7b8-a753-4661-aa74-192a3b232d8a | public int getIntData(int i, int j){
int x = Integer.decode(data[i][j]);
return x;
} |
7685bd71-9354-4fff-ad97-6bc73c66c8b6 | public float getFloatData(int i, int j){
float x = Float.valueOf(data[i][j]);
return x;
} |
837e7ef9-bc31-4133-976c-2b335585cc5e | public void printMatriks(){
for (int i=0; i<M; i++){
for (int j=0; j<N; j++){
System.out.print (" "+ data[i][j]);
}
System.out.println("");
}
} |
9bb8b96a-adb4-42af-951c-50dfe68de006 | public void printCell(int i, int j){
System.out.println(data[i][j]);
} |
c2b5a0bb-05bc-4cc5-9f0b-f861a2b14cf0 | public void isiMatriks (int i, int j, String a){
data[i][j] = a;
} |
a3575b81-36bc-48cd-8635-624c3aa020dd | private float MaxNumber(){
float max=-9999999f;
for (int i=0;i<M;i++){
for (int j=0;j<N;j++){
if (getFloatData(i,j) > max){
max = getFloatData(i,j) ;
}else{
... |
f2de8be7-4626-4e2b-b71f-ad31b86d8053 | private float MinNumber(){
float min=9999999f;
for (int i=0;i<M;i++){
for (int j=0;j<N;j++){
if (getFloatData(i,j) < min){
min = getFloatData(i,j) ;
}else{
... |
2d7125ea-0baa-463c-9192-4b3b21cd196f | public void setMaxMinVal() {
MaxVal = MaxNumber();
MinVal = MinNumber();
// System.out.println("asd"+MinVal);
} |
05f2076b-cead-4edb-858f-94a01fc18ea7 | public float getmaxv() { return MaxVal; } |
e68cc31d-5183-4587-b020-75009c7f0ce9 | public float getminv() { return MinVal; } |
b3f9a127-cd68-4016-828a-a3fe5b171e59 | public int getP() { return M;} |
42b5fa20-ceae-449f-a07f-fcd1ece5de5b | public int getL() { return N;} |
6d507a38-e535-4658-a3f8-f5c904495590 | public Ruang2D() {
canvas = new GLCanvas();
this.setLayout(new BorderLayout());
this.add(canvas, BorderLayout.CENTER);
canvas.addGLEventListener(this);
// Run the animation loop using the fixed-rate Frame-per-second animator, which calls back display() at this fixed-rate (FPS).
... |
b9269a2d-4be5-4384-8129-c05d461072b7 | public Ruang2D(String File, int _layarx, int _layary) {
canvas = new GLCanvas();
this.setLayout(new BorderLayout());
this.add(canvas, BorderLayout.CENTER);
canvas.addGLEventListener(this);
// Run the animation loop using the fixed-rate Frame-per-second animator, which calls back ... |
02388470-703d-44f5-9826-15455dee8fa9 | public Ruang2D(int _layarx, int _layary) {
canvas = new GLCanvas();
this.setLayout(new BorderLayout());
this.add(canvas, BorderLayout.CENTER);
canvas.addGLEventListener(this);
// Run the animation loop using the fixed-rate Frame-per-second animator, which calls back display() at ... |
0dc52591-2174-4255-bc6b-471e08025f92 | public void init(GLAutoDrawable drawable) {
// Use debug pipeline: drawable.setGL(new DebugGL(drawable.getGL()));
gl = drawable.getGL();
System.err.println("INIT GL IS: " + gl.getClass().getName());
// Setup the drawing area and shading mode
gl.glShadeModel(GL.GL_SMOOTH); // try ... |
afaeffd4-9346-45c0-b618-92d42fc918a5 | public void display(GLAutoDrawable drawable) {
gl = drawable.getGL();
glu = new GLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the drawing area
gl.glLoadIdentity(); // Reset the current matrix to the "identity"
// ------------------------------------... |
68aefaa9-259d-420d-ae03-3adad3cad530 | public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
gl = drawable.getGL();
height = (height == 0) ? 1 : height; // prevent divide by zero
float aspect = (float)width / height;
// Set the current view port to cover full screen
gl.glViewport(0, 0, wi... |
66171927-888a-4b5a-b632-1d5ed2a00062 | @Override
public void mouseWheelMoved(MouseWheelEvent e) {
int n = e.getWheelRotation();
// if(n>0)
// sbatas +=(int)(penggambar.OMK.getmaxv()/1000);
// MatriksKecepatan MK2 = penggambar.MK;
// for (int k=0;k<MK2.getP();k++){
// for(int l=0;l<MK2.getL();l++){
// ... |
7ac8d9de-e551-4ce9-abf4-35e8a7522190 | public void mousePressed(MouseEvent e) {
newx=e.getXOnScreen();
newy=e.getYOnScreen();
oldx=newx;
oldy=newy;
} |
d4b87856-d1ac-4d90-bdf5-c8d25bb48a5c | public void mouseDragged(MouseEvent e) {
newx=e.getXOnScreen();
newy=e.getYOnScreen();
kamera.geser(gl, glu, (-newx+oldx), (newy-oldy));
oldx=newx;
oldy=newy;
} |
f73066ee-48b8-42dd-b02a-6f36f8d2a92f | public void mouseEntered(MouseEvent e) {} |
3295ed94-dfe2-454c-9e16-03cc96165265 | public void mouseExited(MouseEvent e) {} |
70aaef21-ddfc-4784-be70-d70abd57d088 | public void mouseReleased(MouseEvent e) {} |
bd492418-5989-468d-847a-baefe5589369 | public void mouseClicked(MouseEvent e) {} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.