id
stringlengths
36
36
text
stringlengths
1
1.25M
d8e71e02-beb2-4d30-84b9-356ea35489ac
public int getFieldId() { return fieldId; }
f5395f7c-6c90-4bbc-a67e-0991a96f0519
public void setFieldId(int fieldId) { this.fieldId = fieldId; }
45cdb640-e6cb-41d3-aae9-3b64fc5103dd
public int getUserId() { return userId; }
b1e8512c-2e9e-46fc-9d5d-772e3cdeb261
public void setUserId(int userId) { this.userId = userId; }
045cd91f-1515-49db-a684-738ac18935e6
public GameServlet() { super(); }
f48b25ca-8096-41a2-bca0-a14d234a4c0d
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use fol...
f25a6233-2dea-4424-b540-a28a2d1de168
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
cc39f44f-aeb4-4796-ba99-175fa1eafbcb
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
a320e081-62a7-422f-9dec-66585183da04
@Override public String getServletInfo() { return "Short description"; }// </editor-fold>
44ddbe26-5de0-4293-9db7-a59f54e2c0c3
public void activationCancelled(ActivationCancelledEvent event) { if (log.isDebugEnabled()) log.debug("ACTIVATION CANCELLED : " + event.getActivation().getRule().getName()); }
b5fa7f37-a03e-45b5-befc-69c1043374bb
public void activationCreated(ActivationCreatedEvent event) { if (log.isDebugEnabled()) log.debug("ACTIVATION CREATED : " + event.getActivation().getRule().getName()); }
bc921ad0-444b-41c5-8b5e-14f0b8b2c3b3
public void afterActivationFired(AfterActivationFiredEvent event) { if (log.isDebugEnabled()) log.debug("AFTER RULE FIRED : " + event.getActivation().getRule().getName()); rulesFired.add(Integer.toString(numRulesFired + 1) + "\t: " + event.getActivation().getRule().getName()); numRulesFired+...
fcac4211-dec3-43bc-b43f-da7fc3fedae5
public void agendaGroupPopped(AgendaGroupPoppedEvent event) { if (log.isDebugEnabled()) log.debug("AGENDA GROUP POPPED : " + event.getAgendaGroup().getName()); }
b35cbca9-91c0-4c80-bfb3-e6850d54c137
public void agendaGroupPushed(AgendaGroupPushedEvent event) { if (log.isDebugEnabled()) log.debug("AGENDA GROUP PUSHED : " + event.getAgendaGroup().getName()); }
4880ed8d-8855-451e-b85e-48212685b873
public void beforeActivationFired(BeforeActivationFiredEvent activation) { if (log.isTraceEnabled()) log.debug("BEFORE RULE FIRED : " + activation.getActivation().getRule().getName()); }
5b273666-9299-4bf9-b3ab-696229597dc6
public void objectInserted(ObjectInsertedEvent event) { if (log.isDebugEnabled()) log.debug("INSERTED : " + event.getObject()); }
030f8d3d-35f4-47e5-814b-8f9c5bc64688
public void objectRetracted(ObjectRetractedEvent event) { if (log.isDebugEnabled()) log.debug("RETRACTED : " + event.getOldObject()); }
ee941d43-2c38-419c-99f3-dc5f3cfef9bf
public void objectUpdated(ObjectUpdatedEvent event) { if (log.isDebugEnabled()) log.debug("UPDATED : " + event.getObject()); }
0b9db769-dcd9-43ac-9b66-696122f592f4
public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent arg0) {}
720d102c-2512-46c3-82d3-1d3c32e4ca7d
public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent arg0) {}
ad09ee95-43bd-4ec4-8a38-688085b89d7a
public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent arg0) {}
f7688321-0915-4804-bf0e-356670e3d75d
public void beforeRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent arg0) {}
aa61c9ec-1b05-4867-845b-895fe39d151f
public int getNumRulesFired() { return numRulesFired; }
8b20c044-b18e-46fc-b81d-3fbb010e8af8
public ArrayList<String> getRulesFired() { return rulesFired; }
1d0021b6-28d8-4a14-8513-1b138edf3454
public void afterNodeLeft(ProcessNodeLeftEvent arg0) {}
aec4345d-77d5-4fc4-a62b-c027f9f81a61
public void afterNodeTriggered(ProcessNodeTriggeredEvent arg0) {}
d14dd49d-13c7-4ce8-bac7-7ee468f90f95
public void afterProcessCompleted(ProcessCompletedEvent arg0) {}
d73160b9-15b4-48bc-93c8-057ac66f440c
public void afterProcessStarted(ProcessStartedEvent arg0) {}
09da8459-c20a-48c8-b22c-20239815fab4
public void afterVariableChanged(ProcessVariableChangedEvent arg0) {}
193b23a7-1d71-4be5-870e-46bf2458b2dd
public void beforeNodeLeft(ProcessNodeLeftEvent arg0) {}
b664b6ec-9227-4f6c-9c5d-eaea12e1f2be
public void beforeNodeTriggered(ProcessNodeTriggeredEvent arg0) {}
2b935c2e-174e-4b5c-9c2b-369eefe8cd97
public void beforeProcessCompleted(ProcessCompletedEvent arg0) {}
126782ce-d312-4cd8-a4fd-cfdc8ca56000
public void beforeProcessStarted(ProcessStartedEvent arg0) {}
79da8361-f019-4013-80a3-398a0187e59a
public void beforeVariableChanged(ProcessVariableChangedEvent arg0) {}
cddc50d3-a45a-4d5f-94f9-d9f3ef5efa28
public DroolsProcessor(String server, String username, String password) throws IOException { this.server = server; this.username = username; this.password = password; }
e54536b4-4631-42e8-9316-5ddf0e55d066
public StatefulKnowledgeSession getStatefulKnowledgeSession(String packageId, String version) throws IOException, ClassNotFoundException { RulePackageDownloader downloader = new RulePackageDownloader(server, username, password); KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase(/* cfg */); kb.addKnow...
b1d0a399-c619-4a7c-adbb-efae501ed22d
public void fire(StatefulKnowledgeSession session, String packageId, String version, Object fact) throws IOException, ClassNotFoundException { EventListener listener = new EventListener(); try { session.addEventListener((WorkingMemoryEventListener) listener); session.addEventListener((AgendaEventLis...
46882256-4c0c-49e7-a61d-536c08a75ba4
public void fire(String packageId, String version, Object fact) throws IOException, ClassNotFoundException { RulePackageDownloader downloader = new RulePackageDownloader(server, username, password); KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase(/* cfg */); kb.addKnowledgePackages(downloader.downl...
b2fbd864-ea28-4fe3-ae5d-4b21cb9c4350
public RulePackageDownloader(String path, String username, String password){ this.basePath=path; this.username=username; this.password=password; }
a5fc4891-54e8-4dd8-a0b7-87f7279fcc94
public Collection<KnowledgePackage> download(String packageId, String version) throws IOException, ClassNotFoundException{ if (basePath.toLowerCase().startsWith("http")){ return downloadFromGuvnor(packageId, version); }else{ return compileFromDisk(packageId, version); } }
dc7040c5-0616-4d9b-8895-301500484509
private Collection<KnowledgePackage> compileFromDisk(String packageId, String version) throws FileNotFoundException, IOException{ KnowledgeBuilder builder=KnowledgeBuilderFactory.newKnowledgeBuilder(); File packageFile=new File(basePath, packageId.replaceAll("\\.", File.separator)+File.separator+version); i...
5da9a3a9-2d6b-4da7-9c71-db590d78da34
@SuppressWarnings("unchecked") private Collection<KnowledgePackage> downloadFromGuvnor(String packageId, String version) throws IOException, ClassNotFoundException{ UrlResource res=(UrlResource)ResourceFactory.newUrlResource(new URL(basePath+packageId+"/"+version)); if (enableBasicAuthentication){ res.s...
8d3bf83e-002e-48a2-8aea-9b6f7a5ce7e7
public boolean isHuman() { return human; }
8d06d03a-165d-4061-8a0d-d858fceee927
public void setHuman(boolean human) { this.human = human; }
8667ca4a-1b63-4031-b819-51817284b4c5
public boolean isLikesBeer() { return likesBeer; }
3f910ee2-dde2-4788-a517-deb2cf8567bf
public void setLikesBeer(boolean likesBeer) { this.likesBeer = likesBeer; }
f0e56968-0442-4d83-a6e6-3c337fb516f1
public String toString(){ return "Person[human="+human+"; likesBeer="+likesBeer+"]"; }
855a7b95-da7b-4c2b-a647-2b522c4a41d6
public void insert(Exchange exchange){ Person p=new Person(); p.setHuman(true); exchange.getIn().setBody(p); }
d2d5ec2f-f5dc-4119-a8c1-5129b833a263
PSOParam(int nParticles, float atenuator, float social, int connectivity) { this.nParticles = nParticles; this.atenuator = atenuator; this.social = social; this.connectivity = connectivity; }
3af20589-64ad-4e4c-ad4e-97c49f1e3571
public static void assemble(float[][] val, float minc, float maxc, int rezx, int rezy) { int i, j; float px, py; float tmp; Color col; float spx = -rezx/2; float spy = -rezy/2; handle = GL11.glGenLists(1); GL11.glNewList(handle,GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); px = spx; for...
d87171f6-328a-4145-a8ce-317fb9cd07ed
static void call() { GL11.glCallList(handle); }
acc76e7f-c202-46a6-8e77-ab3651adc96f
public static void release() { GL11.glDeleteLists(handle,1); }
0fd89d98-def8-4203-899b-b550e319d63c
private static String createNetwork(PSOParam psoParam) { String ret = ""; for (int i = 1; i < psoParam.connectivity; i++) ret += "\n" + " rs = ran(rs); " + " tmp1 = ranToInt(rs,0,99); " + " if(fit[tmp1] < fit[besti]) besti = tmp1; "; return ret; }
1bb7a997-e123-42aa-9932-a216d830bf39
static String create(RanGen ranGen, PSOParam psoParam, ObjectiveFunction of) { String kernelSource = "float f(float x, float y) {" + " return " + of.getCLStr() + "; " + "}" + "\n" + "int ran(int state) { " + " return (state * " + ranGen.a + " + " + ranGen.c + ") % " + ranGen.m + "; ...
4bd69ba5-0934-4f05-8335-6a47acf0c995
void start() throws LWJGLException { initCL(); initGL(); initSurface(); loop(); Surface.release(); freeGL(); freeCL(); }
89ade0bf-36e7-4c2d-bbe2-c5f1c457c152
void initGL() { try { Display.setDisplayMode(new DisplayMode(600,600)); Display.setTitle("OpenCL Particle Swarm Optimization Demo"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); Display.destroy(); System.exit(1); } glMatrixMode(GL_PROJECTION); //glOrtho(0, 800, 600,...
5206d099-fb52-4207-a5ab-158bf43bdd64
void initSurface() { Val val = compute(of,dom,rezx,rezy); Surface.assemble(val.v,val.minc,val.maxc,rezx,rezy); }
0333181e-4034-4092-b7e3-f13d84e0cebd
Val compute(ObjectiveFunction of, float[][] dom, int rezx, int rezy) { float[][] ret = new float[rezx][rezy]; float pasx, pasy; float px, py; pasx = (dom[0][1] - dom[0][0]) / rezx; pasy = (dom[1][1] - dom[1][0]) / rezy; float maxc = -10000, minc = 10000; int i, j; px = dom[0][0]; for(i=0;i<rezx;i++) ...
4f2e9a64-412b-4b75-8d72-5edb70f189d5
void loop() { glMatrixMode(GL_MODELVIEW); while (!Display.isCloseRequested()) { stepCL(); glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glScalef((dom[0][1]-dom[0][0])/(float)rezx,(dom[1][1]-dom[1][0])/(float)rezy,1.0f); Surface.call(); glPopMatrix(); drawAllParticles(); Disp...
7560eb3e-63e0-46a8-9235-9904fc3679ca
void drawAllParticles() { glBegin(GL_QUADS); glColor3f(0.0f, 0.0f, 0.0f); float tx, ty; int i; for(i=0;i<psoParam.nParticles;i++) { tx = x.get(i); ty = y.get(i); glVertex2f(tx-0.05f,ty-0.05f); glVertex2f(tx+0.05f,ty-0.05f); glVertex2f(tx+0.05f,ty+0.05f); glVertex2f(tx-0.05f,ty+0.05f)...
b31b8343-677a-48a1-800f-49d3360addaa
void freeGL() { Display.destroy(); }
61f855ff-33e5-4894-b2e3-4d5dca1b5eaa
void initCL() throws LWJGLException { final String source = KernelBuilder.create(ranGen,psoParam,of); //buffers x = Buffer.toFloatBuffer(Buffer.randomFloatArray(psoParam.nParticles,dom[0][0],dom[0][1])); y = Buffer.toFloatBuffer(Buffer.randomFloatArray(psoParam.nParticles,dom[1][0],dom[1][1])); vx = Buffer...
b00a9fe6-48b5-4e23-b6e5-ce5d00f9d83e
void stepCL() { clEnqueueNDRangeKernel(queue, kernel, 1, null, kernel1DGlobalWorkSize, null, null, null); clEnqueueReadBuffer(queue, xMem, 1, 0, x, null, null); clEnqueueReadBuffer(queue, yMem, 1, 0, y, null, null); clEnqueueReadBuffer(queue, fitMem, 1, 0, fit, null, null); clFinish(queue); }
59a3691e-9cb9-4339-845e-d43203b7a5dd
void freeCL() { clReleaseKernel(kernel); clReleaseProgram(program); clReleaseCommandQueue(queue); clReleaseContext(context); CL.destroy(); }
dd74973d-99f6-47d4-b9e5-20e2b8165ade
public static void main(String[] args) throws LWJGLException { PSO instance = new PSO(); instance.start(); System.exit(0); }
35c5f07b-4294-4dbd-a980-5928b2e7148b
Val(float[][] v, float minc, float maxc) { this.v = v; this.minc = minc; this.maxc = maxc; }
da9fc9ed-ae96-4fc3-8ebc-78dda380e221
String getCLStr();
d559de0b-fef4-45a3-b119-44c14de8b3b4
float f(float x, float y);
5dcd73c8-7ca4-4f1f-8961-f88b06296ad4
public String getCLStr() { final String tmpstr = "0"; return "20 + (x-"+tmpstr+")*(x-"+tmpstr+") + (y-"+tmpstr+")*(y-"+tmpstr+") + cos(x*6.2831)*10 + cos(y*6.2831)*10"; }
27970230-bc55-4c80-9300-148a1820498e
public float f(float x, float y) { return (float)(20 + x*x + y*y + Math.cos(6.2831*x)*10 + Math.cos(6.2831*y)*10); }
dd4fb63d-f925-4c66-ae68-045e2ac37e73
TwoFloatAr(float[] x, float[] y) { this.x = x; this.y = y; }
61ab17c1-05ef-40ae-99cd-965890e65ab3
FourFloatAr(float[] ax, float[] ay, float[] bx, float[] by) { this.ax = ax; this.ay = ay; this.bx = bx; this.by = by; }
7cacd79b-8d4d-47fd-80f1-7c1fcbaff46e
void start() throws LWJGLException { initCL(); initGL(); loop(); freeGL(); freeCL(); }
752158d2-274f-45d3-a334-b8560226e187
void initGL() { try { Display.setDisplayMode(new DisplayMode(800,600)); Display.setTitle("OpenCL Shadows Demo"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); Display.destroy(); System.exit(1); } glMatrixMode(GL_PROJECTION); glOrtho(0, 800, 600, 0, 1, -1); }
d5d6a1c1-9d6e-4756-a1ba-dac8e6e93d6e
void loop() { glMatrixMode(GL_MODELVIEW); while (!Display.isCloseRequested()) { stepCL(); glClear(GL_COLOR_BUFFER_BIT); drawAllParticles(); Display.update(); Display.sync(30); } }
b1af273a-3e16-4fb1-ac96-3e493f83db65
void drawAllParticles() { float tx, ty, tax, tay, tbx, tby; int i; glBegin(GL_LINES); glColor3f(1.0f, 0.0f, 0.0f); for(i=0;i<np;i++) { tx = x.get(i); ty = y.get(i); glVertex2f(400,300); glVertex2f(tx,ty); } glEnd(); glBegin(GL_LINES); glColor3f(1.0f, 1.0f, 1.0f); for(i=0;i<n...
8afba54a-19e2-4a24-a472-f34347a1bf7d
void freeGL() { Display.destroy(); }
f9deb4b5-bcc1-44be-9d3a-ddf1c539cb6b
TwoFloatAr radialBeam(float cx, float cy, float r, int nr) { float[] x, y; x = new float[nr]; y = new float[nr]; float k, ak; k = 0; ak = (float)(Math.PI*2f/nr); int i; for(i=0;i<nr;i++) { x[i] = (float) (Math.cos(k)*r) + cx; y[i] = (float) (Math.sin(k)*r) + cy; k += ak; } return new TwoFlo...
a797d5ac-8bb7-4fbf-a39c-acf5e9e83337
FourFloatAr columns(int nx, int ny) { final float sx = 0, sy = 0, ex = 800, ey = 600; float[] ax, ay, bx, by; ax = new float[nx*ny]; ay = new float[nx*ny]; bx = new float[nx*ny]; by = new float[nx*ny]; int i; for(i=0;i<nx*ny;i++) { ax[i] = (float) (Math.random() * (ex-sx) + sx); ay[i] = (float)...
604b3bf8-b828-46f0-b3ed-b9b87e870c9a
void initCL() throws LWJGLException { final float cx = 400; final float cy = 300; final String source1 = "float dp(float ax, float ay, float bx, float by) {" + " return ax*bx + ay*by; " + "}" + "\n" + "float4 intersect(float p0_x, float p0_y, float p1_x, float p1_y, " + " ...
b3a66e73-05af-49e7-b845-6326243011e9
void stepCL() { clEnqueueNDRangeKernel(queue, kernel1, 1, null, kernel1DGlobalWorkSize1, null, null, null); clEnqueueReadBuffer(queue, xMem, 1, 0, x, null, null); clEnqueueReadBuffer(queue, yMem, 1, 0, y, null, null); clEnqueueNDRangeKernel(queue, kernel2, 1, null, kernel1DGlobalWorkSize2, null, null, null);...
01ec2175-b965-4cc6-bab1-3501738d9835
void freeCL() { clReleaseKernel(kernel1); clReleaseProgram(program1); clReleaseKernel(kernel2); clReleaseProgram(program2); clReleaseCommandQueue(queue); clReleaseContext(context); CL.destroy(); }
363301d9-cf31-4fd8-b8de-dae0d8e3313f
static float[] randomFloatArray(int n, float s, float e) { float[] ret = new float[n]; int i; for(i=0;i<ret.length;i++) ret[i] = (float)(Math.random()*(e-s)+s); return ret; }
96a82a3b-363a-4ad0-8386-f7ad51701aec
static FloatBuffer toFloatBuffer(float[] floats) { FloatBuffer buf = BufferUtils.createFloatBuffer(floats.length).put(floats); buf.rewind(); return buf; }
700b1275-aa1a-4663-b8c3-d54674cc266e
public static void main(String[] args) throws LWJGLException { Shadow instance = new Shadow(); instance.start(); System.exit(0); }
5fd2a1d4-5508-4d21-b04f-1fab993a2aa7
public static FloatBuffer toFloatBuffer(float[] floats) { FloatBuffer buf = BufferUtils.createFloatBuffer(floats.length).put(floats); buf.rewind(); return buf; }
afa6c302-23bd-46f0-894a-c1dac4a8eddf
public static IntBuffer toIntBuffer(int[] ints) { IntBuffer buf = BufferUtils.createIntBuffer(ints.length).put(ints); buf.rewind(); return buf; }
7e4a93a9-f3ab-4ded-b60e-4f5521c15530
public static ValIndex min(FloatBuffer buffer) throws Exception { if (buffer.capacity() <= 0) throw new Exception("buffer.capacity() <= 0"); if (buffer.capacity() == 1) return new ValIndex(buffer.get(),1); float min = buffer.get(0); int mini = 0; float tmp; for (int i = 0; i < buffer.capacity(); i++) { ...
9b613a40-a419-46db-8fa1-0d09e75837fc
public static float[] zeroFloatArray(int n) { float[] ret = new float[n]; int i; for(i=0;i<ret.length;i++) ret[i] = 0f; return ret; }
d304f805-b89c-4b56-ac09-5214f906d419
public static float[] randomFloatArray(int n, float s, float e) { float[] ret = new float[n]; int i; for(i=0;i<ret.length;i++) ret[i] = (float)(Math.random()*(e-s)+s); return ret; }
c10dcd50-cd2b-4ec2-845c-fb2ffa523d08
public static void print(FloatBuffer buffer) { for (int i = 0; i < buffer.capacity(); i++) { System.out.print(buffer.get(i)+" "); } System.out.println(); }
679ac77d-796e-4757-b829-6ecccd70d097
public static void print(IntBuffer buffer) { for (int i = 0; i < buffer.capacity(); i++) { System.out.print(buffer.get(i)+" "); } System.out.println(); }
c4d72f4e-a25d-44bd-bbb1-d413986cd127
ValIndex(float val, int index) { this.val = val; this.index = index; }
d4fe50c1-9ba0-4245-a0aa-89e98f617ac6
void start() throws LWJGLException { initCL(); initGL(); loop(); freeGL(); freeCL(); }
453a9716-251e-44d4-b994-a8b9463804e5
void initGL() { try { Display.setDisplayMode(new DisplayMode(800,600)); Display.setTitle("OpenCL Particle Demo"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); Display.destroy(); System.exit(1); } glMatrixMode(GL_PROJECTION); glOrtho(0, 800, 600, 0, 1, -1); }
ee47cd32-d8cc-47e1-aea0-c628c07d79d3
void loop() { glMatrixMode(GL_MODELVIEW); while (!Display.isCloseRequested()) { stepCL(); glClear(GL_COLOR_BUFFER_BIT); drawAllParticles(); Display.update(); Display.sync(30); } }
8f5fcbfd-3088-47ac-ad88-31d09e568eca
void drawAllParticles() { float tx, ty; int i; glBegin(GL_QUADS); glColor3f(1.0f, 0.0f, 0.0f); for(i=0;i<nParticles;i++) { tx = x.get(i); ty = y.get(i); glVertex2f(tx,ty); glVertex2f(tx+3,ty); glVertex2f(tx+3,ty+3); glVertex2f(tx,ty+3); } glEnd(); }
68366111-d5ab-4bd0-bb44-2e5e832d009a
void freeGL() { Display.destroy(); }
4ec94ead-b18a-4414-8a15-56685cf703b4
void initCL() throws LWJGLException { final float minDist = 50; final String source = KernelBuilder.create(nParticles,minDist); //buffers x = Buffer.toFloatBuffer(Buffer.randomFloatArray(nParticles,0,800)); y = Buffer.toFloatBuffer(Buffer.randomFloatArray(nParticles,0,600)); vx = Buffer.toFloatBuffer(Buf...
d4d6adbc-9414-44eb-a55e-0b26fab01fb1
void stepCL() { clEnqueueNDRangeKernel(queue, kernel, 1, null, kernel1DGlobalWorkSize, null, null, null); clEnqueueReadBuffer(queue, xMem, 1, 0, x, null, null); clEnqueueReadBuffer(queue, yMem, 1, 0, y, null, null); clFinish(queue); }