query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the size's height
public double getHeight() { return height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public final int getHeight() {\r\n return (int) size.y();\r\n }", "public int getHeight();", "public int getHeight();", "public int getHeight();", "public int getHeight();", "public int getHeight();", "public int getHeight();", "public double getHeight();", "public double getHeight();", "public int getHeight() { return height; }", "public int getHeight() {return height;}", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "int getHeight();", "double getHeight();", "long getHeight();", "public float getHeight();", "public int getHeight()\n {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "public int getHeight() {\n return height;\n }", "int getheight();", "public int getHeight()\n {\n return height;\n }", "public int getHeight() {\n\t\treturn (int) (Math.log(size) / Math.log(2));\n\t}", "public int getHeight() {\n return height;\n }", "public int getHeight(){\n return height;\n }", "public int getHeight()\r\n\t{\r\n\t\treturn height;\r\n\t}", "public static int getHeight()\r\n\t{\r\n\t\treturn height;\r\n\t}", "public int getH() { return height; }", "public int getHeight()\n {\n \treturn height;\n }", "public double getHeight () {\n return height;\n }", "String getHeight();", "String getHeight();", "public int getHeight(){\n \treturn height;\n }", "public final int getHeight(){\n return height_;\n }", "public double getHeight() {\r\n return height;\r\n }", "public final int getHeight() {\r\n return height;\r\n }", "public double getHeight()\r\n {\r\n return height;\r\n }", "public int getHeight() {\r\n\t\treturn height;\r\n\t}", "public int getHeight() {\r\n\t\treturn height;\r\n\t}", "public int height();", "public int height();", "public int height();", "public int height();", "public int getHeight() {\r\n return Height;\r\n }", "public double getHeight() {\n return height;\n }", "public double getHeight() {\n return height;\n }", "private double getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() \n\t{\n\t\treturn height;\n\t}", "public int getHeight() {\n\treturn height;\n}", "public int getHeight()\n\t{\n\t\treturn height;\n\t}", "public int getHeight()\n\t{\n\t\treturn height;\n\t}", "public int getHeight() {\n return height_;\n }", "int getHeight() {return height;}", "public int getHeight(){\n return height;\n }", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight() {\n\t\treturn height;\n\t}", "public int getHeight()\n {\n return this.height;\n }", "public int getHeight(){\n return this.height;\n }", "public int getHeight()\n {return height;}", "public int getHeight() {\r\n\t\t\r\n\t\treturn height;\r\n\t}", "public int getHeight() {\n return height_;\n }", "public double getHeight() {\r\n\t\treturn height;\r\n\t}", "Length getHeight();", "public double getHeight() {\n\t\treturn height;\n\t}", "public double getHeight() {\n\t\treturn height;\n\t}", "public double getHeight() {\n\t\treturn height;\n\t}" ]
[ "0.85465586", "0.8314075", "0.8314075", "0.8314075", "0.8314075", "0.8314075", "0.8314075", "0.8257993", "0.8257993", "0.82462364", "0.81689143", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8114156", "0.8113149", "0.81070703", "0.80892384", "0.8088274", "0.8085338", "0.8085338", "0.8085338", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.80738306", "0.8067941", "0.8066648", "0.80660987", "0.8060628", "0.80359495", "0.80235344", "0.8018045", "0.80162495", "0.8016096", "0.80051076", "0.8002382", "0.8002382", "0.8000351", "0.79980016", "0.79967713", "0.799594", "0.7983453", "0.7973627", "0.7973627", "0.7970713", "0.7970713", "0.7970713", "0.7970713", "0.7970098", "0.7969074", "0.7969074", "0.79622996", "0.7959956", "0.7948377", "0.7947406", "0.7947406", "0.7946934", "0.79468447", "0.7935473", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.792204", "0.790177", "0.7900845", "0.7899801", "0.78988427", "0.78961897", "0.789336", "0.7879235", "0.7877345", "0.7877345", "0.7877345" ]
0.8035987
49
Mark the given object as finalized.
public abstract void setFinalized(Object src);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void finalizeIt();", "public void finalize()\r\n\t{\n\t}", "@Nullable\n public abstract Object finalizeComputation(@Nullable Object object);", "public void finalize();", "public abstract void finalize();", "public void finalize() {\n AppMethodBeat.i(66593);\n if (this.mJitterBuffer != 0) {\n nativeDestoryJitterBuffer(this.mJitterBuffer);\n this.mJitterBuffer = 0;\n }\n AppMethodBeat.o(66593);\n }", "public void finalize(World world) { }", "@Override\n\tpublic boolean isFinalized()\n\t{\n\t\treturn finalize;\n\t}", "public void finalize() throws Throwable {\n finish();\n super.finalize();\n }", "public void finish() {\n System.out.println(name + \": Call explicit destroy()\");\n }", "@Override// opcional\n public void finalize(){\n\n }", "public final void finalize() {\n if (!this.f5341c) {\n mo12514a(\"Request on the loose\");\n C1264ee.m6818c(\"Marker log finalized without finish() - uncaught exit point for request\", new Object[0]);\n }\n }", "boolean finalise();", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() {\n delete();\n }", "public void finalize() throws Throwable {\n delete(this.nativeObj);\n }", "public void finalize() throws Throwable {\n delete(this.nativeObj);\n }", "public boolean Finalize() {\n\treturn Finalize(false);\n }", "@Override\n\t\tpublic void onFinish() {\n\t\t\tfinalizar();\n\t\t}", "public void setFinal() {\r\n\t\tthis.isFinal = true;\r\n\t}", "public void finalize() throws Throwable {\n if (this.mObject != 0) {\n nativeDestroy(this.mObject);\n }\n }", "@Override\n protected void finalize() throws Throwable {\n if(!mFinished) {\n finish(\"Request on the loose\", \"\");\n e(\"\", \"Marker log finalized without finish() - uncaught exit point for request\");\n\n }\n }", "protected void finalize() throws Throwable\n\t{\n\t\tsuper.finalize();\n\t\tfinaliseHandle();\n\t\tfinaliseLoggerReference();\n\t}", "@Override()\r\n protected void finalize() {\r\n destroy();\r\n }", "public void finalize() {\r\n super.finalize();\r\n }", "public void finalize() {\n\n System.out.println( \"This is finalize method\" );\n }", "public abstract void endObject();", "public void finaliza(Orcamento orcamento) {\n\t\tthrow new RuntimeException(\"Orçamento já está em estado finalizado\");\n\t}", "private void setFinalSize()\n {\n if (m_isFinalSizeSet)\n return;\n setSize(m_finalSize);\n if (m_finalLocation != null)\n setLocation(m_finalLocation);\n m_isFinalSizeSet = true;\n }", "protected void finalize()\n {\n dispose();\n }", "protected void finalize() { \n \tstopSelf(); \n }", "@Override\n\tpublic void finalize() {\n\t\t\n\t}", "public void finalize() {\r\n destImage = null;\r\n srcImage = null;\r\n mask = null;\r\n\r\n if (keepProgressBar == false) {\r\n disposeProgressBar();\r\n }\r\n\r\n try {\r\n super.finalize();\r\n } catch (Throwable er) { }\r\n }", "protected void makeThreadObjectFinish() {\n\t\ttry {\n\t\t\tif (syncCommands != null) {\n\t\t\t\tsyncCommands.join();\n\t\t\t}\n\t\t} catch (Exception e1) {\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "public void Finalize()\r\n {orders.add(this.o);\r\n this.o=null; }", "public void finalize() {\r\n\r\n mask = null;\r\n newMask = null;\r\n newShortMask = null;\r\n System.gc();\r\n }", "public void finalizeJob() {\n // override to implement\n }", "@Override\r\n\tprotected void finalize() throws Exception\r\n\t{\r\n\t\tif(!this.cleanUpDone )\r\n\t\t\tthis.terminate();\r\n\t}", "private void processDispose(final boolean finalized) {\n new Thread(new Runnable() {\n @Override\n public void run() {\n Thread.currentThread().setName(\"Dispose_Thread\");\n Log.d(TAG, \"Processing dispose with \" + finalized + \" from \"\n + Thread.currentThread().getName());\n disposeInternal(finalized);\n }\n }).start();\n }", "protected void finalize() throws Throwable {\n\t\tSystem.out.println(\">> Student Object Finalized\");\n\t}", "protected void finalize() throws Throwable\n\t{\n\t\tsuper.finalize();\n\t\tfinaliseLoggerReference();\n\t}", "public void finalize() {\n acquire.release();\n }", "public void finalize() {\n acquire.release();\n }", "public void finalize() throws Throwable {\n if (this.mShadow != 0) {\n nativeRelease(this.mShadow);\n this.mShadow = 0;\n }\n super.finalize();\n }", "public final void finalize() throws Throwable {\n try {\n if (!(this.f119471b == null || this.f119482o == 0)) {\n this.f119471b.mo115486a();\n }\n m145766a(true);\n } finally {\n super.finalize();\n }\n }", "protected void finalize() {\n\t\tclose();\n\t}", "public void markAsDone() {\n this.done = true;\n }", "protected final void finalize() {\n if (native_lock != null) {\n synchronized(native_lock) {\n String error = native_finalize(); // may be called more than once\n if (error != null)\n debug(error + \" in native_finalize\");\n }\n }\n }", "public void mo16615c(Object obj) {\n this.f12436U.finish();\n }", "public void finalize() throws Throwable {\n try {\n shutdown();\n } finally {\n super.finalize();\n }\n }", "public void finalize() throws Throwable {\n try {\n shutdown();\n } finally {\n super.finalize();\n }\n }", "public void finalize()\n throws Throwable\n {\n pythonDecRef();\n }", "public void markAsDone() {\r\n this.isDone = true;\r\n }", "public final void finalize() {\n AppMethodBeat.i(116587);\n try {\n if (fZk != null) {\n fZk.invoke(this.fZh, new Object[]{this.fZi});\n RemoteControlReceiver.alQ();\n }\n } catch (InvocationTargetException e) {\n InvocationTargetException invocationTargetException = e;\n Throwable cause = invocationTargetException.getCause();\n RuntimeException runtimeException;\n if (cause instanceof RuntimeException) {\n runtimeException = (RuntimeException) cause;\n AppMethodBeat.o(116587);\n throw runtimeException;\n } else if (cause instanceof Error) {\n Error error = (Error) cause;\n AppMethodBeat.o(116587);\n throw error;\n } else {\n runtimeException = new RuntimeException(invocationTargetException);\n AppMethodBeat.o(116587);\n throw runtimeException;\n }\n } catch (IllegalAccessException e2) {\n ab.e(\"MicroMsg.RemoteControlReceiver\", \"unexpected \".concat(String.valueOf(e2)));\n }\n super.finalize();\n AppMethodBeat.o(116587);\n }", "protected void finalize() {\n close();\n }", "public void markAsDone() {\n // TODO consider adding assertion here\n isDone = true;\n }", "public void finish(boolean b) {\n\t\tisFinished = b;\n\t}", "public void markAsDone() {\n this.isDone = true;\n }", "public void markAsDone() {\n this.isDone = true;\n }", "public void markAsDone() {\n this.isDone = true;\n }", "@Override protected void finalize() throws Throwable {\r\n\t\tsuper.finalize();\r\n\t\tif (flusher != null) {\r\n\t\t\tflusher.stop();\r\n\t\t}\r\n\t\tflush();\r\n\t}", "@Override\n protected void finalize() throws Throwable\n {\n finalize(pointer);\n super.finalize();\n }", "@Override\n\tprotected void finalize() throws Throwable {\n\t\tsuper.finalize();\n\t\tclearData();\n\t}", "@Override\n\t\tprotected void finalize() throws Throwable {\n\t\t\tif (pool != null) {\n\t\t\t\tdone();\n\t\t\t\tpool = null;\n\t\t\t}\n\t\t}", "public boolean isFinalized() {\n\t\tif (this.owner_ != null)\n\t\t\treturn this.owner_.isFinalized();\n\t\treturn false;\n\t}", "synchronized public void markDone() {\n this.done = true;\n }", "public void finish() {}", "public void markAsDone() {\n this.isDone = true;\n\n }", "public void addFinalizer(Finalizable finalizer) {\n synchronized (finalizersMutex) {\n if (finalizers == null) {\n finalizers = new WeakHashMap<Finalizable, Object>();\n }\n finalizers.put(finalizer, null);\n }\n }", "public void finish() {\n\n\t}", "void finalizeStructure();", "@Override\n\tprotected void finalize() {\n\t\tif(refcount>0){\n\t\t\tprint(\"Error \"+refcount+\"Shared \"+id+\"objects in use\");\n\t\t}\n\t}", "private native void finalize(long pointer);", "protected void finish() {\n }", "@Override //sobre-escritura del destructor.\n protected void finalize() throws Throwable {\n super.finalize(); \n System.err.println(\"Chau objeto.\"); //serr y ...\n }", "public void finish() { \n\t\t\n\t}", "@Override\n \tpublic void finished()\n \t{\n \t}", "protected void finalize() throws Throwable {\n\t}", "protected boolean isFinalised() {\n return finalised;\n }", "protected void synchronizationDone() {\n }", "@Override\r\n\tprotected void finalize() throws Throwable {\n\t\tsuper.finalize();\r\n\t}", "protected void finalize() throws Throwable {\n clear();\n }", "public void finalize() throws Throwable {\n close();\n }", "protected void markAsDone() {\n isDone = true;\n }", "@Basic\n\t@Raw\n\tpublic boolean isFinalized() {\n\t\treturn this.finalized;\n\t}", "public void finalize() {\n if (SinkHolder.sink != null || SinkHolder.finalize_count <= 0) {\n SinkHolder.access$008();\n return;\n }\n throw new AssertionError((Object) \"Can't get here\");\n }" ]
[ "0.66737676", "0.64600843", "0.6400111", "0.63881004", "0.6346596", "0.630638", "0.624606", "0.62012035", "0.6161142", "0.6109587", "0.6094996", "0.60667235", "0.6063588", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.60619307", "0.6053765", "0.6053765", "0.6040978", "0.6027057", "0.6019722", "0.60105246", "0.5984522", "0.59427047", "0.5941597", "0.5932318", "0.58832073", "0.58735466", "0.58147466", "0.5813148", "0.5807493", "0.58016115", "0.578968", "0.5789594", "0.57878596", "0.57859623", "0.57567465", "0.5754886", "0.5683087", "0.5680759", "0.5679141", "0.5677014", "0.5657456", "0.5657456", "0.56324", "0.5628475", "0.5628029", "0.56221324", "0.5621388", "0.56093156", "0.5608311", "0.5608311", "0.5590483", "0.5586769", "0.5584778", "0.5576357", "0.556857", "0.55669475", "0.556363", "0.556363", "0.556363", "0.5556302", "0.5537969", "0.5535047", "0.5532469", "0.55297524", "0.5522473", "0.5520919", "0.5511744", "0.55040574", "0.5503163", "0.55021006", "0.54940873", "0.5489284", "0.54852873", "0.5483883", "0.5476479", "0.54597586", "0.54574686", "0.5452771", "0.54513705", "0.54430634", "0.544042", "0.543676", "0.54355353", "0.5427074", "0.5426089" ]
0.71124977
0
Change the color of the given object from oldColor to newColor.
public abstract boolean atomicChangeObjectColor(Object dst, int oldColor, int newColor);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setColor(Color newColor) ;", "public void setColor(Color newColor) {\n\tcolor = newColor;\n }", "public void setColor(Color newColor) {\n\t\tcolor = newColor;\n\t}", "public void setColor(Color newColor)\n {\n this.color = newColor;\n conditionallyRepaint();\n }", "public void setColor(Color newColor) {\n color = newColor;\n Canvas.getInstance().repaint();\n }", "public void setColor(Color another)\r\n {\r\n currentColor = another;\r\n }", "public void setColor( GraphColor newVal ) {\n color = newVal;\n }", "RGB getOldColor();", "public void changeColor(){\r\n if(color == 1)\r\n color = 2;\r\n else\r\n color = 1;\r\n }", "protected void recolorFamily(int newColor, int oldColor) {\n\t\t// Update family Color List\n\t\tif (this.getFamilyColorList().contains(oldColor)) {\n\t\t\tfor (int i = 0; i < this.getFamilyColorList().size(); i++) {\n\t\t\t\tif (this.getFamilyColorList().get(i) == oldColor) {\n\t\t\t\t\tthis.getFamilyColorList().remove(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.getFamilyColorList().add(newColor);\n\t\t\n\t\tif(!this.getType().equals(Constants.RetroStrings.APPLICATION_TYPE)) {\n\t\t\tif(this.getColor() == oldColor) {\n\t\t\t\tthis.color = newColor;\n\t\t\t\tupdateMap(newColor, newColor);\n\t\t\t\tint offset = (Integer) this.getGameElement().getTileSet()\n\t\t\t\t\t\t.getProperties().get(\"firstgid\") - 1;\n\t\t\t\tthis.getGameElement().setTileId(newColor + offset);\n\t\t\t}\n\t\t}\n\t\tif (this.getFamily() != null) {\n\t\t\tthis.getFamily().recolorFamily(newColor, oldColor);\n\t\t}\n\t\t\n\t\tif (this.getNext() != null) {\n\t\t\tthis.getNext().recolorFamily(newColor, oldColor);\n\t\t}\n\t}", "void setColor(){\n this.objectColour = new Color(rValue,gValue,bValue,timeToLive).brighter();\n }", "public Color(Color newColor) {\n\n\t\tthis(newColor.r, newColor.g, newColor.b);\n\t}", "public void setColor(String newColor)\n {\n invalidate();\n paintColor = Color.parseColor(newColor);\n drawPaint.setColor(paintColor);\n }", "public static void changeColor(String username, int oldCol, int newCol){\n\t\t\n\t\t// change name in hashmap\n\t\tvisitorListMap.put(username, new Color(newCol));\n\t\t\n\t\t// trigger list model update\n\t\tvisitorList.repaint();\n\t}", "public void changeColor(Color color) {\n this.color = color;\n }", "public void setColor(Color c) { color.set(c); }", "RGB getNewColor();", "@Override public void setColor(Color c) \n\t{\n\t\tc2 = c1; c1 = c.dup();\n\t}", "public void setColor(Color c);", "@Override\n\tpublic void changeColor2(Color color) {\n\n\t}", "public void setAllColor(double newRed, double newBlue, double newGreen) {\n\t\tthis.setRedColor(newRed);\n\t\tthis.setBlueColor(newBlue);\n\t\tthis.setGreenColor(newGreen);\n\t}", "private void colorObject(String node, Color color) {\r\n pMap.get(node).changeColor(\"\", color, null, null);\r\n }", "public void setActiveColor(Color newColor) {\n\t\tif(newColor == null) {\n\t\t\tIllegalArgumentException e = new IllegalArgumentException(\"newColor cannot be Null\");\n\t\t\tLogger.log(LogType.ERROR, e, \"Session.setActiveColor: Null color passed\");\n\t\t\tnewColor = Color.BLACK;\n\t\t}\n\t\tactiveColor = newColor;\n\t}", "void changeColor(Color color) {\r\n currentColor = color;\r\n redInput.setText(String.valueOf(color.getRed()));\r\n greenInput.setText(String.valueOf(color.getGreen()));\r\n blueInput.setText(String.valueOf(color.getBlue()));\r\n newSwatch.setForeground(currentColor);\r\n }", "public void setColor(Color that){\r\n \t//set this to that\r\n this.theColor = that;\r\n if(this.theColor.getRed() == 255 && this.theColor.getGreen() == 0 && this.theColor.getBlue() == 0){\r\n this.theColor = Color.red;\r\n }\r\n if(this.theColor.getRed() == 0 && this.theColor.getGreen() == 0 && this.theColor.getBlue() == 255){\r\n this.theColor = Color.black;\r\n }\r\n if(this.theColor.getRed() == 0 && this.theColor.getGreen() == 255 && this.theColor.getBlue() == 0){\r\n this.theColor = Color.green;\r\n }\r\n }", "public void set(Color inColor) {\n\n\t\tthis.r = inColor.r;\n\t\tthis.g = inColor.g;\n\t\tthis.b = inColor.b;\n\n\t}", "public void setObjectColor(GObject object, Color color) {\n\t\tobject.setColor(color);\n\t}", "private static void changeColor(Orange apple) {\n\t\tapple.color = \"green\";\n\t\t\n\t}", "private void switchColor(Node node) {\n Circle temp = (Circle) node;\n\n if (isRed) {\n temp.setFill(Paint.valueOf(\"Red\"));\n turnCircle.setFill(Paint.valueOf(\"Blue\"));\n turnDisplay.setText(aiTurn);\n isRed = false;\n } else {\n temp.setFill(Paint.valueOf(\"Blue\"));\n turnCircle.setFill(Paint.valueOf(\"Red\"));\n turnDisplay.setText(humanTurn);\n isRed = true;\n }\n }", "public void setColor(int color);", "public void setColor(int color);", "public void setColor(Color color);", "public void setColor(int r, int g, int b);", "void setColor(int r, int g, int b);", "public void changeColor(Color c){\n switch(identifier){\n case \"FillRec\":\n fillrec.setBackground(c);\n break;\n case \"FillOval\":\n filloval.setBackground(c);\n break;\n case \"EmptyRec\":\n emptyrec.setBackground(c);\n break;\n case \"EmptyOval\":\n emptyoval.setBackground(c);\n break;\n case \"LineDraw\":\n linedraw.setBackground(c);\n break;\n case \"ColorChooser\":\n opencolor.setBackground(c);\n break;\n }\n }", "public void setColor(float r, float g, float b, float a);", "public void changeSignalColor(String name, String source, Color newColor) {\n\t\tfinal String[] colorNames = {\"BLACK\", \"BLUE\", \"CYAN\", \"DARK_GRAY\", \"GRAY\", \"GREEN\", \"LIGHT_GRAY\", \"MAGENTA\", \"ORANGE\", \"PINK\", \"RED\", \"YELLOW\"}; \n\t\t\n\t\tint colorIndex = 0;\n\t\tfor(; colorIndex < m_signalSources.size(); colorIndex++) {\n\t\t\tif( m_signalSources.get(colorIndex).equalsIgnoreCase(source) && m_signalNames.get(colorIndex).equalsIgnoreCase(name) )\n\t\t\t\tbreak;\n\t\t}\n\t\tm_signalColors.set(colorIndex, newColor);\n\t\t\n\t\tif( m_privateNotification != null ) {\n\t\t\tint i = 0;\n\t\t\tfor( ; i < m_palette.length; i++ ) {\n\t\t\t\tif( m_palette[i].equals(newColor) )\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tString content = \"changeSignalColor:\"+source+\" \"+name+\" \"+colorNames[i]+\";\";\n\t\t\tm_privateNotification.sendMessage(m_parentName+\"TSCanvasMenu\", m_parentName+\"TSCanvas\", content);\n\t\t\tm_privateNotification.sendMessage(m_parentName+\"TSCanvasMenu\", m_parentName+\"TSAbstractCanvas\", content);\n\t\t}\n\t}", "public Color(double newR, double newG, double newB) {\n\n\t\tr = newR;\n\t\tg = newG;\n\t\tb = newB;\n\t}", "public void setColor(Color color) {\r\n changeColor(color);\r\n oldSwatch.setForeground(currentColor);\r\n newSwatch.setForeground(currentColor);\r\n colorCanvas.setColor(currentColor);\r\n repaint();\r\n }", "public void switchColor() {\r\n\t\tcolor = !color;\r\n\t}", "boolean changeColor(Color newColor){\n boolean change=false;\r\n\r\n if (fShapes.size() > 0) {\r\n Iterator iter = fShapes.iterator();\r\n\r\n while (iter.hasNext()) {\r\n TShape theShape = (TShape) iter.next();\r\n\r\n if (theShape.getSelected()) {\r\n theShape.setColor(newColor);\r\n change = true;\r\n }\r\n }\r\n }\r\n\r\n if (!change){\r\n TShape prototype=fPalette.getPrototype();\r\n\r\n if (prototype!=null)\r\n prototype.setColor(newColor);\r\n fPalette.repaint(); // no listeners for change in the palette\r\n }\r\n\r\n return\r\n change; // to drawing itself\r\n }", "public void setColor(Color c) {\n color = c;\n }", "void colorize(ObservableValue<? extends Number> ov, Number old_val,\n Number new_val, Color color, BufferedImage myBufferedImage,\n ImageView myImage) {\n double coefColor = (new_val.doubleValue() / 100 + 0.5)\n / (old_val.doubleValue() / 100 + 0.5);\n this.colorizer.setChangeColor(color);\n this.colorizer.setRatio(coefColor);\n myBufferedImage = Utils.clone(this.colorizer.process(myBufferedImage));\n myImage.setImage(SwingFXUtils.toFXImage(myBufferedImage, null));\n }", "void setColor(final java.awt.Color color);", "void setFromInt32Color(int newColor) {\r\n\t\tx = ((float) ((newColor >> 16) | 0xFF)) / 255.0f;\r\n\t\ty = ((float) ((newColor >> 8) | 0xFF)) / 255.0f;\r\n\t\tz = ((float) ((newColor) | 0xFF)) / 255.0f;\r\n\t}", "private void changeColor(List<Node> listToColor, Color red) {\n\t\t\tfor(Node n: listToColor)\n\t\t\t\tn.color = red;\n\t }", "private void changeTheColor(GObject object, int i) {\r\n\t\tif (i % 4 == 0) {\r\n\t\t\tobject.setColor(Color.BLACK);\r\n\t\t} else if (i % 4 == 1) {\r\n\t\t\tobject.setColor(Color.RED);\r\n\r\n\t\t} else if (i % 4 == 2) {\r\n\t\t\tobject.setColor(Color.BLUE);\r\n\r\n\t\t} else if (i % 4 == 3) {\r\n\t\t\tobject.setColor(Color.YELLOW);\r\n\t\t}\r\n\t}", "public ColorChange(Color color, double time) {\n this.color = color;\n this.time = time;\n }", "public void setColor(String newColor){\n invalidate();\n // Comprobar si el valor del color o el nombre del patrón\n if(newColor.startsWith(\"#\")){\n paintColor = Color.parseColor(newColor);\n drawPaint.setColor(paintColor);\n drawPaint.setShader(null);\n }\n else{\n int patternID = getResources().getIdentifier(newColor, \"drawable\", \"com.example.drawingfun\");\n // decodifica los colores\n Bitmap patternBMP = BitmapFactory.decodeResource(getResources(), patternID);\n BitmapShader patternBMPshader = new BitmapShader(patternBMP,\n Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);\n drawPaint.setColor(0xFFFFFFFF);\n drawPaint.setShader(patternBMPshader);\n }\n }", "private void updateColor() {\n int redShift = red << 16; // red: 0xRR0000 <- 0xRR\n int greenShift = green << 8; // red: 0xGG00 <- 0xGG\n int blueShift = blue; // blue: 0xBB <- 0xBB\n int alphaShift = 0xff << 24; // alpha 0xff000000 <- 0xff // we don't want our color to be transparent.\n int color = alphaShift | redShift | greenShift | blueShift;\n viewColor.setBackgroundColor(color);\n }", "public void setColor(int value);", "public void setColor(Color c) {\n this.color = c;\n }", "public void setColor(RGBColor color){\r\n this._color = new RGBColor(color);\r\n }", "public void setColor(Color color) {\n this.color = color;\n }", "@Override\n public void changeColor(ColorEvent ce) {\n \n txtRed.setText(\"\"+ ce.getColor().getRed());\n txtGreen.setText(\"\"+ ce.getColor().getGreen());\n txtBlue.setText(\"\"+ ce.getColor().getBlue());\n \n \n }", "public void setColor(RMColor aColor)\n{\n // Set color\n if(aColor==null) setFill(null);\n else if(getFill()==null) setFill(new RMFill(aColor));\n else getFill().setColor(aColor);\n}", "public void setColor(final Color theColor) {\n myColor = theColor;\n }", "void setColor(@ColorInt int color);", "private void changeShapeColor(int r, int g, int b)\n\t{\n\t\tthis.red = r;\n\t\tthis.green = g;\n\t\tthis.blue = b;\n\t}", "public void setColor(Color c)\n\t{\n\t\tthis.color = c;\n\t}", "private Color spreadColor(Color oldColor){\r\n\t\tdouble spread = 0.8;\r\n\t\tColor newColor = new Color(oldColor.getRed()*(spread)*Math.random(),oldColor.getGreen()*\r\n\t\t\t\t(spread)*Math.random(),oldColor.getBlue()*(spread)*Math.random(),0.4*Math.random());\r\n\t\treturn newColor.brighter().brighter();\r\n\t}", "public void setColor(Color a, Color b) \n\t{\n\t\tc1 = a.dup(); c2 = b.dup();\n\t}", "public final Pen changeColor(Color lineColor) {\n return new Pen(stroke, lineColor);\n }", "public void setColor(Color clr){\n color = clr;\n }", "public void setColor()\n {\n if(eyeL != null) // only if it's painted already...\n {\n eyeL.changeColor(\"yellow\");\n eyeR.changeColor(\"yellow\");\n nose.changeColor(\"green\");\n mouthM.changeColor(\"red\");\n mouthL.changeColor(\"red\");\n mouthR.changeColor(\"red\");\n }\n }", "public void setColor(int red, int green, int blue){\r\n this.red = red;\r\n this.green = green;\r\n this.blue = blue;\r\n }", "public void setColor(Color c) {\n\t\tthis.color = c;\n\t}", "synchronized private void changeColor()\n {\n if ( ++colorIndex == someColors.length )\n colorIndex = 0;\n setForeground( currentColor() );\n repaint();\n }", "public void update(String newColor, String newStyle) throws NoSuchFieldException, IllegalAccessException, InvocationTargetException {\n Field colorF = colorClass.getDeclaredField(newColor);\n colorF.setAccessible(true);\n\n Field styleF = styleClass.getDeclaredField(newStyle);\n styleF.setAccessible(true);\n\n this.color = colorF.get(null);\n this.style = styleF.get(null);\n\n if (bossBar == null) {\n return;\n }\n\n setColor.invoke(bossBar, color);\n setStyle.invoke(bossBar, style);\n }", "public void changeDogColor(Color dogColor) {\n this.color = dogColor;\n }", "public void setColor(int color) {\n/* 77 */ this.color = color;\n/* 78 */ this.paint.setColor(this.color);\n/* */ }", "public void setColor(Color color) {\n this.color = color;\r\n }", "public abstract void setColor(Color color);", "public abstract void setColor(Color color);", "public void setColor(String c);", "public void setColor(Color color) {\n\t\t_color = color;\n\t\tnotifyObs(this);\n\t}", "public void setColorTo(IsColor color) {\n\t\tsetColorTo(IsColor.checkAndGetValue(color));\n\t}", "void setColor(Vector color);", "public void setColor(int color){\n this.color = color;\n }", "public Color setColor(String color){\n\t\tColor oldColor = this.routeColor;\n\t\trouteColor = Color.web(color);\n\n\t\tnotifyObservers(\"color\");\n\n\t\treturn oldColor;\n\t}", "private int reduceColorSize(int oldColor, int colorRange) {\n return (int) Math.floor((oldColor / colorRange)) * colorRange;\n }", "public void setColor(java.awt.Color color1) {\r\n this.color = color1;\r\n }", "public void onUpdateColor() {\n getVertexBufferObject().onUpdateColor(this);\n }", "public void setColor(int gnum, Color col);", "public void setColor(Color color) {\n this.color = color;\n }", "public void setColor(int color){\r\n\t\tthis.color=color;\r\n\t}", "@Override\n\tpublic void setColour(float r, float g, float b) {\n\n\t}", "void setRed(int x, int y, int value);", "@Override\n public void setColor(Color color) {\n this.color = color;\n }", "public void setColour(Colour colour);", "protected void setColor(Color color) {\r\n\t\tthis.color = color;\r\n\t}", "public void setColor(int color) {\n this.color = color;\n }", "private void changeColor(int factor) {\n Color c = getColor();\n int[] color = { c.getRed(), c.getGreen(), c.getBlue()};\n for (int i = 0; i < 3; ++i) {\n if (color[i] + factor <= 255 && color[i] + factor >= 0) {\n color[i] += factor;\n }\n }\n setColor(new Color(color[0], color[1], color[2]));\n }", "public void setColor(Color color) \n\t{\n\t\tthis.color = color;\n\t}", "@NoProxy\n @NoWrap\n public void setColor(final String val) {\n color = val;\n }", "public void setCurrentColor(Color color) {\n super.setColor(color);\n }", "public void setColor(Color color_) {\r\n\t\tcolor = color_;\r\n\t}", "public void setColorTo(String color) {\n\t\tsetValue(Property.COLOR_TO, color);\n\t}", "public ColorChange(IShape shape, Color initialColor, Color targetColor, int startTime,\n int endTime) {\n this.shape = shape;\n this.initialColor = initialColor;\n this.targetColor = targetColor;\n this.startTime = startTime;\n this.endTime = endTime;\n }", "public void setValue(Color value) {\n _color = value;\n _updateField(value);\n }" ]
[ "0.749006", "0.7278994", "0.71717376", "0.69061774", "0.68647283", "0.68202525", "0.6779688", "0.6744155", "0.6563695", "0.65596205", "0.65463054", "0.6507658", "0.650493", "0.6462109", "0.6450659", "0.63953084", "0.63519955", "0.6338583", "0.6312944", "0.6307644", "0.629819", "0.62803835", "0.622487", "0.6210968", "0.61907375", "0.61684835", "0.61612946", "0.6116791", "0.6116673", "0.61074495", "0.61074495", "0.6103145", "0.6101675", "0.608649", "0.6078258", "0.607034", "0.6042446", "0.6029622", "0.6015982", "0.60004336", "0.5992264", "0.5959342", "0.5954714", "0.59444016", "0.59384763", "0.58953166", "0.5893077", "0.5874654", "0.58590895", "0.5852357", "0.58446115", "0.5843514", "0.5841898", "0.5839601", "0.58337677", "0.58293635", "0.58276993", "0.58240384", "0.57936704", "0.5789504", "0.5782906", "0.5772067", "0.5765177", "0.57605255", "0.57408476", "0.5740455", "0.5737849", "0.5732776", "0.5731102", "0.5724528", "0.5719621", "0.5707734", "0.5687756", "0.5687756", "0.5665758", "0.5664848", "0.56604004", "0.56535405", "0.56486326", "0.56422234", "0.5636118", "0.5632502", "0.56279224", "0.5596609", "0.55947393", "0.55914867", "0.55855167", "0.5580979", "0.5577139", "0.55737984", "0.55716103", "0.55681986", "0.5555566", "0.55540675", "0.55530417", "0.5540279", "0.5531766", "0.55284023", "0.5528131", "0.5519151" ]
0.7600333
0
Gets the start address of the boot image
public abstract Address getBootImageStart();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Address getBootHeapStart();", "public abstract Address getBootImageEnd();", "protected int getStartAddress() {\r\n return (readByte(RESET_VECTOR) & 0xff) + ((readByte(RESET_VECTOR + 1) & 0xff) << 8);\r\n }", "public Address getStartAddress() {\n\t\treturn baseAddress;\n\t}", "String getStartAddress();", "public Address getImagebase() {\n return new Address(m_module.getConfiguration().getImageBase().toBigInteger());\n }", "public int getStartPC() {\n\t\treturn startPC & 0xffff;\n\t}", "public int getAddressOfEntryPoint()\n throws IOException, EndOfStreamException\n {\n return peFile_.readInt32(relpos(Offsets.ADDRESS_OF_ENTRY_POINT.position));\n }", "public int getDevicesStartAddress() {\n return devicesStartAddress;\n }", "public static int offset_addr() {\n return (0 / 8);\n }", "public String startIP() {\n return this.startIP;\n }", "public int getStart() {\r\n\t\treturn this.offset;\r\n\t}", "public PixelPoint getStartPoint ()\r\n {\r\n Point start = glyph.getLag()\r\n .switchRef(\r\n new Point(getStart(), line.yAt(getStart())),\r\n null);\r\n\r\n return new PixelPoint(start.x, start.y);\r\n }", "public Location getStartLocation() {\r\n \treturn new Location(0,0);\r\n }", "@Override\n public byte[] getStartKey(){\n return region.getRegionInfo().getStartKey();\n }", "public static String GetBaseAddress() {\n\t\t// Load Projects Settings XML file\n\t\tDocument doc = Utilities.LoadDocumentFromFilePath(IDE.projectFolderPath + \"\\\\ProjectSettings.xml\");\n\t\tString baseAddress = \"\";\n\t\tif (doc != null) {\n\t\t\t// Get all \"files\"\n\t\t\tNodeList baseAddressNode = doc.getDocumentElement().getElementsByTagName(\"baseAddress\");\n\t\t\t// Handle result\n\t\t\tif (baseAddressNode.getLength() > 0) {\n\t\t\t\tbaseAddress = Utilities.getXmlNodeAttribute(baseAddressNode.item(0), \"value\");\n\t\t\t}\n\t\t}\n\t\treturn baseAddress;\n\t}", "public String get_start() {\n\t\treturn start;\n\t}", "String getStartpage();", "public String readBackupStartCode() throws IOException {\n return systemTable.readBackupStartCode(backupInfo.getBackupRootDir());\n }", "public abstract Address getBootHeapEnd();", "private static Image getStartScreen(int screenNum)\n\t{\n\t\ttry {\n\t\t\treturn ImageIO.read(new File(guiDirectory + screen + screenNum\n\t\t\t\t\t+ \".png\"));\n\t\t} catch (IOException ioe) {\n\t\t}\n\t\treturn null;\n\t}", "public String getBaseAddress() {\n return base_address.getAddress();\n }", "public LinkAddress getInitialLinkAddress() {\n if (mIpConfiguration != null && mIpConfiguration.getStaticIpConfiguration() != null) {\n return mIpConfiguration.getStaticIpConfiguration().ipAddress;\n } else {\n return null;\n }\n }", "public int getStart() {\n\t\treturn start;\n\t}", "public int getStart ()\r\n {\r\n return glyph.getBounds().x;\r\n }", "public long getStart() {\n return start;\n }", "public int getStart() {\n\t\t\treturn start;\n\t\t}", "public int getStart() {\r\n\t\treturn start;\r\n\t}", "public String getStart() {\r\n\t\treturn this.start;\r\n\t}", "public Point getStart() {\n\t\treturn _start;\n\t}", "public int getReturnAddressOffset();", "public byte[] getJmpBoot() {\r\n\t\treturn jmpBoot;\r\n\t}", "public Point start() {\r\n return this.start;\r\n }", "public int sourceStart()\n\t{\n\t\treturn sourceStart;\n\t}", "public Block getStart () {\n\t\treturn start;\n\t}", "public long getImageBase()\n throws IOException, EndOfStreamException\n {\n if (imageState_ == ImageStateType.PE64)\n {\n return peFile_.readInt64(relpos(Offsets.IMAGE_BASE_64.position));\n }\n\n return peFile_.readInt32(relpos(Offsets.IMAGE_BASE_32.position));\n }", "public static int offset_source() {\n return (256 / 8);\n }", "public Coordinate getStart( )\n\t{\n\t\treturn startLocation;\n\t}", "public String getStart() {\n return start;\n }", "public static int offsetBits_addr() {\n return 0;\n }", "public int getStart() {\n return start;\n }", "public int getStart() {\n return start;\n }", "public String getStart(){\n\t\treturn start;\n\t}", "public Address getLocalApicAddress() {\n return Address.fromIntZeroExtend(mem.getInt(36));\n }", "public java.math.BigInteger getStartPage()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(STARTPAGE$12);\n if (target == null)\n {\n return null;\n }\n return target.getBigIntegerValue();\n }\n }", "public int getStart() {\n return this.start;\n }", "int getStart();", "public int getStart() {\r\n return start;\r\n }", "public int start() {\n return start;\n }", "public LocatorIF getBase() {\n return base_address;\n }", "public Integer getBeginOffset() {\n return this.beginOffset;\n }", "public Address getFilebase() {\n return new Address(m_module.getConfiguration().getFileBase().toBigInteger());\n }", "public int getStart()\n {\n return start;\n }", "public int getStartBytecodeToCopy() {\n\t\treturn startBytecodeToCopy;\n\t}", "public String getSrcAddress1() {\r\n return (String) getAttributeInternal(SRCADDRESS1);\r\n }", "public Point getStart(){\n\t\treturn bigstart;\n\t}", "public ImPoint getCurrentLoc() {\n \treturn this.startLoc;\n }", "public int getImageOffset() {\n\n\t\tif (isGated()) {\n\n\t\t\tif (isReconstruction()) {\n\n\t\t\t\t// Must have a gated reconstruction. For each gated interval\n\t\t\t\t// there is an extra 128 byte header (beginning \"adac01\") block\n\t\t\t\t// starting at the normal image offset location. Add this to the\n\t\t\t\t// offset:\n\t\t\t\treturn ADACDictionary.IM_OFFSET + getNumberOfGatedIntervals() * 128;\n\n\t\t\t} else {\n\n\t\t\t\t// Gated SPECT data set. For each azimuth there is an additional\n\t\t\t\t// 1664 byte header (beginning \"adac01\") at the normal image\n\t\t\t\t// offset location. Add this to the image offset.\n\t\t\t\treturn ADACDictionary.IM_OFFSET + getNumberOfGatedIntervals() * 1664;\n\n\t\t\t}\n\n\t\t} else {\n\t\t\t// Non gated data - simplest case\n\t\t\treturn ADACDictionary.IM_OFFSET;\n\t\t}\n\n\t}", "public String getStart(){\n\t\treturn mStart;\n\t}", "@Override\n\tpublic long getVendorRamdiskOffset() {\n\t\treturn NumericUtilities.getUnsignedAlignedValue(header_size, getPageSize());\n\t}", "public ImageView loadBoot()\n {\n try \n {\n Image boot = new Image(new FileInputStream(\"boot.png\"), 800, 800, true, true);\n ImageView bootView = new ImageView(boot);\n bootView.setTranslateX(195);\n bootView.setTranslateY(390);\n bootView.setScaleX(0.05);\n bootView.setScaleY(0.05);\n return bootView;\n } \n catch (FileNotFoundException ex) \n {\n Logger.getLogger(TycoonGUI.class.getName()).log(Level.SEVERE, null, ex);\n return null;\n }\n }", "public int findGeneStart()\n {\n return findGeneStart(0);\n }", "public Point getStart() {\n return mStart;\n }", "public int getPageStart(){\r\n\t\treturn (this.page -1) * perPageNum;\r\n\t}", "byte[] getLinkStarts();", "short getPageStart();", "String getAddress( String filename, String generator);", "Long getStartAt();", "public void setStartAddress(Long startAddress) {\r\n\t\tthis.startAddress = startAddress;\r\n\t}", "@Override\n public final void noteAbsoluteEntryPoint(int address) {\n }", "public int getStartIdx() {\n return this.startIdx;\n }", "private AbsoluteAddress getContinuosPoint(FileProcess file) {\n\t\tint t = 0;\n\t\twhile (true) {\n\t\t\tString temp = file.getLineAt(t);\n\n\t\t\tif (temp == null || temp == \"\") {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (temp.contains(\"Address\")) {\n\t\t\t\ttemp = temp.substring(temp.indexOf(\"x\") + 1, temp.length());\n\t\t\t\treturn new AbsoluteAddress(Long.parseLong(temp, 16));\n\t\t\t}\n\t\t\tt++;\n\t\t}\n\t}", "public String getStartNodeID()\r\n {\r\n return startNodeID;\r\n }", "public Point getStartPoint() {\n\t\treturn startPoint;\n\t}", "public Position getStart() {\r\n return start;\r\n }", "org.hl7.fhir.Integer getStart();", "public int rva2offset(Address address) {\n\t\tint offset = -1;\n\t\tfor(IMAGE_SECTION_HEADER section:peFileSections) {\n\t\t\tif(address.getAddr32() >= section.getVirtualAddress()\n\t\t\t&& address.getAddr32() < section.getVirtualAddress() + section.getVirtualSize()) {\n\t\t\t\toffset = address.getAddr32() - section.getVirtualAddress() + section.getPointerToRawData();\n\t\t\t\treturn offset;\n\t\t\t}\n\t\t}\n\t\tif(address.getAddr32() < peOptionalHeader.getSizeOfHeaders())\n\t\t\treturn address.getAddr32();\n\t\treturn offset;\n\t}", "public String getEntryPoint() {\n return entryPoint;\n }", "public int getStartOffset() {\n return startPosition.getOffset();\n }", "public int getStartRange() {\r\n\t\treturn lookupValue(Params.START_RANGE);\r\n\t}", "public int addr2offset(Address address) {\n\t\treturn rva2offset(new Address(address.getAddr32()-peOptionalHeader.getImageBase()));\n\t}", "int getStartSegment();", "public String getPicAddr() {\n return picAddr;\n }", "public String getEthernetMacAddress(){\n\t try {\n\t return loadFileAsString(\"/sys/class/net/eth0/address\")\n\t .toUpperCase().substring(0, 17);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t return null;\n\t }\n\t}", "public String getDefaultFromAddress() {\n\t\treturn myDefaultFromAddress;\n\t}", "public int getStartx(){\n\t\treturn startx;\n\t}", "public WeightedPoint getStart()\n {\n return map.getStart();\n }", "@Override\n public int getStart() {\n return feature.getStart();\n }", "public String getBlockStart () {\n return BLOCK_START_PREFIX + objectName + BLOCK_START_SUFFIX;\n }", "public static Image startScreen(int screenNum)\n\t{\n\t\tif (screenNum >= 0 && screenNum < startScreens.length)\n\t\t\treturn startScreens[screenNum];\n\t\treturn null;\n\t}", "public static int offset_min() {\n return (56 / 8);\n }", "public int start() { return _start; }", "public State getStart() {\n \t\treturn start;\n \t}", "public Block returnStart() {\n\t\treturn start;\n\t}", "public int getStartPage() {\n return startPage;\n }", "public int getBegin() {\r\n return (event.getStartTime() - 6) * PIXELS_PER_HOUR;\r\n }", "public Location getStartingLocation() {\r\n return startingLocation;\r\n }", "public int getStartX() {\r\n\t\treturn startX;\r\n\t}", "public static int offset_virtual_clk() {\n return (104 / 8);\n }", "public int getStart ()\n {\n\n return this.start;\n\n }" ]
[ "0.7145468", "0.6851372", "0.6802024", "0.6639003", "0.65827626", "0.6492477", "0.62233615", "0.61487544", "0.6021119", "0.59524745", "0.5904328", "0.5762779", "0.56187475", "0.5592582", "0.5546848", "0.5545342", "0.5542083", "0.55397063", "0.5527506", "0.54745555", "0.5463952", "0.5438987", "0.5418712", "0.539699", "0.5388547", "0.537551", "0.5374682", "0.53725004", "0.5371976", "0.535539", "0.5352764", "0.5347368", "0.53405416", "0.532261", "0.5317442", "0.53099275", "0.5267639", "0.5266001", "0.52444375", "0.52224827", "0.52108884", "0.5203299", "0.5198255", "0.5197597", "0.51946265", "0.5193792", "0.51873094", "0.5187288", "0.51778626", "0.51747286", "0.51664865", "0.51474774", "0.5144845", "0.51437116", "0.5142338", "0.51140535", "0.5113065", "0.50959367", "0.50906533", "0.50858593", "0.5084643", "0.508266", "0.5081256", "0.50789165", "0.507839", "0.50759137", "0.50705206", "0.50666034", "0.505839", "0.50433403", "0.50415117", "0.50414324", "0.50368035", "0.5027305", "0.5023045", "0.5018872", "0.50002736", "0.498462", "0.49737918", "0.4970082", "0.4969498", "0.49473354", "0.49430108", "0.49344334", "0.49338704", "0.4930102", "0.49253404", "0.49238434", "0.49182472", "0.49066082", "0.49058992", "0.49034122", "0.49011302", "0.4898702", "0.48954245", "0.48946708", "0.48935258", "0.4893069", "0.4882611", "0.4879799" ]
0.8556947
0
End the end address of the boot image
public abstract Address getBootImageEnd();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Address getBootHeapEnd();", "public abstract Address getBootImageStart();", "protected void end() {\n\t\tRobot.Drivetrain.drive(0,0);\n\t}", "@Override\n public void end() \n {\n Robot.mDrive.DriveRobot(0, 0);\n }", "protected void end() {\n \tRobotMap.feedMotor1.set(0);\n \tRobotMap.shootAgitator.set(0);\n }", "@Override\n protected void end() {\n Robot.drive.setCoastMode();\n Robot.tapeAlignSys.disable();\n Robot.lidarAlignSys.disable();\n }", "protected void end() {\n \tRobot.drive.brake();\n }", "protected void end() {\n \tlogger.info(\"Ending AutoMoveLiftUp Command, encoder inches = {}\", Robot.liftSubsystem.readEncoderInInches());\n \t\n }", "public void setEndPC(Address pc) { endPC = pc; }", "protected void end() {\n \tSystem.out.println(\"end ReturnToStart\");\n }", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "@Override\n\tpublic void end() {\n\t\t\n\t}", "protected void end() {\n Robot.drive.DriveStop();\n Robot.drive.HighGear();\n //Robot.drive.setLeftSide(0);\n //Robot.drive.setRightSide(0);\n // Robot.drive.driveshighgear();\n //\tSmartDashboard.putNumber(\"EndAngle\", Robot.drive.gyroGetAngle());\n }", "@Override\n protected void end() {\n Robot.drive_subsystem.drive(0);\n }", "@Override\n\tprotected void end() {\n\t\t\n\t}", "public void end() {\n\n }", "protected void end() {\n \tRobot.driveSubsystem.stopDrivingNow();\n }", "protected void end() {\n\t\tLiquidCrystal lcd = RobotMap.lcd;\n\t\tlcd.clear();\n\n\t\tRobotMap.chassisfrontLeft.set(0);\n\t\tRobotMap.chassisfrontRight.set(0);\n\t\tRobotMap.chassisrearLeft.set(0);\n\t\tRobotMap.chassisrearRight.set(0);\n\t\t\n\t\tRobotMap.climberclimbMotor.set(0);\n\t\tRobotMap.floorfloorLift.set(0);\n\t\tRobotMap.acquisitionacquisitionMotor.set(0);\n\n\n\t}", "protected void end()\n\t{\n\t}", "String getEndAddress();", "@Override\n\t\tpublic void end() {\n\t\t\t\n\t\t}", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "public void endJump() {\n\t\tsetVy(Math.min(0, getVy()));\n\t}", "protected void end() {\r\n }", "protected void end() {\r\n }", "protected void end() {\r\n }", "protected void end() {\r\n }", "@Override\n\t\t\tpublic void end() {\n\t\t\t\t\n\t\t\t}", "protected void end() {\n \n \n }", "public Address getEndPC() { return endPC; }", "@Override\n\tpublic void end() {\n\n\t}", "@Override\n\tpublic void end() {\n\n\t}", "protected void end() {\n\t\tdrive.setBoth(0);\n\t}", "protected void end() {\n \tRobot.driveTrain.setPower(0, 0);\n }", "protected void end() {\n \tRobot.DRIVE_SUBSYSTEM.stop();\n }", "protected void end() {\n \tRobot.driveBase.stopDead();\n }", "protected void end() {\n\r\n\t}", "@Override\r\n\tprotected void end() {\r\n\t}", "@Override\n public void end() {\n }", "protected void end() {\n \t// theres nothing to end\n }", "protected void end() {\n // Robot.drive.setMoveVisionAssist(0);\n // Robot.drive.setTurnVisionAssist(0);\n Robot.limelight.setPipeline(1.0); \n }", "@Override\n protected void end() {\n Robot.hatchIntake.hatchOFF();\n }", "@Override\n\tprotected void end() {\n\n\t}", "@Override\n\tprotected void end() {\n\n\t}", "@Override\n\tprotected void end() {\n\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n public final void noteAbsoluteEntryPoint(int address) {\n }", "protected void end() {\n \tRobot.drivetrain.leftDrive1.set(0); \n \tRobot.drivetrain.leftDrive2.set(0);\n \tRobot.drivetrain.leftDrive3.set(0);\n \t\n \tRobot.drivetrain.rightDrive1.set(0);\n \tRobot.drivetrain.rightDrive2.set(0);\n \tRobot.drivetrain.rightDrive3.set(0);\n \tRobot.twoGearAngle = Robot.drivetrain.gyro.getYaw();\n }", "protected void end() {\n Robot.arm.moveArm(0, 1);\n }", "@Override\n\tpublic void end() {\n\t\t// Empty on purpose, no cleanup required yet\n\t}", "public Address getEndAddress() {\n\t\treturn baseAddress.getNewAddress(baseAddress.getOffset() + maxOffset);\n\t}", "protected void end() {\n\t\tRobot.drivetrain.tankDrive(0, 0);\n\t}", "public void end () {\n drive.driveStop();\n }", "protected void end() {\n \n \tRobotMap.motorLeftOne.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0);\n \tRobotMap.motorLeftTwo.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0);\n \t\n \tRobotMap.motorRightOne.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0);\n \tRobotMap.motorRightTwo.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0);\n \t\n }", "@Override\n protected void end() {\n }", "public void paintFinalScreen() {\n\t\tapp.image(end, 0, 0);\n\t}", "protected void end() {\n \tRobot.chassisSubsystem.setShootingMotors(0);\n }", "protected void end() {\n \t//Just let the lift keep holding the current motion magic\n \t//setpoint after this command ends\n \tRobot.debug.Stop();\n }", "public void setEndPt(final int dataPointer) {\n this.endPt=dataPointer;\n }", "protected void end() {\n\t\t// we are ending the, stop moving the robot\n\t\tRobot.driveSubsystem.arcadeDrive(0, 0);\n\t}", "@Override\r\n\tprotected void end() {\n\r\n\t}", "@Override\r\n\tprotected void end() {\n\r\n\t}" ]
[ "0.68903893", "0.6597846", "0.57502145", "0.57031816", "0.56865203", "0.56842047", "0.5657449", "0.557326", "0.55702066", "0.55657965", "0.55604196", "0.55604196", "0.55604196", "0.55604196", "0.55604196", "0.55604196", "0.5549393", "0.5526238", "0.5518654", "0.5511168", "0.5510413", "0.5504327", "0.5503384", "0.5497052", "0.54965335", "0.5495116", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.54907966", "0.5489159", "0.5487831", "0.5487831", "0.5487831", "0.5487831", "0.54778355", "0.5474705", "0.546591", "0.54627967", "0.54627967", "0.54577", "0.5456115", "0.54542637", "0.5447462", "0.5440675", "0.5433706", "0.5432259", "0.54300684", "0.5429069", "0.54192203", "0.54128695", "0.54128695", "0.54128695", "0.5411387", "0.5411387", "0.5411387", "0.5411387", "0.5388412", "0.53831214", "0.53793734", "0.53714037", "0.5363178", "0.53628314", "0.5352431", "0.5351709", "0.534863", "0.5341584", "0.53376", "0.53373575", "0.53370273", "0.53249186", "0.53203183", "0.53203183" ]
0.8152499
0
Gets the start address of the boot heap
public abstract Address getBootHeapStart();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Address getBootHeapEnd();", "public abstract Address getBootImageStart();", "public Address getStartAddress() {\n\t\treturn baseAddress;\n\t}", "public int getStartPC() {\n\t\treturn startPC & 0xffff;\n\t}", "public int getAddressOfEntryPoint()\n throws IOException, EndOfStreamException\n {\n return peFile_.readInt32(relpos(Offsets.ADDRESS_OF_ENTRY_POINT.position));\n }", "protected int getStartAddress() {\r\n return (readByte(RESET_VECTOR) & 0xff) + ((readByte(RESET_VECTOR + 1) & 0xff) << 8);\r\n }", "String getStartAddress();", "public static int offset_addr() {\n return (0 / 8);\n }", "static int memory_address_hl(){\n\t\tint hl_address = hexa_to_deci(registers.get('H')+registers.get('L'));\n\t\treturn hl_address;\n\t}", "public java.math.BigInteger getStartPage()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(STARTPAGE$12);\n if (target == null)\n {\n return null;\n }\n return target.getBigIntegerValue();\n }\n }", "public int getDevicesStartAddress() {\n return devicesStartAddress;\n }", "public Point min() {\n\t\tif (heapSize >= 0)\n\t\t\treturn new Point(heapArr[0]);\n\t\telse\n\t\t\tthrow new RuntimeException(\"MinHeap is empty!\");\n\t}", "public Point ExtractMin() {\n\t\tif (heapSize < 0)\n\t\t\tthrow new RuntimeException(\"MinHeap underflow!\");\n\t\tPoint min = new Point(heapArr[0]);\n\t\theapArr[0] = new Point(heapArr[heapSize - 1]);\n\t\theapSize = heapSize - 1;\n\t\tminHeapify(0);\n\t\treturn min;\n\n\t}", "public Heap getHeap() {\n return minHeap;\n }", "public long memoryAddress()\r\n/* 143: */ {\r\n/* 144:172 */ throw new UnsupportedOperationException();\r\n/* 145: */ }", "long getLocalOffHeapSizeInBytes();", "String getStartpage();", "private int loadProgram(Program program, int start) throws MemoryFault {\n int address = start;\n for (int i : program.getCode()) {\n machine.memory.store(address++, i);\n }\n return address;\n }", "int getLocalOffHeapSize();", "public Location getStartLocation() {\r\n \treturn new Location(0,0);\r\n }", "public int heapMin() {\n return array[0];\n }", "public node_data heapMinimum(){return _a[0];}", "public com.a9.spec.opensearch.x11.QueryType.StartPage xgetStartPage()\n {\n synchronized (monitor())\n {\n check_orphaned();\n com.a9.spec.opensearch.x11.QueryType.StartPage target = null;\n target = (com.a9.spec.opensearch.x11.QueryType.StartPage)get_store().find_attribute_user(STARTPAGE$12);\n return target;\n }\n }", "public Address getLocalApicAddress() {\n return Address.fromIntZeroExtend(mem.getInt(36));\n }", "public Addr getLocationOnStack() {\n\n\t\tImm immediateStackPointerOffset = new Imm(String.valueOf(this.spOffset));\n\t\tAddr spilledValueLocationOnStack = new Addr(immediateStackPointerOffset, this.sp);\n\t\treturn spilledValueLocationOnStack;\n\t}", "public long getSizeOfHeapReserve()\n throws IOException, EndOfStreamException\n {\n return (imageState_ == ImageStateType.PE64\n ? peFile_.readInt64(relpos(Offsets.SIZE_OF_HEAP_RESERVE_64.position))\n : peFile_.readInt32(relpos(Offsets.SIZE_OF_HEAP_RESERVE_32.position)));\n }", "public static void main(String[] args) {\r\n\t\tFastMinHeap<String> stringHeap = new FastMinHeap();\r\n\t\tstringHeap.insert(\"two\", 2);\r\n\t\tstringHeap.insert(\"four\", 4);\r\n\t\tstringHeap.insert(\"one\", 1);\r\n\t\tstringHeap.insert(\"six\", 6);\r\n\t\tstringHeap.insert(\"neg one\", -1);\r\n\t\tSystem.out.println(stringHeap.locations.toString());\r\n\t\tSystem.out.println(\"min: \" + stringHeap.extractMin());\r\n\t\tSystem.out.println(stringHeap.locations.toString());\r\n\t\tSystem.out.println(stringHeap.toString());\r\n\t\tSystem.out.println(stringHeap.locationOf(\"one\"));\r\n\t}", "public int peek() {\r\n return heap.get(0);\r\n }", "public int getHeapIndex() {\n\t\treturn heapIndex;\n\t}", "public int getStart() {\r\n\t\treturn this.offset;\r\n\t}", "public int extractMin() {\n\t\t\tif (heap_size <= 0) {\n\t\t\t\treturn Integer.MAX_VALUE;\n\t\t\t} else if (heap_size == 1) {\n\t\t\t\theap_size--;\n\t\t\t\treturn harr[0];\n\t\t\t}\n\n\t\t\tint root = harr[0];\n\t\t\tharr[0] = harr[heap_size - 1];\n\t\t\theap_size--;\n\t\t\tminHeapify(0);\n\n\t\t\treturn root;\n\t\t}", "public String get_start() {\n\t\treturn start;\n\t}", "long getLocalOnHeapSizeInBytes();", "public abstract Extent getHeapSize();", "public Address getImagebase() {\n return new Address(m_module.getConfiguration().getImageBase().toBigInteger());\n }", "@Override\n public final void noteAbsoluteEntryPoint(int address) {\n }", "public int getPageStartEntry() {\n\t\treturn this.skipEntries;\n\t}", "public int getPageStart(){\r\n\t\treturn (this.page -1) * perPageNum;\r\n\t}", "int getLocalOnHeapSize();", "public int getStart() {\n\t\treturn start;\n\t}", "public String getEntryPoint() {\n return entryPoint;\n }", "public String getHomeAddress() {\n return homeAddress;\n }", "public Double minMemory() {\n return this.minMemory;\n }", "public int getStartPage() {\n return startPage;\n }", "public long getStart() {\n return start;\n }", "public int getStart() {\r\n\t\treturn start;\r\n\t}", "public Vertex HeapExtractMin() {\n\n if (size == 1) {\n \t\n Vertex min = ver[0];\n size--;\n return min;\n }\n\n // Getting the last element and making it root element of the binary tree\n Vertex min = ver[0];\n Vertex lastItem = ver[size-1];\n ver[0]= lastItem;\n size--;\n // Calling heapMinHeapify to maintain heap property\n heapMinHeapify(0);\n return min;\n }", "public int getStart() {\n\t\t\treturn start;\n\t\t}", "public abstract Address getBootImageEnd();", "@Override\n\tpublic long getVendorRamdiskOffset() {\n\t\treturn NumericUtilities.getUnsignedAlignedValue(header_size, getPageSize());\n\t}", "public String startIP() {\n return this.startIP;\n }", "public byte[] getJmpBoot() {\r\n\t\treturn jmpBoot;\r\n\t}", "private EntryStorageHome home()\r\n {\r\n if( home == null )\r\n {\r\n\t\ttry\r\n\t\t{\r\n home = (EntryStorageHome) \r\n get_storage_home().get_catalog().find_storage_home( PSS_HOME );\r\n\t\t}\r\n\t\tcatch( Throwable e )\r\n\t\t{\r\n\t\t String error = \"Could not resolve the EntryStorageHome\";\r\n\t\t throw new RuntimeException( error, e );\r\n\t\t}\r\n }\r\n return home;\r\n }", "public int getReturnAddressOffset();", "public E minimum() {\r\n\t\treturn objectHeap[0];\r\n\t}", "public TaskStack getHomeStack() {\n return this.mTaskStackContainers.getHomeStack();\n }", "short getPageStart();", "public Point getStart(){\n\t\treturn bigstart;\n\t}", "public int getStart() {\n return start;\n }", "public static int size_addr() {\n return (16 / 8);\n }", "public Point getStart() {\n\t\treturn _start;\n\t}", "public int getStart()\n {\n return start;\n }", "public int getStart() {\n return start;\n }", "private IAddress getFirstAddress(final MemoryMap memoryMap) {\n for (final MemorySection memorySection : memoryMap) {\n return memorySection.getStart();\n }\n\n return new CAddress(0);\n }", "public E extractMin() {\r\n\t\tif (this.size == 0) {\r\n\t\t\tthrow new RuntimeException(\r\n\t\t\t\t\t\"Heap underflow. Cannot extractMin from an empty heap.\");\r\n\t\t}\r\n\t\tE min = this.objectHeap[0];\r\n\t\tdouble costMin = this.costHeap[0];\r\n\t\tthis.objectHeap[0] = this.objectHeap[this.size - 1];\r\n\t\tthis.costHeap[0] = this.costHeap[this.size - 1];\r\n\t\tthis.size -= 1;\r\n\t\tthis.locations.delete(min);\r\n\t\tthis.locations.put(this.objectHeap[0], 0);\r\n\t\tthis.minHeapify(0);\r\n\t\treturn min;\r\n\t}", "public String getBaseAddress() {\n return base_address.getAddress();\n }", "public int getStart() {\r\n return start;\r\n }", "public DHeap_Item Get_Min()\n {\n\treturn array[0];\n }", "public Point start() {\r\n return this.start;\r\n }", "public int heapSize();", "public String getStartNodeID()\r\n {\r\n return startNodeID;\r\n }", "public int getLockAddress() {\n\t\treturn 0;\n\t}", "public int start() {\n return start;\n }", "public int getVirtualAddress() {\n return virtualAddress;\n }", "public int getStart() {\n return this.start;\n }", "public LinkAddress getInitialLinkAddress() {\n if (mIpConfiguration != null && mIpConfiguration.getStaticIpConfiguration() != null) {\n return mIpConfiguration.getStaticIpConfiguration().ipAddress;\n } else {\n return null;\n }\n }", "public int ProgramMemorySize() { return PROGRAM_MEMORY_SIZE; }", "public Block getStart () {\n\t\treturn start;\n\t}", "public Point getHeadLocation ()\r\n {\r\n if (headLocation == null) {\r\n computeLocations();\r\n }\r\n\r\n return headLocation;\r\n }", "public PixelPoint getStartPoint ()\r\n {\r\n Point start = glyph.getLag()\r\n .switchRef(\r\n new Point(getStart(), line.yAt(getStart())),\r\n null);\r\n\r\n return new PixelPoint(start.x, start.y);\r\n }", "public static int offset_min() {\n return (56 / 8);\n }", "public node_data heapExtractMin(){\n\t\tdouble min = _positiveInfinity;\n\t\tnode_data v=null;\n\t\tif (!isEmpty()){\n\t\t\tv = _a[0];\n\t\t\tmin = v.getWeight();\n\t\t\t_a[0]=_a[_size-1];\n\t\t\t_size = _size-1;\n\t\t\tminHeapify(0, _size);\n\t\t}\n\t\treturn v;\n\t}", "public int getStartBytecodeToCopy() {\n\t\treturn startBytecodeToCopy;\n\t}", "int startShutdown() {\n final int offset = CURRENT_OFFSET_UPDATER.getAndAdd(this, queue.length);\n\n // If this offset is larger than reserve, trim it. That is not an accurate\n // view of which slot was actually \"reserved\", but it indicates at which\n // entry we can declare the queue flushed (e.g. at the emergency slot).\n return offset > reserve ? reserve : offset;\n }", "public MinHeap(){\r\n nextAvail = 1;\r\n }", "public Integer getBeginOffset() {\n return this.beginOffset;\n }", "public String getStart() {\r\n\t\treturn this.start;\r\n\t}", "public int getStartingPage() {\n return startingPage;\n }", "public String getHost() {\n return stack.stackAddress;\n }", "public Node getStartNode() {\n return startNode;\n }", "public int getBaseOffset() {\n\t\treturn this.threadCalls.size() + 1;\n\t}", "public int peek (){\n if (size == 0) throw new IllegalStateException();\n return heap [0];\n }", "public int get_addr() {\n return (int)getUIntElement(offsetBits_addr(), 16);\n }", "@External(readonly = true)\n\tpublic Address get_super_admin() {\n\t\tif (DEBUG) {\n\t\t\tContext.println( Context.getOrigin().toString() + \" is getting super admin address.\" + TAG);\n\t\t}\n\t\treturn this.super_admin.get();\n\t}", "public Object[] getHeap() {\n return getHeapArray();\n }", "public E minimum() {\n\t\tif (heap.size() <= 0)\n\t\t\treturn null;\n\t\telse\n\t\t\treturn heap.get(0);\n\t}", "public E minimum() {\n\t\tif (heap.size() <= 0)\n\t\t\treturn null;\n\t\telse\n\t\t\treturn heap.get(0);\n\t}", "public int getHome() {\n return m_home;\n }", "public E extractMin() {\n\t\tif (heap.size() <= 0)\n\t\t\treturn null;\n\t\telse {\n\t\t\tE minVal = heap.get(0);\n\t\t\theap.set(0, heap.get(heap.size()-1)); // Move last to position 0\n\t\t\theap.remove(heap.size()-1);\n\t\t\tminHeapify(heap, 0);\n\t\t\treturn minVal;\n\t\t}\n\t}", "public E extractMin() {\n\t\tif (heap.size() <= 0)\n\t\t\treturn null;\n\t\telse {\n\t\t\tE minVal = heap.get(0);\n\t\t\theap.set(0, heap.get(heap.size() - 1)); // Move last to position 0\n\t\t\theap.remove(heap.size() - 1);\n\t\t\tminHeapify(heap, 0);\n\t\t\treturn minVal;\n\t\t}\n\t}" ]
[ "0.7375915", "0.6451779", "0.62922984", "0.61725795", "0.6090522", "0.6071147", "0.6024503", "0.5802641", "0.57333153", "0.57010525", "0.56762046", "0.5612017", "0.5561912", "0.55615485", "0.5557239", "0.5462296", "0.54198426", "0.53993404", "0.53786105", "0.5367232", "0.53600204", "0.5343268", "0.532669", "0.5262111", "0.52483857", "0.5230149", "0.52040935", "0.5166927", "0.5163016", "0.5160469", "0.5157107", "0.51485157", "0.51476806", "0.51386625", "0.5136481", "0.51253027", "0.5122027", "0.50908726", "0.5083214", "0.5063884", "0.5062535", "0.5057417", "0.5054469", "0.5049989", "0.5035267", "0.5033433", "0.5028851", "0.50226617", "0.5017158", "0.5006796", "0.49934718", "0.49910447", "0.49896067", "0.4988017", "0.49750268", "0.49646077", "0.4936117", "0.49329135", "0.49125847", "0.49025884", "0.4900422", "0.48973784", "0.48896724", "0.48896503", "0.48771757", "0.48755625", "0.48720276", "0.48700738", "0.48656937", "0.486259", "0.4861808", "0.4858979", "0.4857523", "0.48541322", "0.48524576", "0.4851229", "0.48501453", "0.48455113", "0.484406", "0.48389506", "0.4838784", "0.48385665", "0.48224032", "0.4816048", "0.48118737", "0.4797718", "0.47969043", "0.47892153", "0.4783488", "0.478277", "0.47815108", "0.4774618", "0.4773445", "0.47701758", "0.4768927", "0.47685832", "0.47685832", "0.47649488", "0.47538966", "0.47362527" ]
0.8702119
0
End the end address of the boot heap
public abstract Address getBootHeapEnd();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Address getBootHeapStart();", "public abstract Address getBootImageEnd();", "void shutdown()\n {\n // Write the set of address pages, the set of empty user pages and\n // the set of pages with space remaining to a byte buffer.\n\n int size = 0;\n \n size += INT_SIZE + bouquet.getAddressPagePool().size() * Pack.LONG_SIZE;\n \n ByteBuffer reopen = ByteBuffer.allocateDirect(size);\n \n reopen.putInt(bouquet.getAddressPagePool().size());\n for (long position: bouquet.getAddressPagePool())\n {\n reopen.putLong(position);\n }\n \n reopen.flip();\n\n long endOfSheaf;\n try\n {\n endOfSheaf = bouquet.getSheaf().getFileChannel().size();\n }\n catch(IOException e)\n {\n throw new PackException(PackException.ERROR_IO_SIZE, e);\n }\n \n // Write the variable data at the interim page positions.\n \n try\n {\n bouquet.getSheaf().getFileChannel().write(reopen, endOfSheaf);\n }\n catch (IOException e)\n {\n throw new PackException(PackException.ERROR_IO_WRITE, e);\n }\n\n // Write the boundaries and soft shutdown flag.\n \n try\n {\n bouquet.getSheaf().getFileChannel().truncate(endOfSheaf + reopen.capacity());\n }\n catch (IOException e)\n {\n throw new PackException(PackException.ERROR_IO_TRUNCATE, e);\n }\n \n Header<Integer> header = bouquet.getHeader();\n Region addressBoundary = header.get(Housekeeping.ADDRESS_BOUNDARY);\n addressBoundary.getLock().lock();\n try\n {\n addressBoundary.getByteBuffer().putLong(0, bouquet.getAddressBoundary().getPosition());\n addressBoundary.dirty();\n }\n finally\n {\n addressBoundary.getLock().unlock();\n }\n \n Region addressLookupPagePool = header.get(Housekeeping.ADDRESS_LOOKUP_PAGE_POOL);\n addressLookupPagePool.getLock().lock();\n try\n {\n addressLookupPagePool.getByteBuffer().putLong(0, endOfSheaf);\n addressLookupPagePool.dirty();\n }\n finally\n {\n addressLookupPagePool.getLock().unlock();\n }\n\n Region shutdown = header.get(Housekeeping.SHUTDOWN);\n shutdown.getLock().lock();\n try\n {\n shutdown.getByteBuffer().putInt(0, Pack.SOFT_SHUTDOWN);\n shutdown.dirty();\n }\n finally \n {\n shutdown.getLock().unlock();\n }\n\n try\n {\n bouquet.getHeader().write(bouquet.getSheaf().getFileChannel(), 0);\n }\n catch (IOException e)\n {\n throw new PackException(PackException.ERROR_IO_WRITE, e);\n }\n }", "public void setEndPC(Address pc) { endPC = pc; }", "void endEntry();", "protected void end() {\n \t// theres nothing to end\n }", "@Override\n\tpublic void end() {\n\t\t// Empty on purpose, no cleanup required yet\n\t}", "protected void end() {\n \tSystem.out.println(\"end ReturnToStart\");\n }", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "protected void end() {\n\t}", "public Address getEndAddress() {\n\t\treturn baseAddress.getNewAddress(baseAddress.getOffset() + maxOffset);\n\t}", "public void setEndPt(final int dataPointer) {\n this.endPt=dataPointer;\n }", "@Override\n\tpublic void end() {\n\t\t\n\t}", "protected void end() {\r\n }", "protected void end() {\r\n }", "protected void end() {\r\n }", "protected void end() {\r\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "protected void end() {\n }", "void unsetEnd();", "protected void end()\n\t{\n\t}", "public void end() {\n\n }", "@Override\n public final void noteAbsoluteEntryPoint(int address) {\n }", "@Override\n\tprotected void end() {\n\t\t\n\t}", "public int end() { return _end; }", "protected void end() {\n\r\n\t}", "public int end() {\n return end;\n }", "protected void end() {\n \tRobotMap.feedMotor1.set(0);\n \tRobotMap.shootAgitator.set(0);\n }", "@Override\n\t\tpublic void end() {\n\t\t\t\n\t\t}", "void unsetStaEnd();", "public void end();", "@Override\n public void end() {\n }", "@Override\r\n\tprotected void end() {\r\n\t}", "@Override\n\t\t\tpublic void end() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tpublic void end() {\n\n\t}", "@Override\n\tpublic void end() {\n\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n\tprotected void end() {\n\t}", "@Override\n\tprotected void end() {\n\t}", "protected void end() {\n \n \n }", "public void endJump() {\n\t\tsetVy(Math.min(0, getVy()));\n\t}", "@Override\n protected void end() {\n }", "@Override\n\tprotected void end() {\n\n\t}", "@Override\n\tprotected void end() {\n\n\t}", "@Override\n\tprotected void end() {\n\n\t}", "public void DeleteEnd(){\n\t\tsuper.cut();\n\t}", "public Address getEndPC() { return endPC; }", "@Override\r\n\tprotected void end() {\n\r\n\t}", "@Override\r\n\tprotected void end() {\n\r\n\t}", "protected void end() {\n \tif (waitForMovement) Robot.intake.setHopperTracker(deploy ? Status.deployed : Status.stowed);\n }", "@Override\r\n protected void end() {\r\n\r\n }", "@Override\n protected void end() {\n\n }", "protected void end() {\n\t\tLiquidCrystal lcd = RobotMap.lcd;\n\t\tlcd.clear();\n\n\t\tRobotMap.chassisfrontLeft.set(0);\n\t\tRobotMap.chassisfrontRight.set(0);\n\t\tRobotMap.chassisrearLeft.set(0);\n\t\tRobotMap.chassisrearRight.set(0);\n\t\t\n\t\tRobotMap.climberclimbMotor.set(0);\n\t\tRobotMap.floorfloorLift.set(0);\n\t\tRobotMap.acquisitionacquisitionMotor.set(0);\n\n\n\t}", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "@Override\n protected void end() {\n }", "String getEndAddress();" ]
[ "0.67376167", "0.63481814", "0.5942193", "0.5635055", "0.5622759", "0.55797005", "0.5560904", "0.555901", "0.55281746", "0.55281746", "0.55281746", "0.55281746", "0.55281746", "0.55281746", "0.5503165", "0.54902077", "0.54588574", "0.5447359", "0.5447359", "0.5447359", "0.5447359", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.544348", "0.54432046", "0.5432978", "0.5408477", "0.54035765", "0.54034615", "0.5394842", "0.53834546", "0.5382747", "0.5382414", "0.5380232", "0.53737533", "0.53688085", "0.53640866", "0.53606325", "0.53465724", "0.53412604", "0.53412604", "0.5328031", "0.5328031", "0.5328031", "0.5328031", "0.5317999", "0.53006923", "0.5292024", "0.5282392", "0.5282392", "0.5282392", "0.52759326", "0.52723414", "0.52604854", "0.52604854", "0.52299625", "0.52256143", "0.52252555", "0.52238446", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.52104515", "0.5204384" ]
0.8577915
0
Gets the amount of memory available to the memory manager
public abstract Extent getHeapSize();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static long totalMemory() {\n return Native.totalMemory(false);\n }", "long getMemory();", "long getMemory();", "public int getMemory()\n\t{\n\t\treturn memorySize;\n\t}", "public long memoriaRamDisponivel(){\n return hardware.getMemory().getAvailable();\n }", "long memoryUsed();", "public native int getTotalMemory();", "public static long getTotalMemory() {\r\n\t\ttotalMemory = Runtime.getRuntime().totalMemory();\r\n\t\treturn totalMemory;\r\n\t}", "public int getSize() {\n return memory.length;\n }", "public static long getMemoryTotal() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryTotal();\r\n }", "public static long getMemoryFree() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryFree();\r\n }", "public Integer getMemorySize() {\n return this.memorySize;\n }", "public long memory() {\n\treturn 0;\n }", "private long getSystemMemoryInGB() {\n long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory\n .getOperatingSystemMXBean()).getTotalPhysicalMemorySize();\n return memorySize / ONE_BILLION;\n }", "public long getMemoryInternalAvail() {\n StatFs stat = new StatFs(Environment.getDataDirectory().getPath());\n long blockSize = stat.getBlockSize();\n long availableBlocks = stat.getAvailableBlocks();\n return availableBlocks * blockSize;\n }", "public static long getFreeMemory() {\r\n\t\tfreeMemory = Runtime.getRuntime().freeMemory();\r\n\t\treturn freeMemory;\r\n\t}", "private float getMemoryUsage() {\n\t\tRuntime runtime = Runtime.getRuntime();\n\t\tlong allocatedMemory = runtime.totalMemory();\n\t\tlong freeMemory = runtime.freeMemory();\n\t\treturn (allocatedMemory - freeMemory);\n\t}", "long getMemLimit();", "public native int getFreeMemory();", "public static long getAvailableInternalMemorySize() {\r\n File path = Environment.getDataDirectory();\r\n StatFs stat = new StatFs(path.getPath());\r\n long blockSize = stat.getBlockSize();\r\n long availableBlocks = stat.getAvailableBlocks();\r\n return availableBlocks * blockSize;\r\n }", "public Integer getMemoryMb() {\n return memoryMb;\n }", "long getMaxMemory();", "public native int getUsedMemory();", "int memSize() {\n // treat Code as free\n return BASE_NODE_SIZE + 3 * 4;\n }", "public native long memoryConsumed();", "public long memoriaDisponível() {\n int numeroDeParticoes = numeroDeParticoesDeDisco();\n long memoriaDisponivel = 0;\n for (int i = 0; i < numeroDeParticoes; i++) {\n memoriaDisponivel += operatingSystem.getFileSystem().getFileStores()[i].getUsableSpace();\n }\n return memoriaDisponivel;\n }", "public static long getMemoryUsed() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryUsed();\r\n }", "default long getUnusedMemory() {\n return getMaxMemory() - getMemory();\n }", "long getMemorySize() {\n return MemoryBudget.DELTAINFO_OVERHEAD +\n MemoryBudget.byteArraySize(key.length);\n }", "public static long getTotalInternalMemorySize() {\r\n File path = Environment.getDataDirectory();\r\n StatFs stat = new StatFs(path.getPath());\r\n long blockSize = stat.getBlockSize();\r\n long totalBlocks = stat.getBlockCount();\r\n return totalBlocks * blockSize;\r\n }", "long getTotalFreeSpaceInBytes();", "long getTotalFreeSpaceInBytes();", "public static long getMemoryCached() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryCached();\r\n }", "public abstract long estimateMemorySize();", "public int getMemoryUsage() {\n\t\ttry {\n\t\t\treturn super.getProperty(\"MemoryUsage\", Integer.class);\n\t\t} catch (Exception e) {\n\t\t\treturn -1;\n\t\t}\n\t}", "public static long getUsedNonHeapMemory() {\n\t\tMemoryMXBean memBean = ManagementFactory.getMemoryMXBean();\n\t\tMemoryUsage nonHeap = memBean.getNonHeapMemoryUsage();\n\n\t\treturn nonHeap.getUsed();\n\t}", "public long getFreeSpace(){\n return freeSpace;\n }", "int memSize() {\r\n\t\treturn BASE_NODE_SIZE + 5 * 4;\r\n\t}", "public native long memoryRemaining();", "@Override\n public long ramBytesUsed() {\n ensureOpen();\n return sizeInBytes.get();\n }", "@Nullable\n BigInteger getMemoryMb();", "public static long getUsedHeapMemory() {\n\t\tMemoryMXBean memBean = ManagementFactory.getMemoryMXBean();\n\t\tMemoryUsage heap = memBean.getHeapMemoryUsage();\n\n\t\treturn heap.getUsed();\n\t}", "int getLocalOffHeapSize();", "public static long freeMemory() {\n return Native.freeMemory(false);\n }", "public Long get_cacheutilizedmemorykb() throws Exception {\n\t\treturn this.cacheutilizedmemorykb;\n\t}", "public int ProgramMemorySize() { return PROGRAM_MEMORY_SIZE; }", "public double getOccupiedRamGB () { return getRamBaseResource().getOccupiedCapacity(); }", "public double getMaxMemUsage() {\n return maxMemory;\n }", "public static double getUsedMemory()\n {\n\t\tMemoryUsage heapMemoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();\n \t//return (double) (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) / 1024/1024;\n \treturn (double) (heapMemoryUsage.getUsed()) / 1024/1024;\n }", "private long getMemoryFootprint() {\n Runtime runtime = Runtime.getRuntime();\n long memAfter = runtime.totalMemory() - runtime.freeMemory();\n long memBefore = memAfter + 1;\n while (memBefore != memAfter) {\n memBefore = memAfter;\n System.gc();\n memAfter = runtime.totalMemory() - runtime.freeMemory();\n }\n return memAfter;\n }", "protected long calculateLiveMemoryUsage() {\n // NOTE: MemoryUsageGaugeSet provides memory usage statistics but we do not use them\n // here since it will require extra allocations and incur cost, hence it is cheaper to use\n // MemoryMXBean directly. Ideally, this call should not add noticeable\n // latency to a query -- but if it does, please signify on SOLR-14588\n return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();\n }", "public long getTotalFreeSpaceInBytes() {\n return totalFreeSpaceInBytes_;\n }", "public long getTotalFreeSpaceInBytes() {\n return totalFreeSpaceInBytes_;\n }", "int getLocalOnHeapSize();", "public long getMemUsedMax() {\n return memUsedMax;\n }", "public int getFreeSpace() throws YAPI_Exception\n {\n return get_freeSpace();\n }", "long getLocalOffHeapSizeInBytes();", "public static long getAvailableUnusedMemory() {\n Runtime r = Runtime.getRuntime();\n return r.maxMemory() // how large the JVM heap can get\n - r.totalMemory() // current size of heap (<= r.maxMemory())\n + r.freeMemory(); // how much of currently allocated heap is unused\n }", "public static long getMemoryBuffers() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryBuffers();\r\n }", "static long getPresumableFreeMemory() {\n System.gc();\n final long allocatedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n return Runtime.getRuntime().maxMemory() - allocatedMemory;\n }", "long getAvailableSpace() throws IOException;", "public static void getMemoryUsage(){\r\n MemoryMeasurement actMemoryStatus = new MemoryMeasurement();\r\n //MemoryMeasurement.printMemoryUsage(actMemoryStatus);\r\n memoryUsageList.add(actMemoryStatus);\r\n }", "long getLocalOnHeapSizeInBytes();", "public long getTotalFreeSpaceInBytes() {\n return totalFreeSpaceInBytes_;\n }", "public long getTotalFreeSpaceInBytes() {\n return totalFreeSpaceInBytes_;\n }", "BigInteger getLeftoverMemory() {\n return pm.getMemory().subtract(used_mem);\n }", "long getOccupiedSize();", "public long getGlobalMemcacheSize() {\n long total = 0;\n synchronized (onlineRegions) {\n for (HRegion region : onlineRegions.values()) {\n total += region.memcacheSize.get();\n }\n }\n return total;\n }", "abstract int getMaxMemoryUsage();", "public long getTotalSpace(){\n return totalSpace;\n }", "int getTotalFree();", "long getUsedSpace() throws IOException;", "protected long getBytesFree()\r\n {\r\n return this.bytesFree.get();\r\n }", "public double getTotalRamGB () { return n.getResources(RESOURCETYPE_RAM).stream().mapToDouble(r->r.getCapacity()).sum (); }", "public int DataMemorySize() { return DATA_MEMORY_SIZE; }", "public static String getMemoryInfo() {\r\n\t\tRuntime rt = Runtime.getRuntime();\r\n\t\tint maxMemory = (int)(rt.maxMemory() / (1024 * 1024)); // Max memory in MB\r\n\t\tint currentTotalMemory = (int)(rt.totalMemory() / (1024 * 1024)); // Total memory in MB\r\n\t\tdouble freeMemory = (double)(((int)rt.freeMemory()) / (1024.0 * 1024.0)); // Free memory in MB with decimal places\r\n\t\treturn \"Current Memory (Heap) Size: \" + currentTotalMemory + \" MB\" + \r\n\t\t\t\t\"\\nMaximum Memory Size: \" + maxMemory + \" MB\" +\r\n\t\t\t\t\"\\nMemory Free: \" + String.format(\"%.1f\", freeMemory) + \" MB\" +\r\n\t\t\t\t\"\\n\\n(Reserved areas not included)\";\r\n\t}", "public long getMemMax() {\n return memMax;\n }", "public int getTotalSize();", "public long getCurrent() {\n m_Runtime = Runtime.getRuntime();\n m_Total = m_Runtime.totalMemory();\n\n return m_Total;\n }", "public static double getMaxMemory()\n {\n \treturn (double) Runtime.getRuntime().maxMemory() / 1024/1024;\n }", "public int getMemoryLoad() { return memoryLoad; }", "public static long getMemoryShared() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryShared();\r\n }", "@Override\n public int getLocalMaxMemory() {\n if (offHeap && !localMaxMemoryExists) {\n int value = computeOffHeapLocalMaxMemory();\n if (localMaxMemoryExists) {\n // real value now exists so set it and return\n localMaxMemory = value;\n }\n }\n checkLocalMaxMemoryExists();\n return localMaxMemory;\n }", "@Override\n\tpublic long getUsedSpace()\n\t{\n\t\treturn 0;\n\t}", "public Long getUsedSpace() {\n return usedSpace;\n }", "public static native int getMaxCacheMem();", "int getTotalSize();", "public long getTotalRam();", "public static void showMemoryInfo()\r\n\t{ \r\n\t\tRuntime rt = Runtime.getRuntime(); \r\n\t\tpf(\"Maxx : \\t %d Kb\\n\", rt.maxMemory() / 1024); \r\n\t\tpf(\"Free : \\t %d Kb\\n\", rt.freeMemory() / 1024); \r\n\t\tpf(\"Totl : \\t %d Kb\\n\", rt.totalMemory() / 1024); \r\n\t\tpf(\"Used : \\t %d Kb\\n\", (rt.totalMemory()-rt.freeMemory()) / 1024); \r\n\t}", "public Long pagedSystemMemorySize64() {\n return this.pagedSystemMemorySize64;\n }", "long memoryUnused();", "@Override\n\tpublic String getUsedMemory() {\n\t\treturn model.getUsedMemory();\n\t}", "public int getTotalCapacity() {\n return totalCapacity;\n }", "public final int getOutputMemorySize() {\n return this.outputMemorySize;\n }", "@Deprecated\n long getOffHeapSizeInBytes();", "public static long getMaxMemory() {\r\n\t\tmaxMemory = Runtime.getRuntime().maxMemory();\r\n\t\treturn maxMemory;\r\n\t}", "public int getMainMemorySize(){ return Integer.parseInt(mainMemorySize.getText()); }", "public ArrayList<Integer> getMemory() {\n\t\treturn memory;\n\t}", "BigDecimal getCacheSpaceAvailable();", "public int getFreeSpace() {\n return capacity - storage;\n }", "public long getTotalSize() {\n return totalSize;\n }" ]
[ "0.8170806", "0.7963714", "0.7963714", "0.7933321", "0.7902493", "0.7833466", "0.7796123", "0.7761934", "0.76182455", "0.76020026", "0.7591203", "0.7566141", "0.756293", "0.7561598", "0.7542391", "0.75336844", "0.75326246", "0.7473068", "0.74606866", "0.7433278", "0.74128896", "0.74108326", "0.73909473", "0.7337673", "0.733538", "0.73296595", "0.7322616", "0.73081845", "0.7282475", "0.72772956", "0.72144496", "0.72144496", "0.7205562", "0.71935314", "0.7188646", "0.7161002", "0.7139728", "0.7138887", "0.7137231", "0.7135988", "0.7132788", "0.7118775", "0.71186584", "0.71157646", "0.71077555", "0.71068895", "0.70968837", "0.7087087", "0.70625013", "0.7040366", "0.7013637", "0.70098895", "0.70098895", "0.70001686", "0.6997529", "0.69905025", "0.6985713", "0.697911", "0.6967009", "0.6959784", "0.6955405", "0.69460166", "0.69271517", "0.691976", "0.691976", "0.690361", "0.6900533", "0.6874207", "0.6873081", "0.68567073", "0.68421584", "0.6834402", "0.67947745", "0.67872554", "0.6773079", "0.6762053", "0.67338157", "0.67190415", "0.66923946", "0.6681315", "0.6645692", "0.6642032", "0.6618803", "0.65949625", "0.6592518", "0.6578579", "0.6566517", "0.65612555", "0.6547412", "0.65454197", "0.6539803", "0.65390855", "0.65201384", "0.6514557", "0.6495935", "0.6490519", "0.64824176", "0.6481538", "0.64748263", "0.6464081", "0.64605623" ]
0.0
-1
Gets the inflated monitor of an object (if any).
public abstract Monitor getInflatedMonitor(Object object, BaseVmArchitecture arch);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static Object getMonitor() {\n\t\treturn monitor;\n\t}", "public Object getMonitor() {\n\t\treturn this.monitor;\n\t}", "public abstract Parts getMonitor();", "public MonitorType getMonitorType() {\n return monitorType;\n }", "public int getIdMonitor() {\n return idMonitor;\n }", "public interface Monitorable {\n public String getInfo();\n}", "Monitor createMonitor();", "public String getMonitorName() {\n return this.monitorName;\n }", "public Integer getMonitorNum() {\n return monitorNum;\n }", "@Override\n\tpublic Optional<MonitorManager> findById(Long id) {\n\t\treturn monitorManagerRepository.findById(id);\n\t}", "public String getMonitorArn() {\n return this.monitorArn;\n }", "@GetMapping(\"/{monitor_id}\")\n @ApiOperation(value = \"Get the monitor with given database id if created by authenticated user\")\n public BaseMonitor getMonitor(@PathVariable(\"monitor_id\") long monitorId, Principal principal)\n throws ResourceNotFoundException, ForbiddenResourceException {\n return getUsersMonitor(monitorId, principal.getName());\n }", "public void visitMonitor(Quad obj) {\n if (!include_sync_ops) return;\n if (TRACE_INTRA) out.println(\"Visiting: \"+obj);\n Operand src = Monitor.getSrc(obj);\n if (src instanceof RegisterOperand) {\n RegisterOperand rop = ((RegisterOperand)src);\n Register src_r = rop.getRegister();\n monitorOp(obj, src_r);\n } else {\n Node n = handleConst((ConstOperand) src, new QuadProgramLocation(method, obj));\n monitorOp(obj, Collections.singleton(n));\n }\n }", "private MonitoredTask getMonitorStatus() {\n if (monitorStatus == null) {\n monitorStatus = TaskMonitor.get()\n .createStatus(\"Cloning snapshot '\" + snapshot.getName() + \"' to table \" + getTableName());\n }\n return monitorStatus;\n }", "public void doMonitor();", "public InputMonitor getInputMonitor() {\n return this.mInputMonitor;\n }", "@Override\n\tpublic OpenableElementInfo getElementInfo(IProgressMonitor monitor)\n\t\t\tthrows RodinDBException {\n\n\t\tRodinDBManager manager = RodinDBManager.getRodinDBManager();\n\t\tOpenableElementInfo info = manager.getInfo(this);\n\t\tif (info != null)\n\t\t\treturn info;\n\t\treturn openWhenClosed(createElementInfo(), monitor);\n\t}", "final Object getLockObject() {\n return timeManager;\n }", "public static MonitorManager getInstance() {\n\t\tif (instance == null) {\n\t\t\tinstance = new MonitorManager();\n\t\t}\n\t\treturn instance;\n\t}", "public static StateChangeMonitor getInstance() {\n\t\tsynchronized (classLock) {\n\t\t\tif (monitor == null) {\n\t\t\t\tmonitor = new StateChangeMonitor();\n\t\t\t}\n\t\t\treturn monitor;\n\t\t}\n\t}", "private void monitor() {\n monitoringActor.tell(new Monitor(), ActorRef.noSender());\n }", "com.microsoft.schemas.office.x2006.digsig.STPositiveInteger xgetMonitors();", "public BuildStepMonitor getRequiredMonitorService() {\n return BuildStepMonitor.NONE;\n }", "public BuildStepMonitor getRequiredMonitorService() {\t\t\n\t\treturn BuildStepMonitor.NONE;\n\t}", "public ReflectMonitor() {\n boundSupport = new PropertyChangeSupport(this);\n }", "public default boolean hasMonitor() {\n\t\treturn false;\n\t}", "private Object metricLock() {\n return metricLock;\n }", "public String getMonitoringState() {\n StringBuilder sb = new StringBuilder();\n sb.append(queueManager.getMonitoringInfo());\n return sb.toString();\n }", "@Override\n\tpublic final ITrace attach() {\n\t\t// todo how to handle re-entry of active monitors\n\t\tAbstractMonitorTrace trace = (AbstractMonitorTrace) getCurrentTrace();\n\t\ttrace.start();\n\t\tTrace.registerTrace(trace);\n\t\treturn trace;\n\t}", "public Object getUpdate(Observer obj);", "protected Monitor getNextMonitorEntry() throws MonitorException {\n Monitor monitor = null;\n\n // entries are always 4 byte aligned.\n if ((nextEntry % 4) != 0) {\n throw new MonitorStructureException(\n \"Entry index not properly aligned: \" + nextEntry);\n }\n\n // protect against a corrupted shared memory region.\n if ((nextEntry < 0) || (nextEntry > buffer.limit())) {\n throw new MonitorStructureException(\n \"Entry index out of bounds: nextEntry = \" + nextEntry\n + \", limit = \" + buffer.limit());\n }\n\n // check for the end of the buffer\n if (nextEntry == buffer.limit()) {\n lognl(\"getNextMonitorEntry():\"\n + \" nextEntry == buffer.limit(): returning\");\n return null;\n }\n\n buffer.position(nextEntry);\n\n int entryStart = buffer.position();\n int entryLength = buffer.getInt();\n\n // check for valid entry length\n if ((entryLength < 0) || (entryLength > buffer.limit())) {\n throw new MonitorStructureException(\n \"Invalid entry length: entryLength = \" + entryLength);\n }\n\n // check if last entry occurs before the eof.\n if ((entryStart + entryLength) > buffer.limit()) {\n throw new MonitorStructureException(\n \"Entry extends beyond end of buffer: \"\n + \" entryStart = \" + entryStart\n + \" entryLength = \" + entryLength\n + \" buffer limit = \" + buffer.limit());\n }\n\n if (entryLength == 0) {\n // end of data\n return null;\n }\n\n int nameLength = buffer.getInt();\n int vectorLength = buffer.getInt();\n byte dataType = buffer.get();\n byte flags = buffer.get();\n Units u = Units.toUnits(buffer.get());\n Variability v = Variability.toVariability(buffer.get());\n boolean supported = (flags & 0x01) != 0;\n\n // defend against corrupt entries\n if ((nameLength <= 0) || (nameLength > entryLength)) {\n throw new MonitorStructureException(\n \"Invalid Monitor name length: \" + nameLength);\n }\n\n if ((vectorLength < 0) || (vectorLength > entryLength)) {\n throw new MonitorStructureException(\n \"Invalid Monitor vector length: \" + vectorLength);\n }\n\n // read in the perfData item name, casting bytes to chars. skip the\n // null terminator\n //\n byte[] nameBytes = new byte[nameLength-1];\n for (int i = 0; i < nameLength-1; i++) {\n nameBytes[i] = buffer.get();\n }\n\n // convert name into a String\n String name = new String(nameBytes, 0, nameLength-1);\n\n if (v == Variability.INVALID) {\n throw new MonitorDataException(\"Invalid variability attribute:\"\n + \" entry index = \" + perfDataItem\n + \" name = \" + name);\n }\n if (u == Units.INVALID) {\n throw new MonitorDataException(\"Invalid units attribute: \"\n + \" entry index = \" + perfDataItem\n + \" name = \" + name);\n }\n\n int offset;\n if (vectorLength == 0) {\n // scalar Types\n if (dataType == BasicType.LONG.intValue()) {\n offset = entryStart + entryLength - 8; /* 8 = sizeof(long) */\n buffer.position(offset);\n LongBuffer lb = buffer.asLongBuffer();\n lb.limit(1);\n monitor = new PerfLongMonitor(name, u, v, supported, lb);\n perfDataItem++;\n } else {\n // bad data types.\n throw new MonitorTypeException(\"Invalid Monitor type:\"\n + \" entry index = \" + perfDataItem\n + \" name = \" + name\n + \" type = \" + dataType);\n }\n } else {\n // vector types\n if (dataType == BasicType.BYTE.intValue()) {\n if (u != Units.STRING) {\n // only byte arrays of type STRING are currently supported\n throw new MonitorTypeException(\"Invalid Monitor type:\"\n + \" entry index = \" + perfDataItem\n + \" name = \" + name\n + \" type = \" + dataType);\n }\n\n offset = entryStart + PERFDATA_NAME_OFFSET + nameLength;\n buffer.position(offset);\n ByteBuffer bb = buffer.slice();\n bb.limit(vectorLength);\n bb.position(0);\n\n if (v == Variability.CONSTANT) {\n monitor = new PerfStringConstantMonitor(name, supported,\n bb);\n } else if (v == Variability.VARIABLE) {\n monitor = new PerfStringVariableMonitor(name, supported,\n bb, vectorLength-1);\n } else {\n // Monotonically increasing byte arrays are not supported\n throw new MonitorDataException(\n \"Invalid variability attribute:\"\n + \" entry index = \" + perfDataItem\n + \" name = \" + name\n + \" variability = \" + v);\n }\n perfDataItem++;\n } else {\n // bad data types.\n throw new MonitorTypeException(\n \"Invalid Monitor type:\" + \" entry index = \"\n + perfDataItem + \" name = \" + name\n + \" type = \" + dataType);\n }\n }\n\n // setup index to next entry for next iteration of the loop.\n nextEntry = entryStart + entryLength;\n return monitor;\n }", "public static FileMonitor getInstance() {\n return instance;\n }", "@Override //Done\n public USBMonitor getUSBMonitor() {\n return mUSBMonitor;\n }", "@Override\n public USBMonitor getUSBMonitor() {\n return mUSBMonitor;\n }", "int getMonitors();", "private BaseMonitor getUsersMonitor(long monitorId, String username) throws ResourceNotFoundException,\n ForbiddenResourceException {\n BaseMonitor monitor = monitorRepository.findById(monitorId);\n //Monitor doesn't exist.\n if (monitor == null) {\n throw new ResourceNotFoundException(String.format(\"Monitor id:%s\", monitorId));\n }\n //Monitor is created by user\n if (!monitor.getUser().getUsername().equals(username)) {\n throw new ForbiddenResourceException();\n }\n return monitor;\n }", "public interface MonitorBase {\n Date getCurrTime();\n\n int getData();\n}", "public net.ip_label.ws.ws_datametrie_php.GetStatusAllMonitorsDocument.GetStatusAllMonitors getGetStatusAllMonitors()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n net.ip_label.ws.ws_datametrie_php.GetStatusAllMonitorsDocument.GetStatusAllMonitors target = null;\r\n target = (net.ip_label.ws.ws_datametrie_php.GetStatusAllMonitorsDocument.GetStatusAllMonitors)get_store().find_element_user(GETSTATUSALLMONITORS$0, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target;\r\n }\r\n }", "public static Display displayOf(Object obj) {\n if (!(obj instanceof Display))\n return null;\n Display display = (Display) obj;\n if (display.getLowerAlarmLimit() == null || display.getLowerDisplayLimit() == null)\n return null;\n return display;\n }", "@Override\n public CompositeData getAllMonitorCompositeData() {\n return allMonitorCompositeData;\n }", "public abstract Object getObservedObject();", "public java.lang.String getWatcher(){\r\n return localWatcher;\r\n }", "Reference_Monitor createReference_Monitor();", "@Override\n protected EtmMonitor getEtmMonitor() throws ServletException {\n String etmMonitorName =\n filterConfig.getInitParameter(SpringEtmMonitorContextSupport.ETM_MONITOR_PARAMETER_NAME);\n WebApplicationContext ctx =\n WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig\n .getServletContext());\n\n return SpringEtmMonitorContextSupport.locateEtmMonitor(ctx, etmMonitorName);\n }", "eu.m6r.format.openrtb.MbrWin.Win getWin();", "public static boolean isMonitoring(){\n\t\treturn ZMonitorManager.getInstance().getMonitorLifecycle().isMonitorStarted();\n\t}", "public static synchronized Metric getMetricByThread() {\n long tid = Thread.currentThread().getId();\n Metric m = metrics.get(tid);\n if(m == null) {\n m = new Metric(tid);\n metrics.put(tid, m);\n }\n return m;\n }", "public interface ServerMonitorMXBean extends Statistic {\n\n String getHostName();\n\n int getPort();\n\n String getStartupAt();\n\n /**\n * The block IPs\n */\n Set<String> getBlackList();\n}", "public HWatch onWatch(String id)\r\n {\r\n if (!cache.initialized()) \r\n throw new IllegalStateException(Cache.NOT_INITIALIZED);\r\n\r\n if (LOG_WATCH.isTraceOn())\r\n LOG_WATCH.trace(\"onWatch \" + id);\r\n\r\n try\r\n {\r\n synchronized(watches) { return (HWatch) watches.get(id); }\r\n }\r\n catch (RuntimeException e)\r\n {\r\n e.printStackTrace();\r\n throw e;\r\n }\r\n }", "public interface IThreadMonitorService {\n public ThreadMonitorInfo getThreadInfo();\n\n}", "public Object getCurrentObject()\r\n\t{\r\n\t\tif (newState != null)\r\n\t\t{\r\n\t\t\t// Not applied yet\r\n\t\t\treturn newState.unmodifiedObject;\r\n\t\t}\r\n\r\n\t\treturn propertyBrowser.getObject();\r\n\t}", "protected abstract AbstractMonitorTrace createMonitorTrace();", "void monitor(String variable);", "public synchronized final Object readObject() {\n\t\tif (!inQueue.isEmpty())\n\t\t\treturn inQueue.dequeue();\n\t\telse return null;\n\t}", "public Screen getScreen() {\n return screen;\n }", "public interface StatisticsMonitor {\n\n /**\n * The default statistics interval which is 5 seconds.\n */\n static final long DEFAULT_MONITOR_INTERVAL = 5000;\n\n /**\n * The default history size stored in statistics.\n */\n static final int DEFAULT_HISTORY_SIZE = 12 * 10;\n\n /**\n * Sets the statistics interval, automatically updating the monitoring scheduled tasks if\n * monitoring is enabled.\n * @since 8.0 Restarts monitoring, with new interval, if no other party is already monitoring for statistics.\n */\n void setStatisticsInterval(long interval, TimeUnit timeUnit);\n\n /**\n * Sets the history size of number of statistics stored.\n */\n void setStatisticsHistorySize(int historySize);\n\n /**\n * Starts the statistics monitor, starting a scheduled monitor that polls for statistics. Monitoring\n * is required only when wanting to receive statistics change events.\n * @since 8.0 Restarts monitoring if no other party is already monitoring for statistics. \n */\n void startStatisticsMonitor();\n\n /**\n * Stops the statistics monitor.\n * @since 8.0 Stops monitoring if no other party is monitoring for statistics. \n */\n void stopStatisticsMonitor();\n\n /**\n * Returns <code>true</code> if statistics are now being monitored.\n */\n boolean isMonitoring();\n}", "@GetMapping(\"/{monitor_id}/status\")\n @ApiOperation(value = \"Status of the monitor with give monitor id. If monitor id is not valid then returns null\")\n public MonitorLog getMonitorStatus(@PathVariable(\"monitor_id\") long monitorId, Principal principal) {\n return monitorLogRepository.findTopByMonitorIdAndUsernameOrderByCreationTimeDesc(monitorId,\n principal.getName());\n }", "public Monitor updateMonitor(Monitor monitor) {\n try {\n Monitor updatedContact = api.updateMonitor(monitor);\n repo.save(updatedContact);\n return repo.save(updatedContact);\n } catch (IOException e) {\n e.printStackTrace();\n }\n return repo.save(monitor);\n }", "public static com.jancar.media.Notify asInterface(android.os.IBinder obj)\n{\nif ((obj==null)) {\nreturn null;\n}\nandroid.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);\nif (((iin!=null)&&(iin instanceof com.jancar.media.Notify))) {\nreturn ((com.jancar.media.Notify)iin);\n}\nreturn new com.jancar.media.Notify.Stub.Proxy(obj);\n}", "protected SmfPvMonitorPool getMonitorPool() {\n return this.mplLiveData;\n }", "public void requestInspectorFor(Inspectable object) {\n\n // search for it\n InspectorInterface inspector = null;\n Enumeration e = inspectors.elements();\n while (e.hasMoreElements()) {\n inspector = (InspectorInterface)e.nextElement();\n if (inspector.getInspectedObject()==object) {\n inspector.setVisible(true);\n return;\n }\n }\n\n // search for first unfrozen\n e = inspectors.elements();\n while (e.hasMoreElements()) {\n inspector = (InspectorInterface)e.nextElement();\n if (!inspector.isFrozen()) {\n inspector.inspectObject(object);\n return;\n }\n }\n\n // otherwise create a new instance\n inspector = createInspector();\n inspectors.addElement(inspector);\n inspector.inspectObject(object);\n inspector.setVisible(true); // bug fix\n}", "public static com.heuristic.download.aidl.IBatterySaver asInterface(android.os.IBinder obj)\n{\nif ((obj==null)) {\nreturn null;\n}\nandroid.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);\nif (((iin!=null)&&(iin instanceof com.heuristic.download.aidl.IBatterySaver))) {\nreturn ((com.heuristic.download.aidl.IBatterySaver)iin);\n}\nreturn new com.heuristic.download.aidl.IBatterySaver.Stub.Proxy(obj);\n}", "public static synchronized UTMCAppStatusMonitor m33134a() {\n UTMCAppStatusMonitor bVar;\n synchronized (UTMCAppStatusMonitor.class) {\n if (f26013g == null) {\n f26013g = new UTMCAppStatusMonitor();\n }\n bVar = f26013g;\n }\n return bVar;\n }", "@SuppressWarnings(\"rawtypes\")\n \tpublic static Class getWatchableObjectClass() {\n \t\treturn getMinecraftClass(\"WatchableObject\");\n \t}", "public static WakeLock wakeScreen(InstrumentationTestCase owner) {\n\t\tPowerManager pm = (PowerManager) owner.getInstrumentation()\n\t\t\t\t.getTargetContext().getSystemService(Context.POWER_SERVICE);\n\t\tWakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK\n\t\t\t\t| PowerManager.FULL_WAKE_LOCK\n\t\t\t\t| PowerManager.ACQUIRE_CAUSES_WAKEUP, owner.getClass()\n\t\t\t\t.getSimpleName());\n\t\twakeLock.acquire();\n\t\treturn wakeLock;\n\t}", "@Override\n\tpublic BuildStepMonitor getRequiredMonitorService() {\n\t\treturn BuildStepMonitor.NONE;\n\t}", "@Override\n\tpublic BuildStepMonitor getRequiredMonitorService() {\n\t\treturn BuildStepMonitor.NONE;\n\t}", "@Override\n\tpublic BuildStepMonitor getRequiredMonitorService() {\n\t\treturn BuildStepMonitor.NONE;\n\t}", "static public AtomSlinger Get_Instance ()\n {\n return AtomSlingerContainer._instance;\n }", "public XMLEleObject getObject() {\r\n return FlashRate.TheFlashRate;\r\n }", "public Object getObject()\n {\n initialize();\n\n if (_invariant)\n return _cachedValue;\n\n return resolveProperty();\n }", "protected BattleScreen getBattleObserver()\n {\n return battleObserver;\n }", "public Lock getLock();", "public R getResult()\n\t{\n\t\tsynchronized ( monitor )\n\t\t{\n\t\t\tresult = null;\n\t\t\tSwingUtilities.invokeLater( () -> setVisible( true ) );\n\t\t\twhile( true )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tmonitor.wait();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcatch ( final InterruptedException e )\n\t\t\t\t{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public DescribeMonitorResult withMonitorArn(String monitorArn) {\n setMonitorArn(monitorArn);\n return this;\n }", "public java.lang.Integer getScreening() {\r\n return screening;\r\n }", "public eu.m6r.format.openrtb.MbrWin.Win getWin() {\n if (winBuilder_ == null) {\n return win_;\n } else {\n return winBuilder_.getMessage();\n }\n }", "public static EnemyCacheScreen getMe()\n\t{\n\t\treturn me;\n\t}", "public Notification getActiveNotification(){\r\n\t\ttry{\r\n\t\t\treturn this.getChildCount() > 0 ? ((NotificationView) this.getCurrentView()).getNotification() : null;\r\n\t\t}catch(Exception ex){\r\n\t\t\tLog.e(_context, \"NotificationViewFlipper.getActiveNotification() ERROR: \" + ex.toString());\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public Location getMeasureStart() {\n if(measureStart == null) {\n return currentLocation;\n } else {\n return measureStart;\n }\n }", "ManagementLockObject refresh();", "protected Observer getStatusEngine() {\n\t\treturn new GatherStatusEngine(this);\n\t}", "public synchronized void monitor(final MaestroMonitor monitor) {\n monitored.add(monitor);\n }", "public MetricQueue<OpMetric> get() {\n MetricQueue<OpMetric> operationalMetricsQueue = this.f30605a.operationalMetricsQueue();\n C12021c.m31671a(operationalMetricsQueue, \"Cannot return null from a non-@Nullable component method\");\n return operationalMetricsQueue;\n }", "public GraphicsObjectWrapper<?> getCurrentWrapper(\n )\n {return GraphicsObjectWrapper.get(this);}", "@JsonIgnore\n public WM getWM() {\n if (wvm == null || wvm == WVM.Version) {\n return null;\n }\n switch (wvm) {\n case Workspace:\n return WM.Workspace;\n default:\n return WM.Microversion;\n }\n }", "public interface MonitorContext {\n\n\t/**\n\t * This method determines whether the supplied message is valid\n\t * in respect of the supplied message node.\n\t * \n\t * If the message is not relevant, then a Result.NOT_HANDLED\n\t * should be returned. Otherwise Result.VALID, Result.INVALID\n\t * or a specific instance of Result should be returned to provide\n\t * the relevant information from the monitoring environment's\n\t * validation.\n\t * \n\t * @param mesgNode The message node\n\t * @param mesg The message to be validated\n\t * @return The result\n\t */\n\tpublic Result validate(MessageNode mesgNode, Message mesg);\n\t\n}", "public boolean isMonitored() {\n return monitored;\n }", "public InvestigateStore get(ScenarioActivityMonitor monitor, int id,\n\t\t\t\t\tboolean isCollab)\n\t\t\t{\n\t\t\t\tInvestigateStore res = null;\n\t\t\t\tInteger index;\n\t\t\t\tif (isCollab)\n\t\t\t\t\tindex = monitor.hashCode();\n\t\t\t\telse\n\t\t\t\t\tindex = monitor.hashCode() * id;\n\n\t\t\t\tif (_myStore.get(index) != null)\n\t\t\t\t{\n\t\t\t\t\tres = _myStore.get(index);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres = new InvestigateStore();\n\t\t\t\t\t_myStore.put(index, res);\n\t\t\t\t}\n\t\t\t\treturn res;\n\t\t\t}", "public InfoWindowManager getInfoWindowManager() {\n return this.infoWindowManager;\n }", "protected OpenableElementInfo openWhenClosed(OpenableElementInfo info,\n\t\t\tIProgressMonitor monitor) throws RodinDBException {\n\n\t\tRodinDBManager manager = RodinDBManager.getRodinDBManager();\n\t\tboolean hadTemporaryCache = manager.hasTemporaryCache();\n\t\ttry {\n\t\t\tOpenableMap newElements = manager.getTemporaryCache();\n\t\t\tgenerateInfos(info, newElements, monitor);\n\t\t\tif (info == null) {\n\t\t\t\tinfo = newElements.get(this);\n\t\t\t}\n\t\t\tif (info == null) {\n\t\t\t\tthrow newNotPresentException();\n\t\t\t}\n\t\t\tif (!hadTemporaryCache) {\n\t\t\t\tmanager.putInfos(this, newElements);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (!hadTemporaryCache) {\n\t\t\t\tmanager.resetTemporaryCache();\n\t\t\t}\n\t\t}\n\t\treturn info;\n\t}", "Object getMaterialization(Object groupID) throws Exception;", "@Override\n public List<List<Integer>> getObjectInfo() {\n List<List<Integer>> currObjectConfig = getVisualInfoFromPieces(OBJECT_INFO_IDENTIFIER);\n return Collections.unmodifiableList(currObjectConfig);\n }", "@Override\n\tpublic IBasicObject getAccessedObject() {\n\t\treturn heldObj.getAccessedObject();\n\t}", "@GetMapping()\n @ApiOperation(value = \"Get all monitors for the authenticated user\")\n public List<BaseMonitor> getAllMonitors(Principal principal) {\n User user = userRepository.findUserByUsername(principal.getName());\n return monitorRepository.findAllByUser(user);\n }", "private static ProgressMonitor getProgressMonitor(final TaskMonitor aTM)\n{\n return new ProgressMonitor() {\n public void update(int arg0) { aTM.updateTask(arg0); }\n public void start(int arg0) { aTM.startTasks(arg0); }\n public boolean isCancelled() { return aTM.isCancelled(); }\n public void endTask() { aTM.endTask(); }\n public void beginTask(String arg0, int arg1) { aTM.beginTask(arg0, arg1); }\n };\n}", "private Object readResolve() throws ObjectStreamException {\n return ctx.grid().scheduler();\n }", "public interface IMonitorListener {\n public void onEvent(Message cim);\n}", "public interface EventMonitorIfc\n{\n /** source control revision number */\n public static final String revisionNumber = \"$Revision: /rgbustores_13.4x_generic_branch/1 $\";\n /** default time between checks of event source */\n public static final int DEFAULT_PEEK_TIME = 250;\n\n /**\n * Activates this monitor.\n */\n public void activate();\n\n /**\n * Deactivates this monitor.\n */\n public void deactivate();\n\n /**\n * Sets the time between checks of the event source.\n * \n * @param aTime\n * the time (in milliseconds) between event checks\n */\n public void setPeekTime(int aTime);\n\n /**\n * Attaches a specific controller to this monitor.\n * \n * @param controller\n * the time controller that this monitor will notify\n */\n public void setController(TimedControllerIfc controller);\n}", "private Object getLockObject(IAnnotationModel annotationModel) {\n if (annotationModel instanceof ISynchronizable) {\n Object lock = ((ISynchronizable) annotationModel).getLockObject();\n if (lock != null) {\n return lock;\n }\n }\n return annotationModel;\n }" ]
[ "0.7076388", "0.69911236", "0.5918685", "0.5698817", "0.5685497", "0.5662055", "0.5620453", "0.56136346", "0.55051595", "0.54880697", "0.51717514", "0.51514137", "0.5125491", "0.51087826", "0.50237334", "0.5019573", "0.5016313", "0.5007689", "0.4983125", "0.4953359", "0.4920047", "0.491566", "0.4908937", "0.49019215", "0.48995584", "0.48801768", "0.48779282", "0.48753762", "0.4866376", "0.48641375", "0.48635638", "0.485663", "0.4842194", "0.4835915", "0.47811195", "0.47737432", "0.4752157", "0.47518998", "0.47451395", "0.47303674", "0.46674904", "0.46575373", "0.4657172", "0.46524188", "0.46442696", "0.46246862", "0.45615572", "0.4541214", "0.45368183", "0.4531184", "0.45306325", "0.45292598", "0.45259333", "0.45173463", "0.4506833", "0.4496575", "0.4475452", "0.44738242", "0.44727185", "0.4458637", "0.4457741", "0.44535327", "0.44338828", "0.44151294", "0.44005162", "0.43964344", "0.43964344", "0.43964344", "0.43816042", "0.43670788", "0.4361306", "0.43473116", "0.43370166", "0.43307015", "0.43302503", "0.43277448", "0.43233413", "0.43216124", "0.4317835", "0.4315513", "0.43069324", "0.430441", "0.4301587", "0.4301443", "0.43008247", "0.42967638", "0.42963997", "0.4289883", "0.4282921", "0.42760962", "0.4269943", "0.42689216", "0.42599997", "0.42595932", "0.4258026", "0.42572716", "0.42395535", "0.42357254", "0.42303118", "0.4229836" ]
0.7948449
0
Stop and block all threads (on all processors) on a GC safe point. Only the calling thread (the GC thread) will continue.
public abstract void stopThreadsAtSafePoint();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void forceStop() {\n\t\tfor (int i = 0; i < worker_num; i++) {\n\t\t\tif (workThreads[i] == null)\n\t\t\t\tcontinue;\n\t\t\tworkThreads[i].interrupt();\n\t\t\tworkThreads[i] = null;\n\t\t}\n\t\tthreadPool = null;\n\t\ttaskQueue.clear();\n\t}", "public void cleanDeadThreads()\n {\n\t\tSystem.gc();\n }", "public void stopIt() {\n UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),\n \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_stop_cpm__FINEST\",\n new Object[] { Thread.currentThread().getName(), String.valueOf(killed) });\n\n dumpState();\n\n stopped = true;\n killed = true;\n if (!isRunning) {\n UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),\n \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_already_stopped__FINEST\",\n new Object[] { Thread.currentThread().getName() });\n // Already stopped\n return;\n }\n // try {\n // Change global status\n isRunning = false;\n // terminate this thread if the thread has been previously suspended\n synchronized (lockForPause) {\n if (pause) {\n pause = false;\n lockForPause.notifyAll();\n }\n }\n // Let processing threads finish their work by emptying all queues. Even during a hard\n // stop we should try to clean things up as best as we can. First empty process queue or work\n // queue, dump result of analysis into output queue and let the consumers process that.\n // When all queues are empty we are done.\n\n // The logic below (now commented out) has a race condition -\n // The workQueue / outputQueue can become (temporarily) empty, but then\n // can be filled with the eof token\n // But this code proceeds to stop all the CAS processors,\n // which results in a hang because the pool isn't empty and the process thread waits for\n // an available cas processor forever.\n\n // Fix is to not kill the cas processors. Just let them finish normally. The artifact producer\n // will stop sending new CASes and send through an eof token, which causes normal shutdown to\n // occur for all the threads.\n\n /*\n * if (workQueue != null) { if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {\n * UIMAFramework.getLogger(this.getClass()).logrb( Level.FINEST, this.getClass().getName(),\n * \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_consuming_queue__FINEST\", new Object[]\n * { Thread.currentThread().getName(), workQueue.getName(),\n * String.valueOf(workQueue.getCurrentSize()) });\n * \n * } int cc = workQueue.getCurrentSize(); while (workQueue.getCurrentSize() > 0) {\n * sleep(MAX_WAIT_ON_QUEUE); if (System.getProperty(\"DEBUG\") != null) { if (cc <\n * workQueue.getCurrentSize()) { if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {\n * UIMAFramework.getLogger(this.getClass()).logrb( Level.FINEST, this.getClass().getName(),\n * \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_wait_consuming_queue__FINEST\", new\n * Object[] { Thread.currentThread().getName(), workQueue.getName(),\n * String.valueOf(workQueue.getCurrentSize()) });\n * \n * } cc = workQueue.getCurrentSize(); } } } } if (outputQueue != null) { while\n * (outputQueue.getCurrentSize() > 0) { sleep(MAX_WAIT_ON_QUEUE); if\n * (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {\n * UIMAFramework.getLogger(this.getClass()).logrb( Level.FINEST, this.getClass().getName(),\n * \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_wait_consuming_queue__FINEST\", new\n * Object[] { Thread.currentThread().getName(), outputQueue.getName(),\n * String.valueOf(outputQueue.getCurrentSize()) }); } } if\n * (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {\n * UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),\n * \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_done_consuming_queue__FINEST\", new\n * Object[] { Thread.currentThread().getName() }); } }\n * \n * for (int i = 0; processingUnits != null && i < processingUnits.length && processingUnits[i]\n * != null; i++) { if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {\n * UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),\n * \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, \"UIMA_CPM_stop_processors__FINEST\", new Object[]\n * { Thread.currentThread().getName(), String.valueOf(i) }); }\n * processingUnits[i].stopCasProcessors(false); }\n * \n * } catch (Exception e) { if (UIMAFramework.getLogger().isLoggable(Level.FINER)) {\n * e.printStackTrace(); } UIMAFramework.getLogger(this.getClass()).logrb(Level.FINER,\n * this.getClass().getName(), \"process\", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,\n * \"UIMA_CPM_exception__FINER\", new Object[] { Thread.currentThread().getName(), e.getMessage()\n * }); }\n */\n }", "public synchronized void stop() {\n if (isPausing) {\n start();\n }\n if (isRunning) {\n isRunning = false;\n for (int i = 0; i < numComputeTasks; i++) {\n inputQueue.addLast(new ComputeStopSign());\n }\n ComputeUtil.acquire(taskSync,\n numComputeTasks);\n for (int i = 0; i < threads.length; i++) {\n boolean isFailed = false;\n do {\n isFailed = false;\n try {\n threads[i].join();\n } catch (Exception e) {\n isFailed = true;\n }\n } while (isFailed);\n }\n threads = null;\n }\n }", "public void stopThreads() {\n int i;\n Thread[] thGroup;\n Thread t;\n\n thGroup = new Thread[Thread.activeCount()];\n Thread.enumerate(thGroup);\n\n for (i = 0; i < thGroup.length; i++) {\n t = thGroup[i];\n if (t != null) {\n if (t != Thread.currentThread()) {\n if (t.getName().startsWith(\"Thread\"))\n t.stop();\n else if (t.getName().startsWith(\"AWT-EventQueue\"))\n t.stop();\n }\n }\n }\n\n thGroup = null;\n\n System.gc();\n }", "public void stop() {\n\t\trunning = false;\n\t\tfor (ArionumHasher hasher : hashers) {\n\t\t\thasher.setForceStop(true);\n\t\t}\n\n\t\tthreadCollection.clear();\n\t\thashers.clear();\n\t}", "public static void stopAllThreads() {\n SystemManager.getAllDistributors().forEach((d) -> {\n d.stopWork();\n });\n SystemManager.getAllUsers().forEach((u) -> {\n u.stopWork();\n });\n Time.stopWork();\n System.out.println(\"[Simulation is ending]\");\n stopWork = true;\n }", "@Override\n public void stopPoisonPill() {\n Thread.currentThread().stop();\n }", "protected void kill() {\n\t\tsynchronized (this) // Don't allow shutdown during startup.\n\t\t{\n\t\t\t// Only execute for the first caller.\n\t\t\tif (shutdownMutex.acquire()) {\n\t\t\t\t// Shutdown payer thread.\n\t\t\t\tpayerThread.interrupt();\n\n\t\t\t\tfor (int i = 0; i < sets.length; i++) {\n\t\t\t\t\tsets[i].kill();\n\t\t\t\t}\n\n\t\t\t\t// Shutdown the thread pools.\n\t\t\t\tproducerThreadPool.kill();\n\n\t\t\t\t// Let the GC figure the rest out.\n\t\t\t}\n\t\t}\n\t}", "private static void runGC () throws Exception \r\n {\n for (int r = 0; r < 4; ++ r) _runGC (); \r\n }", "void releaseAllWorkers();", "public void stopThread() \n {\n \tthis.exit = true;\n \t//ctr.getMemory().programmcounter = 65536;\n }", "public void stopPollingThread() {\n pool.shutdown();\n }", "public void Stop() {\r\n\t\t\r\n\t\tthread = null;\r\n\t}", "@Stop(priority = 99)\n void stop() {\n for (List<ListenerInvocation> list : listenersMap.values()) {\n if (list != null) list.clear();\n }\n\n if (syncProcessor != null) syncProcessor.shutdownNow();\n }", "public synchronized void stop() {\n\t\tif (!isStart) {\n\t\t\tthrow new IllegalStateException();\n\t\t}\n\t\tfor (LoopThread l : thread) {\n\t\t\tl.finnish();\n\t\t}\n\t\tint activeCount;\n\t\tdo{\n\t\t\tactiveCount = 0;\n\t\t\tfor(LoopThread l : thread){\n\t\t\t\tif(l.isAlive()){\n\t\t\t\t\tactiveCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t} while (activeCount > 0);\n\t\t\n\t}", "private synchronized void stopThreads() {\n if (myGameThread != null) {\n myGameThread.requestStop();\n }\n if (myTumbleweedThread != null) {\n myTumbleweedThread.requestStop();\n }\n if (myMusicMaker != null) {\n myMusicMaker.requestStop();\n }\n myGameThread = null;\n myTumbleweedThread = null;\n myMusicMaker = null;\n }", "public void stop()\n\t{\n\t\tsynchronized(m_vecThreads)\n\t\t{\n\t\t\tThread thread;\n\t\t\tif (m_vecThreads.size() > 0)\n\t\t\t{\n\t\t\t\tthread = (Thread)m_vecThreads.elementAt(0);\n\t\t\t\twhile (thread.isAlive())\n\t\t\t\t{\n\t\t\t\t\tthread.interrupt();\n\t\t\t\t\ttry \n\t\t\t\t\t{\n\t\t\t\t\t\tm_vecThreads.wait(250);\n\t\t\t\t\t} \n\t\t\t\t\tcatch (InterruptedException e)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void stop() {\n thread = null;\n }", "public synchronized void close() {\n \t\trecallThreads();\n \n \t\tsetSize(0, 0);\n \t\t/* Notify everyone waiting for a thread */\n \t\tnotifyAll();\n \n \t\t// destroy the threadgroup, will never go away otherwise\n \t\ttry {\n \t\t\t// Need to set it to a daemon first otherwise it will not be destroyed\n \t\t\tsetDaemon(true);\n \t\t\tdestroy();\n \t\t} catch (Exception e) {\n \t\t\t// TODO: consider logging\n \t\t}\n \t}", "@Override\n\t// O(1)\n\tpublic void close() {\n\t\tsynchronized (mInetAddressList) {\n\t\t\tmIsClosed = true;\n\t\t\tmCleanupTask.cancel();\n\t\t\tmInetAddressList.clear();\n\n\t\t\t// unblock the blocked threads\n\t\t\t// when they resume, they'll throw an interrupted exception\n\t\t\t// there's only one place where they'll be blocked (in take())\n\t\t\twhile (mInetAddressAvailableSemaphore.hasQueuedThreads()) {\n\t\t\t\tmInetAddressAvailableSemaphore.release();\n\t\t\t}\n\t\t}\n\t}", "public void stop() {\n done=true;\n bridges.forEach(Bridge::stop);\n bridges.clear();\n }", "@Override\n\tpublic void run() {\n\t\twhile (true) {\n\t\t\tIterator<Future<Integer>> iter = runningThreadsList.iterator();\n\t\t\tif (iter.hasNext()) {\n\t\t\t\tFuture<Integer> future = (Future<Integer>) iter.next();\n\t\t\t\tif (future.isDone()) {\n\t\t\t\t\trunningThreadsList.remove(future);\n\t\t\t\t\t\n\t\t\t\t\tif (allocator.getInventory().isEmpty()) {\n\t\t\t\t\t\tallocator.shutdown();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tThread.yield();\n\t\t}\n\t\t\t\n\t\t\n\t}", "protected void killUselessThread() {\n if (!System.getProperty(\"os.name\").contains(\"Windows\")) {\n killAllChildrenProcess();\n for (Thread thread : Thread.getAllStackTraces().keySet()) {\n if (!threadSet.contains(thread)) {\n thread.interrupt();\n }\n }\n }\n }", "public void stop() {\n executor.shutdownNow();\n rescanThread.interrupt();\n }", "@VisibleForTesting\n void killIoThreads() {\n ioThreadPool.shutdownNow();\n }", "private void dispose() {\n\t\t\t\r\n\t\t\tif (TRACE) {\r\n\t\t\t\tSystem.out.println(\"Disposing thread \" + workerNo);\r\n\t\t\t}\r\n\t\t\tcontrolLock.lock();\r\n\t\t\ttry {\r\n\t\t\t\tthreads.remove(thread.getId());\r\n\t\t\t}\r\n\t\t\tfinally {\r\n\t\t\t\tcontrolLock.unlock();\r\n\t\t\t}\r\n\t\t}", "public void stop() {\n clockThread = null;\n }", "public void stop() {\n\t\trunflag.set(false);\n\n\t\twhile (worker.isAlive()) {\n\t\t\ttry {\n\t\t\t\tThread.sleep(10); // Wait until it stops\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "protected void cleanup() {\n finished = true;\n thread = null;\n }", "public synchronized void stop()\r\n/* 78: */ {\r\n/* 79:203 */ if (!this.monitorActive) {\r\n/* 80:204 */ return;\r\n/* 81: */ }\r\n/* 82:206 */ this.monitorActive = false;\r\n/* 83:207 */ resetAccounting(milliSecondFromNano());\r\n/* 84:208 */ if (this.trafficShapingHandler != null) {\r\n/* 85:209 */ this.trafficShapingHandler.doAccounting(this);\r\n/* 86: */ }\r\n/* 87:211 */ if (this.scheduledFuture != null) {\r\n/* 88:212 */ this.scheduledFuture.cancel(true);\r\n/* 89: */ }\r\n/* 90: */ }", "public void stop() {\n if (isStop.compareAndSet(false, true)) {\n if (bootstrap.config().group() != null) {\n Future future = bootstrap.config().group().shutdownGracefully();\n ((io.netty.util.concurrent.Future) future).syncUninterruptibly();\n }\n for (BrpcChannelGroup channelGroup : healthyInstances) {\n channelGroup.close();\n }\n for (BrpcChannelGroup channelGroup : unhealthyInstances) {\n channelGroup.close();\n }\n if (timeoutTimer != null) {\n timeoutTimer.stop();\n }\n if (namingService != null) {\n namingService.unsubscribe(subscribeInfo);\n }\n if (healthCheckTimer != null) {\n healthCheckTimer.stop();\n }\n if (loadBalanceStrategy != null) {\n loadBalanceStrategy.destroy();\n }\n if (callbackThread != null) {\n callbackThread.shutdown();\n }\n if (threadPool != null) {\n threadPool.stop();\n }\n }\n }", "public void stop() {\r\n _keepGoing = false;\r\n }", "public void freeThread() {\n\t\tif (this.serverConnectorUsed > 0) {\n\t\t\tthis.serverConnectorUsed--;\n\t\t\tLOG.info(\"Freeing thread in pool. Now pool is \"+Integer.toString(MAX_THREADS-this.serverConnectorUsed)+\" / \"+Integer.toString(MAX_THREADS));\n\t\t}\n\t}", "public void stop() {\n\t\t//start the processor thread\n\t\t//logger.debug(processorName+\" stopping processor thread\");\n\t\tprocessorThread.interrupt();\n\t\t\n\t\t//logger.debug(processorName+\" stopped\");\n\t}", "public void stopSpinning()\n {\n scheduler.shutdown();\n startupLock.lock();\n spinning = false;\n }", "protected void shutdown() throws InterruptedException {\n\t\tsynchronized (this) // Don't allow shutdown during startup.\n\t\t{\n\t\t\t// Only the first call to shutdown() will be executed.\n\t\t\tif (shutdownMutex.acquire()) {\n\t\t\t\t// Stop payment.\n\t\t\t\tpayerThread.interrupt();\n\t\t\t\tpayerThread.join();\n\n\t\t\t\t// Stop allocating.\n\t\t\t\tproducerThreadPool.shutdown();\n\n\t\t\t\t// Stop sets (and their containers' maintenance threads).\n\t\t\t\tfor (int i = 0; i < sets.length; i++) {\n\t\t\t\t\tsets[i].shutdown();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "void stopThreadPool() {\n\n if (!mThreadPoolExecutor.isShutdown()) {\n mThreadPoolExecutor.getQueue().clear();\n mThreadPoolExecutor.shutdown();\n\n new Thread(() -> {\n\n while (!mThread.isInterrupted() && mThread.isAlive()) {\n\n if (mThreadPoolExecutor.isShutdown() && mThreadPoolExecutor.isTerminated()) {\n mThread.interrupt();\n Log.d(TAG, \"Interrupting mThread - thread pool isShutdown\");\n }\n\n try {\n Thread.sleep(500L);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n\n }).start();\n }\n }", "public void shutdown() {\n this.runnable.stop = true;\n LockSupport.unpark(this);\n }", "private static boolean killAllWorkersExceptItself() {\n\t\treturn false;\n\t\t\n\t}", "public static void shutdown() {\n\t\trunning = false;\n\t\texecutor.shutdown();\n\t\tlog.info(\"### All threads shutdown requested ###\");\n\t\t\n\t\ttry {\n\t\t\tfor (int i = 0; !executor.awaitTermination(10, TimeUnit.SECONDS); i++) {\n\t\t\t\tlog.info(\"### Awaiting for pending task pool termination... ({}) ###\", i);\n\t\t\t}\n\t\t} catch (InterruptedException e) {\n\t\t\tlog.warn(\"### Exception awaiting for pending task pool termination: {} ###\", e.getMessage());\n\t\t}\n\t\t\n\t\tlog.info(\"### All threads have finished ###\");\n\t}", "private static void shutdown() {\n\t\tSystem.out.println(\"Shutting down ...\");\n\t\tpool.shutdown();\n\t\tfor (Client client : clientMap.values()) {\n\t\t\tclient.cleanup();\n\t\t}\n\n\t\t// wait until all threads complete\n\t\ttry {\n\t\t\tif (!pool.awaitTermination(30, TimeUnit.SECONDS)) {\n\t\t\t\tSystem.out.println(\"Force shutdown after 30 seconds ...\");\n\t\t\t\tpool.shutdownNow();\n\t\t\t\tif (!pool.awaitTermination(30, TimeUnit.SECONDS)) {\n\t\t\t\t\tSystem.out.println(\"Terminate the process.\");\n\t\t\t\t\tThread.currentThread().interrupt();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (InterruptedException e) {\n\t\t\tThread.currentThread().interrupt();\n\t\t}\n\t}", "public void stop() {\n this.stopRequested.set(true);\n synchronized(this) {\n notifyAll(); // Wakes run() if it is sleeping\n }\n }", "@Override\n protected void onStop() {\n \tsuper.onStop();\n \tthread.setThreadExit(true);\n \tthread = null;\n \t\n }", "@Override\r\n\tpublic void debit() {\n\t\tSystem.out.println(\"Core Method of GC\");\r\n\t}", "public synchronized void shutdown() {\n try {\n stop();\n } catch (Exception ex) {\n }\n \n try {\n cleanup();\n } catch (Exception ex) {\n }\n }", "public void stop() {\n executorService.shutdown();\n try {\n if (!executorService.awaitTermination(500, TimeUnit.MILLISECONDS)) {\n executorService.shutdownNow();\n }\n } catch (InterruptedException e) {\n executorService.shutdownNow();\n }\n }", "private void terminateWorkerThreads() {\n log.info(\"Terminating worker threads..\");\n try {\n this.periodicReportingService.stopPeriodicTasks();\n this.running.set(false);\n this.logWriter.join();\n this.join();\n } catch (Exception e) {\n log.error(\"Error shutting down \", port);\n }\n }", "public void terminateAllCalls();", "public static void stopEverything(){\r\n\t\tfor(final ExecutionHandler<?> execHandler:allThreads){\r\n\t\t\t//interrupt the stack execution, so that it wont be further executed \r\n\t\t\tstopExecutionHandler(execHandler);\r\n\t\t}\r\n\t\t//Now when all ExecutionHandlers should already be empty, but for sure - clear all global lists explicitly\r\n\t\tallThreads.clear(); \r\n\t\tallExecutablesInProcess.clear();\r\n\t\trootBlockToThread.clear();\r\n\t}", "void stopOnCompletion(Thread waiting);", "public static void ThreadStop()\r\n\t{\r\n\t\tthread_running=false;\r\n\t}", "public void stop() {\n // stop all workers and sessions.\n Iterator<Map.Entry<TauSession, Worker>> it\n = sessionToWorkerMap.entrySet().iterator();\n\n while (it.hasNext()) {\n Map.Entry<TauSession, Worker> entry = it.next();\n entry.getValue().stop();\n }\n\n synchronized (lock) {\n sessionToWorkerMap.clear();\n sessionsList.clear();\n }\n }", "void destroy() {\n \t\ttry {\r\n \t\t\tupKeep.stopRunning();\r\n \t\t} catch (InterruptedException e) {\r\n \t\t}\r\n \r\n \t\t// Kill all running processes.\r\n \t\tfor (MaximaProcess mp : pool) {\r\n \t\t\tmp.kill();\r\n \t\t}\r\n \t\tpool.clear();\r\n \r\n \t\t// Kill all used processes.\r\n \t\tfor (MaximaProcess mp : usedPool) {\r\n \t\t\tmp.kill();\r\n \t\t}\r\n \t\tusedPool.clear();\r\n \t}", "public void shutdown() {\n\t\tthreadPool.shutdown();\n\t}", "private void stop()\n {\n if(running)\n {\n scheduledExecutorService.shutdownNow();\n running = false;\n }\n }", "public void stopSweeper()\r\n\t{\r\n\t\tsynchronized (lock) {\r\n\t\t\tcache = null;\r\n\t\t\tlock.notify();\r\n\t\t}\r\n\t}", "private void stopThread()\n {\n if (workerThread != null && workerThread.isAlive())\n {\n workerThread.stopLoop();\n }\n stopSelf();\n }", "private static void gc() {\n System.gc();\n System.gc();\n }", "void doGarbageCollection(GCType type);", "public void unpark() {\n Thread w = this.thread;\n if (w != null) {\n this.thread = null;\n LockSupport.unpark(w);\n }\n }", "void stopAll();", "public void terminate () {\n for (int i=0; i<threads; i++) {\n servers[i].terminate ();\n }\n }", "public abstract void stopThreads() throws IOException, InterruptedException;", "public synchronized void stopSolving()\n/* */ {\n/* 463 */ setKeepSolving(false);\n/* 464 */ notifyAll();\n/* */ }", "protected void stopMaintenance()\n\t{\n\t\tif (this.maintenanceThread == null) return;\n\n\t\tthis.stopMaintenanceThread = true;\n\t\tthis.maintenanceThread.interrupt();\n\t\tthis.maintenanceThread = null;\n\t}", "private void producerShutdownSpinLock() {\n\t\twhile (!imageProducer.isTerminated()) {\n\t\t\t// spin spin\n\t\t}\n\t}", "public void stop() {\n\t\tif (this.isRunning() && !this.isManagedExternally) {\n\t\t\ttry {\n\t\t\t\tHTTP.release(this.http.get(this.shutdown));\n\t\t\t} catch (IOException exception) {\n\t\t\t\tthis.processRunner.abort();\n\t\t\t}\n\n\t\t\tthis.isManagedExternally = null;\n\t\t}\n\t}", "private void signalFree() {\n block.release();\n }", "private void workerStop() {\r\n\r\n\t\tif (_workerThread == null) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsynchronized (_workerLock) {\r\n\r\n\t\t\t_workerCancelled = true;\r\n\t\t\t_workerStopped = true;\r\n\r\n\t\t\t_workerLock.notifyAll();\r\n\t\t}\r\n\r\n\t\twhile (_workerThread != null) {\r\n\t\t\tif (!_display.readAndDispatch()) {\r\n\t\t\t\t_display.sleep();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void terminate() {\n\t\t//terminate probes\n\t\tfor (Entry<String,IProbe> entry :this.probes.entrySet())\n\t\t\tentry.getValue().terminate();\n\t\t//terminate collector\n\t\tthis.collector.terminate();\n\t\tthis.distributorWorker.terminate();\n\t}", "public static void cancelAll() {\n\n ImageDownloadTask[] taskArray = new ImageDownloadTask[sInstance.downloadWorkQueue.size()];\n\n // Populates the array with the task objects in the queue\n sInstance.downloadWorkQueue.toArray(taskArray);\n\n /*\n * Locks on the singleton to ensure that other processes aren't mutating Threads, then\n * iterates over the array of tasks and interrupts the task's current Thread.\n */\n synchronized (sInstance) {\n for (ImageDownloadTask imageDownloadTask : taskArray) {\n Thread thread = imageDownloadTask.getCurrentThread();\n if (null != thread) {\n thread.interrupt();\n }\n }\n }\n }", "@Override\n protected void doStop() throws StopException {\n try {\n LifecycleHelper.stopIfPossible(allocator);\n } catch (StopException e) {\n logger.error(\"[stop][stop allocator error]\", e);\n }\n if (future != null) {\n future.cancel(true);\n future = null;\n }\n super.doStop();\n }", "public void finalize() throws Throwable {\n try {\n if (!pool.isTerminated()) {\n // Try to stop all workers within 10 seconds\n stop(10);\n }\n } catch (Exception e) {\n log.error(\"An error occurred when stopping the pool while finalizing\");\n }\n \n super.finalize();\n }", "public void stopBackgroundVcsOperation() {\n assert ! ApplicationManager.getApplication().isDispatchThread();\n LOG.assertTrue(myBackgroundOperationCounter > 0, \"myBackgroundOperationCounter > 0\");\n myBackgroundOperationCounter--;\n }", "public void shutdown() {\n /**\n * Make this thread instance null.\n */\n THREAD_INSTANCE = null;\n\n /**\n * Destroy Keep Alive Thread.\n */\n KEEP_ALIVE_THREAD.pause();\n KEEP_ALIVE_THREAD.stop();\n KEEP_ALIVE_THREAD = null;\n }", "public static void runGarbageCollection()\n {\n // see if we need to run the collector...\n //----------------------------------------\n if (bRunCollector())\n {\n String sStaleDuration = \"\";\n int iStaleDuration = 0;\n \n try\n {\n sStaleDuration = PropertyAccessor.getProperty(GATEWAY_PROPERTY_FILE, GARBAGE_COLLECT_STALE_DURATION);\n iStaleDuration = Integer.parseInt(sStaleDuration);\n } \n catch (Exception e)\n {\n String sErrorMessage = \"Failed to read and parse property: \" + GARBAGE_COLLECT_STALE_DURATION +\n \" from PropertyFile: \" + GATEWAY_PROPERTY_FILE + \".propertues. No \" +\n \"garbage collection will be done on the aggregator tables.\";\n log.error(sErrorMessage);\n return;\n }\n \n if ((sStaleDuration == null) ||\n (sStaleDuration.length() <= 0))\n {\n String sErrorMessage = \"Failed to read and parse property: \" + GARBAGE_COLLECT_STALE_DURATION +\n \" from PropertyFile: \" + GATEWAY_PROPERTY_FILE + \".propertues. No \" +\n \"garbage collection will be done on the aggregator tables.\";\n log.error(sErrorMessage);\n return;\n }\n \n Calendar oCal = Calendar.getInstance();\n oCal.add(Calendar.SECOND, (-1) * iStaleDuration);\n \n log.debug(\"Running aggregator garbage collection thread now.\");\n \n GarbageCollectorThread oCollectorThread = new GarbageCollectorThread(oCal.getTime());\n oCollectorThread.run();\n dtLastRun = new Date();\n \n }\n }", "void stop()\n {\n log.info(\"Begin stop(), instance = '\" + instance + \"'\");\n\n if (isAlive())\n {\n processor.stop();\n try { t.join(); } catch (InterruptedException e) {}\n running = false;\n }\n\n log.info(\"End stop(), instance = '\" + instance + \"'\");\n }", "synchronized public void shutdownBlocking() throws InterruptedException\n {\n if (!started)\n return;\n\n started = false;\n executor.shutdown();\n executor.awaitTermination();\n segmentManager.shutdown();\n segmentManager.awaitTermination(1L, TimeUnit.MINUTES);\n }", "public void finalize() {\r\n\tif (this.taskGroup!=null) this.taskGroup.interruptAll();\r\n}", "public synchronized void stop() {\n stopping = true;\n }", "public static void onVMDeath() {\n \tDeferredExecution.stopProcessors();\n }", "public void terminateCollect(){\n\t\t\ttry {\n\t\t\t\tdumpHandler.breakLoop();\t\t\t\t\n\t\t\t\tdumpHandler.close();\n\t\t\t\tlog.info(\"terminate!\");\n\t\t\t\t \n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\t\n\t\t\t\n\n\t}", "private synchronized void stop(){\n this.go = false;\n }", "public void stop() {\n executor.shutdown();\n }", "private void shutdownThreads() {\n\t\tif (backupHeartbeatBroadcaster != null) {\n\t\t\tbackupHeartbeatBroadcaster.cancel();\n\t\t}\n\t\tif (activeHeartbeatTimer != null) {\n\t\t\tactiveHeartbeatTimer.cancel();\n\t\t}\n\t\tif (serverLatencyProcessorTimer != null) {\n\t\t\tserverLatencyProcessorTimer.cancel();\n\t\t}\n\t\tif (backupHeartbeatTimer != null) {\n\t\t\tbackupHeartbeatTimer.cancel();\n\t\t}\n\t\tif (reElectionTimer != null) {\n\t\t\treElectionTimer.cancel();\n\t\t}\n\t\tif (preElectionTimeoutTimer != null) {\n\t\t\tpreElectionTimeoutTimer.cancel();\n\t\t}\n\t}", "public void stop(){\n log.info(\"PageDownloaderPool stopped.\");\n downloaders.forEach(PageDownloader::doStop);\n }", "protected void stopClusterer() {\r\n\r\n\t\tif (m_RunThread != null) {\r\n\t\t\tm_RunThread.interrupt();\r\n\r\n\t\t\t// This is deprecated (and theoretically the interrupt should do).\r\n\t\t\tm_RunThread.stop();\r\n\r\n\t\t}\r\n\t}", "private void cleanup() throws RemoteException {\n log.info(\"GP run complete.\");\n running = false;\n\n log.info(\"Releasing clients.\");\n for (IClient client : clients)\n client.release();\n clients.clear();\n\n writeCheckpoint(\"final_generation\");\n }", "protected void finalize() { \n \tstopSelf(); \n }", "void startGCThread() {\n Enumeration<?> nextReq;\n UDPAddress senderAddr;\n Integer packetSeq;\n Hashtable<Integer, DatagramPacket> heldMsgs;\n Integer gClast;\n int bound;\n\n // This thread only exits when the foundry crashes\n while (true) {\n // Wait until there is a new GC packet\n try {\n\tsynchronized (gcPackets) {\n\t if (gcPackets.empty()) \n\t gcPackets.wait();\n\t}\n } catch (InterruptedException e) {\n\tDebug.exit(\"GC thread should never be interrupted!: \" + e.toString());\n }\n\n nextReq = (Enumeration<?>) gcPackets.dequeue();\n senderAddr = (UDPAddress) nextReq.nextElement();\n packetSeq = (Integer) nextReq.nextElement();\n heldMsgs = (Hashtable<Integer, DatagramPacket>) notGCd.get(senderAddr);\n bound = packetSeq.intValue();\n\n if (heldMsgs == null) {\n\theldMsgs = new Hashtable<Integer, DatagramPacket>();\n\tnotGCd.put(senderAddr, heldMsgs);\n }\n gClast = (Integer) lastGCd.get(senderAddr);\n if (gClast == null)\n\tgClast = new Integer(-1);\n\n // PRAGMA [DEBUG] Debug.out.println(\"Message sent from: \" + senderAddr);\n // PRAGMA [DEBUG] Debug.out.println(\"GC messages <= \" + packetSeq);\n\n if (bound > gClast.intValue()) {\n\t// Now remove any messages satisfying:\n\t// gClast < msg_num <= packetSeq\n\tfor(int rem=gClast.intValue() + 1; rem <= bound; rem++) {\n\t // PRAGMA [DEBUG] Debug.out.println(\"Removing message with ID: \" + rem);\n\t notGCd.remove(new Integer(rem));\n\t}\n\n\t// Update lastGCd\n\tlastGCd.put(senderAddr, packetSeq);\n }\n }\n }", "private void kickControlThread() {\r\n\t\tcontrolSignal.release();\r\n\t}", "@Override\n\tpublic void destroy() throws Exception\n\t{\n\t\tlog.debug(\"Shutdown threadpool\");\n\t\tpool.shutdownNow(); // disable new tasks from being submitted and interrupt running threads.\n\n\t\t// Wait briefly for tasks to respond to being cancelled\n\t\tif (!pool.awaitTermination(1, TimeUnit.SECONDS))\n\t\t{\n\t\t\tlog.error(\"Threads still running\");\n\t\t}\n\t\tsuper.destroy();\n\t\tlog.debug(\"Leaving servlet destroy\");\n\t}", "public void shutdown()\n {\n valid = false;\n quitSafely();\n\n synchronized (loading) {\n loading.clear();\n }\n synchronized (toLoad) {\n toLoad.clear();\n }\n synchronized (tilesByFetchRequest) {\n tilesByFetchRequest.clear();\n }\n }", "private void cancelHeavyLifting()\n {\n }", "private void pararCancion() {\n clip.stop();\n clip.close();\n clip = null;\n }", "public void releaseAll() {\n for (T p : this.memoryQueue) {\n p = this.allocator.deallocate(p);\n }\n\n System.gc();\n }", "private void safeStop() {\n getRobotDrive().stop();\n //pneumatics.stop();\n }", "protected void stopAll() {\n\t\tif (this.udpServer!=null)\n\t\t\tthis.udpServer.interrupt();\n\t\tif (this.connectionServer!=null)\n\t\t\tthis.connectionServer.interrupt();\n\t\tthis.connectionServer=null; // supprime le TCPServer et les Sockets associés\n\t\tthis.udpServer=null; // supprime l'UDPServer et les Sockets associés\n\t\tif (this.agent.getUserStatusManager()!=null)\n\t\t\tfor (String u : this.agent.getUserStatusManager().getActiveUsers())\n\t\t\t\tthis.removeSocket(u);; // interrompt tous les UserSockets\n\t\tthis.mapSockets.clear();\n\t}", "public synchronized void closeAllConnections() {\n\t\tstop();\n\t}" ]
[ "0.6497969", "0.64776194", "0.62406987", "0.6223528", "0.62114495", "0.60395545", "0.59955066", "0.59868145", "0.5975054", "0.59680843", "0.5864302", "0.57813525", "0.5720698", "0.57122064", "0.57058924", "0.5702608", "0.57000005", "0.5698916", "0.5691292", "0.5652986", "0.5638154", "0.5616444", "0.5614689", "0.56128466", "0.5601567", "0.55832857", "0.5566385", "0.5554025", "0.55174947", "0.550572", "0.54971236", "0.549132", "0.54790896", "0.547893", "0.5477133", "0.5474863", "0.5469505", "0.5467396", "0.54661614", "0.5463035", "0.5456139", "0.54420954", "0.5441569", "0.543941", "0.542841", "0.5416893", "0.54152244", "0.54100555", "0.54020005", "0.53945464", "0.53900325", "0.53830284", "0.53687835", "0.5367047", "0.5362883", "0.5356817", "0.5354058", "0.5343401", "0.5342547", "0.5336294", "0.53342897", "0.5330976", "0.53285754", "0.532593", "0.5325922", "0.53254664", "0.5310636", "0.53039956", "0.5293755", "0.5292516", "0.52920127", "0.52897114", "0.5283196", "0.52827334", "0.5281337", "0.52749133", "0.5271466", "0.5267556", "0.5263708", "0.5263694", "0.5262217", "0.5259159", "0.52548075", "0.5250584", "0.524604", "0.52351034", "0.52224207", "0.52171963", "0.52093655", "0.5204566", "0.52036643", "0.520008", "0.51981205", "0.51958686", "0.51844126", "0.51804423", "0.5171832", "0.5171786", "0.5171237", "0.51710874" ]
0.69328713
0
Visit all roots of the object tree.
public abstract void visitAllRoots(ObjectVisitor visitor, VmHeapManager heapManager);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void preTraverse() {\n // ensure not an empty tree\n while (root != null) {\n \n }\n }", "public static void inOrderTraverse(Node root) {\n\t\tStack<Node> stack = new Stack<Node>();\n\t\tNode node = root;\n\t\twhile (node!=null || !stack.empty()) {\n if(node!=null){\n \t stack.push(node);\n \t node = node.lchild;\n }else{\n \t node = stack.pop();\n \t node.visit();\n \t node = node.rchild;\n }\n\t\t}\n\t}", "private void rootTreeIterate(Element rootNode) throws DocumentException {\n\n Iterator rootIterator = rootNode.elementIterator();\n\n while (rootIterator.hasNext()) {\n\n Element node = (Element) rootIterator.next();\n\n if (node.getName().equals(TABLE_NODE)) {\n processTableNode(node);\n } else if (node.getName().equals(CLASS_NODE)) {\n processClassNode(node);\n } else if (node.getName().equals(CLASS_PARENT_NODE)) {\n processClassParentNode(node);\n } else if (node.getName().equals(PROPERTY_NODE)) {\n processPropertyNode(node);\n } else if (node.getName().equals(PROPERTY_PARENT_NODE)) {\n processPropertyParentNode(node);\n } else {\n throw new DocumentException(\"Node with illegal name \\\"\" + node.getName() + \"\\\" found\");\n }\n }\n }", "@Override\n public ArrayList<Node> getAllNodes() {\n return getAllNodesRecursive(root);\n\n }", "public void traverseLevelOrder() {\n\t\tif (root == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tLinkedList<Node> ls = new LinkedList<>();\n\t\tls.add(root);\n\t\twhile (!ls.isEmpty()) {\n\t\t\tNode node = ls.remove();\n\t\t\tSystem.out.print(\" \" + node.value);\n\t\t\tif (node.left != null) {\n\t\t\t\tls.add(node.left);\n\t\t\t}\n\t\t\tif (node.right != null) {\n\t\t\t\tls.add(node.right);\n\t\t\t}\n\t\t}\n\t}", "private void traversal (\n TreeNodeVisitor visitor\n ) {\n\n visitor.visit (this);\n if (children != null) {\n for (SceneOctTree child : children) child.traversal (visitor);\n } // if\n\n }", "private void preOrdertraverse(Node root){\n System.out.println(root.value);\n for(var child : root.getChildren())\n preOrdertraverse(child); //recursively travels other childrens in current child\n }", "private static void traversals(Node root) {\n\t\tSystem.out.println(\"Node Pre \" + root.data);\n\t\tfor(Node child : root.children) {\n\t\t\tSystem.out.println(\"Edge Pre \" + root.data + \"--\" + child.data);\n\t\t\ttraversals(child);\n\t\t\tSystem.out.println(\"Edge Post \" + root.data + \"--\" + child.data);\n\t\t}\n\t\tSystem.out.println(\"Node Post \" + root.data);\n\t}", "public void root(Node n) {}", "public void iterate(){//iterate over all the keys\n\t\tSystem.out.println(\"Keys are :\");\n\t\tSystem.out.println(\"-----------------------\");\n\t\titerate(this.root);\n\t\tSystem.out.println(\"-----------------------\");\n\t}", "public void printAllRootToLeafPaths(){\n\t\tint[] path = new int[256];\n\t\tBinaryTreeNode root = null;\n\t\tprintAllRootToLeafPaths(root ,path,0);\n\t}", "private void postOrdertraverse(Node root){\n for(var child : root.getChildren())\n postOrdertraverse(child); //recursively travels other childrens in current child\n\n //finally visit root\n System.out.println(root.value);\n\n }", "public void iterate() {\n\t\t// iterator\n\t\tQueue<NDLMapEntryNode<T>> nodes = new LinkedList<NDLMapEntryNode<T>>();\n\t\tnodes.add(rootNode);\n\t\twhile(!nodes.isEmpty()) {\n\t\t\t// iterate BFSwise\n\t\t\tNDLMapEntryNode<T> node = nodes.poll();\n\t\t\tif(node.end) {\n\t\t\t\t// end of entry, call processor\n\t\t\t\tif(keyProcessor != null) {\n\t\t\t\t\tkeyProcessor.process(node.data);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(node.keys != null) {\n\t\t\t\t// if available\n\t\t\t\tnodes.addAll(node.keys.values()); // next nodes to traverse\n\t\t\t}\n\t\t}\n\t}", "public void inorderTraversal() {\n inorderThroughRoot(root);\n System.out.println();\n }", "public void inorderTraverse(){\n\t\tinorderHelper(root);\n\t\tSystem.out.println();\n\t}", "public void printRoot(){\n for(String temp : root){\n System.out.println(temp);\n }\n }", "@Override\n public void clearAst() {\n this.root = null;\n }", "public void printTree() {\r\n printTree(overallRoot, 0);\r\n }", "public void preorderTraverse(){\n\t\tpreorderHelper(root);\n\t\tSystem.out.println();\n\t}", "public void printAll() {\n\t\tNode node = root;\n\t\twhile (node != null) {\n\t\t\tSystem.out.println(node.data);\n\t\t\tnode = node.left;\n\t\t}\n\t}", "public void invalidateAllEdges(EntityInstance root)\r\n\t{\r\n\t\tEnumeration en;\r\n\r\n\t\t/* Draw all the visible objects */\r\n\r\n\t\troot.invalidateAllEdges(); \r\n\r\n\t\tif (root.isOpen()) {\r\n\t\t\tfor (en = root.getChildren(); en.hasMoreElements(); ) {\r\n\t\t\t\tinvalidateAllEdges((EntityInstance) en.nextElement());\r\n\t\t}\t}\r\n\t}", "void startVisitingObject(Object node);", "@Override\n public OctreeIterator iterator()\n {\n Stack<CelestialBody> stack = new Stack<>();\n stack = this.root.iterate(stack);\n\n OctreeIterator iterator = new OctreeIterator(stack);\n return iterator;\n }", "private void VisitChildren(AST root){\n for (AST child : root.children) {\n try {\n String switchValue;\n switchValue = (child.GetValue() != null) ? child.GetValue() : ((IdExpr) child).ID;\n visitValue.Visit(switchValue, child);\n } catch (ClassCastException e){\n }\n }\n }", "public void internal() {\n if(count() == 1) return;\n if(!empty()){\n internalNodes(root);\n }\n System.out.println();\n }", "public void list() {\n\t\ttraverseInOrder(root);\n\t}", "private void inOrder(Node root) {\r\n\t\t// inOrderCount++;\r\n\t\t// System.out.println(\" Count: \" + inOrderCount);\r\n\t\tif (root == null) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// System.out.println(\" Count: \" + inOrderCount);\r\n\t\tinOrder(root.getlChild());\r\n\t\tif (inOrderCount < 20) {\r\n\t\t\tSystem.out.print(\"< \" + root.getData() + \" > \");\r\n\t\t\tinOrderCount++;\r\n\t\t\t//System.out.println(\" Count: \" + inOrderCount);\r\n\t\t}\r\n\t\tinOrder(root.getrChild());\r\n\r\n\t}", "public void inorderTraversal(Node root) {\r\n\t\tif(root != null) {\r\n\t\t\tinorderTraversal(root.leftChild);\r\n\t\t\tSystem.out.print(root.data + \" \");\r\n\t\t\tinorderTraversal(root.rightChild);\r\n\t\t}\r\n\t}", "public void inOrderTraversal(TreeNode<T> root) {\n\t\tif (null == root) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tinOrderTraversal(root.getLeftChild());\n\t\t\tSystem.out.println(root);\n\t\t\tinOrderTraversal(root.getRightChild());\n\t\t}\n\t}", "public void printAllPaths() {\n\n if (root == null) System.out.println(\"No paths for you!\");\n else {\n printPaths(root.left, root.element.toString());\n printPaths(root.right, root.element.toString());\n }\n }", "public void dumpChildren ()\r\n {\r\n dumpChildren(0);\r\n }", "public void printStructure() {\n printStructure(mRoot);\n }", "public void flatten()\r\n\t\t{\r\n\t\t\tif (_children.size() > 0) \r\n\t\t\t{\r\n\t\t\t\tint i = 0;\r\n\t\t\t\twhile(i < _children.size())\r\n\t\t\t\t{\r\n\t\t\t\t\tExpressionNode subExpr = _children.get(i);\r\n\t\t\t\t\tsubExpr.flatten();\r\n\t\t\t\t\tif (_data.equals(subExpr._data)) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t_children.addAll(subExpr._children);\r\n\t\t\t\t\t\t_children.remove(subExpr);\r\n\t\t\t\t\t}\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t}\r\n\t\t}", "@Override\r\n\tpublic Node<T> getRoot() {\r\n\t\treturn raiz;\r\n\t}", "public void printRoot()\r\n\t{\r\n\t\tSystem.out.println(\"Root is:\"+root.data);\r\n\t}", "public ObjectTreeNode getRoot() {\n return root;\n }", "public void printTree(T root) {\n List<TreeLine> treeLines = buildTreeLines(root);\n printTreeLines(treeLines);\n if(flush) outStream.flush();\n }", "void accept0(ASTVisitor visitor) {\n boolean visitChildren = visitor.visit(this);\n if (visitChildren) {\n // visit children in normal left to right reading order\n acceptChildren(visitor, initializers);\n acceptChild(visitor, getExpression());\n acceptChildren(visitor, updaters);\n acceptChild(visitor, getBody()); }\n visitor.endVisit(this); }", "public void work(RootNode root) throws Exception;", "EntryIterator(final IntTree<V> root) {\n gotoMinOf(root);\n }", "public QuadTreeIterator() {\n\t\t\telements = new TreeSet();\n\t\t\tanalyze(((RootNode)root).children[0]);\n\t\t\tanalyze(((RootNode)root).children[1]);\n\t\t\tanalyze(((RootNode)root).children[2]);\n\t\t\tanalyze(((RootNode)root).children[3]);\n\t\t}", "public void printTree() {\r\n\t if (expressionRoot == null) {\r\n\t return;\r\n\t }\r\n if (expressionRoot.right != null) {\r\n printTree(expressionRoot.right, true, \"\");\r\n }\r\n System.out.println(expressionRoot.data);\r\n if (expressionRoot.left != null) {\r\n printTree(expressionRoot.left, false, \"\");\r\n }\r\n }", "void inorder(Node root) {\n\t\tboolean leftdone = false;\n\n\t\t// Start traversal from root\n\t\twhile (root != null) {\n\t\t\t// If left child is not traversed, find the\n\t\t\t// leftmost child\n\t\t\tif (!leftdone) {\n\t\t\t\twhile (root.left != null) {\n\t\t\t\t\troot = root.left;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Print root's data\n\t\t\tSystem.out.print(root.data + \" \");\n\n\t\t\t// Mark left as done\n\t\t\tleftdone = true;\n\n\t\t\t// If right child exists\n\t\t\tif (root.right != null) {\n\t\t\t\tleftdone = false;\n\t\t\t\troot = root.right;\n\t\t\t}\n\n\t\t\t// If right child doesn't exist, move to parent\n\t\t\telse if (root.parent != null) {\n\t\t\t\t// If this node is right child of its parent,\n\t\t\t\t// visit parent's parent first\n\t\t\t\twhile (root.parent != null && root == root.parent.right)\n\t\t\t\t\troot = root.parent;\n\n\t\t\t\tif (root.parent == null)\n\t\t\t\t\tbreak;\n\t\t\t\troot = root.parent;\n\t\t\t} else\n\t\t\t\tbreak;\n\t\t}\n\t}", "public void preOrderTraversal() {\n preOrderThroughRoot(root);\n System.out.println();\n }", "public void inOrder() {\n inOrder(root);\n }", "public void visitInorder(Visitor<T> visitor) { if (root != null) root.visitInorder(visitor); }", "@Override\n\tpublic Iterator<E> iterator() {\n\n\t\tNode tempRoot = root;\n\t\tinOrder(tempRoot);\n\t\treturn null;\n\t}", "public void depthFirstTraverse() {\n\t\tInteger first = (Integer) edges.keySet().toArray()[0];\n\t\t// track whether vertex was visited\n\t\tHashMap<Integer, Boolean> visited = buildVisited();\n\t\tdepthFirstTraverse(first, visited);\n\t}", "public void setRoot(Node root) {\n this.root = root;\n }", "static void inorderTraversal(Node root) {\n if (root == null) {\n return;\n }\n inorderTraversal(root.left);\n System.out.print(root.data + \" \");\n inorderTraversal(root.right);\n }", "public static List<Node> traverseTreeInDepth(Node root) {\n LinkedList<Node> result = new LinkedList<Node>();\n visitNode(root, result);\n return result;\n }", "void accept(RebaseJavaVisitor v)\n{\n v.preVisit(this);\n if (!v.preVisit2(this)) return;\n\n if (v.visit(this)) {\n for (CompilationUnit cu : getTrees()) {\n\t cu.accept(v);\n }\n }\n\n v.postVisit(this);\n}", "public void treeOrder ()\n {\n treeOrder (root, 0);\n }", "public void inOrderIterative(TreeNode root)\r\n\t{\r\n\t\tif(root == null)\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tStack<TreeNode> stack = new Stack<>();\r\n\t\tTreeNode temp=root;\r\n\t\twhile(!stack.isEmpty() || temp!=null)\r\n\t\t{\r\n\t\t\tif(temp!=null)\r\n\t\t\t{\r\n\t\t\t\tstack.push(temp);\r\n\t\t\t\ttemp=temp.left;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttemp=stack.pop();\r\n\t\t\t\tSystem.out.print(temp.data+\" \");\r\n\t\t\t\ttemp=temp.right;\r\n\t\t\t}\r\n\t\t\r\n\t\t}\r\n\t}", "public void traverseInOrder() {\n\t System.out.println(\"============= BTREE NODES ===============\");\n\t\tinOrder(root);\n System.out.println(\"=========================================\");\n\t}", "public void checkTypes() {\n this.root.accept(this);\n }", "public void printInorder() {\n if (myRoot == null) {\n System.out.println(\"(empty tree)\");\n } else {\n myRoot.printInorder();\n System.out.println();\n }\n }", "public void printInorder() {\n if (myRoot == null) {\n System.out.println(\"(empty tree)\");\n } else {\n myRoot.printInorder();\n System.out.println();\n }\n }", "public void calculateForces()\n {\n Stack<CelestialBody> stack = new Stack<>();\n stack = this.root.iterate(stack);\n\n OctreeIterator iterator = new OctreeIterator(stack);\n root.calculateForces(root, iterator);\n }", "public void printTree() {\n printTreeHelper(root);\n }", "public synchronized void clearResources()\r\n {\r\n // create a new root, making old tree eligible for GCing\r\n createRootNode();\r\n\r\n // clear all registered objects\r\n unRegisterAll();\r\n }", "public IAstTopLevelNode[] getTopLevelNodes();", "public void printTreeNodes(){\n logger.trace(\"Name: \"+this.getName());\n for(int i=0;i<this.getChildCount();i++){\n SearchBaseNode node = (SearchBaseNode) this.getChildAt(i);\n node.printTreeNodes();\n }\n }", "private void inorder() {\n inorder(root);\n }", "public void print(){\n inorderTraversal(this.root);\n }", "public void printNodes() {\n\t\tprintNodes(root);\n\n\t}", "@Override\n protected void iterChildren(TreeFunction f) {\n }", "@Override\n protected void iterChildren(TreeFunction f) {\n }", "@Override\n protected void iterChildren(TreeFunction f) {\n }", "public void analyseRoot(Resource root) {\n\t\tserTypes.put(root, new SerialziationTypeRefs());\r\n\t}", "public void clear() {\n\t\tthis.root = new Node();\n\t}", "private void buildRoot() {\n this.root = new GPRootTreeNode(this.tree);\n }", "static void printTree(AbstractNode root) throws IOException {\n if (root == null) {\n return;\n }\n System.out.println(root.toString());\n if(root.getTypeNode() == 0) {\n ConscellNode nextNode = (ConscellNode)root;\n printTree(nextNode.getFirst());\n printTree(nextNode.getNext());\n }\n }", "public void postOrderTraversal() {\n postOrderThroughRoot(root);\n System.out.println();\n }", "public Iterator<String> listRootClasses()\r\n\t{\r\n\t\treturn new ToStringIterator<String>(ONT_MODEL.listHierarchyRootClasses().filterDrop( new Filter() {\r\n public boolean accept( Object o ) {\r\n return ((Resource) o).isAnon();\r\n }} )\r\n );\t\t\r\n\t}", "public void setRoot(Node<T> root) {\n this.root = root;\n }", "public List<Node> getRootElements() {\n List<Node> subRoots = tree.find(\"s\", \"neb\", \"objc\");\n List<Node> directRoots = this.tree.getChildren().stream()\n .filter(x -> !x.getPosGroup().equals(\"$.\") && !x.getPosGroup().equals(\"$,\") && !x.getPosGroup().equals(\"$(\"))\n .collect(Collectors.toList());\n\n subRoots.addAll(directRoots);\n\n return subRoots;\n }", "public void dumpTree() {\n\t\tsendMessage(\"/g_dumpTree\", new Object[] { 0, 0 });\n\t}", "public void InOrder() {\n\t\tInOrder(root);\n\t}", "public void inOrder() {\r\n \r\n // call the private inOrder method with the root\r\n inOrder(root);\r\n }", "public void postorderTraverse(){\n\t\tpostorderHelper(root);\n\t\tSystem.out.println();\n\t}", "public TraversalResults traverse(ObjectNode traverse);", "public IntTree() {\n overallRoot = null;\n }", "void accept0(ASTVisitor visitor) {\r\n\t\tboolean visitChildren = visitor.visit(this);\r\n\t\tif (visitChildren) {\r\n\t\t\t// visit children in normal left to right reading order\r\n\t\t\tacceptChild(visitor, getExpression());\r\n\t\t\tacceptChildren(visitor, newArguments);\r\n\t\t\tacceptChildren(visitor, constructorArguments);\r\n\t\t\tacceptChildren(visitor, baseClasses);\r\n\t\t\tacceptChildren(visitor, declarations);\r\n\t\t}\r\n\t\tvisitor.endVisit(this);\r\n\t}", "@Override\n public void clear() {\n root = null;\n }", "BinarySearchTree() {\n this.root = null;\n }", "public void inOrder(){\n inOrder(root);\n }", "void printTree(Node root) { \r\n if (root != null) { \r\n \tprintTree(root.leftChild); \r\n System.out.println(\"\\\"\" + root.keyValuePair.getKey() + \"\\\"\" + \" : \" + root.getKeyValuePair().getValue()); \r\n printTree(root.rightChild); \r\n } \r\n }", "@Override\n public void accept(TreeVisitor visitor) {\n }", "public void visitNodes( MetricTreeVisitor visitor ) {\n\t\tMetricTreeNode root = getRoot();\n\t\tvisitNodeImpl( root, visitor );\n\t}", "public void print()\r\n {\r\n print(root);\r\n }", "public void printTree() {\r\n\t\tif (isEmpty())\r\n\t\t\tSystem.out.println(\"Empty tree\");\r\n\t\telse\r\n\t\t\tprintTree(root);\r\n\t}", "@Override\n public Object root() {\n return root;\n }", "@Override\n public Object root() {\n return root;\n }", "private void inorder() {\r\n\t\t\tinorder(root);\r\n\t\t}", "public void leaves( ) {\n if(count() == 1) return;\n if(!empty()){\n leavesNodes(root);\n }\n System.out.println();\n }", "public void testRootHierarchy() throws Exception {\n // Initialize the tree with a driver and a connection\n JDBCDriver driver = Util.createDummyDriver();\n JDBCDriverManager.getDefault().addDriver(driver);\n\n addListener();\n DatabaseConnection conn = DatabaseConnection.create(\n driver, \"jdbc:mark//twain\", \"tomsawyer\", null, \"whitewash\", true);\n ConnectionManager.getDefault().addConnection(conn);\n waitChanged();\n\n RootNode rootNode = RootNode.instance();\n\n // Need to force a refresh because otherwise it happens asynchronously\n // and this test does not pass reliably\n RootNode.instance().getChildNodesSync();\n \n checkConnection(rootNode, conn);\n checkNodeChildren(rootNode);\n }", "public void inOrder(){\n inOrder(root);\n System.out.println();\n }", "public void printTree() {\n Object[] nodeArray = this.toArray();\n for (int i = 0; i < nodeArray.length; i++) {\n System.out.println(nodeArray[i]);\n }\n }", "@Override\n public void printTree() {\n System.out.println(\"node with char: \" + this.getChar() + \" and key: \" + this.getKey());\n int i = 0;\n for(IABTNode node : this.sons) {\n if(!node.isNull()) {\n System.out.print(\"Son \" + i + \" :\");\n node.printTree();\n }\n i++;\n }\n }" ]
[ "0.6238733", "0.61460674", "0.6083021", "0.60009277", "0.59549636", "0.5940999", "0.5938609", "0.5922032", "0.5869212", "0.5865272", "0.58628416", "0.5845674", "0.5815565", "0.5782391", "0.57564497", "0.57470846", "0.5701997", "0.56985486", "0.5670572", "0.5658207", "0.565256", "0.5651699", "0.5645435", "0.56312835", "0.56145954", "0.55915433", "0.55442333", "0.55353993", "0.55352354", "0.5505615", "0.5486315", "0.5482125", "0.54817516", "0.5455823", "0.54480743", "0.5446539", "0.5430236", "0.5423526", "0.5421697", "0.5421357", "0.54122275", "0.54106545", "0.5393051", "0.53916854", "0.53912663", "0.53897256", "0.5389478", "0.5384839", "0.5375774", "0.5368058", "0.5367628", "0.536094", "0.53608215", "0.5358507", "0.5349232", "0.53440726", "0.53390414", "0.53390414", "0.53388464", "0.53358185", "0.5334052", "0.5333141", "0.5331034", "0.53286666", "0.53280604", "0.5325337", "0.53131056", "0.53131056", "0.53131056", "0.53128684", "0.53088945", "0.5308218", "0.52974296", "0.52884763", "0.5276023", "0.527196", "0.52668047", "0.526549", "0.5257272", "0.52513725", "0.52504057", "0.52481824", "0.5247129", "0.5246066", "0.52425796", "0.5240326", "0.5237271", "0.52367115", "0.5234092", "0.5231943", "0.52310866", "0.52305955", "0.52286017", "0.52286017", "0.5227827", "0.5227298", "0.52240515", "0.5218387", "0.5208645", "0.52036345" ]
0.6867662
0
Boot the architecture object.
public abstract void bootArchitecture(boolean emptyMMap);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@OnThread(Tag.Any)\n private void bootBluej()\n {\n initializeBoot();\n try {\n URLClassLoader runtimeLoader = new URLClassLoader(runtimeClassPath, bootLoader);\n \n // Construct a bluej.Main object. This starts BlueJ \"proper\".\n Class<?> mainClass = Class.forName(\"bluej.Main\", true, runtimeLoader);\n mainClass.getDeclaredConstructor().newInstance();\n \n } catch (ClassNotFoundException | InstantiationException | NoSuchMethodException \n | InvocationTargetException | IllegalAccessException exc) {\n throw new RuntimeException(exc);\n }\n }", "private void initializeBoot()\n {\n bootLoader = getClass().getClassLoader();\n\n // Get the home directory of the Java implementation we're being run by\n javaHomeDir = new File(System.getProperty(\"java.home\"));\n\n try {\n runtimeClassPath = getKnownJars(getBluejLibDir(), runtimeJars, false, numBuildJars);\n runtimeUserClassPath = getKnownJars(getBluejLibDir(), userJars, true, numUserBuildJars);\n }\n catch (Exception exc) {\n exc.printStackTrace();\n }\n }", "public void startup() throws Exception\n {\n //\n // instantiate the runtime root application block\n //\n\n synchronized( m_state )\n {\n if( !isStartable() ) return;\n if( getLogger().isDebugEnabled() )\n {\n getLogger().debug( \"application assembly\" );\n }\n\n try\n {\n setState( ASSEMBLY );\n m_model.assemble();\n }\n catch( Exception e )\n {\n setState( INITIALIZED );\n final String error =\n \"Cannot assemble application due to exception.\";\n throw new KernelException( error, e );\n }\n catch( Throwable e )\n {\n setState( INITIALIZED );\n final String error =\n \"Cannot assemble application due to throwable.\";\n throw new KernelRuntimeException( error, e );\n }\n\n if( getLogger().isDebugEnabled() )\n {\n getLogger().debug( \"application deployment\" );\n }\n\n try\n {\n setState( DEPLOYMENT );\n m_model.commission();\n }\n catch( Exception e )\n {\n setState( INITIALIZED );\n final String error =\n \"Cannot deploy application.\";\n throw new KernelException( error, e );\n }\n catch( Throwable e )\n {\n setState( INITIALIZED );\n final String error =\n \"Cannot deploy application.\";\n throw new KernelRuntimeException( error, e );\n }\n \n setState( STARTED );\n }\n }", "@Override\n public void postBootSetup() {\n }", "private static void boot() {\n\t\tEJB3StandaloneBootstrap.boot(null);\r\n\r\n\t\t// Deploy custom stateless beans (datasource, mostly)\r\n\t\tEJB3StandaloneBootstrap.deployXmlResource(\"META-INF/superStar-beans.xml\");\r\n\r\n\t\t// Deploy all EJBs found on classpath (slow, scans all)\r\n\t\t// EJB3StandaloneBootstrap.scanClasspath();\r\n\r\n\t\t// Deploy all EJBs found on classpath (fast, scans only build\r\n\t\t// directory)\r\n\t\t// This is a relative location, matching the substring end of one of\r\n\t\t// java.class.path locations!\r\n\t\t// Print out System.getProperty(\"java.class.path\") to understand\r\n\t\t// this...\r\n\t\tEJB3StandaloneBootstrap.scanClasspath(\"SuperStar/build\".replace(\"/\", File.separator));\r\n\t}", "public synchronized static void load()\n throws Exception\n { \n if (!isBootstrap) {\n String basedir = System.getProperty(JVM_OPT_BOOTSTRAP);\n load(basedir);\n SystemProperties.initializeProperties(\"com.iplanet.am.naming.url\",\n SystemProperties.getServerInstanceName() + \"/namingservice\");\n }\n }", "Architecture createArchitecture();", "void systemBoot();", "public void bootstrapped() {\n configStore.createOrUpdate(NamespaceId.SYSTEM.getNamespace(), TYPE,\n new Config(NAME, Collections.emptyMap()));\n }", "public synchronized static void load()\n throws Exception\n { \n if (!isBootstrap) {\n String basedir = System.getProperty(JVM_OPT_BOOTSTRAP);\n if (load(basedir, false) == null) {\n throw new ConfiguratorException(\n \"configurator.cannot.bootstrap\");\n }\n SystemProperties.initializeProperties(\"com.iplanet.am.naming.url\",\n SystemProperties.getServerInstanceName() + \"/namingservice\");\n }\n }", "public static synchronized void bootstrap() {\n ImplementingClassResolver.clearCache();\n if (bootstrapedNeeded) {\n reflectionsModel.rescann(\"\");\n }\n bootstrapedNeeded = false;\n }", "private void initHardware(){\n }", "public void startup() throws JyroException {\n\t\tClassLoader loader = java.lang.Thread.currentThread().getContextClassLoader();\n\t\tplatform = new JyroPlatform(name, home, loader, null);\n\t\tplatform.startup();\n\t\treturn;\n\t}", "public void autonomousInit() {\n \tNetworkCommAssembly.start();\n }", "private void startUp () {\n NativeMethodBroker.loadLibrary(false);\n try {\n start_up();\n } catch (UnsatisfiedLinkError e) {\n try {\n NativeMethodBroker.loadLibrary(true);\n NativeMethodBroker.traceln(AX_PROGRESS, \"There apparently were problems \" +\n \"in initially loading JavaContainer.dll. \" +\n \"It appears to be ok now. Error message \" +\n \"was \" + e.getMessage());\n start_up();\n } catch (UnsatisfiedLinkError e2) {\n NativeMethodBroker.traceln(AX_ERROR, fatalErrorMessage +\n \" Error message was: \" + e2.getMessage());\n // Really should exit here.\n // System.exit(-1);\n }\n }\n }", "public void boot() throws Exception {\n main = new Main();\n // add routes\n main.addRouteBuilder(this.getRouteBuilder());\n // add event listener\n main.addMainListener(this.getMainListener(getClass()));\n // run until you terminate the JVM\n System.out.println(\"Starting Camel. Use ctrl + c to terminate the JVM.\\n\");\n main.run();\n }", "protected void buildBootstrap() {\n String command = \"-prod -mac -o2 rom -strip:d j2me imp\";\n if (includeDebugger) {\n command += \" debugger\";\n }\n command += \" -- translator\";\n builder(command);\n }", "public abstract void startup();", "public void startup() {\n\t\tstart();\n }", "protected abstract void initializeBartender();", "private void initialize() {\n if (!stopped.get()) {\n \tSystem.out.printf(\"Starting Red5 with args: %s\\n\", Arrays.toString(commandLineArgs));\n // start\n try {\n\t\t\t\tBootstrap.main(commandLineArgs);\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n }\n }", "@Override\n public void prepare() {\n applicationDeployer.initialize();\n this.initialize();\n }", "@Override\n public void startup() {\n }", "private void init() {\n safeLevel = config.getSafeLevel();\n \n // Construct key services\n loadService = config.createLoadService(this);\n posix = POSIXFactory.getPOSIX(new JRubyPOSIXHandler(this), RubyInstanceConfig.nativeEnabled);\n javaSupport = new JavaSupport(this);\n \n if (RubyInstanceConfig.POOLING_ENABLED) {\n executor = new ThreadPoolExecutor(\n RubyInstanceConfig.POOL_MIN,\n RubyInstanceConfig.POOL_MAX,\n RubyInstanceConfig.POOL_TTL,\n TimeUnit.SECONDS,\n new SynchronousQueue<Runnable>(),\n new DaemonThreadFactory());\n }\n \n // initialize the root of the class hierarchy completely\n initRoot();\n \n // Set up the main thread in thread service\n threadService.initMainThread();\n \n // Get the main threadcontext (gets constructed for us)\n ThreadContext tc = getCurrentContext();\n \n // Construct the top-level execution frame and scope for the main thread\n tc.prepareTopLevel(objectClass, topSelf);\n \n // Initialize all the core classes\n bootstrap();\n \n // Initialize the \"dummy\" class used as a marker\n dummyClass = new RubyClass(this, classClass);\n dummyClass.freeze(tc);\n \n // Create global constants and variables\n RubyGlobal.createGlobals(tc, this);\n \n // Prepare LoadService and load path\n getLoadService().init(config.loadPaths());\n \n booting = false;\n \n // initialize builtin libraries\n initBuiltins();\n \n if(config.isProfiling()) {\n getLoadService().require(\"jruby/profiler/shutdown_hook\");\n }\n \n // Require in all libraries specified on command line\n for (String scriptName : config.requiredLibraries()) {\n loadService.require(scriptName);\n }\n }", "private void init() throws UnknownHostException, RemoteException {\n\n FileApp.setMapper(this);\n predKey = 0;\n toDistribute = readNodeEntries();\n //System.out.println(\"Mapper.init() :: toDistribute=\"+toDistribute);\n }", "public BoardSetup() {\n\t\tthis.theBoard = Board.getInstance();\n\t}", "public void startup(){}", "@Override\r\n public void pack() {\r\n super.pack();\r\n JkFileTree.of(this.classDir()).exclude(\"**/*.jar\").zip().to(packer().jarFile(\"lean\"));\r\n distrib();\r\n }", "public ClassLoader getBootClassLoader ()\n {\n return bootLoader;\n }", "public void startUp() {\n\t\t/* Language of App */\n\t\t\n\t\t/* Init Icons */\n\t\tPaintShop.initIcons(display);\n\t\t/* Init all components */\n\t\tinitComponents();\n\t\t\n\t\t\n\t}", "public static void __boot__(ClassMetaClass metaClass) {\n Mutator mutator = metaClass.mutator();\n try {\n mutator.addMixin(RT.getMetaClass(ObjectMixin.class));\n } finally {\n mutator.close();\n }\n }", "@Before\n public void startUp() {\n registry = new DeserializerRegistryImpl();\n registry.init();\n }", "public static void main(String args[]) {\n Main myWork = new Main(); // Construct the bootloader\n myWork.run(); // execute\n }", "public ArmPayPlanConfigBootStrap() {\n }", "public static void someApplicationBootupMethod() {\n if (!AgentLoader.loadAgentFromClasspath(\"avaje-ebeanorm-agent\", \"debug=1;packages=model.**\")) {\n System.out.println(\"avaje-ebeanorm-agent not found in classpath - not dynamically loaded\");\n }\n\n System.out.println(\"avaje-ebeanorm-agent loaded\");\n }", "public void environmentStart(EnvironmentClassLoader loader)\n {\n }", "public void bootConsumer() throws Exception {\n\t\tmain = new Main();\r\n\t\t// bind MyBean into the registry\r\n\t\tmain.bind(\"foo\", new AsimpleBean());\r\n\t\t// add routes\r\n\t\tmain.addRouteBuilder(new SubRouteBuilder());\r\n\r\n\t\t// add event listener\r\n\t\tmain.addMainListener(new SubEvents());\r\n\t\t// run until you terminate the JVM\r\n\t\tSystem.out.println(\"Starting Camel. Use ctrl + c to terminate the JVM.\\n\");\r\n\t\tmain.run();\r\n\t}", "public void autonomousInit() {\n \n }", "public KafkaBacksideEnvironment() {\n\t\tConfigPullParser p = new ConfigPullParser(\"kafka-props.xml\");\n\t\tproperties = p.getProperties();\n\t\tconnectors = new HashMap<String, IPluginConnector>();\n\t\t//chatApp = new SimpleChatApp(this);\n\t\t//mainChatApp = new ChatApp(this);\n\t\t//elizaApp = new ElizaApp(this);\n\t\tbootPlugins();\n\t\t//TODO other stuff?\n\t\tSystem.out.println(\"Booted\");\n\t\t//Register a shutdown hook so ^c will properly close things\n\t\tRuntime.getRuntime().addShutdownHook(new Thread() {\n\t\t public void run() { shutDown(); }\n\t\t});\n\t}", "public void autonomousInit() {\n }", "public void autonomousInit() {\n }", "@Override\n\tprotected void setup() {\n\t\tcarImg();\n\t\tsetResolution(Resolution.MSX);\n\t\tsetFramesPerSecond(100);\n\t\t\n\t\tbola = new Bola();\n\n\t\tbotoes();\n\n\t\tcriaBlocos();\n\n\t\tpaddle = new Paddle();\n\n\t\t\n\n\t}", "private ActorSystemBootstrapTools() {}", "private Boot(Properties props, final FXPlatformSupplier image)\n {\n commandLineProps = null;\n }", "public void run() {\n Runtime.getRuntime().addShutdownHook(new MNOSManagerShutdownHook(this));\n\n OFNiciraVendorExtensions.initialize();\n\n this.startDatabase();\n\n try {\n final ServerBootstrap switchServerBootStrap = this\n .createServerBootStrap();\n\n this.setServerBootStrapParams(switchServerBootStrap);\n\n switchServerBootStrap.setPipelineFactory(this.pfact);\n final InetSocketAddress sa = this.ofHost == null ? new InetSocketAddress(\n this.ofPort) : new InetSocketAddress(this.ofHost,\n this.ofPort);\n this.sg.add(switchServerBootStrap.bind(sa));\n }catch (final Exception e){\n throw new RuntimeException(e);\n }\n\n }", "public static void init() {\n //Reset Flywheel Falcons to factory default\n flywheelMaster.configFactoryDefault();\n flywheelSlave.configFactoryDefault();\n\n //Master settings\n flywheelMaster.setNeutralMode(NeutralMode.Brake); //Set neutral mode to break\n flywheelMaster.configSelectedFeedbackSensor(FeedbackDevice.IntegratedSensor); //Use Falcon 500 Integrated Encoder\n flywheelMaster.setSelectedSensorPosition(0,0,10); //Reset encoder position\n\n //Slave settings\n flywheelSlave.follow(flywheelMaster); //Follow master mode\n flywheelSlave.setInverted(true); //Invert motor to go along with master controller\n flywheelSlave.setNeutralMode(NeutralMode.Brake); //Set neutral mode to break\n }", "@Override\r\n\tpublic void setup(){\n\t\tmidiIO = CCMidiIO.getInstance();\r\n\t\tmidiIO.printDevices();\r\n\r\n\t\t// print a list with all available devices\r\n\t\tmidiIO.printDevices();\r\n\r\n\t\t// open an midiout using the first device and the first channel\r\n\t\tmidiOut = midiIO.midiOut(0, 1);\r\n\r\n\t\tbowl = new Bowl[10];\r\n\t\tfor (int i = 0; i < bowl.length; i++){\r\n\t\t\tbowl[i] = new Bowl(i);\r\n\t\t}\r\n\t}", "public void boot() throws Exception {\n HazelcastInstance hz = Hazelcast.newHazelcastInstance();\n\n // setup the hazelcast idempontent repository which we will use in the route\n HazelcastIdempotentRepository repo = new HazelcastIdempotentRepository(hz, \"camel\");\n\n main = new Main();\n main.enableHangupSupport();\n // bind the hazelcast repository to the name myRepo which we refer to from the route\n main.bind(\"myRepo\", repo);\n // add the route and and let the route be named BAR and use a little delay when processing the files\n main.addRouteBuilder(new FileConsumerRoute(\"BAR\", 100));\n main.run();\n }", "public boolean getBoot() {\n return boot;\n }", "public Bootstrap() {\r\n\t\t//Create or load UserList\r\n\t\tuserList = new CopyOnWriteArrayList<User>();\r\n\t\ttry {\r\n\t\t\tuserList = importUserList();\r\n\t\t} catch (FileNotFoundException e){\r\n\t\t\t\r\n\t\t} catch (IOException | ClassNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tthis.ip_adresse = StaticFunctions.loadPeerIp();\t\t\t//Load ip-address\r\n\t\t\r\n\t\t//Create a new Zone\r\n\t\tcreateZone(new Point(0.0, 0.0), new Point(1.0, 1.0));\t//initialize zone\r\n\t}", "protected void setup(){\n setupRouter();\n \n if( bluetoothEnabled ){\n setupBluetooth();\n }\n }", "private void setupLauncherClassLoader() throws Exception {\n ClassLoader extCL = ClassLoader.getSystemClassLoader().getParent();\n ClassPathBuilder cpb = new ClassPathBuilder(extCL);\n\n try {\n addFrameworkJars(cpb);\n addJDKToolsJar(cpb);\n findDerbyClient(cpb);\n File moduleDir = bootstrapFile.getParentFile();\n cpb.addGlob(moduleDir, additionalJars);\n this.launcherCL = cpb.create();\n } catch (IOException e) {\n throw new Error(e);\n }\n Thread.currentThread().setContextClassLoader(launcherCL);\n }", "public void autonomousInit() {\n\t\t\n\t}", "public void start() {\n\t\tSystem.out.println(\"BMW start method\");\n\t}", "public abstract void init() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, RemoteReadException, InterruptedException;", "private void setupAllMafiosis()\n {\n }", "private void appInitialization(){\n openRom();\n openGuide();\n setOffset(0);\n addressChanged();\n }", "public void bootPublisher() throws Exception {\n\t\tmain = new Main();\r\n\t\t// bind MyBean into the registry\r\n\t\tmain.bind(\"foo\", new AsimpleBean());\r\n\t\tmain.addRouteBuilder(new PubRouteBuilder());\r\n\t\t// add event listener\r\n\t\tPubEvents pubEvt = new PubEvents();\r\n\t\tpubEvt.setMessage(this.getMessage());\r\n\t\tmain.addMainListener(pubEvt);\r\n\t\t// run until you terminate the JVM\r\n\t\tmain.run();\r\n\t\tSystem.out.println(\"Starting Camel. Use ctrl + c to terminate the JVM.\\n\");\r\n\r\n\t}", "public void rebootToBootloader() {\n mPowerManager.reboot(\"bootloader\");\n }", "@Override\n public void onMachineAssembled()\n {\n \n }", "protected abstract void initHardwareInstructions();", "@Override\n\tprotected void setup() {\n\t\tgetContentManager().registerLanguage(new SLCodec());\n\t\tgetContentManager().registerOntology(MobilityOntology.getInstance());\n\t\tthis.addBehaviour(new ReceiveMessage());\n\t}", "private void initializeStartup()\n {\n /* Turn off Limelight LED when first started up so it doesn't blind drive team. */\n m_limelight.turnOffLED();\n\n /* Start ultrasonics. */\n m_chamber.startUltrasonics();\n }", "public static void init() {\r\n try {\r\n defaultImplementation = new LinkLayer_Impl_PC();\r\n } catch (IOException e) {\r\n Log.e(TAG, e, \"Failed in creating defaultImplementation!\");\r\n }\r\n }", "@Override\r\n\tpublic void startup() {\n\t\tif(!initialized)\r\n\t\t\tinitOperation();\r\n\t\tregisterMBean();\r\n\t}", "protected abstract void setup();", "public HALMapper() {\n registerModule(DEFAULT_HAL_MODULE);\n }", "public void setBootable(java.lang.Boolean bootable) {\r\n this.bootable = bootable;\r\n }", "@Override\n protected void setup() {\n // exception handling for invoke the main2();\n try {\n main2();\n } catch (StaleProxyException e) {\n e.printStackTrace();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n // create central agent of the application\n try {\n AgentController Main = main1.createNewAgent(\"Main\",\"test.Main\",null);\n Main.start();\n } catch (StaleProxyException e) {\n e.printStackTrace();\n }\n try {\n showResualt();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "public static void init() {\n\t\tregisterRecipes();\n\t\tregisterShapelessRecipes();\n\t\tregisterSmeltingRecipes();\n\t}", "private void init() throws ClassNotFoundException{\n }", "private void startBootstrapServices() {\n traceBeginAndSlog(\"StartWatchdog\");\n Watchdog watchdog = Watchdog.getInstance();\n watchdog.start();\n traceEnd();\n if (MAPLE_ENABLE) {\n this.mPrimaryZygotePreload = SystemServerInitThreadPool.get().submit($$Lambda$SystemServer$UyrPns7R814gZEylCbDKhe8It4.INSTANCE, \"PrimaryZygotePreload\");\n }\n Slog.i(TAG, \"Reading configuration...\");\n traceBeginAndSlog(\"ReadingSystemConfig\");\n SystemServerInitThreadPool.get().submit($$Lambda$YWiwiKm_Qgqb55C6tTuq_n2JzdY.INSTANCE, \"ReadingSystemConfig\");\n traceEnd();\n traceBeginAndSlog(\"StartInstaller\");\n this.installer = (Installer) this.mSystemServiceManager.startService(Installer.class);\n traceEnd();\n traceBeginAndSlog(\"DeviceIdentifiersPolicyService\");\n this.mSystemServiceManager.startService(DeviceIdentifiersPolicyService.class);\n traceEnd();\n traceBeginAndSlog(\"UriGrantsManagerService\");\n this.mSystemServiceManager.startService(UriGrantsManagerService.Lifecycle.class);\n traceEnd();\n traceBeginAndSlog(\"StartActivityManager\");\n ActivityTaskManagerService atm = this.mSystemServiceManager.startService(ActivityTaskManagerService.Lifecycle.class).getService();\n this.mActivityManagerService = ActivityManagerService.Lifecycle.startService(this.mSystemServiceManager, atm);\n this.mActivityManagerService.setSystemServiceManager(this.mSystemServiceManager);\n this.mActivityManagerService.setInstaller(this.installer);\n this.mWindowManagerGlobalLock = atm.getGlobalLock();\n traceEnd();\n traceBeginAndSlog(\"StartPowerManager\");\n try {\n this.mPowerManagerService = (PowerManagerService) this.mSystemServiceManager.startService(\"com.android.server.power.HwPowerManagerService\");\n } catch (RuntimeException e) {\n Slog.w(TAG, \"create HwPowerManagerService failed\");\n this.mPowerManagerService = (PowerManagerService) this.mSystemServiceManager.startService(PowerManagerService.class);\n }\n traceEnd();\n traceBeginAndSlog(\"StartThermalManager\");\n this.mSystemServiceManager.startService(ThermalManagerService.class);\n traceEnd();\n try {\n Slog.i(TAG, \"PG Manager service\");\n this.mPGManagerService = PGManagerService.getInstance(this.mSystemContext);\n } catch (Throwable e2) {\n reportWtf(\"PG Manager service\", e2);\n }\n traceBeginAndSlog(\"InitPowerManagement\");\n this.mActivityManagerService.initPowerManagement();\n traceEnd();\n traceBeginAndSlog(\"StartRecoverySystemService\");\n this.mSystemServiceManager.startService(RecoverySystemService.class);\n traceEnd();\n RescueParty.noteBoot(this.mSystemContext);\n traceBeginAndSlog(\"StartLightsService\");\n try {\n this.mSystemServiceManager.startService(\"com.android.server.lights.LightsServiceBridge\");\n } catch (RuntimeException e3) {\n Slog.w(TAG, \"create LightsServiceBridge failed\");\n this.mSystemServiceManager.startService(LightsService.class);\n }\n traceEnd();\n traceBeginAndSlog(\"StartSidekickService\");\n if (SystemProperties.getBoolean(\"config.enable_sidekick_graphics\", false)) {\n this.mSystemServiceManager.startService(WEAR_SIDEKICK_SERVICE_CLASS);\n }\n traceEnd();\n traceBeginAndSlog(\"StartDisplayManager\");\n this.mDisplayManagerService = (DisplayManagerService) this.mSystemServiceManager.startService(DisplayManagerService.class);\n traceEnd();\n try {\n this.mSystemServiceManager.startService(\"com.android.server.security.HwSecurityService\");\n Slog.i(TAG, \"HwSecurityService start success\");\n } catch (Exception e4) {\n Slog.e(TAG, \"can't start HwSecurityService service\");\n }\n traceBeginAndSlog(\"WaitForDisplay\");\n this.mSystemServiceManager.startBootPhase(100);\n traceEnd();\n String cryptState = (String) VoldProperties.decrypt().orElse(\"\");\n if (ENCRYPTING_STATE.equals(cryptState)) {\n Slog.w(TAG, \"Detected encryption in progress - only parsing core apps\");\n this.mOnlyCore = true;\n } else if (ENCRYPTED_STATE.equals(cryptState)) {\n Slog.w(TAG, \"Device encrypted - only parsing core apps\");\n this.mOnlyCore = true;\n }\n HwBootCheck.bootSceneEnd(100);\n HwBootFail.setBootTimer(false);\n HwBootCheck.bootSceneStart(105, 900000);\n if (!this.mRuntimeRestart) {\n MetricsLogger.histogram((Context) null, \"boot_package_manager_init_start\", (int) SystemClock.elapsedRealtime());\n }\n traceBeginAndSlog(\"StartPackageManagerService\");\n try {\n Watchdog.getInstance().pauseWatchingCurrentThread(\"packagemanagermain\");\n this.mPackageManagerService = PackageManagerService.main(this.mSystemContext, this.installer, this.mFactoryTestMode != 0, this.mOnlyCore);\n Watchdog.getInstance().resumeWatchingCurrentThread(\"packagemanagermain\");\n this.mFirstBoot = this.mPackageManagerService.isFirstBoot();\n this.mPackageManager = this.mSystemContext.getPackageManager();\n Slog.i(TAG, \"Finish_StartPackageManagerService\");\n traceEnd();\n if (!this.mRuntimeRestart && !isFirstBootOrUpgrade()) {\n MetricsLogger.histogram((Context) null, \"boot_package_manager_init_ready\", (int) SystemClock.elapsedRealtime());\n HwBootCheck.addBootInfo(\"[bootinfo]\\nisFirstBoot: \" + this.mFirstBoot + \"\\nisUpgrade: \" + this.mPackageManagerService.isUpgrade());\n HwBootCheck.bootSceneStart(101, JobStatus.DEFAULT_TRIGGER_MAX_DELAY);\n HwBootFail.setBootTimer(true);\n }\n HwBootCheck.bootSceneEnd(105);\n if (!this.mOnlyCore && !SystemProperties.getBoolean(\"config.disable_otadexopt\", false)) {\n traceBeginAndSlog(\"StartOtaDexOptService\");\n try {\n Watchdog.getInstance().pauseWatchingCurrentThread(\"moveab\");\n OtaDexoptService.main(this.mSystemContext, this.mPackageManagerService);\n } catch (Throwable th) {\n Watchdog.getInstance().resumeWatchingCurrentThread(\"moveab\");\n traceEnd();\n throw th;\n }\n Watchdog.getInstance().resumeWatchingCurrentThread(\"moveab\");\n traceEnd();\n }\n traceBeginAndSlog(\"StartUserManagerService\");\n this.mSystemServiceManager.startService(UserManagerService.LifeCycle.class);\n traceEnd();\n traceBeginAndSlog(\"InitAttributerCache\");\n AttributeCache.init(this.mSystemContext);\n traceEnd();\n traceBeginAndSlog(\"SetSystemProcess\");\n this.mActivityManagerService.setSystemProcess();\n traceEnd();\n traceBeginAndSlog(\"InitWatchdog\");\n watchdog.init(this.mSystemContext, this.mActivityManagerService);\n traceEnd();\n this.mDisplayManagerService.setupSchedulerPolicies();\n traceBeginAndSlog(\"StartOverlayManagerService\");\n this.mSystemServiceManager.startService(new OverlayManagerService(this.mSystemContext, this.installer));\n traceEnd();\n traceBeginAndSlog(\"StartSensorPrivacyService\");\n this.mSystemServiceManager.startService(new SensorPrivacyService(this.mSystemContext));\n traceEnd();\n if (SystemProperties.getInt(\"persist.sys.displayinset.top\", 0) > 0) {\n this.mActivityManagerService.updateSystemUiContext();\n ((DisplayManagerInternal) LocalServices.getService(DisplayManagerInternal.class)).onOverlayChanged();\n }\n this.mSensorServiceStart = SystemServerInitThreadPool.get().submit($$Lambda$SystemServer$oG4I04QJrkzCGs6IcMTKU2211A.INSTANCE, START_SENSOR_SERVICE);\n } catch (Throwable th2) {\n Watchdog.getInstance().resumeWatchingCurrentThread(\"packagemanagermain\");\n throw th2;\n }\n }", "public void start() {\r\n\t\tsetupWWD();\r\n\t\tsetupStatusBar();\r\n\t\tsetupViewControllers();\r\n\t\tsetupSky();\r\n\t\t//setupAnnotationToggling();\r\n\r\n\t\t// Center the application on the screen.\r\n\t\tWWUtil.alignComponent(null, this, AVKey.CENTER);\r\n\t\t\r\n\t\tgetLayerEnableCmd().run(); // Enable/disable the desired layers.\r\n\t}", "@Override\n\tpublic void start() {\n\t\tSystem.out.println(\"BMW -- start\");\n\t}", "private void loadInitializationAttributes() {\n \t\tURL url = BootLoader.getInstallURL();\n \n \t\t// load any initialization attributes. These are the default settings for\n \t\t// key attributes (eg. default primary feature) supplied by the packaging team.\n \t\t// They are always reloaded on startup to pick up any changes due to\n \t\t// \"native\" updates.\n \t\tProperties initProps = new Properties();\n \t\tInputStream is = null;\n \t\ttry {\n \t\t\tURL initURL = new URL(url, CONFIG_FILE_INIT);\n \t\t\tis = initURL.openStream();\n \t\t\tinitProps.load(is);\n \t\t\tif (DEBUG)\n \t\t\t\tdebug(\"Defaults from \" + initURL.toExternalForm()); //$NON-NLS-1$\n \t\t} catch (IOException e) {\n \t\t\treturn; // could not load default settings\n \t\t} finally {\n \t\t\tif (is != null) {\n \t\t\t\ttry {\n \t\t\t\t\tis.close();\n \t\t\t\t} catch (IOException e) {\n \t\t\t\t\t// ignore ...\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \n \t\t// use default settings if supplied\n \t\tString initId = loadAttribute(initProps, INIT_DEFAULT_FEATURE_ID, null);\n \t\tif (initId != null) {\n \t\t\tString application = loadAttribute(initProps, INIT_DEFAULT_FEATURE_APPLICATION, null);\n \t\t\tString initPluginId = loadAttribute(initProps, INIT_DEFAULT_PLUGIN_ID, null);\n \t\t\tif (initPluginId==null)\n \t\t\t\tinitPluginId = initId;\n \t\t\tIFeatureEntry fe = findConfiguredFeatureEntry(initId);\n \n \t\t\tif (fe == null) {\n \t\t\t\t// bug 26896 : setup optimistic reconciliation if the primary feature has changed or is new\n \t\t\t\tcmdFirstUse = true;\n \t\t\t\t// create entry if not exists\n \t\t\t\tfe = createFeatureEntry(initId, null, initPluginId, null, true, application, null);\n \t\t\t} else\n \t\t\t\t// update existing entry with new info\n \t\t\t\tfe = createFeatureEntry(initId, fe.getFeatureVersion(), fe.getFeaturePluginIdentifier(), fe.getFeaturePluginVersion(), fe.canBePrimary(), application, fe.getFeatureRootURLs());\n \t\t\tconfigureFeatureEntry(fe);\n \t\t\tdefaultFeature = initId;\n \t\t\tif (DEBUG) {\n \t\t\t\tdebug(\" Default primary feature: \" + defaultFeature); //$NON-NLS-1$\n \t\t\t\tif (application != null)\n \t\t\t\t\tdebug(\" Default application : \" + application); //$NON-NLS-1$\n \t\t\t}\n \t\t}\n \t}", "private void initialiseByHand() {\n Configuration production = new Configuration(\"api.example.com\", false, 2000);\n Configuration staging = new Configuration(\"api-staging.example.com\", false, 2000);\n Configuration debug = new Configuration(\"api-dev.example.com\", true, 1000);\n Map<String, Configuration> baseVariants = new HashMap<>();\n baseVariants.put(PRODUCTION, production);\n baseVariants.put(STAGING, staging);\n baseVariants.put(DEBUG, debug);\n Neanderthal.initialise(this, baseVariants, PRODUCTION);\n }", "private <B, I> void _start() throws Exception\n {\n bootstrap.bindBean(ApplicationDescriptor.class, null, descriptor);\n\n // Bind the application context\n bootstrap.declareBean(ApplicationContext.class, null, InternalApplicationContext.class);\n\n //\n bootstrap.setFilter(new BeanFilter()\n {\n public <T> boolean acceptBean(Class<T> beanType)\n {\n if (beanType.getName().startsWith(\"org.juzu.\") || beanType.getAnnotation(Export.class) != null)\n {\n return false;\n }\n else\n {\n // Do that better with a meta annotation that describe Juzu annotation\n // that veto beans\n for (Method method : beanType.getMethods())\n {\n if (method.getAnnotation(View.class) != null || method.getAnnotation(Action.class) != null || method.getAnnotation(Resource.class) != null)\n {\n return false;\n }\n }\n return true;\n }\n }\n });\n\n // Bind the scopes\n for (Scope scope : Scope.values())\n {\n bootstrap.addScope(scope);\n }\n\n // Bind the controllers\n for (ControllerDescriptor controller : descriptor.getControllers())\n {\n bootstrap.declareBean(controller.getType(), null, (Class)null);\n }\n\n // Bind the templates\n for (TemplateDescriptor template : descriptor.getTemplates())\n {\n bootstrap.declareBean(Template.class, null, template.getType());\n }\n\n //\n Class<?> s = descriptor.getPackageClass();\n\n // Bind the bean bindings\n Bindings bindings = s.getAnnotation(Bindings.class);\n if (bindings != null)\n {\n for (Binding binding : bindings.value())\n {\n Class<?> type = binding.value();\n Class<?> implementation = binding.implementation();\n if (MetaProvider.class.isAssignableFrom(implementation))\n {\n MetaProvider mp = (MetaProvider)implementation.newInstance();\n Provider provider = mp.getProvider(type);\n bootstrap.bindProvider(type, null, provider);\n }\n else if (Provider.class.isAssignableFrom(implementation))\n {\n Method m = implementation.getMethod(\"get\");\n ArrayList<Annotation> qualifiers = null;\n for (Annotation annotation : m.getAnnotations())\n {\n if (annotation.annotationType().getAnnotation(Qualifier.class) != null)\n {\n if (qualifiers == null)\n {\n qualifiers = new ArrayList<Annotation>();\n }\n qualifiers.add(annotation);\n }\n }\n bootstrap.declareProvider(type, qualifiers, (Class)implementation);\n }\n else\n {\n if (implementation == Object.class)\n {\n implementation = null;\n }\n bootstrap.declareBean((Class)type, null, (Class)implementation);\n }\n }\n }\n\n //\n List<Class<? extends Plugin>> plugins = descriptor.getPlugins();\n\n // Declare the plugins\n for (Class<? extends Plugin> pluginType : plugins)\n {\n bootstrap.declareBean(pluginType, null, null);\n }\n\n //\n InjectManager<B, I> manager = bootstrap.create();\n\n //\n B contextBean = manager.resolveBean(ApplicationContext.class);\n I contextInstance = manager.create(contextBean);\n \n // Get plugins\n ArrayList<Plugin> p = new ArrayList<Plugin>();\n for (Class<? extends Plugin> pluginType : plugins)\n {\n B pluginBean = manager.resolveBean(pluginType);\n I pluginInstance = manager.create(pluginBean);\n Object o = manager.get(pluginBean, pluginInstance);\n p.add((Plugin)o);\n }\n\n //\n this.context = (InternalApplicationContext)manager.get(contextBean, contextInstance);\n }", "public interface BootLoaderManager {\n\n /**\n * 注入上下文\n * @param atlasWrapperApplicationContext\n */\n BootLoaderManager attachContext(AtlasWrapperApplicationContext atlasWrapperApplicationContext);\n\n /**\n * 获取上下文环境\n * @return\n */\n AtlasWrapperApplicationContext getContext();\n\n /**\n * 启动加载\n */\n void load();\n}", "public AbstractBootstrap()\n {\n }", "public void simpleInitApp() {\n//\t\t\t\tdl=new DirectionalLight(new Vector3f(0f, 1f, 0),new ColorRGBA(.72f,.97f,1f,1f).mult(1.4f));\n//\t\t\t\trootNode.addLight(dl);\n\t\t\t\tF3bLoader.init(assetManager);\n\t\t\t\tflyCam.setMoveSpeed(10f);\n\t\t\t\tflyCam.setDragToRotate(true);\n\t\t\t\trun_tab.put(this,new Object());\n\t\t\t}", "public void robotInit() {\r\n\t\t// Create and start the compressor. It will control pressure automagically\r\n\t\tCompressor comp = new Compressor(RobotMap.pneumaticPreasureSwitch, RobotMap.compresserRelay);\r\n\t\tcomp.start();\r\n\r\n\t\t// instantiate the command used for the autonomous period\r\n\t\tautonomousCommand = new Autonomous();\r\n\r\n\t\t// Initialize all subsystems\r\n\t\tCommandBase.init();\r\n\t}", "public void autonomousInit() {\n\t\tSystem.out.println(\"Auto Init\");\n//\t\tint autonStep = 0;\t//step that autonomous is executing\n\t\tclaw = new Claw();\n\t\televator = new Elevator();\n//\t\televator.elevator();\n\t\tdecode = new Decode();\n//\t\tdecode.decode();\n\t}", "public void setup() {\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tthis.bag.add(new Gem(1));\r\n\t\t}\r\n\t\tthis.bag.add(new Crash());\r\n\t}", "void startup();", "void startup();", "@Override\n public void autonomousInit()\n {\n System.out.println(\"Initializing autonomous mode...\");\n\n // zero arm encoder only in autonomous\n //cargoArm.zeroEncoder();\n\n commonInit();\n\n // move hatch finger down\n \n hatchArm.fingerSentDown = false;\n hatchArm.toggleFinger();\n\n System.out.println(\"Autonomous initialization complete.\");\n }", "@Override\n public void initialize(Bootstrap<SkyeWorkerConfiguration> bootstrap) {\n this.bootstrap = bootstrap;\n }", "@Override\n\tpublic void initialize(Bootstrap<MicroServicioRequerimientosConfig> bootstrap) {\n\t\t\n\t}", "protected void initialize() {\n\t\tif (type == switchType.True) {\n\t\t\tVariables.platformStatus = true;\n\t\t}\n\t\telse if (type == switchType.False) {\n\t\t\tVariables.platformStatus = false;\n\t\t}\n\t\telse {\n\t\t\tVariables.platformStatus = !Variables.platformStatus;\n\t\t}\n\t\tgo.start();\n\t}", "private void readEntityDeploymentInitial() {\n for (Class<?> entityClass : bootupClasses.getEntities()) {\n DeployBeanInfo<?> info = createDeployBeanInfo(entityClass);\n deployInfoMap.put(entityClass, info);\n Class<?> embeddedIdType = info.getEmbeddedIdType();\n if (embeddedIdType != null) {\n embeddedIdTypes.add(embeddedIdType);\n }\n }\n for (Class<?> entityClass : bootupClasses.getEmbeddables()) {\n DeployBeanInfo<?> info = createDeployBeanInfo(entityClass);\n deployInfoMap.put(entityClass, info);\n if (embeddedIdTypes.contains(entityClass)) {\n // register embeddedId types early - scalar properties only\n // and needed for creating BeanTables (id properties)\n registerEmbeddedBean(info);\n } else {\n // delay register of other embedded beans until after\n // the BeanTables have been created to support ManyToOne\n embeddedBeans.add(info);\n }\n }\n }", "private void initializeBoundary() {\n\t\tapp = new Application(model);\n\t}", "protected void init() {\n try {\n updateDevice();\n } catch (Exception e) {\n RemoteHomeManager.log.error(42,e);\n }\n }", "protected void ensureLoaded()\n {\n if (!m_fLoaded)\n {\n if (m_abClazz != null)\n {\n ByteArrayInputStream streamRaw = new ByteArrayInputStream(m_abClazz);\n DataInput stream = new DataInputStream(streamRaw);\n try\n {\n disassemble(stream, m_pool);\n }\n catch (IOException e)\n {\n throw ensureRuntimeException(e);\n }\n }\n\n m_fLoaded = true;\n }\n }", "public abstract ArchECoreArchitecture newArchitecture(ArchEVersionVO version) throws ArchEException;", "abstract void setup();", "protected void setup() {\n /**\n * Content manager manages the content languages and ontologies \"known\" by a given agent.\n * We register new languages that is required that our agent knows.\n * SLCodec is the codec class for the FIPA-SLn languages.\n * MobilityOntology is the class that represents the ontology used for JADE mobility.\n */\n getContentManager().registerLanguage(new SLCodec());\n getContentManager().registerOntology(MobilityOntology.getInstance());\n\n /**\n * Create containers. ProfileImpl allows us to set boot-parameters for the new containers.\n */\n homeContainer = getContainerController(); //retrieve the containercontroller that this agent lives in\n createdContainers = new AgentContainer[3]; //we require 3 containers for this scenario\n ProfileImpl curatorContainer1 = new ProfileImpl();\n curatorContainer1.setParameter(ProfileImpl.CONTAINER_NAME, \"Curator-Container-1\");\n ProfileImpl curatorContainer2 = new ProfileImpl();\n curatorContainer2.setParameter(ProfileImpl.CONTAINER_NAME, \"Curator-Container-2\");\n ProfileImpl artistManagerContainer = new ProfileImpl();\n artistManagerContainer.setParameter(ProfileImpl.CONTAINER_NAME, \"Artistmanager-Container\");\n createdContainers[0] = runtime.createAgentContainer(curatorContainer1);\n createdContainers[1] = runtime.createAgentContainer(curatorContainer2);\n createdContainers[2] = runtime.createAgentContainer(artistManagerContainer);\n doWait(2000); //wait while containers initializes\n\n /**\n * Request a list of all containers on the platform from AMS\n */\n getAllContainers();\n\n /**\n * Initialize gui\n */\n\n myGui = new ControllerAgentGUI(this, (String[]) containersOnPlatform.keySet().toArray(new String[containersOnPlatform.keySet().size()]));\n myGui.setVisible(true);\n }", "public void startup() throws MbStartupException {\r\n //start up MbModule\r\n super.startup();\r\n\r\n //get all room objects from the data repository\r\n DataRepository.DataList list = dataRepository.getList(\"roomobjects\");\r\n if (list!=null) {\r\n Iterator items = list.items();\r\n while (items.hasNext()) {\r\n DataRepository.DataListItem item = (DataRepository.DataListItem)items.next();\r\n String name = (String)item.getField(\"name\");\r\n String address = (String)item.getField(\"nodename\");\r\n \r\n String bytes = (String)item.getField(\"byte\");\r\n String[] bytearray = bytes.split(\",\");\r\n UByte[] b = new UByte[bytearray.length];\r\n for (int i = 0; i < bytearray.length; i++) {\r\n \tb[i] = UByte.parseUByte(bytearray[i]);\r\n }\r\n //UByte b = UByte.parseUByte((String)item.getField(\"byte\"));\r\n \r\n boolean pub = ((String)item.getField(\"public\")).equals(\"true\");\r\n String remotebtn = item.containsField(\"remotebutton\") ? (String)item.getField(\"remotebutton\") : \"\";\r\n roomObjects.put(name, new GenRoomObject(name, address, b, remotebtn, pub));\r\n }\r\n }\r\n //no room objects found in data repository\r\n else {\r\n _info.println(\"roomobjects-list is missing. no room objects defined!\");\r\n }\r\n\r\n //if we have any room objects\r\n if (!roomObjects.isEmpty()) {\r\n //lets send requests for their remote control buttons\r\n MbPacket p = new MbPacket();\r\n p.setDestination(new MbLocation(\"self\", \"RemoteControl\"));\r\n Iterator it = roomObjects.keySet().iterator();\r\n while (it.hasNext()) {\r\n String key = (String) it.next();\r\n GenRoomObject o = (GenRoomObject) roomObjects.get(key);\r\n if (o != null) {\r\n p.appendContents(\" <buttonrequest button=\\\"\" + o.remoteButton + \"\\\" module=\\\"\" + name() + \"\\\" />\");\r\n }\r\n }\r\n sendPacket(p);\r\n }\r\n }", "protected void bootstrap() throws KikahaException {\n\t\ttry {\n\t\t\tval deploymentContext = createDeploymentContext();\n\t\t\trunDeploymentHooks(deploymentContext);\n\t\t\tdeployWebResourceFolder(deploymentContext);\n\t\t\tthis.deploymentContext = deploymentContext;\n\t\t} catch (final ServiceProviderException cause) {\n\t\t\tthrow new KikahaException(cause);\n\t\t}\n\t}", "protected void initApplication() throws Exception {\r\n\t\tthis.updateDynamicWelcomeText(\"Initializing application subsystem...\");\r\n\r\n\t\t// default (true) is that ImageIO caches images to disk when they are\r\n\t\t// read!\r\n\t\tImageIO.setUseCache(false);\r\n\r\n\t\t// Use of MediaLib acceleration or not\r\n\t\t// JAI 1.1.3 native acceleration problems:\r\n\t\t// SubSampleAverage: sometimes black lines around tiles (Pyramid\r\n\t\t// Dimension)\r\n\t\tSystem.setProperty(\"com.sun.media.jai.disableMediaLib\", \"true\");\r\n\r\n\t\t// initialize all IQM user operators for JAI\r\n\t\tCommonTools.setDefaultToolTipDelays();\r\n\r\n\t\t// initialize the factories, registries and dynamic menus\r\n\t\tTaskFactory.getInstance();\r\n\t\tPluginRegistry.getInstance();\r\n\t\tOperatorRegistry.getInstance();\r\n\t\tPluginMenu.getInstance();\r\n\t\t// initialize the Groovy script engine\r\n\r\n\t\t// initialize the workflow control classes\r\n\t\tTank.getInstance();\r\n\t\tManager.getInstance();\r\n\t\tLook.getInstance();\r\n\t\tPlot.getInstance();\r\n\t\tTable.getInstance();\r\n\t\tText.getInstance();\r\n\r\n\t\t// register other singletons\r\n\t\tDialogUtil.getInstance();\r\n\r\n\t\t// register all standard operators\r\n\t\tOperatorRegistryHelper.registerImageOperators();\r\n\t\tOperatorRegistryHelper.registerPlotOperators();\r\n\r\n\t\t// initialize the custom cursors\r\n\t\tCursorFactory.initializeCustomCursors();\r\n\r\n\t\t// register the plugins\r\n\t\tthis.loadPlugins();\r\n\r\n\t\t// TileCache Memory, etc..\r\n\t\tthis.setJAIDefaultOptions();\r\n\t}", "@Override\n protected void startUp() {\n }" ]
[ "0.6667256", "0.6453917", "0.64463377", "0.6360887", "0.6200039", "0.60260916", "0.5966028", "0.58688366", "0.5824195", "0.57677126", "0.56869775", "0.5654185", "0.5645782", "0.5619389", "0.5576328", "0.5566721", "0.5526447", "0.55190843", "0.54227746", "0.5415055", "0.54020387", "0.5353884", "0.5342478", "0.53286153", "0.53285855", "0.5326432", "0.5299486", "0.5296671", "0.52940947", "0.52920055", "0.52871585", "0.5282777", "0.52821344", "0.5258084", "0.5235287", "0.52253324", "0.52186954", "0.5208039", "0.51958805", "0.5194905", "0.5194905", "0.51894957", "0.5188219", "0.5185517", "0.5176715", "0.51741666", "0.51663", "0.5151155", "0.5145117", "0.51332366", "0.5122552", "0.51196796", "0.5117615", "0.51167846", "0.50990134", "0.50882095", "0.508004", "0.5075406", "0.5065537", "0.5058753", "0.5053417", "0.5051849", "0.50480133", "0.5044488", "0.50391203", "0.5036386", "0.5031559", "0.50308454", "0.50305486", "0.5030458", "0.50248694", "0.5010197", "0.4997269", "0.49880612", "0.498467", "0.49819294", "0.4974592", "0.4970963", "0.49705502", "0.4966871", "0.496599", "0.49617738", "0.49523556", "0.4944287", "0.4944287", "0.49433357", "0.49417368", "0.49311334", "0.49305832", "0.49220908", "0.49204618", "0.4916421", "0.49164137", "0.489963", "0.48988223", "0.48939005", "0.4892295", "0.48892292", "0.48889387", "0.4885587" ]
0.68274295
0
Created by xiaowenlong on 18/8/2017.
public interface IProvider extends BaseProvider{ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "public final void mo51373a() {\n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n public void func_104112_b() {\n \n }", "public void mo38117a() {\n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "public void mo4359a() {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "private void poetries() {\n\n\t}", "@Override\n public int describeContents() { return 0; }", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n protected void initialize() \n {\n \n }", "private void m50366E() {\n }", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n public void init() {\n }", "@Override\n void init() {\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "private static void cajas() {\n\t\t\n\t}", "public void gored() {\n\t\t\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "public void mo6081a() {\n }", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\n public void init() {}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public void initialize() { \n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n protected void init() {\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\r\n\tpublic void init() {}", "Petunia() {\r\n\t\t}", "public Pitonyak_09_02() {\r\n }", "@Override\n public void initialize() {\n \n }", "private void init() {\n\n\t}", "@Override\n public int getSize() {\n return 1;\n }", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "public void mo12930a() {\n }", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public final void mo91715d() {\n }", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public void mo12628c() {\n }", "private void kk12() {\n\n\t}", "protected boolean func_70814_o() { return true; }" ]
[ "0.621902", "0.6060641", "0.59615666", "0.5848769", "0.58418477", "0.58418477", "0.5806001", "0.57881355", "0.57454324", "0.5679951", "0.56784564", "0.5671982", "0.5657199", "0.56465125", "0.5631826", "0.5620933", "0.56173205", "0.56173205", "0.56173205", "0.56173205", "0.56173205", "0.56173205", "0.5608228", "0.56075716", "0.56034154", "0.5592216", "0.55877346", "0.5585156", "0.5583439", "0.5572096", "0.5567223", "0.55615497", "0.55614763", "0.55508566", "0.5547343", "0.5547343", "0.55450976", "0.55244184", "0.55097896", "0.55097896", "0.55033875", "0.5494832", "0.54875493", "0.54839176", "0.54839176", "0.54839176", "0.54839176", "0.54839176", "0.5479858", "0.54712546", "0.5462911", "0.54619586", "0.5460336", "0.5459068", "0.54571223", "0.54553944", "0.5448236", "0.5445148", "0.54437417", "0.5436659", "0.5436659", "0.5436659", "0.5436659", "0.5436659", "0.5436659", "0.5436659", "0.54219425", "0.5417102", "0.54072946", "0.54072946", "0.5403218", "0.53988147", "0.5396214", "0.53914964", "0.53878033", "0.53878033", "0.53878033", "0.5380362", "0.5380362", "0.5380362", "0.5377351", "0.5373226", "0.5370063", "0.5368916", "0.53677523", "0.53648055", "0.53597546", "0.5346313", "0.5346313", "0.53426766", "0.53387904", "0.5335689", "0.5331816", "0.5331816", "0.5331816", "0.53293043", "0.53293043", "0.53293043", "0.5328523", "0.5328471", "0.5319233" ]
0.0
-1
TODO Autogenerated method stub
@Override protected void initListener() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Of the first constructor Is the state available? Just a stub here.
public boolean isStateAvailable(int paraState) { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public InitialState() {\r\n\t\t}", "public State(){}", "private StateUtils() {}", "@Override\n public void initState() {\n \n\t//TODO: Complete Method\n\n }", "abstract public boolean init();", "private State5() {\n\t}", "public abstract boolean init();", "protected abstract boolean init();", "public void\ninit(SoState state)\n//\n////////////////////////////////////////////////////////////////////////\n{\n flags = 0;\n}", "public void testCtor() {\n assertNotNull(\"Failed to create a new AddActionStateAction instance.\", action);\n assertTrue(\"The state should be formatted.\", state.isSpecification());\n }", "public State()\n {\n this(\"\");\n }", "@Test\n @DisplayName(\"The state key must match what was provided in the constructor\")\n void testStateKey() {\n final var state = new WritableSingletonStateBase<>(COUNTRY_STATE_KEY, () -> AUSTRALIA, val -> {});\n assertThat(state.getStateKey()).isEqualTo(COUNTRY_STATE_KEY);\n }", "public StateHeader() { // for externalization\r\n }", "private SyncState() {}", "StateClass() {\r\n restored = restore();\r\n }", "public CurrentRobotState() {\r\n currentPos = new RobotCoordinates();\r\n motorState = new Motor();\r\n reInitialize();\r\n }", "public void init() { }", "public void init() { }", "@Test\n public void testConstruction()\n {\n String constructed = StateUtils.construct(TEST_DATA, externalContext);\n Object object = org.apache.myfaces.application.viewstate.StateUtils.reconstruct(constructed, externalContext);\n Assertions.assertTrue(TEST_DATA.equals(object));\n }", "public State state();", "public void\ninit(SoState state)\n//\n////////////////////////////////////////////////////////////////////////\n{\n data = getDefault().getValue();\n}", "@Test\n public void constructorInitializesAllItemsInUnknownState() {\n FirstAidItem firstAidItem = Tests.buildFirstAidItem(Point.pt(2.5, 3.5));\n WeaponItem weaponItem = Tests.buildWeaponItem(Point.pt(1.5, 0.5), Weapon.WeaponType.HANDGUN);\n\n Bot bot = Tests.mockBot();\n ItemMemory itemMemory = new ItemMemory(bot, asList(firstAidItem, weaponItem));\n\n assertThat(itemMemory.get(firstAidItem).getState(), is(ItemMemoryRecord.State.UNKNOWN));\n assertThat(itemMemory.get(weaponItem).getState(), is(ItemMemoryRecord.State.UNKNOWN));\n }", "public void init() {}", "public void init() {}", "protected abstract void construct();", "private void init() {\n }", "public boolean init() {\n\r\n return true;\r\n }", "@Override\n protected void initialize() {\n System.out.println(\"initializing claw state machine\");\n }", "public State(String fromString)\n {\n// Metrics.increment(\"State count\");\n //...\n }", "public GameState() {}", "private void _init() {\n }", "public State () {\n\t\tthis.stateId = generateStateId();\n\t}", "private void init() {\n }", "private void init() {\n }", "private void init() {\n }", "private void init() {\n }", "public HasQuarterStateTest()\n {\n }", "abstract protected void initialize();", "public boolean init() {\n\t\treturn true;\n\t}", "public boolean init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "public abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "protected abstract void init();", "abstract public void init();", "abstract void initialize();", "abstract void initialize();", "public void init(){}", "public void testCtor_NullState() {\n try {\n new AddActionStateAction(null, activityGraph, manager);\n fail(\"IllegalArgumentException expected.\");\n } catch (IllegalArgumentException iae) {\n //good\n }\n }", "private StateManagerFactory() {}", "private EagerInitializedSingleton() {\n\t}", "private EagerInitializedSingleton() {\n\t}", "protected void _init(){}", "@Override\r\n\tpublic void init() {}", "@Override\r\n\tpublic final void init() {\r\n\r\n\t}", "public boolean isConstructor();", "protected abstract void initialize();", "public void init()\r\n {\r\n ;\r\n }", "private void initialize() {\n }", "public void init() {\r\n // nothing to do\r\n }", "boolean init();", "@Override\n\tpublic synchronized void init() {\n\t}", "void create( State state );", "public abstract void initialize();", "public abstract void initialize();", "public abstract void initialize();", "public abstract void initialise();", "public abstract void initialise();", "public abstract void initialise();", "private Object getState() {\n\treturn null;\r\n}", "protected void initialize() {}", "protected void initialize() {}", "public State(T state) {\r\n\t\tthis.state = state;\r\n\t}", "private SingleObject()\r\n {\r\n }", "public void init() {\n }", "public void init() {\n }", "public void init() {\n }", "public void init() {\n }", "public void init() {\n \n }", "private Transition(State sourceState) {\r\n \t\t\tthis.sourceState = sourceState;\r\n \t\t\tthis.nextStateInfo = new ArrayList<NextStateInfo>();\r\n \t\t}", "private EagerlySinleton()\n\t{\n\t}", "public State(GameStateManager gameStateManager){ //constructor\n this.gameStateManager = gameStateManager;\n camera = new OrthographicCamera();\n mouse = new Vector3();\n }", "private void init() {\n\n\n\n }", "public void init()\n {\n }" ]
[ "0.6931035", "0.68375677", "0.6715087", "0.67139", "0.66778743", "0.66187024", "0.66061", "0.6588916", "0.65396756", "0.64710844", "0.6433092", "0.6430955", "0.6404825", "0.6382924", "0.6345654", "0.6343706", "0.6334999", "0.6334999", "0.63224465", "0.6316444", "0.63159704", "0.63026506", "0.6298046", "0.6298046", "0.62941706", "0.6253315", "0.62469214", "0.62325555", "0.6220065", "0.62142605", "0.62045896", "0.620377", "0.6184111", "0.6184111", "0.6184111", "0.6184111", "0.616857", "0.61658293", "0.61652607", "0.6157558", "0.615429", "0.615429", "0.615429", "0.615429", "0.615429", "0.615429", "0.615429", "0.615429", "0.615429", "0.615429", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.6151482", "0.61378515", "0.6137761", "0.6137761", "0.61339396", "0.61313725", "0.61285937", "0.61228985", "0.61228985", "0.6100282", "0.6095695", "0.60948545", "0.60913664", "0.60844296", "0.6070141", "0.6068958", "0.6051938", "0.6049023", "0.6048689", "0.60390985", "0.60363597", "0.60363597", "0.60363597", "0.6032588", "0.6032588", "0.6032588", "0.6029983", "0.6022933", "0.6022933", "0.60185945", "0.60116976", "0.59949213", "0.59949213", "0.59949213", "0.59949213", "0.59945726", "0.59760106", "0.5975168", "0.5967426", "0.59637964", "0.59633726" ]
0.0
-1
Of isStateAvailable Getter. Just a stub here.
public int[][] getTransitionMatrix() { return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract boolean isAvailable();", "public abstract boolean isAvailable();", "public boolean isStateAvailable(int paraState) {\n\t\treturn true;\n\t}", "Boolean isAvailable();", "boolean isAvailable();", "boolean isAvailable();", "boolean isAvailable();", "boolean isAvailable();", "public boolean isAvailable() {\r\n return isavailable;\r\n }", "public Integer getIsAvailable() {\r\n\t\treturn isAvailable;\r\n\t}", "public boolean isAvailable() {\n return available;\n }", "public boolean isAvailable() {\r\n\treturn available;\r\n }", "default boolean isAvailable() {\n switch (getState()) {\n case STOPPED:\n return true;\n case STARTING:\n return false;\n case STARTED:\n return false;\n case STOPPING:\n return false;\n default:\n throw new IllegalStateException(\"The speaker state is in an unknown state\");\n }\n }", "protected boolean isAvailable() {\r\n\t\treturn true;\r\n\t}", "public boolean isAvailable() {\n return available;\n }", "public boolean isAvailable()\n {\n return available;\n }", "public boolean isAvailable() {\n return available;\n }", "public boolean isAvailable() {\n return available;\n }", "boolean isAvailable() {\r\n\t\treturn available;\r\n\t}", "public boolean isAvailable() {\r\n\t\treturn available;\r\n\t}", "public boolean isAvailable() {\n\t\tObject oo = get_Value(\"IsAvailable\");\n\t\tif (oo != null) {\n\t\t\tif (oo instanceof Boolean)\n\t\t\t\treturn ((Boolean) oo).booleanValue();\n\t\t\treturn \"Y\".equals(oo);\n\t\t}\n\t\treturn false;\n\t}", "public void setIsAvailable(Integer isAvailable) {\r\n\t\tthis.isAvailable = isAvailable;\r\n\t}", "public Boolean isAvailable()\n\t{\n\t\treturn presence != null && presence.equals(AVAILABLE);\n\t}", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "public boolean isAvalible() {\n return available;\n }", "public void setAvailable(boolean available) {\r\n isAvailable = available;\r\n }", "public boolean isAvailable() {\n lock.readLock().lock();\n try {\n return available;\n } finally {\n lock.readLock().unlock();\n }\n }", "public boolean getAvailability(){\n return availabile;\n }", "boolean hasHasState();", "public void setAvailable(boolean a)\n {\n this.available = a;\n }", "public boolean isAvailable() {\n return LocalTime.now().isAfter(busyEndTime);\n }", "public List<MclnState> getAvailableStates();", "public boolean isStateKnown(){\n\t\treturn (state != null);\n\t}", "public void setAvailable(boolean available) {\n this.available = available;\n }", "public void setAvailable(boolean available) {\n this.available = available;\n }", "public List<S> getAvailableStates();", "@Override\n public boolean isAvailable() {\n return room.isAvailable();\n }", "public void takeAvailable() {\n\t\tavailable = false;\n\t}", "public boolean isStateKnown() {\r\n\t\treturn stateKnown;\r\n\t}", "public void setAvailable(boolean x){\n availabile = x;\n }", "public void makeAvailable() {\n\t\tavailable = true;\n\t}", "boolean isAvailable( long millis );", "boolean hasServerState();", "public boolean isReady();", "public boolean isReady();", "public boolean isAvailable(){\n\t\ttry{\n\t\t\tgetPrimingsInternal(\"Test\", \"ATGATGATGATGATGATGATG\");\n\t\t}\n\t\tcatch(IOException e){\n\t\t\treturn false;\n\t\t}\n\t\tcatch(InterruptedException e){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "int available() {\n return numAvailable;\n }", "boolean available()\n {\n synchronized (m_lock)\n {\n return (null == m_runnable) && (!m_released);\n }\n }", "@java.lang.Override\n public boolean hasStateInfo() {\n return stateInfo_ != null;\n }", "public boolean isAvailable() {\n return this.isAcceptingRider && this.currentTrip == null;\n }", "public boolean isAvailable(){\r\n // return statement\r\n return (veh == null);\r\n }", "@Test\n public void testHasAvailable1() {\n Pieces inv = new Pieces();\n boolean expResult = true;\n boolean result = inv.hasAvailable();\n assertEquals(expResult, result);\n }", "@Override\n public boolean isAvailable(Resource resource) {\n return false;\n }", "boolean isReady();", "boolean isReady();", "boolean isReady();", "@Override\n\tpublic boolean getState() {\n\t\treturn true;\n\t}", "public interface AvailableIn extends Activated\n{\n boolean isAvailableIn(DateTime time);\n boolean isAvailableNow();\n\n}", "public int getAvailability() {\r\n\t\treturn this.availability;\r\n\t}", "public int available() {\n return numAvailable;\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000002) == 0x00000002);\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000002) == 0x00000002);\n }", "boolean isNetworkAvailable();", "public boolean isReady() {\n\t\treturn state == State.READY;\n\t}", "public boolean getSwitchState() throws UnavailableDeviceException, ClosedDeviceException, IOException{\n\t\tif (switchState){\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean getState( ) { return state; }", "public String getAvailability() {\n\t\treturn availability;\n\t}", "void isReady();", "void isReady();", "public synchronized void makeAvailable(){\n isBusy = false;\n }", "public boolean isUseable()\n {\n if (state == 0)\n {\n return true;\n }\n return false;\n }", "protected boolean statusIs(String state)\n { return call_state.equals(state); \n }", "boolean hasCompatibilityState();", "public boolean ready();", "public boolean hasState() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "public boolean isOn(){\n return state;\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "@SuppressWarnings(\"WeakerAccess\")\n public ReadyState getReadyState() {\n return mReadyState;\n }", "boolean getCheckState();", "public boolean hasState() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "public boolean hasState() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "@Override\r\n public boolean poll()\r\n {\n return state.isConnected();\r\n }", "@Override\r\n\tpublic boolean getState() {\n\t\treturn activated;\r\n\t}", "@Test\n public void testNotDeployedStateNotDeployedService() {\n cleanUp();\n\n State notDeployed = makeState(2L, \"State 2\");\n\n assertFalse(propertyService.isServiceDeployedInState(Service.MOBILE_ACADEMY, notDeployed));\n }", "public void changeAvailability() {\n\t\tavailability = !availability;\n\t}", "public boolean hasStateInfo() {\n return ((bitField0_ & 0x00000100) != 0);\n }", "public boolean isNetworkAvailable() {\n initNetwork();\n NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();\n return activeNetworkInfo != null && activeNetworkInfo.isConnected();\n}", "public BigDecimal getAvailable() {\n return available;\n }", "public boolean getIsReady() {\n return localIsReady;\n }", "@Test\r\n\tpublic void testGetState() {\r\n\t}" ]
[ "0.77039444", "0.77039444", "0.77016544", "0.7499722", "0.74503255", "0.74503255", "0.74503255", "0.74503255", "0.7449992", "0.7417844", "0.7414524", "0.7382172", "0.73539317", "0.73518974", "0.73384523", "0.7322424", "0.72540504", "0.72540504", "0.72538596", "0.7232377", "0.6977518", "0.69444317", "0.6931384", "0.6875712", "0.6875712", "0.6875712", "0.6875712", "0.6875712", "0.6875712", "0.6875712", "0.6875712", "0.6839561", "0.6816198", "0.6784581", "0.6754081", "0.6740035", "0.6690292", "0.66704476", "0.66305506", "0.66246057", "0.6611134", "0.6611134", "0.65493155", "0.6499103", "0.64962643", "0.6457045", "0.642689", "0.6420448", "0.63808334", "0.63387334", "0.6320092", "0.6320092", "0.63052136", "0.62956893", "0.62835276", "0.6256124", "0.6229974", "0.62132925", "0.61977065", "0.619535", "0.61899614", "0.61899614", "0.61899614", "0.6159469", "0.6147416", "0.6140165", "0.61259514", "0.60971373", "0.60953933", "0.6086142", "0.60628116", "0.6053175", "0.60436773", "0.60309047", "0.6027105", "0.6027105", "0.6025537", "0.60196155", "0.6014048", "0.60117203", "0.60104716", "0.6009745", "0.60086083", "0.6003695", "0.60032475", "0.60031736", "0.5982456", "0.598221", "0.59779507", "0.5977558", "0.5977558", "0.5974911", "0.5959483", "0.59441406", "0.59408045", "0.5935305", "0.5929746", "0.59287876", "0.5913919", "0.590142", "0.5899055" ]
0.0
-1
Of setCurrentStates Get valid actions of the current state.
public int[] getValidActions() { return getValidActions(currentState); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static List<String> getValidActions() {\n return VALID_ACTIONS;\n }", "public List<boolean[]> getValidActions()\n\t{\n\t\tList<boolean[]> validActions = new ArrayList<boolean[]>(allActions);\n\t\t//TODO remove actions that contain jump if environment.mayMarioJump() is false\n\t\treturn validActions;\n\t}", "public List<ActionValue> getActions(State state);", "public List<A> getAvailableActionsFor(S state);", "ActionsSet getActions();", "public static void getValidActionsTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 6643 };\n\n\t\tint[] tempResultArray;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResultArray = tempEnvironment.getValidActions(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The valid actions of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.toString(tempResultArray));\n\t\t} // Of for i\n\t}", "@Override\n public ArrayList<agents.Action> actionsFor(agents.State state) {\n\n ArrayList<agents.Action> legalActions = new ArrayList<agents.Action>();\n int[] board = ((State) state).getBoard();\n int blankPosition = 0;\n while (board[blankPosition] != 0) blankPosition++;\n if (blankPosition % 3 != 0) legalActions.add(new Action(LEFT));\n if (blankPosition % 3 != 2) legalActions.add(new Action(RIGHT));\n if (blankPosition < 6) legalActions.add(new Action(DOWN));\n if (blankPosition > 2) legalActions.add(new Action(UP));\n return legalActions;\n }", "public Set getActions () {\n if (actions == null) // lazy aren't we\n initActions ();\n return actions;\n }", "private Map<String, List<String>> getSelectedStatesToApprove() {\n Map<String, List<String>> stateAction = new HashMap<String, List<String>>();\n // exract selected states from stateList and populate the map\n if (stateList != null) {\n // list will be something like ' Created:Publish,Created:Deploy as a Prototype,Published:Block ' String\n // It will have State:action pairs\n String[] statelistArray = stateList.split(\",\");\n for (int i = 0; i < statelistArray.length; i++) {\n String[] stateActionArray = statelistArray[i].split(\":\");\n if (stateAction.containsKey(stateActionArray[0].toUpperCase())) {\n ArrayList<String> actionList = (ArrayList<String>) stateAction\n .get(stateActionArray[0].toUpperCase());\n actionList.add(stateActionArray[1]);\n } else {\n ArrayList<String> actionList = new ArrayList<String>();\n actionList.add(stateActionArray[1]);\n stateAction.put(stateActionArray[0].toUpperCase(), actionList);\n }\n }\n }\n if (log.isDebugEnabled()) {\n log.debug(\"selected states: \" + stateAction.toString());\n }\n return stateAction;\n }", "public List<RequiredAction> getActions() {\n return this.actions;\n }", "private HashMap<List<Integer>,List<Integer>> obtainValidActions(){\n\t\tHashMap<List<Integer>,List<Integer>> mapp= new HashMap<List<Integer>,List<Integer>>();\n\t\tfor (int i = 0;i<states.size();i++) {\n\t\t\tList<Integer> act= new ArrayList<Integer>();\n\t\t\tfor (int j = 0; j < actions.size(); j++) {\n\t\t\t\tif (isActionValid(states.get(i), actions.get(j))) \n\t\t\t\t\t//System.out.println(\"Inside Validation if\\n\");\n\t\t\t\t\tact.add(j);\n\t\t\t}\n\t\t\tmapp.put(states.get(i),act);\n\t\t}\n\t\treturn mapp;\n\t}", "public void checkActions() {\n\t\tfor (BaseAction ba : this.actions) {\n\t\t\tba.checkAction();\n\t\t}\n\t}", "public List<Action> actions() {\r\n\t\treturn this.actions;\r\n\t}", "private void setActiveActions() {\n\t\tnewBinaryContext.setEnabled(true);\n\t\tnewValuedContext.setEnabled(true);\n\t\tnewNestedContext.setEnabled(true);\n\t\topenContext.setEnabled(true);\n\t\tsaveContext.setEnabled(true);\n\t\tsaveAsContext.setEnabled(true);\n\t\tsaveAllContexts.setEnabled(true);\n\t\tcloseContext.setEnabled(true);\n\t\tcloseAllContexts.setEnabled(true);\n\t\tquitViewer.setEnabled(true);\n\n\t\tif (contextPanes.size() == 0) {\n\t\t\t/* Boutons de la toolbar */\n\t\t\tsaveBtn.setEnabled(false);\n\t\t\topenBtn.setEnabled(true);\n\t\t\tnewBinCtxBtn.setEnabled(true);\n\t\t\tremoveCtxBtn.setEnabled(false);\n\t\t\tnewAttributeBtn.setEnabled(false);\n\t\t\tnewObjectBtn.setEnabled(false);\n\t\t\tdelAttributeBtn.setEnabled(false);\n\t\t\tdelObjectBtn.setEnabled(false);\n\t\t\tshowLatBtn.setEnabled(false);\n\t\t\tshowRulesBtn.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Edit\" */\n\t\t\taddEmptyLevel.setEnabled(false);\n\t\t\taddContextLevel.setEnabled(false);\n\t\t\tremoveLevel.setEnabled(false);\n\t\t\torderLevels.setEnabled(false);\n\t\t\taddObject.setEnabled(false);\n\t\t\taddAttribute.setEnabled(false);\n\t\t\tmergeAttributes.setEnabled(false);\n\t\t\tlogicalAttribute.setEnabled(false);\n\t\t\tcompareAttributes.setEnabled(false);\n\t\t\tremoveObject.setEnabled(false);\n\t\t\tremoveAttribute.setEnabled(false);\n\t\t\tcreateClusters.setEnabled(false);\n\t\t\tconvertToBinary.setEnabled(false);\n\t\t\tconvertToNested.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Lattice\" */\n\t\t\tshowLatticeMenu.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Rules\" */\n\t\t\tshowRulesMenu.setEnabled(false);\n\t\t\treturn;\n\t\t}\n\n\t\tContextTableScrollPane selectedPane = contextPanes\n\t\t\t\t.elementAt(currentContextIdx);\n\t\tContext currentContext = ((ContextTableModel) selectedPane\n\t\t\t\t.getContextTable().getModel()).getContext();\n\n\t\tif (currentContext instanceof NestedContext) {\n\t\t\t/* Boutons de la toolbar */\n\t\t\tsaveBtn.setEnabled(true);\n\t\t\topenBtn.setEnabled(true);\n\t\t\tnewBinCtxBtn.setEnabled(true);\n\t\t\tremoveCtxBtn.setEnabled(true);\n\t\t\tnewAttributeBtn.setEnabled(false);\n\t\t\tnewObjectBtn.setEnabled(false);\n\t\t\tdelAttributeBtn.setEnabled(false);\n\t\t\tdelObjectBtn.setEnabled(false);\n\t\t\tshowLatBtn.setEnabled(true);\n\t\t\tshowRulesBtn.setEnabled(true);\n\n\t\t\t/* Elements du menu \"Edit\" */\n\t\t\taddEmptyLevel.setEnabled(true);\n\t\t\taddContextLevel.setEnabled(true);\n\t\t\tremoveLevel.setEnabled(true);\n\t\t\torderLevels.setEnabled(true);\n\t\t\taddObject.setEnabled(false);\n\t\t\taddAttribute.setEnabled(false);\n\t\t\tmergeAttributes.setEnabled(false);\n\t\t\tlogicalAttribute.setEnabled(false);\n\t\t\tcompareAttributes.setEnabled(false);\n\t\t\tremoveObject.setEnabled(false);\n\t\t\tremoveAttribute.setEnabled(false);\n\t\t\tcreateClusters.setEnabled(false);\n\t\t\tconvertToBinary.setEnabled(true);\n\t\t\tconvertToNested.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Lattice\" */\n\t\t\tshowLatticeMenu.setEnabled(true);\n\n\t\t\t/* Elements du menu \"Rules\" */\n\t\t\tshowRulesMenu.setEnabled(true);\n\t\t}\n\n\t\telse if (currentContext instanceof BinaryContext) {\n\t\t\t/* Boutons de la toolbar */\n\t\t\tsaveBtn.setEnabled(true);\n\t\t\topenBtn.setEnabled(true);\n\t\t\tnewBinCtxBtn.setEnabled(true);\n\t\t\tremoveCtxBtn.setEnabled(true);\n\t\t\tnewAttributeBtn.setEnabled(true);\n\t\t\tnewObjectBtn.setEnabled(true);\n\t\t\tdelAttributeBtn.setEnabled(true);\n\t\t\tdelObjectBtn.setEnabled(true);\n\t\t\tshowLatBtn.setEnabled(true);\n\t\t\tshowRulesBtn.setEnabled(true);\n\n\t\t\t/* Elements du menu \"Edit\" */\n\t\t\taddEmptyLevel.setEnabled(false);\n\t\t\taddContextLevel.setEnabled(false);\n\t\t\tremoveLevel.setEnabled(false);\n\t\t\torderLevels.setEnabled(false);\n\t\t\taddObject.setEnabled(true);\n\t\t\taddAttribute.setEnabled(true);\n\t\t\tmergeAttributes.setEnabled(true);\n\t\t\tlogicalAttribute.setEnabled(true);\n\t\t\tremoveObject.setEnabled(true);\n\t\t\tremoveAttribute.setEnabled(true);\n\t\t\tcreateClusters.setEnabled(true);\n\t\t\tcompareAttributes.setEnabled(true);\n\t\t\tconvertToBinary.setEnabled(false);\n\t\t\tconvertToNested.setEnabled(true);\n\n\t\t\t/* Elements du menu \"Lattice\" */\n\t\t\tshowLatticeMenu.setEnabled(true);\n\n\t\t\t/* Elements du menu \"Rules\" */\n\t\t\tshowRulesMenu.setEnabled(true);\n\t\t}\n\n\t\telse if (currentContext instanceof ValuedContext) {\n\t\t\t/* Boutons de la toolbar */\n\t\t\tsaveBtn.setEnabled(true);\n\t\t\topenBtn.setEnabled(true);\n\t\t\tnewBinCtxBtn.setEnabled(true);\n\t\t\tremoveCtxBtn.setEnabled(true);\n\t\t\tnewAttributeBtn.setEnabled(true);\n\t\t\tnewObjectBtn.setEnabled(true);\n\t\t\tdelAttributeBtn.setEnabled(true);\n\t\t\tdelObjectBtn.setEnabled(true);\n\t\t\tshowLatBtn.setEnabled(false);\n\t\t\tshowRulesBtn.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Edit\" */\n\t\t\taddEmptyLevel.setEnabled(false);\n\t\t\taddContextLevel.setEnabled(false);\n\t\t\tremoveLevel.setEnabled(false);\n\t\t\torderLevels.setEnabled(false);\n\t\t\taddObject.setEnabled(true);\n\t\t\taddAttribute.setEnabled(true);\n\t\t\tmergeAttributes.setEnabled(true);\n\t\t\tlogicalAttribute.setEnabled(false);\n\t\t\tcompareAttributes.setEnabled(false);\n\t\t\tremoveObject.setEnabled(true);\n\t\t\tremoveAttribute.setEnabled(true);\n\t\t\tcreateClusters.setEnabled(false);\n\t\t\tconvertToBinary.setEnabled(true);\n\t\t\tconvertToNested.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Lattice\" */\n\t\t\tshowLatticeMenu.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Rules\" */\n\t\t\tshowRulesMenu.setEnabled(false);\n\t\t}\n\n\t\telse {\n\t\t\t/* Boutons de la toolbar */\n\t\t\tsaveBtn.setEnabled(false);\n\t\t\topenBtn.setEnabled(false);\n\t\t\tnewBinCtxBtn.setEnabled(false);\n\t\t\tremoveCtxBtn.setEnabled(false);\n\t\t\tnewAttributeBtn.setEnabled(false);\n\t\t\tnewObjectBtn.setEnabled(false);\n\t\t\tdelAttributeBtn.setEnabled(false);\n\t\t\tdelObjectBtn.setEnabled(false);\n\t\t\tshowLatBtn.setEnabled(false);\n\t\t\tshowRulesBtn.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Edit\" */\n\t\t\taddEmptyLevel.setEnabled(false);\n\t\t\taddContextLevel.setEnabled(false);\n\t\t\tremoveLevel.setEnabled(false);\n\t\t\torderLevels.setEnabled(false);\n\t\t\taddObject.setEnabled(false);\n\t\t\taddAttribute.setEnabled(false);\n\t\t\tmergeAttributes.setEnabled(false);\n\t\t\tlogicalAttribute.setEnabled(false);\n\t\t\tcompareAttributes.setEnabled(false);\n\t\t\tremoveObject.setEnabled(false);\n\t\t\tremoveAttribute.setEnabled(false);\n\t\t\tcreateClusters.setEnabled(false);\n\t\t\tconvertToBinary.setEnabled(false);\n\t\t\tconvertToNested.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Lattice\" */\n\t\t\tshowLatticeMenu.setEnabled(false);\n\n\t\t\t/* Elements du menu \"Rules\" */\n\t\t\tshowRulesMenu.setEnabled(false);\n\t\t}\n\t}", "public List<Action> getActions()\r\n {\r\n return Collections.unmodifiableList(actions);\r\n }", "@Override\r\n\tpublic List<ActionInput> getActions()\r\n\t{\n\t\treturn null;\r\n\t}", "public String[] getActions() {\n return impl.getActions();\n }", "public Collection<Action> getActions() {\n\t\treturn Collections.unmodifiableCollection(actionList);\n\t}", "public static HashSet<gameState> Actions(gameState currentState) {\n\t\t\n\t\tHashSet<gameState> possibleStates = new HashSet<gameState>();\n\t\t\n\t\t\n\t\t// Store which player goes next after this player plays\n\t\tint nextNextUp;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tnextNextUp = 1;\n\t\t} else {\n\t\t\tnextNextUp = 0;\n\t\t}\n\t\t\n\t\t// Store corresponding characters for each player\n\t\t// DARK(X) - 0, LIGHT(O) - 1\n\t\tchar myTile;\n\t\tchar opponentTile;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tmyTile = 'x';\n\t\t\topponentTile = 'o';\n\t\t} else {\n\t\t\tmyTile = 'o';\n\t\t\topponentTile = 'x';\n\t\t}\n\n\t\t\n\n\t\t// Check the entire board of the state \n\t\tfor (int i = 0; i<boardSize; i++) {\n\t\t\tfor (int j = 0; j<boardSize; j++) {\n\t\t\t\t\n\t\t\t\t// If the tile is my tile\n\t\t\t\tif (currentState.getBoard()[i][j] == '_') {\n\t\t\t\t\t\n\t\t\t\t\tchar[][] moveBoard = createNewBoard(currentState);\n\t\t\t\t\t\n\t\t\t\t\t// Up\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// If it is an opponent tile, then you keep going up until you either my tile (fail) or\n\t\t\t\t\t\t// a blank space (success/move possible)\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=i;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Down\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=i;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j-1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=j;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j+1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=j;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j-1] == opponentTile) { \n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j+1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j-1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j+1] == opponentTile) { \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\tif (!compareBoards(moveBoard, currentState.getBoard())) {\n\t\t\t\t\t\tgameState move = new gameState(moveBoard, nextNextUp);\t\t\n\t\t\t\t\t\tpossibleStates.add(move);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\n\t\treturn possibleStates;\n\t\t\n\t\t\n\t\t\n\t}", "public List<Action> getActions() {\n\n if (actions != null)\n return new ArrayList<>(actions.values());\n else\n return new ArrayList<>();\n\n }", "String[] getActions();", "public Set<ActionReader> getActions();", "private StateActions(){}", "public ActionList getActions();", "@Updatable\n public Set<String> getOkActions() {\n if (okActions == null) {\n okActions = new HashSet<>();\n }\n\n return okActions;\n }", "protected HashSet<GoapAction> extractPossibleActions() {\r\n\t\tHashSet<GoapAction> possibleActions = new HashSet<GoapAction>();\r\n\r\n\t\ttry {\r\n\t\t\tfor (GoapAction goapAction : this.goapUnit.getAvailableActions()) {\r\n\t\t\t\tif (goapAction.checkProceduralPrecondition(this.goapUnit)) {\r\n\t\t\t\t\tpossibleActions.add(goapAction);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn possibleActions;\r\n\t}", "public java.lang.Integer getActions() {\r\n return actions;\r\n }", "public abstract List<Instruction> getPossibleActions();", "public Actions getActions() {\n if (actions == null) {\n actions = new Actions();\n }\n return actions;\n }", "public List<boolean[]> getAllActions()\n\t{\n\t\t// initiate valid actions\n\t\tList<boolean[]> allActions = new ArrayList<boolean[]>();\n\t\t\n\t\tallActions.add(JUMP);\n\t\tallActions.add(SPEED);\n\t\tallActions.add(LEFT);\n\t\tallActions.add(LEFT_SPEED);\n\t\tallActions.add(LEFT_JUMP);\n\t\tallActions.add(LEFT_JUMP_SPEED);\n\t\tallActions.add(JUMP_SPEED);\n\t\tallActions.add(RIGHT);\n\t\tallActions.add(RIGHT_SPEED);\n\t\tallActions.add(RIGHT_JUMP);\n\t\tallActions.add(RIGHT_JUMP_SPEED);\n\t\t\n\t\treturn allActions;\n\t}", "public List<Action> getActions() {\n return this.data.getActions();\n }", "public int getActions() {\n return actions;\n }", "public String[] getStepActions() {\r\n HistoryStep[] steps = currentProcessInstance.getHistorySteps();\r\n String[] actions = new String[steps.length];\r\n Action action = null;\r\n \r\n for (int i = 0; i < steps.length; i++) {\r\n try {\r\n if (steps[i].getAction().equals(\"#question#\"))\r\n actions[i] = getString(\"processManager.question\");\r\n \r\n else if (steps[i].getAction().equals(\"#response#\"))\r\n actions[i] = getString(\"processManager.response\");\r\n \r\n else if (steps[i].getAction().equals(\"#reAssign#\"))\r\n actions[i] = getString(\"processManager.reAffectation\");\r\n \r\n else {\r\n action = processModel.getAction(steps[i].getAction());\r\n actions[i] = action.getLabel(currentRole, getLanguage());\r\n }\r\n } catch (WorkflowException we) {\r\n actions[i] = \"##\";\r\n }\r\n }\r\n \r\n return actions;\r\n }", "public States states();", "public List<Action> getActions(){return actions;}", "public Action[] getActions() {\n return TextAction.augmentList(super.getActions(), defaultActions);\n }", "List<WorkflowProcessingState> getStates();", "private void setActions(){\n login.setOnAction(e->login());\n simulate.setOnAction(e->simulate());\n scoreBoardButton.setOnAction(e->scoreBoard());\n viewBracket.setOnAction(e->viewBracket(selectedBracket, playerMap));\n clearButton.setOnAction(e->clear());\n resetButton.setOnAction(e->reset());\n finalizeButton.setOnAction(e->finalizeBracket());\n }", "public List<S> getAvailableStates();", "private void setStates(List<AbstractActuatorCmd> states) {\n this.states = states;\n }", "public void setActions() {\n actions = new HashMap<String, Action>();\n for (Action a: jsonManager.getActionsFromJson()) {\n actions.put(a.getName(), a);\n }\n }", "private static List<State<StepStateful>> getStates() {\n List<State<StepStateful>> states = new LinkedList<>();\n states.add(s0);\n states.add(s1);\n states.add(s2);\n states.add(s3);\n states.add(s4);\n states.add(s5);\n states.add(s6);\n return states;\n }", "@Override\n public String getActions() {\n\treturn \"\";\n }", "public Action[] getActions(Object target, Object sender) {\n \t\treturn actions;\n \t}", "@Override\n\tpublic Action[] getActions(Object target, Object sender) {\n\t\treturn ACTIONS;\n\t}", "public java.util.List<com.rpg.framework.database.Protocol.CharacterAction> getActionsList() {\n if (actionsBuilder_ == null) {\n return java.util.Collections.unmodifiableList(actions_);\n } else {\n return actionsBuilder_.getMessageList();\n }\n }", "public java.util.List<com.rpg.framework.database.Protocol.CharacterAction> getActionsList() {\n if (actionsBuilder_ == null) {\n return java.util.Collections.unmodifiableList(actions_);\n } else {\n return actionsBuilder_.getMessageList();\n }\n }", "public List<AState> getStates() {\n return states;\n }", "protected Actions exec() {\n return actions;\n }", "public List<MclnState> getAvailableStates();", "private JMenu getMActions() {\n\t\tif (mActions == null) {\n\t\t\tmActions = new JMenu();\n\t\t\tmActions.setText(\"Servisler\");\n mActions.add(getMiBilesikKutukSorgula());\n\t\t\tmActions.add(getMiKimlikNumarasindanKisiBilgisiSorgula());\n\t\t\tmActions.add(getMiKisiListesiSorgula());\n \n\t\t}\n\t\treturn mActions;\n\t}", "@OneToMany(fetch = FetchType.LAZY, mappedBy = Action.Attributes.SYSTEM, targetEntity = Action.class, orphanRemoval = true)\n\tpublic Set<Action> getActions() {\n\t\treturn this.actions;\n\t}", "public List<String> getStates() {\n\t\treturn states;\n\t}", "public void setActions(Set<Action> actions) {\n\t\tthis.actions = actions;\n\t}", "public void removeAllActions() {\n menuDirty = true;\n actions.clear();\n selectedAction = null;\n }", "private ArrayList<String> getAllActions() {\n\t\t\n\t\tArrayList<String> allActions = new ArrayList<String>();\n\t\tallActions.add(\"Job fisher\");\n\t\tallActions.add(\"Job captain\");\n\t\tallActions.add(\"Job teacher\");\n\t\tallActions.add(\"Job factory worker\");\n\t\tallActions.add(\"Job factory boss\");\n\t\tallActions.add(\"Job elderly caretaker\");\n\t\tallActions.add(\"Job work outside village\");\n\t\tallActions.add(\"Job unemployed\");\n\t\treturn allActions;\n\t}", "public int[] getCountActions() {\r\n return countActions;\r\n }", "public ArrayList<State> getStates(){\n\t\treturn this.states;\n\t}", "@Override\n\tpublic int getAction() {\n\t\tint bstar = -1;\n\t\tdouble bstarval = Double.NEGATIVE_INFINITY;\n\t\tfor (int b : actions) {\n\t\t\t// now we need to look at each possible state transition\n\t\t\tdouble newStateSum = 0;\n\t\t\t// which means for every possible next state\n\t\t\tfor (int newX = 0; newX < beliefs.length; newX++) {\n\t\t\t\tfor (int newY = 0; newY < beliefs[0].length; newY++) {\n\t\t\t\t\tint[] newState = new int[]{newX,newY};\n\t\t\t\t\t// we need to look at every possible previous state\n\t\t\t\t\tdouble stateSum = 0;\n\t\t\t\t\tfor (int x = 0; x < beliefs.length; x++) {\n\t\t\t\t\t\tfor (int y = 0; y < beliefs[0].length; y++) {\n\t\t\t\t\t\t\tstateSum += beliefs[x][y] * // belief in CURRENT state if we were to make the observation, times\n\t\t\t\t\t\t\t\t\t\tworld.transitionProbability(newX, newY, x, y, b) * // probability of getting into the new state\n\t\t\t\t\t\t\t\t\t\tworld.getReward(newState);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewStateSum += stateSum;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (newStateSum > bstarval) {\n\t\t\t\tbstar = b;\n\t\t\t\tbstarval = newStateSum;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"(EntropicExplorer) Choosing action: \" + world.actionToString(bstar) + \" (value = \" + bstarval + \")\");\n\t\tlastAction = bstar;\n\t\tadvanceBeliefs(bstar);\n\t\treturn bstar;\n\t}", "public java.util.List<com.rpg.framework.database.Protocol.CharacterAction> getActionsList() {\n return actions_;\n }", "public java.util.List<com.rpg.framework.database.Protocol.CharacterAction> getActionsList() {\n return actions_;\n }", "private ArrayList<String> getPossibleActions() {\n\t\t\n\t\tRandom r = new Random();\n\t\tArrayList<String> possibleActions = new ArrayList<String>();\n\t\tfor (String actionTitle : getAllActions()) {\n\t\t\tif (r.nextDouble() < 0.3) {\n\t\t\t\tpossibleActions.add(actionTitle);\n\t\t\t}\n\t\t}\n\t\treturn possibleActions;\n\t}", "public AccessibleStateSet getAccessibleStateSet() {\n/* 589 */ AccessibleStateSet accessibleStateSet = super.getAccessibleStateSet();\n/* 590 */ accessibleStateSet.add(AccessibleState.ACTIVE);\n/* 591 */ return accessibleStateSet;\n/* */ }", "private void setupDFA() {\r\n\t\tcurrentState = 0;\r\n\t\tif (actor.getScheduleFSM() == null) {\r\n\t\t\t// generate trivial DFA in case there is no schedule fsm.\r\n\t\t\t// 1. only one state\r\n\t\t\t// 2. all actions are eligible\r\n\t\t\t// 3. the successor state is always the same\r\n\t\t\teligibleActions = new Action [][] {actions};\r\n\t\t\tsuccessorState = new int [1] [actions.length];\r\n\t\t\tfor (int i = 0; i < actions.length; i++) {\r\n\t\t\t\tsuccessorState[0][i] = 0;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tSet stateSets = new HashSet();\r\n\t\t// put initial state into set of state sets\r\n\t\tSet initialState = Collections.singleton(actor.getScheduleFSM().getInitialState());\r\n\t\tstateSets.add(initialState);\r\n\t\tint previousSize = 0;\r\n\t\t// iterate until fixed-point, i.e. we cannot reach any new state set\r\n\t\twhile (previousSize != stateSets.size()) {\r\n\t\t\tpreviousSize = stateSets.size();\r\n\t\t\t// for each action...\r\n\t\t\tfor (int i = 0; i < actions.length; i ++) {\r\n\t\t\t\tSet nextStates = new HashSet();\r\n\t\t\t\t// ... compute the set of states that can be reached through it... \r\n\t\t\t\tfor (Iterator j = stateSets.iterator(); j.hasNext(); ) {\r\n\t\t\t\t\tSet s = (Set) j.next();\r\n\t\t\t\t\tif (isEligibleAction(s, actions[i])) {\r\n\t\t\t\t\t\tnextStates.add(computeNextStateSet(s, actions[i]));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// ... and add them to the state set\r\n\t\t\t\tstateSets.addAll(nextStates);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// The set of all reachable state sets is the state space of the NDA. \r\n\t\tndaStateSets = (Set []) new ArrayList(stateSets).toArray(new Set[stateSets.size()]);\r\n\t\t// Make sure the initial state is state 0.\r\n\t\tfor (int i = 0; i < ndaStateSets.length; i++) {\r\n\t\t\tif (ndaStateSets[i].equals(initialState)) {\r\n\t\t\t\tSet s = ndaStateSets[i];\r\n\t\t\t\tndaStateSets[i] = ndaStateSets[0];\r\n\t\t\t\tndaStateSets[0] = s;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\teligibleActions = new Action [ndaStateSets.length] [];\r\n\t\tsuccessorState = new int [ndaStateSets.length] [];\r\n\t\t// For each state set (i.e. each NDA state), identify the eligible actions,\r\n\t\t// and also the successor state set (i.e. the successor state in the NDA).\r\n\t\tfor (int i = 0; i < ndaStateSets.length; i++) {\r\n\t\t\tList ea = new ArrayList();\r\n\t\t\tList ss = new ArrayList();\r\n\t\t\tfor (int j = 0; j < actions.length; j++) {\r\n\t\t\t\tif (isEligibleAction(ndaStateSets[i], actions[j])) {\r\n\t\t\t\t\tea.add(actions[j]);\r\n\t\t\t\t\tss.add(computeNextStateSet(ndaStateSets[i], actions[j]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\teligibleActions[i] = (Action []) ea.toArray(new Action[ea.size()]);\r\n\t\t\tList ds = Arrays.asList(ndaStateSets); // so we can use List.indexOf()\r\n\t\t\tsuccessorState[i] = new int [ss.size()];\r\n\t\t\t// locta the NDA successor state in array\r\n\t\t\tfor (int j = 0; j < ss.size(); j++) {\r\n\t\t\t\tsuccessorState[i][j] = ds.indexOf(ss.get(j));\r\n\t\t\t\t\r\n\t\t\t\t// must be in array, because we iterated until reaching a fixed point.\r\n\t\t\t\tassert successorState[i][j] >= 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "java.util.List<com.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction> \n getSetParameterActionsList();", "public int getStates() {\n return states;\n }", "public static ActionList<BankActionContext> initActions() {\n\t\tBankActionContext context = BankActionContext.getInstance();\n\t\tBankAgency ag = context.getBankAgency();\n\t\tBankAccountActionList<BankActionContext> actionListBankAgency = new BankAccountActionList<BankActionContext>(\"1\", \"General\",\n\t\t\t\t\"--\\n \" + ag.getAgencyName() + \" (\" + ag.getAgencyLoc() + \")\\n General Menu\\n--\");\n\t\tactionListBankAgency.addAction(new ListAccounts(\"1\", \"List of the Agency accounts\"));\n\t\tactionListBankAgency.addAction(new AccountNumber(\"2\", \"See an account (by its number)\"));\n\n\t\tBankAccountActionList<BankActionContext> actionListAccountOperation = new BankAccountActionList<BankActionContext>(\"3\", \"Operation on an account\",\n\t\t\t\t\"--\\n \" + ag.getAgencyName() + \" (\" + ag.getAgencyLoc() + \")\\n Menu Operation on an account\\n--\");\n\t\tactionListAccountOperation.addAction(new Deposit(\"1\", \"Deposit money on an account\"));\n\t\tactionListAccountOperation.addAction(new Withdraw(\"2\", \"Withdraw money from an account\"));\n\t\tactionListBankAgency.addAction(actionListAccountOperation);\n\n\t\tBankAccountActionList<BankActionContext> actionListManagement = new BankAccountActionList<BankActionContext>(\"4\",\n\t\t\t\t\"Accounts management\",\n\t\t\t\t\"--\\n \" + ag.getAgencyName() + \" (\" + ag.getAgencyLoc() + \")\\n Menu Accounts management\\n--\");\n\t\tactionListManagement.addAction(new AddAccount(\"1\", \"Add an account\"));\n\t\tactionListManagement.addAction(new DeleteAccount(\"2\", \"Delete an account\"));\n\t\tactionListBankAgency.addAction(actionListManagement);\n\n\t\treturn actionListBankAgency;\n\t}", "@Override\n protected Action selectAction(State state, Set<Action> actions){\n //Call the preSelectAction method from the DefaultProtocol so that, if necessary,\n //unwanted processes are killed and SUT is put into foreground.\n Action retAction = preSelectAction(state, actions);\n if (retAction == null)\n //if no preSelected actions are needed, then implement your own strategy\n retAction = RandomActionSelector.selectAction(actions);\n return retAction;\n }", "public int[] getValidActions(int paraState) {\n\t\t// Step 1. Construct the checkerboard.\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\tint[] tempValidActions = new int[SIZE * SIZE];\n\t\tint tempNumValidActions = 0;\n\n\t\t// Step 1. Check all states.\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tif (tempCheckerboard[i][j] == EMPTY) {\n\t\t\t\t\ttempValidActions[tempNumValidActions] = i * SIZE + j;\n\t\t\t\t\ttempNumValidActions++;\n\t\t\t\t} // Of if\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\t// Step 2. Compress.\n\t\tint[] resultActions = new int[tempNumValidActions];\n\t\tfor (int i = 0; i < tempNumValidActions; i++) {\n\t\t\tresultActions[i] = tempValidActions[i];\n\t\t} // Of for i\n\n\t\t// SimpleTools.variableTrackingOutput(\"Valid actions: \" +\n\t\t// Arrays.toString(resultActions));\n\n\t\treturn resultActions;\n\t}", "public ArrayList<Action> getActions() {\n\t\tSquare [] adjacents = adjacentCells(); \n\t\tint sol[]=new int[adjacents.length];\n\t\tArrayList solutions = new ArrayList(); \n\n\t\tdistributeSand(0,getS(),adjacents,sol,solutions);\n\n\t\tArrayList<Action> actions=new ArrayList<Action>();\n\n\t\tint aux[]; \n\t\tfor (int k=0;k<adjacents.length;k++) {\n\t\t\tfor (int i=0; i<solutions.size();i++){\n\t\t\t\taux=(int[]) solutions.get(i);\n\t\t\t\tactions.add(new Action(adjacents[k],adjacents,aux));\n\t\t\t} \n\t\t} \n\t\treturn actions;\n\t}", "private void resetActionButtonsState()\n {\n // Actions\n GameAction fpAction = firstPlayer.getLastAction();\n GameAction spAction = secondPlayer.getLastAction();\n\n // First player reset state\n if (fpAction instanceof RockAction)\n {\n animateSelectedButton(firstPlayerRock, false);\n }\n else if (fpAction instanceof PaperAction)\n {\n animateSelectedButton(firstPlayerPaper, false);\n }\n else if (fpAction instanceof ScissorsAction)\n {\n animateSelectedButton(firstPlayerScissors, false);\n }\n\n // Second player reset state\n if (spAction instanceof RockAction)\n {\n animateSelectedButton(secondPlayerRock, true);\n }\n else if (spAction instanceof PaperAction)\n {\n animateSelectedButton(secondPlayerPaper, true);\n }\n else if (spAction instanceof ScissorsAction)\n {\n animateSelectedButton(secondPlayerScissors, true);\n }\n }", "public int getCurrentSets(){\n\t\tCurrentSets = 0;\n\t\twhile(blocks[CurrentSets].getValid() == true){\n\t\t\tCurrentSets++;\n\t\t\tif(CurrentSets == blocksPerSet)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn CurrentSets ;\n\t}", "public java.util.List<? extends com.rpg.framework.database.Protocol.CharacterActionOrBuilder> \n getActionsOrBuilderList() {\n if (actionsBuilder_ != null) {\n return actionsBuilder_.getMessageOrBuilderList();\n } else {\n return java.util.Collections.unmodifiableList(actions_);\n }\n }", "public java.util.List<? extends com.rpg.framework.database.Protocol.CharacterActionOrBuilder> \n getActionsOrBuilderList() {\n if (actionsBuilder_ != null) {\n return actionsBuilder_.getMessageOrBuilderList();\n } else {\n return java.util.Collections.unmodifiableList(actions_);\n }\n }", "public void setActions(List<OFAction> actions) {\n\t\tthis.actions = actions;\r\n\t}", "default List<ItemAction<T>> actions() {\n return new ArrayList<>();\n }", "public AccessibleStateSet getAccessibleStateSet() {\n AccessibleStateSet states = super.getAccessibleStateSet();\n states.add(AccessibleState.SINGLE_LINE);\n return states;\n }", "public CachetActionList getActions() {\n throw new RuntimeException(\"Method not implemented.\");\n }", "protected void updateButtonStates()\n\t{\n\t\tboolean isLastStep = isLastStep(currentStep);\n\t\tboolean isFirstStep = isFirstStep(currentStep);\n\t\t// Check whether current step data is valid or not\n\t\tboolean isValid = currentStep.onAdvance();\n\t\tthis.getCancelButton().setVisible(!isLastStep);\n\t\tthis.getCancelButton().setEnabled(!isLastStep);\n\t\t\n\t\tthis.getBackButton().setVisible(!isLastStep);\n\t\tthis.getBackButton().setEnabled(!isFirstStep && !isLastStep);\n\n\t\tthis.getNextButton().setVisible(!isLastStep);\n\t\tthis.getNextButton().setEnabled(!isLastStep && isValid);\n\n\t\tthis.getFinishButton().setEnabled(isLastStep);\n\t\tthis.getFinishButton().setVisible(isLastStep);\n\t}", "private static String getStateInput() {\n\t\treturn getQuery(\"Valid State\");\n\t}", "@Test\n\tpublic void shouldListStates() {\n\t\tRoleDTO role = workflowStub.assignRole(app, user, formDto);\n\t\n\t\t// Creamos estados con el mismo rol\n\t\tnewState(formDto, \"state1\", role);\n\t\tnewState(formDto, \"state2\", role);\n\t\tnewState(formDto, \"state3\", role);\n\t\t\n\t\tList<State> states = stateService.listStatesForUser(user, formDto);\n\t\tAssert.assertNotNull(\"List of states should NOT be null\", states);\n\t\tAssert.assertEquals(\"List should have the expected size\", 3, states.size());\n\t}", "public void setStateToActive() {\n state = VALID_STATES[0];\n }", "public List<ActionButton> getButtonActions() {\n\n ArrayList<ActionButton> result = new ArrayList<>();\n\n for (Action item : actions.values())\n if (item instanceof ActionButton)\n result.add((ActionButton)item);\n\n return result;\n }", "public List<List<Action>> getPlannedActions() {\r\n\t\treturn plannedActions;\r\n\t}", "public Map<StageAction, StageComponent> getActionsForStage(int stage) {\n\t\treturn stagesOfActions.getOrDefault(stage, null);\n\t}", "static public Action[] getActions()\r\n {\r\n JTextPane TempTextPane = new JTextPane();\r\n\t return(TempTextPane.getActions() );\r\n }", "@ApiModelProperty(required = true, value = \"Actions this permission is allowed to perform\")\n public List<String> getPermittedActions() {\n return permittedActions;\n }", "public java.util.List<? extends com.rpg.framework.database.Protocol.CharacterActionOrBuilder> \n getActionsOrBuilderList() {\n return actions_;\n }", "public java.util.List<? extends com.rpg.framework.database.Protocol.CharacterActionOrBuilder> \n getActionsOrBuilderList() {\n return actions_;\n }", "public int getActionsCount() {\n return actions_.size();\n }", "public int getActionsCount() {\n return actions_.size();\n }", "@Override\n protected Set<Action> deriveActions(SUT system, State state) throws ActionBuildException {\n\n //The super method returns a ONLY actions for killing unwanted processes if needed, or bringing the SUT to\n //the foreground. You should add all other actions here yourself.\n // These \"special\" actions are prioritized over the normal GUI actions in selectAction() / preSelectAction().\n Set<Action> actions = super.deriveActions(system,state);\n\n\n // Derive left-click actions, click and type actions, and scroll actions from\n // top level (highest Z-index) widgets of the GUI:\n actions = deriveClickTypeScrollActionsFromTopLevelWidgets(actions, system, state);\n\n if(actions.size()==0){\n // If the top level widgets did not have any executable widgets, try all widgets:\n// System.out.println(\"No actions from top level widgets, changing to all widgets.\");\n // Derive left-click actions, click and type actions, and scroll actions from\n // all widgets of the GUI:\n actions = deriveClickTypeScrollActionsFromAllWidgetsOfState(actions, system, state);\n }\n\n //return the set of derived actions\n return actions;\n }", "private int debugCurrentActions(ClusterRegionStatus crs) {\n Map<ServerName, List<CompactAction>> serverCompactActions = getAllActions(crs);\n int totalActions = 0;\n for(ServerName name : serverCompactActions.keySet()) {\n log.info(\"Printing pending compaction actions for server \" + name.getHostname());\n for(CompactAction action : serverCompactActions.get(name)) {\n totalActions++;\n log.info(\"Want to perform \" + action);\n }\n }\n return totalActions;\n }", "public String[] getActiveStates() {\r\n String[] states = currentProcessInstance.getActiveStates();\r\n if (states == null)\r\n return new String[0];\r\n \r\n String[] stateLabels = new String[states.length];\r\n for (int i = 0; i < states.length; i++) {\r\n stateLabels[i] = getState(states[i]).getLabel(currentRole, getLanguage());\r\n }\r\n \r\n return stateLabels;\r\n }", "private static void _VerifyAllowedTransition(short oldState, short newState){\r\n\t\tswitch (oldState){\r\n\t\t\tcase STATE_INSTALLED: {\r\n\t\t\t\tif (newState == STATE_SELECTED) {break;}\r\n\t\t\t\tif (newState == STATE_BLOCKED) {break;}\r\n\r\n\t\t\t\tthrow new RuntimeException(\"State transition is not allowed\");\r\n\t\t\t}\r\n\t\t\tcase STATE_SELECTED: {\r\n\t\t\t\tif (newState == STATE_BLOCKED) {break;}\r\n\r\n\t\t\t\tthrow new RuntimeException(\"State transition is not allowed\");\r\n\t\t\t}\r\n\t\t\tcase STATE_UPLOADED: {\r\n\t\t\t\tif (newState == STATE_INSTALLED) {break;}\r\n\r\n\t\t\t\tthrow new RuntimeException(\"State transition is not allowed\");\r\n\t\t\t}\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tthrow new RuntimeException(\"State transition is not allowed\");\r\n\t\t}\r\n\t}", "@Override\n protected Action preSelectAction(State state, Set<Action> actions){\n // adding available actions into the HTML report:\n htmlReport.addActions(actions);\n return(super.preSelectAction(state, actions));\n }", "public Set getSchedulerState() {\r\n if (ndaStateSets == null) {\r\n return Collections.EMPTY_SET;\r\n } else {\r\n return Collections.unmodifiableSet(ndaStateSets[currentState]);\r\n }\r\n }", "public static List<IcyAbstractAction> getAllActions()\r\n {\r\n final List<IcyAbstractAction> result = new ArrayList<IcyAbstractAction>();\r\n\r\n for (Field field : GeneralActions.class.getFields())\r\n {\r\n final Class<?> type = field.getType();\r\n\r\n try\r\n {\r\n if (type.isAssignableFrom(IcyAbstractAction[].class))\r\n result.addAll(Arrays.asList(((IcyAbstractAction[]) field.get(null))));\r\n else if (type.isAssignableFrom(IcyAbstractAction.class))\r\n result.add((IcyAbstractAction) field.get(null));\r\n }\r\n catch (Exception e)\r\n {\r\n // ignore\r\n }\r\n }\r\n\r\n return result;\r\n }", "public State result(List<ActionSchema> actions) {\n State resultState = new State(new ArrayList<>(this.getFluents()));\n for (ActionSchema action :\n actions) {\n resultState = resultState.result(action);\n }\n return resultState;\n }", "public String getActions()\n {\n StringBuffer sb = new StringBuffer();\n boolean first = true;\n \n if ( ( m_eventTypeMask & MASK_SERVICE ) != 0 )\n {\n if ( first )\n {\n sb.append( ',' );\n }\n else\n {\n first = false;\n }\n sb.append( EVENT_TYPE_SERVICE );\n }\n if ( ( m_eventTypeMask & MASK_CONTROL ) != 0 )\n {\n if ( first )\n {\n sb.append( ',' );\n }\n else\n {\n first = false;\n }\n sb.append( EVENT_TYPE_CONTROL );\n }\n if ( ( m_eventTypeMask & MASK_CORE ) != 0 )\n {\n if ( first )\n {\n sb.append( ',' );\n }\n else\n {\n first = false;\n }\n sb.append( EVENT_TYPE_CORE );\n }\n \n return sb.toString();\n }" ]
[ "0.66276973", "0.65545887", "0.6493592", "0.6215038", "0.6089572", "0.60677886", "0.6016111", "0.5967374", "0.58761626", "0.5851257", "0.57760537", "0.57422745", "0.5730564", "0.5721561", "0.5713174", "0.570809", "0.5671971", "0.56715155", "0.5671195", "0.56517994", "0.56158996", "0.5593841", "0.55476743", "0.5541754", "0.5538427", "0.55278385", "0.55069923", "0.5490054", "0.5459841", "0.54414874", "0.541526", "0.5404045", "0.53918946", "0.53872436", "0.5352535", "0.5332407", "0.53047657", "0.5276663", "0.5265199", "0.52602875", "0.52453005", "0.5239907", "0.52382267", "0.52367043", "0.5207603", "0.5203158", "0.5201696", "0.5199022", "0.5198344", "0.51789516", "0.51775014", "0.51731235", "0.514849", "0.513907", "0.5132276", "0.5132101", "0.5129257", "0.5116597", "0.5115543", "0.5112838", "0.5112838", "0.5100513", "0.50819093", "0.5078049", "0.50744486", "0.507275", "0.5057687", "0.50407445", "0.50399953", "0.5036637", "0.5035081", "0.5024459", "0.50231683", "0.50231683", "0.4992788", "0.49890637", "0.49871165", "0.4986093", "0.49845517", "0.49744943", "0.496987", "0.49636394", "0.49609965", "0.4956845", "0.49494722", "0.49487337", "0.49463174", "0.49450147", "0.49439123", "0.493582", "0.49358016", "0.4934541", "0.49135605", "0.49065375", "0.49025247", "0.48985952", "0.48806563", "0.48790503", "0.48757657", "0.48697945" ]
0.71686673
0
Of getValidActions Reset the game.
public void reset() { // SimpleTools.processTrackingOutput("Resetting TicTacToe."); for (int i = 0; i < checkerboard.length; i++) { for (int j = 0; j < checkerboard[0].length; j++) { checkerboard[i][j] = EMPTY; } // Of for j } // Of for i currentState = 0; currentRouteLength = 1; // White first currentPlayer = WHITE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void reset(){\n\t\tstate.reset();\n\t\toldState.reset();\n\t\treturnAction = new boolean[Environment.numberOfButtons]; \n\t\trewardSoFar = 0;\n\t\tcurrentReward = 0;\n\t}", "public int[] getValidActions() {\n\t\treturn getValidActions(currentState);\n\t}", "private void resetValidMove()\n {\n validMoves = null;\n setToValidMoveColor = false;\n validMoveFlag = false;\n }", "protected void resetActionsCache() {\r\n\t\tactionsCache.clear();\r\n\t}", "void clearActions();", "private void resetActionButtonsState()\n {\n // Actions\n GameAction fpAction = firstPlayer.getLastAction();\n GameAction spAction = secondPlayer.getLastAction();\n\n // First player reset state\n if (fpAction instanceof RockAction)\n {\n animateSelectedButton(firstPlayerRock, false);\n }\n else if (fpAction instanceof PaperAction)\n {\n animateSelectedButton(firstPlayerPaper, false);\n }\n else if (fpAction instanceof ScissorsAction)\n {\n animateSelectedButton(firstPlayerScissors, false);\n }\n\n // Second player reset state\n if (spAction instanceof RockAction)\n {\n animateSelectedButton(secondPlayerRock, true);\n }\n else if (spAction instanceof PaperAction)\n {\n animateSelectedButton(secondPlayerPaper, true);\n }\n else if (spAction instanceof ScissorsAction)\n {\n animateSelectedButton(secondPlayerScissors, true);\n }\n }", "public void reset() {\r\n active.clear();\r\n missioncontrollpieces = GameConstants.PIECES_SET;\r\n rolled = 0;\r\n phase = 0;\r\n round = 0;\r\n action = 0;\r\n }", "public void reset()\n {\n Action = new boolean[Environment.numberOfButtons];\n }", "public List<boolean[]> getValidActions()\n\t{\n\t\tList<boolean[]> validActions = new ArrayList<boolean[]>(allActions);\n\t\t//TODO remove actions that contain jump if environment.mayMarioJump() is false\n\t\treturn validActions;\n\t}", "public void gameReset() {\r\n\t\tfor (int n = 0; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 7; m++) {\r\n\t\t\t\tsquares[n][m].setText(\"\");\r\n\t\t\t\tsquares[n][m].setBackground(Color.BLUE);\r\n\t\t\t\tsquares[n][m].setEnabled(true);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int a = 0; a < 7; a++) {\r\n\t\t\tbuttons[a].setEnabled(true);\r\n\t\t\tbuttons[a].setBackground(Color.BLACK);\r\n\r\n\t\t}\r\n\t\tif (gameType == 2) {\r\n\t\t\tboard();\r\n\t\t\tfor (int i = 0; i < 7; i++) {\r\n\t\t\t\tindex[i] = 6;\r\n\t\t\t}\r\n\r\n\t\t} else if (gameType == 1) {\r\n\t\t\tcompAI.setUpArray(ROW, COL);\r\n\t\t}\r\n\t}", "@Test\n public void testReset() {\n action.reset();\n assertFalse(action.isExecuted());\n }", "public static void getValidActionsTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 6643 };\n\n\t\tint[] tempResultArray;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResultArray = tempEnvironment.getValidActions(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The valid actions of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.toString(tempResultArray));\n\t\t} // Of for i\n\t}", "public void resetAction()\r\n {\r\n this.action = null;\r\n }", "public void resetGame() {\r\n\t\tfor(Player p : players) {\r\n\t\t\tp.reset();\r\n\t\t}\r\n\t\tstate.reset();\r\n\t}", "private void resetAfterGame() {\n }", "public void reset(){\n if (isValidated()) resetAndUnblock();\n }", "public void clearActions() {\n internalGroup.clearActions();\n }", "private void disableActions() {\r\n\t\tif (resetToDefaults.isEnabled()) {\r\n\t\t\tresetToDefaults.setEnabled(true);\r\n\t\t\tresetToDefaults.setEnabled(false);\r\n\t\t}\r\n\t}", "private void resetGame(){\n\n }", "public static List<String> getValidActions() {\n return VALID_ACTIONS;\n }", "public void reset() {\n gameStatus = null;\n userId = null;\n gameId = null;\n gameUpdated = false;\n selectedTile = null;\n moved = false;\n }", "public void checkActions() {\n\t\tfor (BaseAction ba : this.actions) {\n\t\t\tba.checkAction();\n\t\t}\n\t}", "public void reset() {\r\n\t\tplayAgain = false;\r\n\t\tmainMenu = false;\r\n\t\tachievement = 0;\r\n\t}", "public void reset(){\n paycheckController.reset();\n }", "public void resetValid()\n\t{\n\t\tthis.valid = true;\n\t}", "public ResetAction() {\n width = height = mines = 0;\n }", "@Override\r\n\tpublic void reset() {\r\n\t\tfor(int i = 0; i < rows_size; i++) {\r\n\t\t\tfor(int j = 0; j < columns_size; j++)\r\n\t\t\t\tgame[i][j].Clear();\r\n\t\t}\r\n\t\tcomputerTurn();\r\n\t\tcomputerTurn();\r\n\t\tfreeCells = rows_size*columns_size - 2;\r\n\t\ttakenCells = 2;\r\n\t}", "public void resetTimeLimitAction();", "private void reset() // reset the game so another game can be played.\n\t{\n\t\tenableControls(); // enable the controls again..\n\n\t\tfor (MutablePocket thisMutPocket: playerPockets) // Reset the pockets to their initial values.\n\t\t{\n\t\t\tthisMutPocket.setDiamondCount(3);\n\t\t}\n\n\t\tfor(ImmutablePocket thisImmPocket: goalPockets)\n\t\t{\n\t\t\tthisImmPocket.setDiamondCount(0);\n\t\t}\n\n\t\tfor(Player thisPlayer: players) // Same for the player..\n\t\t{\n\t\t\tthisPlayer.resetPlayer();\n\t\t}\n\n\t\tupdatePlayerList(); // Update the player list.\n\n\t}", "public void reset() {\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tfor (int j = 0; j<DIVISIONS; j++){\n\t\t\t\tgameArray[i][j] = 0;\n\t\t\t}\n\t\t}\n\t\tgameWon = false;\n\t\twinningPlayer = NEITHER;\n\t\tgameTie = false;\n\t\tcurrentPlayer = USER;\n\t}", "@Override\n public void reset(MiniGame game) {\n }", "@Override\n public void reset() {\n mMoveButtonActive = true;\n mMoveButtonPressed = false;\n mFireButtonPressed = false;\n droidHitPoints = 0;\n totalKillCollectPoints = 0;\n totalCollectNum = 0;\n// mCoinCount = 0;\n// mRubyCount = 0;\n mTotalKillCollectPointsDigits[0] = 0;\n mTotalKillCollectPointsDigits[1] = -1;\n mTotalCollectNumDigits[0] = 0;\n mTotalCollectNumDigits[1] = -1;\n totalKillCollectPointsDigitsChanged = true;\n totalCollectNumDigitsChanged = true;\n// mCoinDigits[0] = 0;\n// mCoinDigits[1] = -1;\n// mRubyDigits[0] = 0;\n// mRubyDigits[1] = -1;\n// mCoinDigitsChanged = true;\n// mRubyDigitsChanged = true;\n \n levelIntro = false;\n// mLevelIntro = false;\n \n mFPS = 0;\n mFPSDigits[0] = 0;\n mFPSDigits[1] = -1;\n mFPSDigitsChanged = true;\n mShowFPS = false;\n for (int x = 0; x < mDigitDrawables.length; x++) {\n mDigitDrawables[x] = null;\n }\n// mXDrawable = null;\n mFadePendingEventType = GameFlowEvent.EVENT_INVALID;\n mFadePendingEventIndex = 0;\n }", "public final void reset(){\n\t\tthis.undoStack = new GameStateStack();\n\t\tthis.redoStack = new GameStateStack();\n\t\t\n\t\tthis.currentBoard = currentRules.createBoard(currentSize);\n\t\tthis.currentRules.initBoard(currentBoard, currentInitCells, currentRandom);\n\t}", "public void resetMovementAttempts() {\r\n\t\tmovementAttempts = 0;\r\n\t}", "public void reset() { \r\n myGameOver = false; \r\n myGamePaused = false; \r\n }", "public void reset(){\n newGame();\n removeAll();\n repaint();\n ended = false;\n }", "private void resetGame() {\n game.resetScores();\n this.dialogFlag = false;\n rollButton.setDisable(false);\n undoButton.setDisable(true);\n resetButton.setDisable(true);\n setDefault(\"player\");\n setDefault(\"computer\");\n }", "public void reset() {\n\t\txD = x;\n\t\tyD = y;\n\t\taction = 0;\n\t\tdir2 = dir;\n\t\tvisibleToEnemy = false;\n\t\tselected = false;\n\t\t\n\t\tif (UNIT_R == true) {\n\t\t\t// dir = 0;\n\t\t} else if (UNIT_G == true) {\n\t\t\t// dir = 180 / 2 / 3.14;\n\t\t}\n\t}", "public int[] reset() \n {\n return reset;\n }", "public void removeAllActions() {\n menuDirty = true;\n actions.clear();\n selectedAction = null;\n }", "public void resetAttackAttempts() {\r\n\t\tattackAttempts = 0;\r\n\t}", "public abstract Op resetStates();", "public void resetGame() { \n\t\tInvokeMessage im = new InvokeMessage();\n\t\tim.setMethodName(\"doResetGame\");\n\t\tSheepPhysicsState sps = getSps();\n\t\tnew InvokeCallable(im, sps);\n\t}", "public void resetGame()\r\n\t{\r\n\t\tthis.inProgress = false;\r\n\t\tthis.round = 0;\r\n\t\tthis.phase = 0;\r\n\t\tthis.prices = Share.generate();\r\n\t\tint i = 0;\r\n\t\twhile(i < this.prices.size())\r\n\t\t{\r\n\t\t\tthis.prices.get(i).addShares(Config.StartingStockPrice);\r\n\t\t\t++i;\r\n\t\t}\r\n\t\tint p = 0;\r\n\t\twhile(p < Config.PlayerLimit)\r\n\t\t{\r\n\t\t\tif(this.players[p] != null)\r\n\t\t\t{\r\n\t\t\t\tthis.players[p].reset();\r\n\t\t\t}\r\n\t\t\t++p;\r\n\t\t}\r\n\t\tthis.deck = Card.createDeck();\r\n\t\tthis.onTable = new LinkedList<>();\r\n\t\tCollections.shuffle(this.deck);\r\n\t\tthis.dealToTable();\r\n\t}", "@Override\n public void resetGame() {\n\n }", "public int[] reset() {\r\n return reset;\r\n }", "@Override\r\n\tpublic List<ActionInput> getActions()\r\n\t{\n\t\treturn null;\r\n\t}", "@Override\n\tpublic void execute(Game game, Controller controller) {\n\t\tgame.reset();\n\t}", "public void resetBoard() {\n\t\tplayerTurn = 1;\n\t\tgameStart = true;\n\t\tdispose();\n\t\tplayerMoves.clear();\n\t\tnew GameBoard();\n\t}", "void reset()\n {\n reset(values);\n }", "public GameChart resetGame();", "@Test\n\tpublic void testValidRemainingActions() {\n\t\tassertFalse(Player.isValidRemainingActions(Player.MAX_ALLOWED_ACTIONS + 1));\n\t}", "public void reset() {\r\n\t\tsuper.reset();\r\n\t\tfor (TransitionMode mode : transitionModes) {\r\n\r\n\t\t\tmode.reset();\r\n\t\t}\r\n\r\n\t}", "public void reset(){\r\n\t\tdialogToDisplay=0;\r\n\t\tqueuedDialog=0;\r\n\t\toptionSelection=null;\r\n\t\tdone=false;\r\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent ae){\n\t\treset();\n\t}", "public void resetGame(){\n\t\tPlayer tempPlayer = new Player();\n\t\tui.setPlayer(tempPlayer);\n\t\tui.resetCards();\n\t}", "public static void resetGame() {\r\n\t\t//Set all variables to their default values.\r\n\t\tMain.isGameStarted = false;\r\n\t\tMain.isSetupDone = false;\r\n\t\tMain.isGameWon = false;\r\n\t\tMain.isGameLost = false;\r\n\t\tMain.isThreeHanded = false;\r\n\t\tMain.isFourHandedSingle = false;\r\n\t\tMain.isFourHandedTeams = false;\r\n\t\tMain.doBidding = false;\r\n\t\tMain.doScoring = false;\r\n\t\tMain.dealerIsPlayer1 = false;\r\n\t\tMain.dealerIsPlayer2 = false;\r\n\t\tMain.dealerIsPlayer3 = false;\r\n\t\tMain.dealerIsPlayer4 = false;\r\n\t\tMain.isNilAllowed = true;\r\n\t\tMain.isDoubleNilAllowed = true;\r\n\t\tMain.nilBidTeam1 = false;\r\n\t\tMain.nilBidTeam2 = false;\r\n\t\tMain.doubleIsAllowedPlayer1 = false;\r\n\t\tMain.doubleIsAllowedPlayer2 = false;\r\n\t\tMain.doubleIsAllowedPlayer3 = false;\r\n\t\tMain.doubleIsAllowedPlayer4 = false;\r\n\t\tMain.doubleIsAllowedTeam1 = false;\r\n\t\tMain.doubleIsAllowedTeam2 = false;\r\n\r\n\t\t\r\n\t\tMain.player1 = \"\";\r\n\t\tMain.player2 = \"\";\r\n\t\tMain.player3 = \"\";\r\n\t\tMain.player4 = \"\";\r\n\t\tMain.team1 = \"\";\r\n\t\tMain.team2 = \"\";\r\n\t\tMain.player1Bid = \"\";\r\n\t\tMain.player2Bid = \"\";\r\n\t\tMain.player3Bid = \"\";\r\n\t\tMain.player4Bid = \"\";\r\n\t\tMain.player1TricksTaken = \"\";\r\n\t\tMain.player2TricksTaken = \"\";\r\n\t\tMain.player3TricksTaken = \"\";\r\n\t\tMain.player4TricksTaken = \"\";\r\n\t\tMain.curDealer = \"\";\r\n\t\tMain.startDealer = \"\";\r\n\t\tMain.bagValue = \"1\";\r\n\t\tMain.nilValue = \"50\";\r\n\t\tMain.doubleNilValue = \"200\";\r\n\t\t\r\n\t\tMain.round = 0;\r\n\t\tMain.player1TimesSet = 0;\r\n\t\tMain.player2TimesSet = 0;\r\n\t\tMain.player3TimesSet = 0;\r\n\t\tMain.player4TimesSet = 0;\r\n\t\tMain.player1Score = \"0\";\r\n\t\tMain.player2Score = \"0\";\r\n\t\tMain.player3Score = \"0\";\r\n\t\tMain.player4Score = \"0\";\r\n\t\tMain.team1Score = \"0\";\r\n\t\tMain.team2Score = \"0\";\r\n\t\t\r\n\t\tGameSetup.gameTypeHidden.setState(true);\r\n\t\tGameSetup.threeHanded.setEnabled(true);\r\n\t\tGameSetup.fourHandedSingle.setEnabled(true);\r\n\t\tGameSetup.fourHandedTeams.setEnabled(true);\r\n\t\tGameSetup.dealerHidden.setState(true);\r\n\t\tGameSetup.choiceBoxPlayer1.setEnabled(true);\r\n\t\tGameSetup.choiceBoxPlayer2.setEnabled(true);\r\n\t\tGameSetup.choiceBoxPlayer3.setEnabled(true);\r\n\t\tGameSetup.choiceBoxPlayer4.setEnabled(true);\r\n\t\tGameSetup.hasPlayerChanged = false;\r\n\t\t\r\n\t\tEditGame.playerChanged = false;\r\n\t\tEditGame.scoreChanged = false;\r\n\t\tEditGame.roundToEdit = 0;\r\n\t\tEditGame.editedRound = 0;\r\n\t}", "public void ResetPlayer() {\n\t\tfor (int i = 0; i < moveOrder.length; i++) {\n\t\t\tmoves.add(moveOrder[i]);\n\t\t}\n\t\tthis.X = 0;\n\t\tthis.Y = 0;\n\t\tthis.movesMade = 0;\n\t\tthis.face = 1;\n\t}", "protected static void resetStateOfExecution(){\n collumsCalculated.set(0);\n updateExecutionStateProperty();\n }", "public ActionListener newResetAction() {\n // TODO Auto-generated method stub\n return new ResetAction();\n }", "private void resetActionPerformed(ActionEvent evt) {\n\t\t//if the reels are nor spinning perform the the action\n\t\tif (!isSpining) {\n\t\t\tint betAm = obj.getBet();\n\t\t\t//reset the bet amount and return the credit amount and update the labels and buttons\n\t\t\tobj.setCredit(obj.getCredit() + betAm);\n\t\t\tobj.setBet(0);\n\t\t\tupdateLabels();\n\t\t\tupdateDisabledButtons();\n\t\t}\n\t\t//restart\n//\t\tobj.setBet(0);\n//\t\tobj.setWin(0);\n//\t\tobj.setLoses(0);\n//\t\tobj.setCredit(10);\n//\t\tdispose();\n//\t\tstart();\n\t}", "public void resetTheGame(){\n\t\tfjCount = 0;\n\t\tquestionAnsweredCount = 0;\n\t\tfor(int i = 0 ; i< 5; i++){\n\t\t\tfor(int j = 0 ; j < 5 ; j++){\n\t\t\t\tboard[i][j].reset();\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0 ; i < teamNum; i ++){\n\t\t\tteams[i].reset();\n\t\t\tbets[i] = 0; \n\t\t}\n\t}", "public void reset(){\n active = false;\n done = false;\n state = State.invisible;\n curX = 0;\n }", "public void resetCommand() {\n beginMatchButton.setEnabled(false);\n switcherButton.setEnabled(true);\n stopMatchButton.setEnabled(false);\n\n autonomousTime.setEditable(true);\n teleoperatedTime.setEditable(true);\n\n resetProBar();\n\n renewGameThread(autonomousTime.getText(), teleoperatedTime.getText());\n\n SetAllBypassBoxesEnabled(true);\n\n SetAllBypassBoxesSelected(false);\n\n dsComStatusBlueTeam1.setBackground(NOT_READY);\n dsComStatusBlueTeam2.setBackground(NOT_READY);\n dsComStatusBlueTeam3.setBackground(NOT_READY);\n dsComStatusRedTeam1.setBackground(NOT_READY);\n dsComStatusRedTeam2.setBackground(NOT_READY);\n dsComStatusRedTeam3.setBackground(NOT_READY);\n\n robotComStatusBlueTeam1.setBackground(NOT_READY);\n robotComStatusBlueTeam2.setBackground(NOT_READY);\n robotComStatusBlueTeam3.setBackground(NOT_READY);\n robotComStatusRedTeam1.setBackground(NOT_READY);\n robotComStatusRedTeam2.setBackground(NOT_READY);\n robotComStatusRedTeam3.setBackground(NOT_READY);\n\n runningMatchTime.setText(UI_Layer.fixAutoTime(autonomousTime.getText()));\n\n PLC_Receiver.resetFieldESTOPPED();\n PLC_Sender.getInstance().updatePLC_Lights(true);\n\n SetAllTeamFieldsEditable(true);\n\n if (!Main.isSimpleMode()) {\n PLC_Sender.getInstance().updatePLC_Time(true);\n }\n System.out.println(\"Resetting Fields\");\n }", "private void resetGame() {\n rockList.clear();\n\n initializeGame();\n }", "@Override\n public void reset() {\n cancelAll();\n }", "public void reset() {\r\n\r\n for ( Card card : cards ) {\r\n if ( card.isFaceUp() ) {\r\n card.toggleFace( true );\r\n }\r\n }\r\n Collections.shuffle( cards );\r\n\r\n this.undoStack = new ArrayList<>();\r\n\r\n this.moveCount = 0;\r\n\r\n announce( null );\r\n }", "@Test\n public void testResetGame(){\n scoresModel.resetGame();\n try {\n scoresModel.resetGame();\n for(int i = 0; i < ScoresModel.maxNumOfAttempts; i++) {\n assertEquals(scoresModel.attemptsScore[i], 0);\n }\n for(int i = 0; i < ScoresModel.maxNumOfFrames; i++){\n assertEquals(scoresModel.frameTypes[i], FrameType.NOT_PLAYED);\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private void resetAll() {\n\t\tif(mu1 != null)\n\t\t\tmodel.getView().reset(mu1);\n\t\tmu1 = null;\n\t\t\n\t\tif(mu2 != null)\n\t\t\tmodel.getView().reset(mu2);\n\t\tmu2 = null;\n\t\t\n\t\tif(functionWord != null)\n\t\t\tmodel.getView().reset(functionWord);\n\t\tfunctionWord = null;\n\t\t\n\t\tmodel.getSGCreatingMenu().reset();\n\t}", "private void resetGame() {\r\n\t\t\r\n\t\tif(easy.isSelected()) {\r\n\t\t\tGRID_SIZE = 10;\r\n\t\t\tlbPits = 3;\r\n\t\t\tubPits = 5;\t\t\t\r\n\t\t} else if(medium.isSelected()) {\r\n\t\t\tGRID_SIZE = 15;\r\n\t\t\tlbPits = 8;\r\n\t\t\tubPits = 12;\r\n\t\t} else if(hard.isSelected()) {\r\n\t\t\tGRID_SIZE = 20;\r\n\t\t\tlbPits = 35;\r\n\t\t\tubPits = 45;\r\n\t\t} else {\r\n\t\t\tGRID_SIZE = 10;\r\n\t\t\tlbPits = 3;\r\n\t\t\tubPits = 5;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tvisited = new boolean[GRID_SIZE][GRID_SIZE];\r\n\t\tGameMapFactory mf = new GameMapFactory(new Obstacle[GRID_SIZE][GRID_SIZE], new Random(), GRID_SIZE, lbPits, ubPits);\r\n\t\tmf.setupMap();\r\n\t\tgame.resetGame(GRID_SIZE, mf.getGameMap(), visited, mf.getHunterPosition());\r\n\t\t\r\n\t}", "void reset() {\n myManager.reset();\n myScore = 0;\n myGameOver = false;\n myGameTicks = myInitialGameTicks;\n myOldGameTicks = myInitialGameTicks;\n repaint();\n }", "public void reset() {\n\t\t// set any default values\n\t\t// setDefaultController() ???\n\t}", "public void reset() {\n // corresponding function called in the Board object to reset piece\n // positions\n board.reset();\n // internal logic reset\n lastColor = true;\n gameOver = false;\n opponentSet = false;\n }", "private void resetValid() {\n for (String name : slotNames) {\n if (!validSlotCandidates.containsKey(name)) {\n validSlotCandidates.put(name, new TreeSet<RecognizerPrimitive>());\n }\n validSlotCandidates.get(name).clear();\n }\n }", "public void reset() {\n\t\tplayerModelDiff1.clear();\n\t\tplayerModelDiff4.clear();\n\t\tplayerModelDiff7.clear();\n\t\tif(normalDiffMethods)\n\t\t{\t\n\t\tupdatePlayerModel();\n\t\tdisplayReceivedRewards();\n\t\t}\n\t\tint temp_diffsegment1;\n\t\tint temp_diffsegment2;\n\t\tif (currentLevelSegment == 0) {\n\t\t\t//System.out.println(\"-you died in the first segment, resetting to how you just started\");\n\t\t\ttemp_diffsegment1 = (int) plannedDifficultyLevels.get(0);\n\t\t\ttemp_diffsegment2 = (int) plannedDifficultyLevels.get(1);\n\t\t}\n\t\telse {\n\t\t\t//System.out.println(\"-nextSegmentAlreadyGenerated:\" + nextSegmentAlreadyGenerated);\n\t\t\tif (nextSegmentAlreadyGenerated) {\n\t\t\t\t//because the next segment is already generated (and so the previous does not exist anymore),\n\t\t\t\ttemp_diffsegment1 = (int) plannedDifficultyLevels.get(currentLevelSegment);\n\t\t\t\ttemp_diffsegment2 = (int) plannedDifficultyLevels.get(currentLevelSegment+1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//because the next segment is not yet generated\n\t\t\t\ttemp_diffsegment1 = (int) plannedDifficultyLevels.get(currentLevelSegment-1);\n\t\t\t\ttemp_diffsegment2 = (int) plannedDifficultyLevels.get(currentLevelSegment);\n\t\t\t}\n\t\t}\n\t\tplannedDifficultyLevels.clear();\n\n\t\t//System.out.println(\"-resetting to: \" + temp_diffsegment1 + \", \" + temp_diffsegment2);\n\t\tplannedDifficultyLevels.add(temp_diffsegment1);\n\t\tplannedDifficultyLevels.add(temp_diffsegment2);\n\t\tcurrentLevelSegment = 0;\n\n\t\tpaused = false;\n\t\tSprite.spriteContext = this;\n\t\tsprites.clear();\n\n\t\ttry {\n\t\t\tlevel2 = level2_reset.clone();\n\t\t} catch (CloneNotSupportedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\ttry {\n\t\t\tlevel3 = level3_reset.clone();\n\t\t} catch (CloneNotSupportedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n fixborders();\n\t\tconjoin();\n\n\t\tlayer = new LevelRenderer(level, graphicsConfiguration, 320, 240);\n\t\tfor (int i = 0; i < 2; i++)\n\t\t{\n\t\t\tint scrollSpeed = 4 >> i;\n\t\tint w = ((level.getWidth() * 16) - 320) / scrollSpeed + 320;\n\t\tint h = ((level.getHeight() * 16) - 240) / scrollSpeed + 240;\n\t\tLevel bgLevel = BgLevelGenerator.createLevel(w / 32 + 1, h / 32 + 1, i == 0, levelType);\n\t\tbgLayer[i] = new BgRenderer(bgLevel, graphicsConfiguration, 320, 240, scrollSpeed);\n\t\t}\n\n\t\tdouble oldX = 0;\n\t\tif(mario!=null)\n\t\t\toldX = mario.x;\n\n\t\tmario = new Mario(this);\n\t\tsprites.add(mario);\n\t\tstartTime = 1;\n\n\t\ttimeLeft = 200*15;\n\n\t\ttick = 0;\n\n\t\t/*\n\t\t * SETS UP ALL OF THE CHECKPOINTS TO CHECK FOR SWITCHING\n\t\t */\n\t\t switchPoints = new ArrayList<Double>();\n\n\t\t//first pick a random starting waypoint from among ten positions\n\t\tint squareSize = 16; //size of one square in pixels\n\t\tint sections = 10;\n\n\t\tdouble startX = 32; //mario start position\n\t\tdouble endX = level.getxExit()*squareSize; //position of the end on the level\n\t\t//if(!isCustom && recorder==null)\n level2.playValues = this.valueList[0];\n\t\t\trecorder = new DataRecorder(this,level3,keys);\n\t\t\t////System.out.println(\"\\n enemies LEFT : \" + recorder.level.COINS); //Sander disable\n\t\t\t////System.out.println(\"\\n enemies LEFT : \" + recorder.level.BLOCKS_COINS);\n\t\t\t////System.out.println(\"\\n enemies LEFT : \" + recorder.level.BLOCKS_POWER);\n\t\t\tgameStarted = false;\n\t}", "public void reset() {\n\t\tmCycleFlip = false;\n\t\tmRepeated = 0;\n\t\tmMore = true;\n //mOneMoreTime = true;\n \n\t\t// 추가\n\t\tmStarted = mEnded = false;\n\t\tmCanceled = false;\n }", "public void reset() {\r\n reset(params);\r\n }", "public void resetGame(){\r\n\t\tSystem.out.println(\"Reset game min:\"+minimum+\" max:\"+maximum);\r\n\t\t//reset the target, set guesses to 1, and newGame flag to true\r\n\t\ttarget.setRandom(minimum, maximum, \"reset game\");\r\n\t\tthis.msg.setMessage(\"\");\r\n\t\tthis.guesses.setValue(1);\r\n\t\t\r\n\t}", "public void resetFail() {\n borraArchivos();\n addMessage(\"Carga Cancelada\", null);\n }", "private void reset() {\n\n\n spaceShips.clear();\n playerOne = null;\n playerTwo = null;\n friendlyBullets.clear();\n enemyBullets.clear();\n powerUps.clear();\n enemyGenerator.reset();\n difficulty.reset();\n Bullets.BulletType.resetSpeed();\n\n for (int i = 0; i < enemies.size(); i++) {\n enemies.get(i).getEnemyImage().delete();\n }\n enemies.clear();\n }", "public void reset()\r\n {\r\n gameBoard.reset();\r\n fillBombs();\r\n fillBoard();\r\n scoreBoard.reset();\r\n }", "public void resetGame() {\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tfor (int j = 0; j < 4; j++) {\n\t\t\t\tboard[i][j] = 0;\n\t\t\t\tgetChildren().remove(renders[i][j]);\n\t\t\t\trenders[i][j] = null;\n\t\t\t}\n\t\t}\n\t}", "public void resetState();", "public void reset(){\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm -r data/games_module\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"sed -i \\\"1s/.*/ \"+\"0\"+\" /\\\" data/winnings\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"sed -i \\\"1s/.*/ \"+\"175\"+\" /\\\" data/tts_speed\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/answered_questions\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/five_random_categories\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/current_player\");\n\t\t_currentPlayer = null;\n\t\t_internationalUnlocked = false;\n\t\t_gamesData.clear();\n\t\t_fiveRandomCategories.clear();\n\t\tfor (int i= 0; i<5;i++) {\n\t\t\t_answeredQuestions[i]=0;\n\t\t}\n\t\tBashCmdUtil.bashCmdNoOutput(\"touch data/answered_questions\");\n\t\tinitialiseCategories();\n\t\ttry {\n\t\t\treadCategories();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tsetFiveRandomCategories();\n\t}", "protected abstract boolean reset();", "public void reset() {\n\n players = new Player[numAIPlayers + 1];\n createHumanPlayer();\n createAIPlayers(numAIPlayers);\n wholeDeck.shuffle();\n\n // --- DEBUG LOG ---\n // The contents of the complete deck after it has been shuffled\n Logger.log(\"COMPLETE GAME DECK AFTER SHUFFLE:\", wholeDeck.toString());\n\n assignCards(wholeDeck, players);\n activePlayer = randomlySelectFirstPlayer(players);\n playersInGame = new ArrayList<>(Arrays.asList(players));\n winningCard = null;\n roundWinner = null;\n\n roundNumber = 1;\n drawRound = 0;\n }", "public void resetGame() {\n\t\thandler.setDown(false);\n\t\thandler.setLeft(false);\n\t\thandler.setRight(false);\n\t\thandler.setUp(false);\n\n\t\tclearOnce = 0;\n\t\thp = 100;\n\t\tfromAnotherScreen = true;\n\t\tsetState(1);\n\t}", "public void reset () {}", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();" ]
[ "0.664398", "0.64907396", "0.64466804", "0.6291138", "0.61908", "0.6169665", "0.61690044", "0.6163931", "0.6115357", "0.6102568", "0.6020735", "0.60067487", "0.59865266", "0.5943725", "0.5931844", "0.58979535", "0.58741456", "0.5873918", "0.58639246", "0.58568037", "0.5850716", "0.58304954", "0.58290446", "0.5827573", "0.58268225", "0.5819092", "0.5773084", "0.57251525", "0.5720637", "0.5718241", "0.5710101", "0.5707096", "0.56857157", "0.5666462", "0.56540567", "0.5638807", "0.5628034", "0.5626221", "0.5568212", "0.5564048", "0.5561536", "0.55524105", "0.55508196", "0.5539878", "0.55374473", "0.5529823", "0.5518003", "0.5512203", "0.5468088", "0.5440585", "0.5440319", "0.54382193", "0.5436808", "0.54355294", "0.5431075", "0.54184896", "0.54099333", "0.5408357", "0.5407616", "0.54025805", "0.54008293", "0.5397241", "0.53926337", "0.5383193", "0.53794646", "0.53773975", "0.53757447", "0.5365183", "0.5356728", "0.5355296", "0.53490204", "0.53482586", "0.5347509", "0.53459984", "0.53448933", "0.53373224", "0.5336122", "0.5333225", "0.5325395", "0.5324263", "0.5321077", "0.53168756", "0.53162307", "0.5316005", "0.5310731", "0.53105795", "0.53052634", "0.5301168", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326", "0.52983326" ]
0.57760006
26
Of reset Get the game situation.
public int getGameSituation() { return gameSituation; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void resetAfterGame() {\n }", "@Override\n public void resetGame() {\n\n }", "@Override\n public void reset(MiniGame game) {\n }", "private void resetGame(){\n\n }", "private void resetGame() {\n game.resetScores();\n this.dialogFlag = false;\n rollButton.setDisable(false);\n undoButton.setDisable(true);\n resetButton.setDisable(true);\n setDefault(\"player\");\n setDefault(\"computer\");\n }", "public void reset() { \r\n myGameOver = false; \r\n myGamePaused = false; \r\n }", "public GameChart resetGame();", "public void reset() {\r\n\t\tplayAgain = false;\r\n\t\tmainMenu = false;\r\n\t\tachievement = 0;\r\n\t}", "public void resetGame() {\n\t\thandler.setDown(false);\n\t\thandler.setLeft(false);\n\t\thandler.setRight(false);\n\t\thandler.setUp(false);\n\n\t\tclearOnce = 0;\n\t\thp = 100;\n\t\tfromAnotherScreen = true;\n\t\tsetState(1);\n\t}", "public void reset() {\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tfor (int j = 0; j<DIVISIONS; j++){\n\t\t\t\tgameArray[i][j] = 0;\n\t\t\t}\n\t\t}\n\t\tgameWon = false;\n\t\twinningPlayer = NEITHER;\n\t\tgameTie = false;\n\t\tcurrentPlayer = USER;\n\t}", "private void resetGame() {\r\n\t\t\r\n\t\tif(easy.isSelected()) {\r\n\t\t\tGRID_SIZE = 10;\r\n\t\t\tlbPits = 3;\r\n\t\t\tubPits = 5;\t\t\t\r\n\t\t} else if(medium.isSelected()) {\r\n\t\t\tGRID_SIZE = 15;\r\n\t\t\tlbPits = 8;\r\n\t\t\tubPits = 12;\r\n\t\t} else if(hard.isSelected()) {\r\n\t\t\tGRID_SIZE = 20;\r\n\t\t\tlbPits = 35;\r\n\t\t\tubPits = 45;\r\n\t\t} else {\r\n\t\t\tGRID_SIZE = 10;\r\n\t\t\tlbPits = 3;\r\n\t\t\tubPits = 5;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tvisited = new boolean[GRID_SIZE][GRID_SIZE];\r\n\t\tGameMapFactory mf = new GameMapFactory(new Obstacle[GRID_SIZE][GRID_SIZE], new Random(), GRID_SIZE, lbPits, ubPits);\r\n\t\tmf.setupMap();\r\n\t\tgame.resetGame(GRID_SIZE, mf.getGameMap(), visited, mf.getHunterPosition());\r\n\t\t\r\n\t}", "private void reset() // reset the game so another game can be played.\n\t{\n\t\tenableControls(); // enable the controls again..\n\n\t\tfor (MutablePocket thisMutPocket: playerPockets) // Reset the pockets to their initial values.\n\t\t{\n\t\t\tthisMutPocket.setDiamondCount(3);\n\t\t}\n\n\t\tfor(ImmutablePocket thisImmPocket: goalPockets)\n\t\t{\n\t\t\tthisImmPocket.setDiamondCount(0);\n\t\t}\n\n\t\tfor(Player thisPlayer: players) // Same for the player..\n\t\t{\n\t\t\tthisPlayer.resetPlayer();\n\t\t}\n\n\t\tupdatePlayerList(); // Update the player list.\n\n\t}", "void resetGame() {\r\n if (GameInfo.getInstance().isWin()) {\r\n GameInfo.getInstance().resetDots();\r\n MazeMap.getInstance().init();\r\n GameInfo.getInstance().resetFruitDisappearTime();\r\n MazeMap.getInstance().updateMaze(GameInfo.getInstance().getMode());\r\n }\r\n for (PropertyChangeListener pcl : pcs.getPropertyChangeListeners(Constants.PACMAN)) {\r\n pcs.removePropertyChangeListener(Constants.PACMAN, pcl);\r\n }\r\n for (PropertyChangeListener pcl : pcs.getPropertyChangeListeners(Constants.GHOSTS)) {\r\n pcs.removePropertyChangeListener(Constants.GHOSTS, pcl);\r\n }\r\n PacMan pacMan = initPacMan();\r\n initGhosts(pacMan);\r\n }", "public void reset() {\n\t\tmakeSolutionState();\n\t\twhile (isSolution(this.gameBoard)) {\n\t\t\trandomizeBoard();\n\t\t}\n\t\tlog.clear();\n\t\twon =false;\n\t\twasReset=true;\n\t\t\n\t\tsetChanged();\n\t\tnotifyObservers();\t\t\n\t}", "public void resetGame(){\r\n\t\tSystem.out.println(\"Reset game min:\"+minimum+\" max:\"+maximum);\r\n\t\t//reset the target, set guesses to 1, and newGame flag to true\r\n\t\ttarget.setRandom(minimum, maximum, \"reset game\");\r\n\t\tthis.msg.setMessage(\"\");\r\n\t\tthis.guesses.setValue(1);\r\n\t\t\r\n\t}", "public void resetGame() { \n\t\tInvokeMessage im = new InvokeMessage();\n\t\tim.setMethodName(\"doResetGame\");\n\t\tSheepPhysicsState sps = getSps();\n\t\tnew InvokeCallable(im, sps);\n\t}", "public void resetGame()\r\n\t{\r\n\t\tthis.inProgress = false;\r\n\t\tthis.round = 0;\r\n\t\tthis.phase = 0;\r\n\t\tthis.prices = Share.generate();\r\n\t\tint i = 0;\r\n\t\twhile(i < this.prices.size())\r\n\t\t{\r\n\t\t\tthis.prices.get(i).addShares(Config.StartingStockPrice);\r\n\t\t\t++i;\r\n\t\t}\r\n\t\tint p = 0;\r\n\t\twhile(p < Config.PlayerLimit)\r\n\t\t{\r\n\t\t\tif(this.players[p] != null)\r\n\t\t\t{\r\n\t\t\t\tthis.players[p].reset();\r\n\t\t\t}\r\n\t\t\t++p;\r\n\t\t}\r\n\t\tthis.deck = Card.createDeck();\r\n\t\tthis.onTable = new LinkedList<>();\r\n\t\tCollections.shuffle(this.deck);\r\n\t\tthis.dealToTable();\r\n\t}", "public void restart() {\n this.getPlayerHand().getHandCards().clear();\n this.dealerHand.getHandCards().clear();\n this.getPlayerHand().setActualValue(0);\n this.getDealerHand().setActualValue(0);\n this.gameOver = false;\n this.playerBet = MIN_BET;\n this.roundCount = 0;\n this.isRunning = true;\n this.startGame();\n }", "@Override\n\tpublic void reset(){\n\t\tstate.reset();\n\t\toldState.reset();\n\t\treturnAction = new boolean[Environment.numberOfButtons]; \n\t\trewardSoFar = 0;\n\t\tcurrentReward = 0;\n\t}", "private void ResetGame(){\n this.deck = new Deck();\n humanPlayer.getHand().clear();\n humanPlayer.setWager(0);\n dealer.getHand().clear();\n }", "public void resetGame(){\n\t\tPlayer tempPlayer = new Player();\n\t\tui.setPlayer(tempPlayer);\n\t\tui.resetCards();\n\t}", "public void resetgamestate() {\n \tthis.gold = STARTING_GOLD;\n \tthis.crew = STARTING_FOOD;\n \tthis.points = 0;\n \tthis.masterVolume = 0.1f;\n this.soundVolume = 0.5f;\n this.musicVolume = 0.5f;\n \n this.ComputerScience = new Department(COMP_SCI_WEPS.getWeaponList(), COMP_SCI_UPGRADES.getRoomUpgradeList(), this);\n this.LawAndManagement = new Department(LMB_WEPS.getWeaponList(), LMB_UPGRADES.getRoomUpgradeList(), this);\n this.Physics = new Department(PHYS_WEPS.getWeaponList(), PHYS_UPGRADES.getRoomUpgradeList(), this);\n \n this.playerShip = STARTER_SHIP.getShip();\n this.playerShip.setBaseHullHP(700);\n this.playerShip.repairHull(700);\n this.combatPlayer = new CombatPlayer(playerShip);\n }", "public static void resetGame() {\r\n\t\t//Set all variables to their default values.\r\n\t\tMain.isGameStarted = false;\r\n\t\tMain.isSetupDone = false;\r\n\t\tMain.isGameWon = false;\r\n\t\tMain.isGameLost = false;\r\n\t\tMain.isThreeHanded = false;\r\n\t\tMain.isFourHandedSingle = false;\r\n\t\tMain.isFourHandedTeams = false;\r\n\t\tMain.doBidding = false;\r\n\t\tMain.doScoring = false;\r\n\t\tMain.dealerIsPlayer1 = false;\r\n\t\tMain.dealerIsPlayer2 = false;\r\n\t\tMain.dealerIsPlayer3 = false;\r\n\t\tMain.dealerIsPlayer4 = false;\r\n\t\tMain.isNilAllowed = true;\r\n\t\tMain.isDoubleNilAllowed = true;\r\n\t\tMain.nilBidTeam1 = false;\r\n\t\tMain.nilBidTeam2 = false;\r\n\t\tMain.doubleIsAllowedPlayer1 = false;\r\n\t\tMain.doubleIsAllowedPlayer2 = false;\r\n\t\tMain.doubleIsAllowedPlayer3 = false;\r\n\t\tMain.doubleIsAllowedPlayer4 = false;\r\n\t\tMain.doubleIsAllowedTeam1 = false;\r\n\t\tMain.doubleIsAllowedTeam2 = false;\r\n\r\n\t\t\r\n\t\tMain.player1 = \"\";\r\n\t\tMain.player2 = \"\";\r\n\t\tMain.player3 = \"\";\r\n\t\tMain.player4 = \"\";\r\n\t\tMain.team1 = \"\";\r\n\t\tMain.team2 = \"\";\r\n\t\tMain.player1Bid = \"\";\r\n\t\tMain.player2Bid = \"\";\r\n\t\tMain.player3Bid = \"\";\r\n\t\tMain.player4Bid = \"\";\r\n\t\tMain.player1TricksTaken = \"\";\r\n\t\tMain.player2TricksTaken = \"\";\r\n\t\tMain.player3TricksTaken = \"\";\r\n\t\tMain.player4TricksTaken = \"\";\r\n\t\tMain.curDealer = \"\";\r\n\t\tMain.startDealer = \"\";\r\n\t\tMain.bagValue = \"1\";\r\n\t\tMain.nilValue = \"50\";\r\n\t\tMain.doubleNilValue = \"200\";\r\n\t\t\r\n\t\tMain.round = 0;\r\n\t\tMain.player1TimesSet = 0;\r\n\t\tMain.player2TimesSet = 0;\r\n\t\tMain.player3TimesSet = 0;\r\n\t\tMain.player4TimesSet = 0;\r\n\t\tMain.player1Score = \"0\";\r\n\t\tMain.player2Score = \"0\";\r\n\t\tMain.player3Score = \"0\";\r\n\t\tMain.player4Score = \"0\";\r\n\t\tMain.team1Score = \"0\";\r\n\t\tMain.team2Score = \"0\";\r\n\t\t\r\n\t\tGameSetup.gameTypeHidden.setState(true);\r\n\t\tGameSetup.threeHanded.setEnabled(true);\r\n\t\tGameSetup.fourHandedSingle.setEnabled(true);\r\n\t\tGameSetup.fourHandedTeams.setEnabled(true);\r\n\t\tGameSetup.dealerHidden.setState(true);\r\n\t\tGameSetup.choiceBoxPlayer1.setEnabled(true);\r\n\t\tGameSetup.choiceBoxPlayer2.setEnabled(true);\r\n\t\tGameSetup.choiceBoxPlayer3.setEnabled(true);\r\n\t\tGameSetup.choiceBoxPlayer4.setEnabled(true);\r\n\t\tGameSetup.hasPlayerChanged = false;\r\n\t\t\r\n\t\tEditGame.playerChanged = false;\r\n\t\tEditGame.scoreChanged = false;\r\n\t\tEditGame.roundToEdit = 0;\r\n\t\tEditGame.editedRound = 0;\r\n\t}", "@Override\n public void reset() {\n updateDice(1, 1);\n playerCurrentScore = 0;\n playerScore = 0;\n updateScore();\n notifyPlayer(\"\");\n game.init();\n }", "public void resetGame() {\r\n\r\n\t\tplayerScore = 0;\r\n\t\tframe.setVisible(false);\r\n\t\tgame = new Game();\r\n\r\n\t}", "public void reset(){\n newGame();\n removeAll();\n repaint();\n ended = false;\n }", "public void ResetGame(){\n handComputer.clear();\n handHuman.clear();\n deck.clear();\n\n InitializeDeck();\n InitializeComputerHand();\n InitializeHumanHand();\n\n topCard = deck.get(0);\n }", "private void resetGame() {\n rockList.clear();\n\n initializeGame();\n }", "public void reset()\n\t{\n\t\t\n\t\tif (lifeCount > 1)\n\t\t{\n\t\t\tthis.setCollisionOn(false);\n\t\t\tthis.setEingabe(false);\n\t\t\tthis.reduceLifeCount();\n\t\t\timg.setRotation(0);\n\t\t\tthis.posX = startPosX;\n\t\t\tthis.setPosY(startPosY + 105);\n\t\t\tthis.spdX = startSpdX;\n\t\t\tthis.setSpdY(-60);\n\t\t\tcollisionShape.setCenterX(startPosX);\n\t\t\tcollisionShape.setCenterY(startPosY);\n\t\t\tsetRupeesInBag(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t/*\n\t\t\t * When Gameover\n\t\t\t */\n\t\t\t\n\t\t\tthis.posX = startPosX;\n\t\t\tthis.setPosY(startPosY);\n\t\t\tcollisionShape.setCenterX(startPosX);\n\t\t\tcollisionShape.setCenterY(startPosY);\n\t\t\tthis.reduceLifeCount();\n\t\t}\n\t}", "public void gameReset() {\r\n\t\tfor (int n = 0; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 7; m++) {\r\n\t\t\t\tsquares[n][m].setText(\"\");\r\n\t\t\t\tsquares[n][m].setBackground(Color.BLUE);\r\n\t\t\t\tsquares[n][m].setEnabled(true);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int a = 0; a < 7; a++) {\r\n\t\t\tbuttons[a].setEnabled(true);\r\n\t\t\tbuttons[a].setBackground(Color.BLACK);\r\n\r\n\t\t}\r\n\t\tif (gameType == 2) {\r\n\t\t\tboard();\r\n\t\t\tfor (int i = 0; i < 7; i++) {\r\n\t\t\t\tindex[i] = 6;\r\n\t\t\t}\r\n\r\n\t\t} else if (gameType == 1) {\r\n\t\t\tcompAI.setUpArray(ROW, COL);\r\n\t\t}\r\n\t}", "public void reset() {\n\t\tmCycleFlip = false;\n\t\tmRepeated = 0;\n\t\tmMore = true;\n //mOneMoreTime = true;\n \n\t\t// 추가\n\t\tmStarted = mEnded = false;\n\t\tmCanceled = false;\n }", "@Override\n public void reset() {\n mMoveButtonActive = true;\n mMoveButtonPressed = false;\n mFireButtonPressed = false;\n droidHitPoints = 0;\n totalKillCollectPoints = 0;\n totalCollectNum = 0;\n// mCoinCount = 0;\n// mRubyCount = 0;\n mTotalKillCollectPointsDigits[0] = 0;\n mTotalKillCollectPointsDigits[1] = -1;\n mTotalCollectNumDigits[0] = 0;\n mTotalCollectNumDigits[1] = -1;\n totalKillCollectPointsDigitsChanged = true;\n totalCollectNumDigitsChanged = true;\n// mCoinDigits[0] = 0;\n// mCoinDigits[1] = -1;\n// mRubyDigits[0] = 0;\n// mRubyDigits[1] = -1;\n// mCoinDigitsChanged = true;\n// mRubyDigitsChanged = true;\n \n levelIntro = false;\n// mLevelIntro = false;\n \n mFPS = 0;\n mFPSDigits[0] = 0;\n mFPSDigits[1] = -1;\n mFPSDigitsChanged = true;\n mShowFPS = false;\n for (int x = 0; x < mDigitDrawables.length; x++) {\n mDigitDrawables[x] = null;\n }\n// mXDrawable = null;\n mFadePendingEventType = GameFlowEvent.EVENT_INVALID;\n mFadePendingEventIndex = 0;\n }", "public void resetTask() {\n super.resetTask();\n this.entity.setAggroed(false);\n this.seeTime = 0;\n this.attackTime = -1;\n this.entity.resetActiveHand();\n }", "public void reset() {\n playing = true;\n won = false;\n startGame();\n\n // Make sure that this component has the keyboard focus\n requestFocusInWindow();\n }", "void reset() {\n myManager.reset();\n myScore = 0;\n myGameOver = false;\n myGameTicks = myInitialGameTicks;\n myOldGameTicks = myInitialGameTicks;\n repaint();\n }", "public void reset() {\r\n active.clear();\r\n missioncontrollpieces = GameConstants.PIECES_SET;\r\n rolled = 0;\r\n phase = 0;\r\n round = 0;\r\n action = 0;\r\n }", "public void reset() {\n gameStatus = null;\n userId = null;\n gameId = null;\n gameUpdated = false;\n selectedTile = null;\n moved = false;\n }", "public void resetHand()\r\n\t{\r\n\t\thandCount = 0;\r\n\t\tstand = false;\r\n\t}", "private void softReset() {\n // variables\n lapMap.clear();\n // ui\n sessionTView.setText(\"\");\n positionTView.setText(\"-\");\n currentLapTView.setText(\"--:--:---\");\n lastLapTView.setText(\"--:--:---\");\n bestLapTView.setText(\"--:--:---\");\n currentLapNumberTView.setText(\"-\");\n gapTView.setText(\" -.---\");\n fastestDriver = Float.MAX_VALUE;\n fastestDriverName = null;\n fastestDriverTView.setText(\"--:--:---\");\n fastestDriverNameTView.setText(\"Fastest lap\");\n Log.d(TAG, \"SOFT Reset: between game states\");\n }", "public void reset() {\n // corresponding function called in the Board object to reset piece\n // positions\n board.reset();\n // internal logic reset\n lastColor = true;\n gameOver = false;\n opponentSet = false;\n }", "public void reset(){\r\n barn.setVisited(Boolean.FALSE);\r\n turkeyTalk.setVisited(Boolean.FALSE);\r\n pigginOut.setVisited(Boolean.FALSE);\r\n seeTheLight.setVisited(Boolean.FALSE);\r\n theGobbling.setVisited(Boolean.FALSE);\r\n youDied1.setVisited(Boolean.FALSE);\r\n threeLittlePigs.setVisited(Boolean.FALSE);\r\n forTheGreaterGood.setVisited(Boolean.FALSE);\r\n farmHouseTurkey.setVisited(Boolean.FALSE);\r\n youWin.setVisited(Boolean.FALSE);\r\n }", "public void resetGame() {\r\n\t\tfor(Player p : players) {\r\n\t\t\tp.reset();\r\n\t\t}\r\n\t\tstate.reset();\r\n\t}", "protected void reset() {\n speed = 2.0;\n max_bomb = 1;\n flame = false;\n }", "private void resetGame() {\n game.resetGame();\n round_score = 0;\n\n // Reset values in views\n player_tot_view.setText(String.valueOf(game.getPlayer_total()));\n bank_tot_view.setText(String.valueOf(game.getBank_total()));\n round_score_view.setText(String.valueOf(round_score));\n String begin_label = \"Round \" + game.getRound() + \" - Player's Turn\";\n round_label.setText(begin_label);\n\n getTargetScore();\n }", "public void resetGame(){\n initBoard(ROWS, COLS, rand);\n }", "public final void reset() {\n\t\tscore = 0;\n\t\tlives = 10;\n\t\tshields = 3;\n\t}", "@Override\n public void resetQuestion() {\n super.resetQuestion();\n hadSecondChance = false;\n currentTeam = null;\n originalTeam = null;\n teamHasAnswered.clear();\n //reset teamHasAnswered map so all teams get a chance to anaswer again\n for (int i = 0; i < numTeams; i++) teamHasAnswered.put(i, false);\n }", "public void resetWinRecord()\n{\n gamesWon = 0;\n}", "public void resetTheGame(){\n\t\tfjCount = 0;\n\t\tquestionAnsweredCount = 0;\n\t\tfor(int i = 0 ; i< 5; i++){\n\t\t\tfor(int j = 0 ; j < 5 ; j++){\n\t\t\t\tboard[i][j].reset();\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0 ; i < teamNum; i ++){\n\t\t\tteams[i].reset();\n\t\t\tbets[i] = 0; \n\t\t}\n\t}", "public void resetGame(){\n\t\tlabyrinth.reset();\n\t\tlabyrinth = Labyrinth.getInstance();\n\t\tplayer.setX(0);\n\t\tplayer.setY(0);\n\n\t\tcandies = new HashMap();\n\t\tenemies = new HashMap();\n\t\tbuttons = new HashMap();\n\n\t\tint coordX = ThreadLocalRandom.current().nextInt(0, 16);\n\t\tint coordY = ThreadLocalRandom.current().nextInt(0, 16);\n\t\tdoor.setX(coordX);\n\t\tdoor.setY(coordY);\n\n\t\tgenerateCandies();\n\t\tgenerateEnemies();\n\n\t}", "public void reset(){\n\t\tfrogReposition();\n\t\tlives = 5;\n\t\tend = 0;\n\t}", "boolean reset();", "public void reset()\n {\n playersPiece = -1;\n king = false;\n empty = true;\n setTileColor(-1);\n }", "private void resetGame() {\n \tcanvas.reset();\n \tguessesLeft = 8;\n \tcurrentWord = \"\";\n \t\n \tguesses = \"\";\n \tword = pickWord();\n \tlist = new boolean[word.length()];\n \t\n \tfor (int i = 0; i < word.length(); i++) {\n \t\tcurrentWord += \"-\";\n \t}\n }", "@Override\r\n\tpublic void reset() {\r\n\t\t// TODO Auto-generated method stub\r\n\t\t\r\n\t\tthis.guessHistory.clear();\r\n\t}", "public void reset(){\r\n \ttablero.clear();\r\n \tfalling = null;\r\n \tgameOver = false;\r\n \tlevel = 0;\r\n \ttotalRows = 0;\r\n \tLevelHelper.setLevelSpeed(level, this);\r\n }", "protected abstract boolean reset();", "public void reset () {}", "public boolean reset();", "public final void reset(){\n\t\tthis.undoStack = new GameStateStack();\n\t\tthis.redoStack = new GameStateStack();\n\t\t\n\t\tthis.currentBoard = currentRules.createBoard(currentSize);\n\t\tthis.currentRules.initBoard(currentBoard, currentInitCells, currentRandom);\n\t}", "public void reset()\r\n {\r\n gameBoard.reset();\r\n fillBombs();\r\n fillBoard();\r\n scoreBoard.reset();\r\n }", "public void reset()\n {\n mine = false;\n revealed = false;\n flagged = false;\n repaint();\n }", "@Override\r\n\tpublic void reset() {\r\n\t\tfor(int i = 0; i < rows_size; i++) {\r\n\t\t\tfor(int j = 0; j < columns_size; j++)\r\n\t\t\t\tgame[i][j].Clear();\r\n\t\t}\r\n\t\tcomputerTurn();\r\n\t\tcomputerTurn();\r\n\t\tfreeCells = rows_size*columns_size - 2;\r\n\t\ttakenCells = 2;\r\n\t}", "public void reset(){\n }", "public void reset()\n {\n m_fCorrectEvent = false;\n }", "public void resetPlayerForNewGame(Game game){\n\t\tthis.game = game;\n\t\tthis.coins = game.getStartCoins();\n\t\tthis.collectedCards = new int[game.getMaxCardValue() + 1];\n\t\tSystem.out.println(name + \" is ready for the new Game.\");\n\t}", "public void reset()\n\t{\n\t}", "public void reset()\n\t{\n\t}", "public void reset() {\n/* 138 */ if (TimeUtil.getWeek() == 1) {\n/* 139 */ LogUtil.errorLog(new Object[] { \"MentalRankService::reset begin\", Long.valueOf(TimeUtil.currentTimeMillis()) });\n/* 140 */ sendRankReward();\n/* */ } \n/* */ }", "public void resetPlayer() {\n\t\tthis.carrotCards = 65;\n\t\tthis.playerSpace = 0;\n\n\t}", "private void resetGame()\n {\n createRooms();\n createItems();\n createCharacters();\n\n int itemsToAdd = getRandomNumber(10,items.size());\n addRoomItems(itemsToAdd);\n winItem = createWinItem();\n\n moves = 1;\n currentRoom = getRoom(STARTROOM); // Player's start location.\n }", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void reset();", "public void resetScreen(){\n\t\tGame_Map_Manager.infoVisible= false;\n\t\tGame_PauseMenu.actorManager.open = false;\n\t\tPlayerGoals.open = false;\n\t\tGame_Shop.actorManager.open = false;\n\t\tTrainDepotUI.actorManager.open = false;\n\t\tGameScreenUI.resourcebarexpanded =false;\n\t\tGoalMenu.open= false;\n\t\t\n\t\t//CARDS\n\t\tGame_CardHand.actorManager.open=false;\n\t\tGame_CardHand.actorManager.cardactors.clear();;\n\t\t\n\t\t//Map\n\t\tGame_StartingSequence.reset();\n\t\tGame_Map_Manager.resetMap();\n\t}", "private void reset() {\n }", "public void resetValues() {\n SharedPreferences.Editor editor = sharedPreferences.edit();\n editor.putString(CUREDIFFICULTY, null);\n editor.putInt(CURETARGETSCORE, 0);\n editor.putInt(CURRSCOREFINDCURE, 0);\n editor.apply();\n System.out.println(sharedPreferences.getAll());\n\n }", "final void reset() {\r\n\t\t\tsp = 0;\r\n\t\t\thp = 0;\r\n\t\t}", "private void resetGame() {\r\n SCORE = 0;\r\n defaultState();\r\n System.arraycopy(WordCollection.WORD, 0, tempWord, 0, WordCollection.WORD.length);\r\n }", "public void reset(){\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm -r data/games_module\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"sed -i \\\"1s/.*/ \"+\"0\"+\" /\\\" data/winnings\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"sed -i \\\"1s/.*/ \"+\"175\"+\" /\\\" data/tts_speed\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/answered_questions\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/five_random_categories\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/current_player\");\n\t\t_currentPlayer = null;\n\t\t_internationalUnlocked = false;\n\t\t_gamesData.clear();\n\t\t_fiveRandomCategories.clear();\n\t\tfor (int i= 0; i<5;i++) {\n\t\t\t_answeredQuestions[i]=0;\n\t\t}\n\t\tBashCmdUtil.bashCmdNoOutput(\"touch data/answered_questions\");\n\t\tinitialiseCategories();\n\t\ttry {\n\t\t\treadCategories();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tsetFiveRandomCategories();\n\t}", "public void reset() {\n\t\tplayerModelDiff1.clear();\n\t\tplayerModelDiff4.clear();\n\t\tplayerModelDiff7.clear();\n\t\tif(normalDiffMethods)\n\t\t{\t\n\t\tupdatePlayerModel();\n\t\tdisplayReceivedRewards();\n\t\t}\n\t\tint temp_diffsegment1;\n\t\tint temp_diffsegment2;\n\t\tif (currentLevelSegment == 0) {\n\t\t\t//System.out.println(\"-you died in the first segment, resetting to how you just started\");\n\t\t\ttemp_diffsegment1 = (int) plannedDifficultyLevels.get(0);\n\t\t\ttemp_diffsegment2 = (int) plannedDifficultyLevels.get(1);\n\t\t}\n\t\telse {\n\t\t\t//System.out.println(\"-nextSegmentAlreadyGenerated:\" + nextSegmentAlreadyGenerated);\n\t\t\tif (nextSegmentAlreadyGenerated) {\n\t\t\t\t//because the next segment is already generated (and so the previous does not exist anymore),\n\t\t\t\ttemp_diffsegment1 = (int) plannedDifficultyLevels.get(currentLevelSegment);\n\t\t\t\ttemp_diffsegment2 = (int) plannedDifficultyLevels.get(currentLevelSegment+1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//because the next segment is not yet generated\n\t\t\t\ttemp_diffsegment1 = (int) plannedDifficultyLevels.get(currentLevelSegment-1);\n\t\t\t\ttemp_diffsegment2 = (int) plannedDifficultyLevels.get(currentLevelSegment);\n\t\t\t}\n\t\t}\n\t\tplannedDifficultyLevels.clear();\n\n\t\t//System.out.println(\"-resetting to: \" + temp_diffsegment1 + \", \" + temp_diffsegment2);\n\t\tplannedDifficultyLevels.add(temp_diffsegment1);\n\t\tplannedDifficultyLevels.add(temp_diffsegment2);\n\t\tcurrentLevelSegment = 0;\n\n\t\tpaused = false;\n\t\tSprite.spriteContext = this;\n\t\tsprites.clear();\n\n\t\ttry {\n\t\t\tlevel2 = level2_reset.clone();\n\t\t} catch (CloneNotSupportedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\ttry {\n\t\t\tlevel3 = level3_reset.clone();\n\t\t} catch (CloneNotSupportedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n fixborders();\n\t\tconjoin();\n\n\t\tlayer = new LevelRenderer(level, graphicsConfiguration, 320, 240);\n\t\tfor (int i = 0; i < 2; i++)\n\t\t{\n\t\t\tint scrollSpeed = 4 >> i;\n\t\tint w = ((level.getWidth() * 16) - 320) / scrollSpeed + 320;\n\t\tint h = ((level.getHeight() * 16) - 240) / scrollSpeed + 240;\n\t\tLevel bgLevel = BgLevelGenerator.createLevel(w / 32 + 1, h / 32 + 1, i == 0, levelType);\n\t\tbgLayer[i] = new BgRenderer(bgLevel, graphicsConfiguration, 320, 240, scrollSpeed);\n\t\t}\n\n\t\tdouble oldX = 0;\n\t\tif(mario!=null)\n\t\t\toldX = mario.x;\n\n\t\tmario = new Mario(this);\n\t\tsprites.add(mario);\n\t\tstartTime = 1;\n\n\t\ttimeLeft = 200*15;\n\n\t\ttick = 0;\n\n\t\t/*\n\t\t * SETS UP ALL OF THE CHECKPOINTS TO CHECK FOR SWITCHING\n\t\t */\n\t\t switchPoints = new ArrayList<Double>();\n\n\t\t//first pick a random starting waypoint from among ten positions\n\t\tint squareSize = 16; //size of one square in pixels\n\t\tint sections = 10;\n\n\t\tdouble startX = 32; //mario start position\n\t\tdouble endX = level.getxExit()*squareSize; //position of the end on the level\n\t\t//if(!isCustom && recorder==null)\n level2.playValues = this.valueList[0];\n\t\t\trecorder = new DataRecorder(this,level3,keys);\n\t\t\t////System.out.println(\"\\n enemies LEFT : \" + recorder.level.COINS); //Sander disable\n\t\t\t////System.out.println(\"\\n enemies LEFT : \" + recorder.level.BLOCKS_COINS);\n\t\t\t////System.out.println(\"\\n enemies LEFT : \" + recorder.level.BLOCKS_POWER);\n\t\t\tgameStarted = false;\n\t}", "public void reset() {\n solving = false;\n length = 0;\n checks = 0;\n }", "private void hardReset() {\n softReset();\n // variables\n recordLap = 0; // force first query on database after race restart\n trackName = null;\n // ui\n recordLapTView.setText(\"--:--:---\");\n trackTView.setText(\"Track location\");\n carTView.setText(\"Car\");\n Log.d(TAG, \"HARD Reset: main menu\");\n }", "public void reset() {\n\n\t}", "public void reset() {\n\n }", "void reset();", "void reset();", "void reset();", "void reset();" ]
[ "0.76658076", "0.7376819", "0.7363012", "0.7263422", "0.7215865", "0.72087306", "0.7184025", "0.7167749", "0.7162698", "0.7033077", "0.7007641", "0.6994992", "0.69869447", "0.6981852", "0.69779867", "0.6944283", "0.6926876", "0.6922728", "0.6915995", "0.6909849", "0.685026", "0.68431413", "0.67941034", "0.6789183", "0.6732474", "0.67248225", "0.6709769", "0.6708568", "0.669106", "0.6686382", "0.66825134", "0.6680481", "0.66669565", "0.66559005", "0.6610029", "0.65976435", "0.658427", "0.6582365", "0.6581265", "0.6579347", "0.6575427", "0.65615124", "0.6544477", "0.65398806", "0.6510012", "0.6504802", "0.6504105", "0.6494907", "0.64805955", "0.645818", "0.6442905", "0.6439958", "0.6408663", "0.64057446", "0.6386308", "0.63851017", "0.6383935", "0.63804144", "0.6369045", "0.6367518", "0.6363155", "0.63513035", "0.63379", "0.632774", "0.63186365", "0.63172406", "0.6315577", "0.6315577", "0.6313216", "0.62966245", "0.6293761", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62933964", "0.62932515", "0.6289389", "0.62837756", "0.62728095", "0.6272322", "0.62708676", "0.6267564", "0.62579674", "0.62578183", "0.62467444", "0.6245448", "0.6230353", "0.6230353", "0.6230353", "0.6230353" ]
0.0
-1
Of getCurrentRouteStates Is the current state a final state?
public boolean isFinished() { if (gameSituation == UNFINISHED) { return false; } // Of if return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isFinalState() {\n return finalState[currentState.getValue()];\n }", "public boolean isFinalState(final State state) {\n\t\treturn finalStates.contains(state);\n\t}", "public List<State> getFinalStates() {\n\t\tif (cachedFinalStates == null) {\n\t\t\tcachedFinalStates = new LinkedList<>(finalStates);\n\t\t}\n\t\treturn cachedFinalStates;\n\t}", "public boolean hasCurrentRouteSegmentVersion() {\n return currentRouteSegmentVersionBuilder_ != null || currentRouteSegmentVersion_ != null;\n }", "boolean hasRoute();", "public abstract State getDestinationState ();", "private boolean hasUniqueState()\n {\n return (getExternalArcState() == getMiddleArcState() && getExternalArcState() == getInternalArcState() && getExternalArcState() == getCircleState());\n }", "boolean hasCurrentStateTime();", "@java.lang.Override\n public boolean hasCurrentRouteSegmentVersion() {\n return currentRouteSegmentVersion_ != null;\n }", "@java.lang.Override\n public boolean hasRoute() {\n return stepInfoCase_ == 7;\n }", "@java.lang.Override\n public boolean hasRoute() {\n return stepInfoCase_ == 7;\n }", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "boolean hasState();", "public boolean getState( ) { return state; }", "@Override\n public boolean checkCurrentStates(final CurrentStateOutput currentStateOutput,\n final String resourceName, final Partition partition, StateModelDefinition stateModelDef) {\n if (!stateModelDef.isSingleTopStateModel()) {\n return true;\n }\n // TODO: Cache top state count in the ResourceControllerDataProvider and avoid repeated counting\n // TODO: here. It would be premature to do it now. But with more use case, we can improve the\n // TODO: ResourceControllerDataProvider to calculate by default.\n if (currentStateOutput.getCurrentStateMap(resourceName, partition).values().stream()\n .filter(state -> state.equals(stateModelDef.getTopState())).count() > 1) {\n return false;\n }\n return true;\n }", "public boolean isNewRoute() {\n return newRoute;\n }", "@Override\n\tpublic boolean isIsFinal() {\n\t\treturn _esfTournament.isIsFinal();\n\t}", "public boolean isCurrentState() {\n return currentState;\n }", "public boolean isLastPhase ()\n {\n return true;\n }", "public boolean isStateKnown(){\n\t\treturn (state != null);\n\t}", "boolean hasHasState();", "public State getfinalState(){\n\t\t\treturn finalState;\n\t\t}", "public boolean hasValidRoute() \n {\n return validRoute;\n }", "public boolean nextState() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean getState() {\n\t\treturn true;\n\t}", "boolean hasLastAction();", "public boolean getState() {\n\t\treturn state;\n\t}", "public boolean hasAvailableConnections(Router current){\n boolean destinationAvailable = false;\n for (Connection c : current.getConnections()){\n //if there is a router that has not been visited\n if (c.getDestination().getVisit() == false){\n destinationAvailable = true;\n }\n }\n return destinationAvailable;\n }", "protected boolean lastStateOnPathIsNew(PrioritizedSearchNode psn) {\n\n\tPrioritizedSearchNode cmpNode = (PrioritizedSearchNode) psn.backPointer;\n\n\twhile (cmpNode != null) {\n\t if (psn.equals(cmpNode)) {\n\t\treturn false;\n\t }\n\t cmpNode = (PrioritizedSearchNode) cmpNode.backPointer;\n\t}\n\n\treturn true;\n }", "public boolean isSetState()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n return get_store().count_elements(STATE$8) != 0;\r\n }\r\n }", "public boolean isGoalState() {\n boolean isGoal = false;\r\n if(currjug1 == goal || currjug2 == goal)\r\n isGoal = true;\r\n return isGoal;\r\n }", "Object getState();", "ShapeState getFinalState();", "public boolean isOnRoute() {\n\t\treturn onRoute;\n\t}", "@java.lang.Override\n public boolean hasCurrentRouteSegmentEndPoint() {\n return currentRouteSegmentEndPoint_ != null;\n }", "public boolean isMaxState();", "public boolean checkLastNodeStatus()\r\n {\r\n return visitedNodes.isEmpty();\r\n }", "public boolean hasCurrentRouteSegmentEndPoint() {\n return currentRouteSegmentEndPointBuilder_ != null || currentRouteSegmentEndPoint_ != null;\n }", "int getState();", "int getState();", "int getState();", "int getState();", "int getState();", "int getState();", "public boolean isVisited() {\n return isVisited;\n }", "public boolean validateFinalState_OutgoingTransitionCount(\r\n\t\t\tFinalState finalState, DiagnosticChain diagnostics,\r\n\t\t\tMap<Object, Object> context) {\r\n\t\tif ((finalState.getOutgoingTransitions().size() > 0)) {\r\n\t\t\treturn warning(finalState, diagnostics,\r\n\t\t\t\t\tISSUE_FINAL_STATE_OUTGOING_TRANSITION);\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public boolean hasBeenVisited() {\n\t\treturn visited; // Replace with your code\n\t}", "public boolean isStateActive(State state) {\n\t\tswitch (state) {\n\t\t\tcase mainRegion_State1 :\n\t\t\t\treturn stateVector[0] == State.mainRegion_State1;\n\t\t\tcase mainRegion_State2 :\n\t\t\t\treturn stateVector[0].ordinal() >= State.mainRegion_State2.ordinal()\n\t\t\t\t\t\t&& stateVector[0].ordinal() <= State.mainRegion_State2__region0_State5.ordinal();\n\t\t\tcase mainRegion_State2__region0_a :\n\t\t\t\treturn stateVector[0] == State.mainRegion_State2__region0_a;\n\t\t\tcase mainRegion_State2__region0_State4 :\n\t\t\t\treturn stateVector[0].ordinal() >= State.mainRegion_State2__region0_State4.ordinal() && stateVector[0]\n\t\t\t\t\t\t.ordinal() <= State.mainRegion_State2__region0_State4__region0_State7__region0_State9.ordinal();\n\t\t\tcase mainRegion_State2__region0_State4__region0_State6 :\n\t\t\t\treturn stateVector[0] == State.mainRegion_State2__region0_State4__region0_State6;\n\t\t\tcase mainRegion_State2__region0_State4__region0_State7 :\n\t\t\t\treturn stateVector[0].ordinal() >= State.mainRegion_State2__region0_State4__region0_State7.ordinal()\n\t\t\t\t\t\t&& stateVector[0]\n\t\t\t\t\t\t\t\t.ordinal() <= State.mainRegion_State2__region0_State4__region0_State7__region0_State9\n\t\t\t\t\t\t\t\t\t\t.ordinal();\n\t\t\tcase mainRegion_State2__region0_State4__region0_State7__region0_State8 :\n\t\t\t\treturn stateVector[0] == State.mainRegion_State2__region0_State4__region0_State7__region0_State8;\n\t\t\tcase mainRegion_State2__region0_State4__region0_State7__region0_State9 :\n\t\t\t\treturn stateVector[0] == State.mainRegion_State2__region0_State4__region0_State7__region0_State9;\n\t\t\tcase mainRegion_State2__region0_State5 :\n\t\t\t\treturn stateVector[0] == State.mainRegion_State2__region0_State5;\n\t\t\tdefault :\n\t\t\t\treturn false;\n\t\t}\n\t}", "boolean isVisited();", "boolean isVisited();", "public boolean areRoutesValid() {\n return valid;\n }", "private int countPossibleRoutes(){\n\tint totPossRoutes =0;\n\tfor(int i=0;i<ConditionTree.length;i++){\n\t\tif(ConditionTree[i][5].equals(\"Y\")){\n\t\t\ttotPossRoutes++;\n\t\t}\n\t}\n\t\n\treturn totPossRoutes;\n}", "protected boolean isFinished() {\n \tif (Robot.clawElevator.getContainerHeight() == 0) {\n \t\treturn Robot.clawElevator.getLowerSwitch();\n \t} else {\n \t\treturn Robot.clawElevator.getLowerSwitch() || Robot.clawElevator.isAtIntemediateStop(Math.abs(Robot.clawElevator.getContainerHeight() - 3), false);\n \t}\n }", "private static boolean getState(Context context) {\n return Settings.System.getInt(context.getContentResolver(),\n Settings.System.AIRPLANE_MODE_ON, 0) == 1;\n }", "State getState();", "State getState();", "State getState();", "State getState();", "private boolean containState(String state) {\r\n for (int i = 0; i < this.visitedList.size(); i++) {\r\n if (state.equals(this.visitedList.get(i))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "boolean goalState() {\n\t\treturn (numbersLeft == 0);\n\t}", "public List<MclnState> getAvailableStates();", "String getCurrentState() {\n return context.getString(allStates[currentIdx]);\n }", "public IPlacementState getState();", "String getState();", "String getState();", "String getState();", "public State getLastState() {\n\t\treturn endState;\r\n\t}", "boolean hasRouteDest();", "@Override\r\n\tpublic boolean isVisited() {\n\t\treturn false;\r\n\t}", "boolean hasServerState();", "int getServerState();", "public boolean isVisited(){\n return visited;\n }", "public AeBpelState getState();", "@java.lang.Override\n public boolean hasStateInfo() {\n return stateInfo_ != null;\n }", "@Override\n\tpublic void onCalculateRouteSuccess() {\n\t\tnaviActivity();\n\t}", "boolean isSetState();", "public boolean isEndState()\n {\n return !this.safe || (this.e.size() == 0) || (this.d.size() == 0);\n }", "public boolean isStartState() {\r\n\t\treturn flow.getStartState() == this;\r\n\t}", "public State getState(){\n\t\treturn State.TUT_ISLAND;\n\t}", "public int getState();", "public int getState();", "public int getState();", "public int getState();", "public Boolean getState() {\n return state;\n }", "java.lang.String getState();", "@Override\n\tpublic boolean isStartingState(State state, MaxNode maxNode) {\n\t\treturn false;\n\t}", "public boolean isVisited() {\n return visited;\n }", "public boolean isVisited () {\n if (this.equals(SquareType.VISITED))\n return true;\n else\n return false;\n }", "public boolean isVisited() {\n return visited;\n }", "public boolean transition() {\n current = new State(ts++, hopper); \n if (terminus.isTerminus(current)) {\n return false;\n } else {\n hopper.sendBall(oneMinute);\n return true;\n }\n }", "public S getCurrentState();", "public boolean isVisited()\n\t{\n\t\treturn visited;\n\t}", "public boolean hasLastLocation() {\n return lastLocationBuilder_ != null || lastLocation_ != null;\n }", "public boolean WasVisited() { return _visited; }", "public boolean isVisited() {\n\t\treturn visited;\n\t}" ]
[ "0.6613393", "0.6024308", "0.55680525", "0.5528411", "0.5526606", "0.5508943", "0.5505009", "0.5476283", "0.54762405", "0.54208356", "0.53949547", "0.53224206", "0.53224206", "0.53224206", "0.53224206", "0.53224206", "0.53224206", "0.53224206", "0.53224206", "0.5319613", "0.5318784", "0.5307187", "0.5300886", "0.5300802", "0.52745235", "0.52688336", "0.52340376", "0.52248216", "0.52147716", "0.5197897", "0.51974577", "0.5193529", "0.5180986", "0.51724845", "0.5172253", "0.51638085", "0.51619446", "0.5158968", "0.5154465", "0.51274604", "0.51054794", "0.50792235", "0.50674087", "0.50536937", "0.5046354", "0.5046354", "0.5046354", "0.5046354", "0.5046354", "0.5046354", "0.503347", "0.5032052", "0.502117", "0.500485", "0.49967784", "0.49967784", "0.4992307", "0.49910042", "0.49844033", "0.49799973", "0.49752253", "0.49752253", "0.49752253", "0.49752253", "0.49749398", "0.4969226", "0.49572268", "0.49543318", "0.49511042", "0.4950602", "0.4950602", "0.4950602", "0.49479523", "0.4931609", "0.49199545", "0.49181312", "0.4917366", "0.49137357", "0.49093124", "0.4906683", "0.49013335", "0.4898068", "0.4891004", "0.48894358", "0.48762405", "0.48759452", "0.48759452", "0.48759452", "0.48759452", "0.4873991", "0.4872664", "0.4870671", "0.48704267", "0.4867899", "0.48585927", "0.4858407", "0.4857621", "0.48575574", "0.48561206", "0.48430133", "0.48423406" ]
0.0
-1
Of isFinished Get the winner.
public int getWinner() throws Exception { if (gameSituation == UNFINISHED) { throw new Exception("Game unfinished yet, cannot get winner."); } // Of if return gameSituation; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean winner() {\r\n return winner;\r\n }", "public boolean isFinished() {\n\t\tif ((player1_moves | player2_moves) == COMPLETE) {\n\t\t\tfinished = true;\n\t\t\tcurrentPlayer = '\\0';\n\t\t}\n\t\tfor (int i : winning_cases) {\n\t\t\tif ((player1_moves & i) == i) {\n\t\t\t\twinner = 'X';\n\t\t\t\tfinished = true;\n\t\t\t} else if ((player2_moves & i) == i) {\n\t\t\t\twinner = 'O';\n\t\t\t\tfinished = true;\n\t\t\t}\n\t\t}\n\t\treturn finished;\n\t}", "public int getWinner() {return winner();}", "Piece winner() {\r\n return _winner;\r\n }", "public static boolean isGameFinished() {\n return mafiaIsWinner() || citizenIsWinner();\n }", "public boolean winner(){\n\t\treturn goals1 > goals2;\n\t}", "public Player getWinner() {\n return winner;\n }", "public int getWinner() {\n return winner;\n }", "public void handleEndAuctionRound(String winner);", "public String getWinner() {\n return winner;\n }", "@Override\n public int getWinner()\n {\n return currentPlayer;\n }", "@Override\n public int getWinner() {\n return this.board.getWinner();\n }", "public String winner() {\r\n\t\tif(player1.isDone() || player2.isDone()) {\r\n\t\t\tint count1 = player1.winningsCount();\r\n\t\t\tint count2 = player2.winningsCount();\r\n\t\t\tif(count1 > count2) {\r\n\t\t\t\treturn \"Player 1 wins, \" + count1 + \" to \" + count2 + \"!\";\r\n\t\t\t}else if(count2 > count1) {\r\n\t\t\t\treturn \"Player 2 wins, \" + count2 + \" to \" + count1 + \"!\";\r\n\t\t\t}else {\r\n\t\t\t\treturn \"The Game ends in a tie!\";\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "@Override\n public void setFinished() {\n if (finished > 0) {\n return;\n }\n\n // A mine has been opened (lose game)\n int openMines = (int) cells.stream().flatMap(Collection::stream)\n .filter(c -> c.isOpen() && c.isMine()).count();\n if (openMines > 0) {\n finished = 2;\n alertListeners(GameChangeType.LOSE);\n return;\n }\n\n // The board has been revealed (win game)\n int openCells = (int) cells.stream().flatMap(Collection::stream)\n .filter(c -> c.isOpen() && !c.isMine() && c.getCellState() != CellState.MINE3).count();\n if (openCells == (dims.getX() * dims.getY() - numMines)) {\n finished = 1;\n alertListeners(GameChangeType.WIN);\n return;\n }\n\n // Nothing so far, not finished\n finished = 0;\n }", "public Player getWinner();", "private String getWinner() {\n\t\treturn winner;\n\t}", "public String getWinner() {\n\t\treturn winner;\n\t}", "void matchEnd(boolean winner);", "private boolean winGame() {\n if (model.isCompleted()) {\n win.message(\"Winner\");\n return true;\n }\n return false;\n }", "public boolean isWinner() {\n\t\treturn winner;\n\t}", "boolean getFinished();", "public boolean hasGameEnded() {\n return winner != 0;\n }", "public void tellPlayerResult(int winner) {\n\t}", "public void determineWinner() {\n\t\twinner = \"\";\n\t\tif (board[6] > board[13])\n\t\t\twinner = player1.getName();\n\t\telse if (board[6] < board[13])\n\t\t\twinner = player2.getName();\n\t\telse {\n\t\t\tSystem.out.println(\"The game is a tie\");\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(winner + \" is the winner\");\n\t}", "@Override\n public int getWinner() {\n //TODO Implement this method\n return -1;\n }", "public void endsGameAndSetsWinner(Player player) {\n this.winner = player.getId(); \n this.gameStarted = false; \n \n }", "Piece getWinner();", "public Player getWinner() {\n if (winner == null) {\n winner = winnerStrategy.winner(this);\n }\n return winner;\n }", "void finishMatch() {\n\t\tint playerResult = ParticipantResult.MATCH_RESULT_NONE;\n\t\tint opponentResult = ParticipantResult.MATCH_RESULT_NONE;\n\n\t\tif (!GameActivity.gameMachine.player.isAlive()) {\n\t\t\tLayoutHelper.showResult(resultTextView, false);\n\t\t\tplayerResult = ParticipantResult.MATCH_RESULT_LOSS;\n\t\t\topponentResult = ParticipantResult.MATCH_RESULT_WIN;\n\t\t} else if (!GameActivity.gameMachine.opponent.isAlive()) {\n\t\t\tLayoutHelper.showResult(resultTextView, true);\n\t\t\tplayerResult = ParticipantResult.MATCH_RESULT_WIN;\n\t\t\topponentResult = ParticipantResult.MATCH_RESULT_LOSS;\n\t\t}\n\n\t\tArrayList<ParticipantResult> results = new ArrayList<ParticipantResult>();\n\n\t\tresults.add(new ParticipantResult(GPGHelper.getMyId(\n\t\t\t\tgameHelper.getApiClient(), match), playerResult,\n\t\t\t\tParticipantResult.PLACING_UNINITIALIZED));\n\n\t\tresults.add(new ParticipantResult(GPGHelper.getOpponentId(\n\t\t\t\tgameHelper.getApiClient(), match), opponentResult,\n\t\t\t\tParticipantResult.PLACING_UNINITIALIZED));\n\n\t\tif (match.getStatus() == TurnBasedMatch.MATCH_STATUS_ACTIVE) {\n\t\t\tif (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN) {\n\t\t\t\tGames.TurnBasedMultiplayer.finishMatch(\n\t\t\t\t\t\tgameHelper.getApiClient(), match.getMatchId(),\n\t\t\t\t\t\twriteGameState(match), results);\n\t\t\t\tturnUsed = true;\n\t\t\t\tremoveNotification();\n\t\t\t}\n\t\t} else if (match.getStatus() == TurnBasedMatch.MATCH_STATUS_COMPLETE) {\n\t\t\tif (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN) {\n\t\t\t\tGames.TurnBasedMultiplayer.finishMatch(\n\t\t\t\t\t\tgameHelper.getApiClient(), match.getMatchId());\n\t\t\t}\n\t\t}\n\t}", "public PlayerNumber winner() {\n\t\tif (someoneQuit) {\n\t\t\treturn onePlayerLeft;\n\t\t}\n\t\tif (winningPlayer == Game.FIRST_PLAYER) {\n\t\t\treturn Game.FIRST_PLAYER;\n\t\t}\n\t\tif (winningPlayer == Game.SECOND_PLAYER) {\n\t\t\treturn Game.SECOND_PLAYER;\n\t\t}\n\t\tif (movesLeft() > 0) {\n\t\t\treturn Game.GAME_NOT_OVER;\n\t\t}\n\t\treturn Game.DRAW;\n\t}", "public abstract Player getWinner();", "public String getWinner(){\n if(whiteWins && blackWins){\n return \"ITS A DRAW\";\n } else if(whiteWins){\n return \"WHITE WINS\";\n } else if(blackWins){\n return \"BLACK WINS\";\n } else {\n return \"NO WINNER\";\n }\n }", "public int getWinner() {\n for (int i = 0; i < nrOfPlayers(); i++) {\n if (players.get(i).isFinished()) {\n\n // PLAYERLISTENER : Trigger playerEvent for player that WON\n for (PlayerListener listener : playerListeners) {\n PlayerEvent event = new PlayerEvent(this, players.get(i).getColour(), PlayerEvent.WON);\n listener.playerStateChanged(event);\n }\n return i;\n }\n }\n return -1;\n }", "private void checkFinish() {\n for (Player temp: players) {\n if (temp.getNumberOfCards() == 0) {\n System.out.println(\"...................................................................................................................................................................\");\n System.out.println(\"Game finished.\\n\");\n System.out.println(Color.PURPLE.getPrintColor() + temp.getName() + \" is winner.\\n\" + Color.RESET.getPrintColor());\n setGameStatus();\n }\n }\n if (!gameStatus) {\n System.out.println(Color.RESET.getPrintColor() + \"Results:\\n\");\n for (Player temp: players) {\n if (temp.getNumberOfCards() != 0) {\n System.out.println(Color.CYAN.getPrintColor() + temp.toString());\n System.out.print(temp.handToString() + Color.RESET.getPrintColor());\n }\n }\n }\n }", "public String winner(){\n\t\tString winner =\"\";\n\t\tif(board.isWin() == \"blue\")\n\t\t\t{\n\t\t\twinner= \"blue\";\n\t\t\t}\n\t\telse if(board.isWin()==\"red\")\n\t\t\t{\n\t\t\twinner= \"red\";\n\t\t\t}\n\t\treturn winner; \n\t}", "public Player winner() {\n Player result = null;\n boolean humanResult = board.fiveInARow(humanPlayer.getPiece());\n boolean player2Result = board.fiveInARow(aiPlayer.getPiece());\n if(humanResult && player2Result) {\n result = new Player(\"Tie\", 'T');\n } else if (humanResult && !player2Result) {\n result = humanPlayer;\n } else if (!humanResult && player2Result) {\n result = aiPlayer;\n }\n return result;\n }", "public int winner() {\n if (player1Wins())\n return 1;\n if (player2Wins())\n return 2;\n return -1; // No one has won\n }", "public int winner() {\n if(humanPlayerHits == 17) {\n return 1;\n }\n if(computerPlayerHits == 17){\n return 2;\n }\n return 0;\n }", "void finishTurn();", "void computeResult() {\n // Get the winner (null if draw).\n roundWinner = compareTopCards();\n\n\n if (roundWinner == null) {\n logger.log(\"Round winner: Draw\");\n logger.log(divider);\n // Increment statistic.\n numDraws++;\n\n } else {\n logger.log(\"Round winner: \" + roundWinner.getName());\n\t logger.log(divider);\n this.gameWinner = roundWinner;\n if (roundWinner.getIsHuman()) {\n // Increment statistic.\n humanWonRounds++;\n }\n }\n\n setGameState(GameState.ROUND_RESULT_COMPUTED);\n }", "protected abstract boolean isGameFinished();", "public boolean topPlayerWon() {\n return winner == 2;\n }", "public Player checkForWinner() {\n if (playersInGame.size() == 1) {\n Player winner = playersInGame.get(0);\n\n // --- DEBUG LOG ---\n // The winner of the game\n Logger.log(\"WINNING PLAYER:\", winner.toString());\n\n return winner;\n } else {\n return null;\n }\n }", "public Player getWinner(){\r\n if(!hasMovements(model.getPlayerA().getColor()))\r\n return model.getPlayerB();\r\n if(!hasMovements(model.getPlayerB().getColor()))\r\n return model.getPlayerA();\r\n // In case of draw\r\n return null;\r\n }", "@Override\n public void run() {\n Player winner = game.getWinner();\n String result = winner.getName() + \" won the game!\";\n\n // pass the string referred by \"result\" to make an alert window\n // check the bottom of page 9 of the PA description for the appearance of this alert window\n Alert alert = new Alert(AlertType.CONFIRMATION, result, ButtonType.YES, ButtonType.NO);\n alert.showAndWait();\n if (alert.getResult() == ButtonType.YES)\n {\n Platform.exit();\n }\n }", "public int getWinner()\n {\n //Loops to get the winner\n for(int i = 0; i < NUM_PLAYERS; i++){\n if(isPlayerWinner(i)) return i; //This player is a winner\n }\n return -1; //no one is a winner so far\n }", "@Override\r\n\tboolean isFinished() {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tif(checkForWin() != -1)\r\n\t\t\treturn true;\r\n\t\telse if(!(hasValidMove(0) || hasValidMove(1)))\r\n\t\t\treturn true; //game draw both are stuck\r\n\t\telse return false;\r\n\t}", "public void announceWinner() {\r\n Piece winer;\r\n if (_board.piecesContiguous(_board.turn().opposite())) {\r\n winer = _board.turn().opposite();\r\n } else {\r\n winer = _board.turn();\r\n }\r\n if (winer == WP) {\r\n _command.announce(\"White wins.\", \"Game Over\");\r\n System.out.println(\"White wins.\");\r\n } else {\r\n _command.announce(\"Black wins.\", \"Game Over\");\r\n System.out.println(\"Black wins.\");\r\n }\r\n }", "boolean CanFinishTurn();", "private void checkForGameEnd() {\n\t\tint checkWin = controller.checkForWinner();\n\t\tif(playerType == null && checkWin == 1 || (playerType != null && playerType == checkWin)) {\n\t\t\tgameFinished = true;\n\t\t\tAlert alert = new Alert(Alert.AlertType.WARNING);\n\t\t\talert.setTitle(\"VICTORY\");\n\t\t\talert.setHeaderText(\"VICTORY\");\n\t\t\talert.setContentText(\"CONGRATULATIONS! YOU WIN!\");\n\t\t\talert.showAndWait()\n\t\t .filter(response -> response == ButtonType.OK)\n\t\t .ifPresent(response -> formatSystem());\n\t\t\t\n\t\t}else if (playerType == null && checkWin == 2 || (playerType != null && playerType%2 + 1 == checkWin)) {\n\t\t\tgameFinished = true;\n\t\t\tAlert alert = new Alert(Alert.AlertType.WARNING);\n\t\t\talert.setTitle(\"DEFEAT\");\n\t\t\talert.setHeaderText(\"DEFEAT\");\n\t\t\talert.setContentText(\"SHAME! YOU LOSE!\");\n\t\t\talert.showAndWait()\n\t\t .filter(response -> response == ButtonType.OK)\n\t\t .ifPresent(response -> formatSystem());\n\t\t\t\n\t\t}else if (controller.checkForTie()) {\n\t\t\tgameFinished = true;\n\t\t\tAlert alert = new Alert(Alert.AlertType.WARNING);\n\t\t\talert.setTitle(\"STALEMATE\");\n\t\t\talert.setHeaderText(\"STALEMATE\");\n\t\t\talert.setContentText(\"ALAS! TIE GAME!\");\n\t\t\talert.showAndWait()\n\t\t .filter(response -> response == ButtonType.OK)\n\t\t .ifPresent(response -> formatSystem());\n\t\t}\n\t\t\n\t\tif(playerType != null && gameFinished) {\n\t\t\tSystem.out.println(\"closing connection\");\n\t\t\ttry {\n\t\t\t\tconnection.close();\n\t\t\t}catch (Exception e) {\n\t\t\t\tSystem.out.println(\"ERROR CLOSING\");\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic boolean playerWon() {\n\t\treturn lastPlayerWin;\n\t}", "protected boolean isFinished() {\n\n \tif(weAreDoneSenor == true) {\n\n \t\treturn true;\n \t} else {\n \t\treturn false;\n \t}\n \t\n }", "public boolean endManche(Player winner) {\n if(numManche != 0) {\n ManchesDTO manche = new ManchesDTO();\n manche.setMatch(new MatchesDTO(match, matchTime));\n if (winner != null) {\n manche.setNumber(numManche);\n PhrasesDTO newPhras = getCurrentPhrase();\n String them = Match.prepareStringForDB(newPhras.getTheme());\n String phras = Match.prepareStringForDB(newPhras.getPhrase());\n manche.setPhrase(new PhrasesDTO(them, phras));\n dbManager.addMancheWinner(winner.getIdPlayer(), manche, winner.getPartialPoints());\n }\n setNumManche(numManche + 1);\n manche.setNumber(numManche);\n if(numManche < 6) {\n PhrasesDTO newPhrase = getCurrentPhrase();\n String theme = Match.prepareStringForDB(newPhrase.getTheme());\n String phrase = Match.prepareStringForDB(newPhrase.getPhrase());\n manche.setPhrase(new PhrasesDTO(theme, phrase));\n calledConsonant = new ArrayList<String>();\n boolean tur = turns.saveMoves(dbManager);\n boolean man = true;\n dbManager.addManche(manche);\n if (man && tur) {\n return true;\n } else\n return false;\n }else\n return false;\n }else\n return true;\n }", "public Boolean getWinner(){\n return spil.erSpilletVundet();\n }", "public SoccerTeam getWinner() {\n SoccerTeam winner = null;\n\n if (this.scoreOne > this.scoreTwo) {\n winner = this.teamOne;\n }\n else if (this.scoreOne < this.scoreTwo) {\n winner = this.teamTwo;\n }\n\n return winner;\n }", "public void finalResult() {\n ConnectionSockets.getInstance().sendMessage(Integer.toString(points)+\"\\n\");\n System.out.println(\"escreveu para o oponente\");\n opponentPoints = Integer.parseInt(ConnectionSockets.getInstance().receiveMessage());\n System.out.println(\"leu do oponente\");\n if(points != opponentPoints) {\n if (points > opponentPoints) {// Won\n MatchController.getInstance().getSets().add(1);\n MatchController.getInstance().increaseSet();\n } else { //Lost\n MatchController.getInstance().getSets().add(0);\n MatchController.getInstance().increaseSet();\n }\n }\n }", "Boolean isFinished();", "public boolean getGameFinished() {\r\n\t\treturn gameFinished;\r\n\t}", "public String Winner() {\r\n if(Main.player1.SuaVida()==0)\r\n return \"player2\";\r\n else\r\n return \"player1\";\r\n }", "private boolean isGameEnded() {\n int playerOneRemainingSeeds = 0;\n int playerTwoRemainingSeeds = 0;\n\n boolean isEnded = false;\n\n Player playerOne = mContainersManager.getOwnerOf(0);\n Player playerTwo = mContainersManager.getOwnerOf(7);\n\n for (int i = 0 ; i < mNumberOfBowls; i++) {\n playerOneRemainingSeeds += mContainersManager.getNumberOfSeedsOf(i);\n }\n for (int j = (mNumberOfBowls + mNumberOfTrays) ; j < (mContainersManager.getNumberContainers() - 1); j++) {\n playerTwoRemainingSeeds += mContainersManager.getNumberOfSeedsOf(j);\n }\n\n if ((playerOneRemainingSeeds == 0) || (playerTwoRemainingSeeds == 0)) {\n isEnded = true;\n }\n\n // If the game is ended put all remaining seeds in the player bowl_selected and find the winner\n if (isEnded) {\n if (playerOneRemainingSeeds > 0) {\n for (int j = 0; j < mNumberOfBowls; j++) {\n mContainersManager.emptyBowl(j);\n }\n mContainersManager.putSeedsInTrayOf( playerOne, playerOneRemainingSeeds);\n } else {\n for (int j = (mNumberOfBowls + mNumberOfTrays);\n j < (mContainersManager.getNumberContainers() -1); j++)\n {\n mContainersManager.emptyBowl(j);\n }\n mContainersManager.putSeedsInTrayOf(playerTwo, playerTwoRemainingSeeds);\n }\n setWinner();\n }\n\n return isEnded;\n }", "String getWinner();", "public boolean getIsWinner() {\n\t\treturn isWinner;\n\t}", "protected boolean isFinished() {\n \t\n \tif(current_time >= goal) {\n \t\t\n \t\treturn true;\n \t}else {\n \t\t\n \t\treturn false;\n \t}\n }", "public String getWinner()\n\t{\n\n\n\n\n\n\n\n\n\n\n\n\n\t\treturn \"\";\n\t}", "private void whoIsTheWinner() {\n\t\t// at first we say let the number for winner and the maximal score be 0.\n\t\tint winnerName = 0;\n\t\tint maxScore = 0;\n\t\t// then, for each player, we check if his score is more than maximal\n\t\t// score, and if it is we let that score to be our new maximal score and\n\t\t// we generate the player number by it and we let that player number to\n\t\t// be the winner, in other way maximal scores doen't change.\n\t\tfor (int i = 1; i <= nPlayers; i++) {\n\t\t\tif (totalScore[i] > maxScore) {\n\t\t\t\tmaxScore = totalScore[i];\n\t\t\t\twinnerName = i - 1;\n\t\t\t}\n\t\t}\n\t\t// finally, program displays on screen who is the winner,and what score\n\t\t// he/she/it got.\n\t\tdisplay.printMessage(\"Congratulations, \" + playerNames[winnerName]\n\t\t\t\t+ \", you're the winner with a total score of \" + maxScore + \"!\");\n\t}", "public boolean isGameFinished() {\r\n return gameFinished;\r\n }", "private void getWinner() {\r\n int nWhite = 0, nBlack = 0;\r\n if(nextPlayer.getChecks() == 0 && nextPlayer.getQueens() == 0){\r\n winner = currentPlayer;\r\n }\r\n else if(currentPlayer.getQueens() == nextPlayer.getQueens()){\r\n for (int i = 1; i<8; i++){\r\n for (int x = 0; x<8; x++) {\r\n if (checks[i][x] == 1) nBlack++;\r\n if (checks[7 - i][x] == 2) nWhite++;\r\n }\r\n if (nWhite>nBlack) winner = getPlayer(WHITE);\r\n else if(nBlack>nWhite)winner = getPlayer(BLACK);\r\n nWhite = 0;\r\n nBlack = 0;\r\n }\r\n }\r\n else if (currentPlayer.getQueens() > nextPlayer.getQueens()){ winner = currentPlayer;}\r\n else{winner = nextPlayer; }\r\n }", "@Override\n public void setWinner(Player winner)\n {\n for(int i = 0; i < gc.getF().size(); i++)\n {\n if(gc.getF().get(i).readyStart() == 0 || gc.getF().get(i).readyStart() == 1)\n {\n gc.getF().get(gc.getF().size() -1).addPlayer(this.winner);\n sl.save(\"The winner of QuarterFinal ID: \" + this.getGameID() + \" is: \"\n + winner.getName(), \"qfwinners.txt\");\n gc.getGameHistory().add(this); \n System.out.println(winner.getName() + \" has won the round! Player added to the Final!\");\n return;\n }\n }\n //If there are no available spots, make a new game\n Final f = new Final();\n System.out.println(\"created a new Final!\");\n f.addPlayer(winner);\n //Save winner details\n sl.save(\"The winner of QuarterFinal ID: \" + this.getGameID() + \" is: \"\n + winner.getName(), \"qfwinners.txt\");\n \n gc.getF().add(f);\n //Move game to history \n gc.getGameHistory().add(this); \n System.out.println(winner.getName() + \" has won the round! Player added to the Final!\");\n \n }", "public int winner(){\n getValidMoves();\n if(check(1)!=0) return 1;\n else if(check(-1)!=0) return -1;\n else if(validX.size()==0) return 2;\n else return 0;\n }", "public String getWinner() {\n\t\tif (this.getScore(this.player1Name) > this.getScore(this.player2Name)) {\n\t\t\treturn this.player1Name;\n\t\t} else if (this.getScore(this.player1Name) == this.getScore(this.player2Name)) {\n\t\t\treturn \"Tie\";\n\t\t}\n\t\treturn this.player2Name;\n\t}", "public Winner whoWins(){\r\n\r\n /* transfer the matrix to an array */\r\n Sign[] flatBoard = flattenBoard();\r\n\r\n /* check if someone has won */\r\n if (CompPlayer.compWon(flatBoard))\r\n return Winner.COMPUTER;\r\n else if (CompPlayer.playerWon(flatBoard))\r\n return Winner.PLAYER;\r\n else\r\n return Winner.NON;\r\n }", "protected boolean isFinished() {\r\n\t\t \tboolean ans = false;\r\n\t\t \treturn ans;\r\n\t\t }", "public void endGame() {\n Player player = playerManager.getWinner();\n MainActivity mainActivity = (MainActivity) this.getContext();\n updateLiveComment(\"Winner : \" + player.getName());\n mainActivity.setAlertDialog(player.getName()+\" Wins !\", \"Congratulations\", true);\n }", "public abstract boolean isFinished ();", "private void announceWinner() {\n // FIXME\n if (_board.turn() == Piece.WP) {\n System.out.println(\"Black wins.\");\n } else {\n System.out.println(\"White wins.\");\n }\n }", "void askEndTurn();", "public boolean wasFinished()\n {\n return this.isFinished;\n }", "public long getWinner() {\n long winner = member_1_id;\n if (getMember2Score() > getMember1Score()) {\n winner = member_2_id;\n }\n return winner;\n }", "public Colour getWinner(){\n\t\treturn winner;\n\t}", "private void finaliseGame() {\r\n gameOn = false;\r\n if(bestAnswer==null) {\r\n target.reply(\"Nobody got an answer. The best answer was: \" + CountdownSolver.Solve( sourceNumbers, targetNumber ));\r\n return;\r\n }\r\n if( bestAnswer.getAnswer() == bestPossibleAnswer ) {\r\n String reply = Constants.BOLD + bestAnswer.getUsername() + Constants.BOLD\r\n + \" has won with \" + bestAnswer.getAnswer() + \"!\";\r\n if( bestPossibleAnswer!=targetNumber)\r\n reply+=\" This was the best possible answer.\";\r\n target.reply(reply);\r\n } else {\r\n target.reply( \"The best answer was \" + bestAnswer.getAnswer() + \" by \" + bestAnswer.getUsername() + \".\"\r\n + \" But the best possible answer was: \" + CountdownSolver.Solve( sourceNumbers, targetNumber ));\r\n }\r\n bestAnswer=null;\r\n runner.stop();\r\n }", "public char getWinner() {\n\t\treturn winner;\n\t}", "public void imFinished() {\n isUserDone = true;\n layoutUserReady.setVisibility(View.VISIBLE);\n\n String userTextToShow = \"\";\n switch (challengeType) {\n case TIME:\n userTextToShow = getString(R.string.user_finished) +\n \"\\n\" +\n getString(R.string.final_distance) +\n (int)((ChallengeSenderFragment)senderFragment).getRun().getTrack().getDistance() +\n getString(R.string.meters);\n break;\n case DISTANCE:\n userTextToShow = getString(R.string.user_completed) +\n challengeGoal + getString(R.string.km) +\n getString(R.string.white_space) + getString(R.string.in) +\n UtilsUI.timeToString((int)((ChallengeSenderFragment)senderFragment).getRun().getDuration(),\n true);\n break;\n }\n userTxt.setText(userTextToShow);\n //noinspection deprecation\n userStatus.setImageDrawable(getResources().getDrawable(R.drawable.finish_icon));\n\n fragmentManager.beginTransaction().remove(senderFragment).commitAllowingStateLoss();\n\n challengeProxy.imFinished();\n\n if (isOpponentDone) {\n isIntendedActivityExit = true;\n endChallenge();\n }\n }", "public int getWinner();", "public Winner whoWon() {\n\t\tif (!isGameOver()) {\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\t// REPLACE NEXT LINE WITH YOUR IMPLEMENTATION\n\t\tint countBLACK = discBlackCount();\n\t\tint countWHITE = discWhiteCount();\n\t\t\n\t\tif (countWHITE == countBLACK) {\n\t\t\t\n\t\t\treturn Winner.TIE;\n\t\t\t\n\t\t} else if (countWHITE > countBLACK) {\n\t\t\t\n\t\t\tif (player1Disc == Disc.WHITE) {\n\t\t\t\t\n\t\t\t\treturn Winner.PLAYER1;\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\treturn Winner.PLAYER2;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\tif (player1Disc == Disc.BLACK) {\n\t\t\t\t\n\t\t\t\treturn Winner.PLAYER1;\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\treturn Winner.PLAYER2;\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}", "protected boolean isFinished()\n\t{\n\t\treturn !Robot.oi.respoolWinch.get();\n\t}", "public void endOfTurn() {\n if (playerInTurn.equals(Player.RED)) {\n playerInTurn = Player.BLUE;\n observers.turnEnds(playerInTurn, age);\n controlStrategy.playRound(this);\n return;\n }\n\n // If blue is in turn, change player in turn to red and do end-of-round processing.\n playerInTurn = Player.RED;\n\n // Calculate the age of the game in the next round.\n age = ageStrategy.calculateAge(age);\n\n // Restore the move count of all the units.\n for (Position p : world.getUnitPositions()) {\n world.getUnitAt(p).restoreMoveCount();\n }\n\n // For each city, add 6 to the current amount of production, and produce as many units as it can afford.\n for (Position p : world.getCityPositions()) {\n ModifiableCity city = world.getCityAt(p);\n\n workForceStrategy.gatherFoodAndProduction(world, p);\n\n populationStrategy.populationGrowth(world, p);\n\n // produce units!\n city.produceUnits(world, p, observers);\n }\n // Add to the counter of rounds played in the game.\n roundsPlayed++;\n\n observers.turnEnds(playerInTurn, age);\n\n controlStrategy.playRound(this);\n\n }", "public void winGame() {\n this.isWinner = true;\n }", "public void onFinish() {\n\t\tthis.notRewarded.putAll(Bake_Auxillary.rewardPlayers(projectReminderList, activeQuest.getLoot(bakeInstance.API_LEVEL), activeQuest.getThreshold(), activeQuest.getName()));\n\t\tnewQuest();\n\t}", "public boolean isFinished() {\n\t\tif (gameSituation == UNFINISHED) {\n\t\t\treturn false;\n\t\t} // Of if\n\n\t\treturn true;\n\t}", "public static void decidedWinner(){\n if(playerOneWon == true ){\n//\n// win.Fill(\"Player One Has Won !\");\n// new WinnerWindow().setVisible(true);\n }\n else if (playerTwoWon == true){\n// win.Fill(\"Player Two Has Won !\");\n// new WinnerWindow().setVisible(true);\n }\n else\n {\n// win.Fill(\"Match Has been Tied !\");\n// new WinnerWindow().setVisible(true);\n }\n }", "public static Player whoWonGame() {\r\n\t\tint highest = Main.winScoreNumb;\r\n\t\tPlayer winner = null;\r\n\t\t\r\n\t\t//Three handed play.\r\n\t\tif (Main.isThreeHanded){\r\n\t\t\tif (Utils.stringToInt(Main.player1Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player1Score);\r\n\t\t\t\twinner = Main.playerOne;\r\n\t\t\t}\r\n\t\t\tif (Utils.stringToInt(Main.player2Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player2Score);\r\n\t\t\t\twinner = Main.playerTwo;\r\n\t\t\t}\r\n\t\t\tif (Utils.stringToInt(Main.player3Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player3Score);\r\n\t\t\t\twinner = Main.playerThree;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//Four handed play with no teams.\r\n\t\tif (Main.isFourHandedSingle){\r\n\t\t\tif (Utils.stringToInt(Main.player1Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player1Score);\r\n\t\t\t\twinner = Main.playerOne;\r\n\t\t\t}\r\n\t\t\tif (Utils.stringToInt(Main.player2Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player2Score);\r\n\t\t\t\twinner = Main.playerTwo;\r\n\t\t\t}\r\n\t\t\tif (Utils.stringToInt(Main.player3Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player3Score);\r\n\t\t\t\twinner = Main.playerThree;\r\n\t\t\t}\r\n\t\t\tif (Utils.stringToInt(Main.player4Score) >= highest) {\r\n\t\t\t\thighest = Utils.stringToInt(Main.player4Score);\r\n\t\t\t\twinner = Main.playerFour;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn winner;\r\n\t}", "void checkWinner() {\n\t}", "public void decideResult() {\n\t\t\n\t\tif (mUser.getHandValue() < 22 && mUser.getHandValue() > mDealer.getHandValue()) {\n\t\t\tmResult = \"win\";\n\t\t}else if(mUser.getHandValue() < 22 && mUser.getHandValue() == mDealer.getHandValue()) {\n\t\t\tmResult = \"draw\";\n\t\t}else {\n\t\t\tmResult = \"lose\";\n\t\t}\n\t\t\n\t}", "public void Gamefinished()\n\t\t{\n\t\t\tplayers_in_game--;\n\t\t}", "public boolean isFinished();", "public boolean getEndTurn() {\n\t\treturn turnEnd;\n\t}", "public boolean winner(){ \r\n\t\tif (rowWin() || colWin() || diagWin()){ \r\n\t\t\tchangeTurn(); \r\n\t\t\tSystem.out.println(\"Winner: \" + playerToString(currentTurn) + \"!\"); \r\n\t\t\treturn true; \r\n\t\t}\r\n\t\telse if (tie()){\r\n\t\t\tSystem.out.println(\"There is a tie.\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse{ \r\n\t\t\tSystem.out.println(\"No winner yet.\\n\"); \r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t}", "boolean isFinished();", "public void endOfTurn();", "private boolean winner() {\n\t\t\n\t\tif(( gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_LEFT] + gameBoard[BTM_LEFT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_CENTER] + gameBoard[CTR_CENTER] + gameBoard[BTM_CENTER]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_CENTER] + gameBoard[BTM_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_CENTER] + gameBoard[BTM_LEFT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_LEFT] + gameBoard[BTM_LEFT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_CENTER] + gameBoard[CTR_CENTER] + gameBoard[BTM_CENTER]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_CENTER] + gameBoard[BTM_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_CENTER] + gameBoard[BTM_LEFT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if(gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT] + \n\t\t\t\t gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT] +\n\t\t\t\t gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT] == CAT){\n\t\t\t//cat winner player_1 goes first\n\t\t\twinner = CAT;\n\t\t}else if(gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT] + \n\t\t\t\t gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT] +\n\t\t\t\t gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT] == (CAT + 3)){\n\t\t\t//cat winner player_2 goes first\n\t\t\twinner = CAT;\n\t\t} \n\t\t\n\t\tif(winner > 0){\n\t\t\treturn true;//there is a winner\n\t\t}else{\n\t\t\treturn false;//still no winner yet\n\t\t}\t\n\t}" ]
[ "0.6819094", "0.6758483", "0.6742033", "0.672339", "0.6606587", "0.65113866", "0.6449875", "0.6407826", "0.6379409", "0.6375103", "0.6359107", "0.63510984", "0.6341944", "0.63356155", "0.6332003", "0.63311166", "0.6314156", "0.63115036", "0.6290902", "0.62393296", "0.621577", "0.61734", "0.61606365", "0.6157948", "0.615736", "0.6127892", "0.6125622", "0.6124112", "0.6120477", "0.6116437", "0.61142266", "0.6107082", "0.608855", "0.60848796", "0.6079422", "0.6070931", "0.6069135", "0.6059855", "0.6055051", "0.6043043", "0.6022368", "0.6018718", "0.60142785", "0.5996016", "0.59953916", "0.5976748", "0.5964074", "0.5917812", "0.5912848", "0.5906096", "0.59025615", "0.58985484", "0.5896753", "0.5896424", "0.58932257", "0.58912027", "0.58889884", "0.5888532", "0.58845", "0.58842826", "0.587649", "0.5868699", "0.586668", "0.5856335", "0.58508164", "0.5834279", "0.5827382", "0.5827186", "0.58161145", "0.58121383", "0.5809266", "0.58019584", "0.58012575", "0.57961416", "0.5795959", "0.578418", "0.57834053", "0.5778533", "0.5758323", "0.57560474", "0.57496554", "0.57486445", "0.57453793", "0.5741644", "0.5740158", "0.574004", "0.573951", "0.5734752", "0.5731341", "0.57266974", "0.5724972", "0.57207793", "0.57134026", "0.570893", "0.5707947", "0.57036996", "0.5702108", "0.5696413", "0.56798095", "0.5678227" ]
0.64629143
6
Of getWinner Get valid actions of the given state.
public int[] getValidActions(int paraState) { // Step 1. Construct the checkerboard. int[][] tempCheckerboard = stateToCheckerboard(paraState); int[] tempValidActions = new int[SIZE * SIZE]; int tempNumValidActions = 0; // Step 1. Check all states. for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { if (tempCheckerboard[i][j] == EMPTY) { tempValidActions[tempNumValidActions] = i * SIZE + j; tempNumValidActions++; } // Of if } // Of for j } // Of for i // Step 2. Compress. int[] resultActions = new int[tempNumValidActions]; for (int i = 0; i < tempNumValidActions; i++) { resultActions[i] = tempValidActions[i]; } // Of for i // SimpleTools.variableTrackingOutput("Valid actions: " + // Arrays.toString(resultActions)); return resultActions; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public ArrayList<agents.Action> actionsFor(agents.State state) {\n\n ArrayList<agents.Action> legalActions = new ArrayList<agents.Action>();\n int[] board = ((State) state).getBoard();\n int blankPosition = 0;\n while (board[blankPosition] != 0) blankPosition++;\n if (blankPosition % 3 != 0) legalActions.add(new Action(LEFT));\n if (blankPosition % 3 != 2) legalActions.add(new Action(RIGHT));\n if (blankPosition < 6) legalActions.add(new Action(DOWN));\n if (blankPosition > 2) legalActions.add(new Action(UP));\n return legalActions;\n }", "public List<A> getAvailableActionsFor(S state);", "public static HashSet<gameState> Actions(gameState currentState) {\n\t\t\n\t\tHashSet<gameState> possibleStates = new HashSet<gameState>();\n\t\t\n\t\t\n\t\t// Store which player goes next after this player plays\n\t\tint nextNextUp;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tnextNextUp = 1;\n\t\t} else {\n\t\t\tnextNextUp = 0;\n\t\t}\n\t\t\n\t\t// Store corresponding characters for each player\n\t\t// DARK(X) - 0, LIGHT(O) - 1\n\t\tchar myTile;\n\t\tchar opponentTile;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tmyTile = 'x';\n\t\t\topponentTile = 'o';\n\t\t} else {\n\t\t\tmyTile = 'o';\n\t\t\topponentTile = 'x';\n\t\t}\n\n\t\t\n\n\t\t// Check the entire board of the state \n\t\tfor (int i = 0; i<boardSize; i++) {\n\t\t\tfor (int j = 0; j<boardSize; j++) {\n\t\t\t\t\n\t\t\t\t// If the tile is my tile\n\t\t\t\tif (currentState.getBoard()[i][j] == '_') {\n\t\t\t\t\t\n\t\t\t\t\tchar[][] moveBoard = createNewBoard(currentState);\n\t\t\t\t\t\n\t\t\t\t\t// Up\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// If it is an opponent tile, then you keep going up until you either my tile (fail) or\n\t\t\t\t\t\t// a blank space (success/move possible)\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=i;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Down\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=i;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j-1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=j;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j+1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=j;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j-1] == opponentTile) { \n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j+1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j-1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j+1] == opponentTile) { \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\tif (!compareBoards(moveBoard, currentState.getBoard())) {\n\t\t\t\t\t\tgameState move = new gameState(moveBoard, nextNextUp);\t\t\n\t\t\t\t\t\tpossibleStates.add(move);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\n\t\treturn possibleStates;\n\t\t\n\t\t\n\t\t\n\t}", "public static void getValidActionsTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 6643 };\n\n\t\tint[] tempResultArray;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResultArray = tempEnvironment.getValidActions(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The valid actions of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.toString(tempResultArray));\n\t\t} // Of for i\n\t}", "public Action getBestAction(State state);", "public List<ActionValue> getActions(State state);", "public void DeclareWinner(int[] state);", "public boolean[] eGreedyAction()\n\t{\n\t\t// initialize variables\n\t\tRandom generator = new Random();\n\t\t\n\t\t// find best action\n\t\tList<boolean[]> validActions = getValidActions();\n\t\t\n\t\t// initiate values for comparison\n\t\tStateActionPair sap = new StateActionPair(state, validActions.get(0));\n\t\tboolean[] bestAction = sap.action;\n\t\t\n\t\tdouble bestValue= getStateActionValue(sap);\n\t\t\n\t\tfor(int i=1; i<validActions.size(); i++)\n\t\t{\n\t\t\tsap = new StateActionPair(state, validActions.get(i));\n\t\t\tdouble qValue = getStateActionValue(sap);\n\t\t\tif( qValue > bestValue )\n\t\t\t{\n\t\t\t\tbestAction = sap.action;\n\t\t\t\tbestValue = qValue;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// choose random action\n\t\tif( generator.nextDouble() < epsilon )\t\n\t\t{\n\t\t\tList<boolean[]> randomActions = new ArrayList<boolean[]>(validActions);\n\t\t\trandomActions.remove(bestAction);\t// don't choose the best action\n\t\t\tboolean[] randomAction = randomActions.get(generator.nextInt(randomActions.size()));\n\t\t\treturn randomAction;\n\t\t}\n\t\t\n\n\t\treturn bestAction;\t// choose best action\n\t}", "public PossibleMoves getPossibleMoves(State state){\n if(possibleMoves == null){\n possibleMoves = new PossibleMoves(state);\n }\n return possibleMoves;\n }", "protected HashSet<GoapAction> extractPossibleActions() {\r\n\t\tHashSet<GoapAction> possibleActions = new HashSet<GoapAction>();\r\n\r\n\t\ttry {\r\n\t\t\tfor (GoapAction goapAction : this.goapUnit.getAvailableActions()) {\r\n\t\t\t\tif (goapAction.checkProceduralPrecondition(this.goapUnit)) {\r\n\t\t\t\t\tpossibleActions.add(goapAction);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn possibleActions;\r\n\t}", "public double getReward(List<Integer> state, List<Integer> action) {\n\t\tList<Integer> newState=sumLists(state,action);\n\t\tif (listElementSum(newState)>this.ventureManager.getMaxManufacturingFunds()) {\n\t\t\tthrow new IllegalArgumentException(\"Action not Valid for given state at getReward(state,action)\");\n\t\t}\n\t\t\n\t\treturn this.futureRewards.get(newState);\n\t\t\n\t}", "public static int checkForWin(BitSet state, BitSet theirBoard) {\n \n BitSet[] myWins = Shifts.doShifts(state, 5, true);\n BitSet[] theirWins = Shifts.doShifts(theirBoard, 5, true);\n\n\n boolean iWon = !myWins[0].isEmpty() || !myWins[1].isEmpty() || !myWins[2].isEmpty() || !myWins[3].isEmpty();\n boolean theyWon = !theirWins[0].isEmpty() || !theirWins[1].isEmpty() || !theirWins[2].isEmpty() || !theirWins[3].isEmpty();\n \n if (iWon && theyWon) {\n //draw, we both have a win\n return 0;\n }\n else if (iWon) {\n return 3000; \n }\n else if (theyWon){\n return -3000;\n }\n else {\n return 13;\n }\n }", "@Override\n\tpublic int getAction() {\n\t\tint bstar = -1;\n\t\tdouble bstarval = Double.NEGATIVE_INFINITY;\n\t\tfor (int b : actions) {\n\t\t\t// now we need to look at each possible state transition\n\t\t\tdouble newStateSum = 0;\n\t\t\t// which means for every possible next state\n\t\t\tfor (int newX = 0; newX < beliefs.length; newX++) {\n\t\t\t\tfor (int newY = 0; newY < beliefs[0].length; newY++) {\n\t\t\t\t\tint[] newState = new int[]{newX,newY};\n\t\t\t\t\t// we need to look at every possible previous state\n\t\t\t\t\tdouble stateSum = 0;\n\t\t\t\t\tfor (int x = 0; x < beliefs.length; x++) {\n\t\t\t\t\t\tfor (int y = 0; y < beliefs[0].length; y++) {\n\t\t\t\t\t\t\tstateSum += beliefs[x][y] * // belief in CURRENT state if we were to make the observation, times\n\t\t\t\t\t\t\t\t\t\tworld.transitionProbability(newX, newY, x, y, b) * // probability of getting into the new state\n\t\t\t\t\t\t\t\t\t\tworld.getReward(newState);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewStateSum += stateSum;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (newStateSum > bstarval) {\n\t\t\t\tbstar = b;\n\t\t\t\tbstarval = newStateSum;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"(EntropicExplorer) Choosing action: \" + world.actionToString(bstar) + \" (value = \" + bstarval + \")\");\n\t\tlastAction = bstar;\n\t\tadvanceBeliefs(bstar);\n\t\treturn bstar;\n\t}", "public int[] getValidActions() {\n\t\treturn getValidActions(currentState);\n\t}", "public List<Action> getActionsBasedOnProbability(final State state) {\r\n double bestProbability = 0;\r\n final List<Action> bestActions = new LinkedList<Action>();\r\n\r\n for (final Map.Entry<Action, Double> actionProb : getProperties(state).getActionProbabilities().entrySet()) {\r\n final double probability = actionProb.getValue();\r\n if (probability > bestProbability) {\r\n bestActions.clear();\r\n bestProbability = probability;\r\n }\r\n if (probability >= bestProbability) {\r\n bestActions.add(actionProb.getKey());\r\n }\r\n }\r\n\r\n return bestActions;\r\n }", "Piece getWinner();", "void checkWinner() {\n\t}", "public abstract int getReward(int initialState, int initialAction);", "boolean isWinner(GameState state, String username) throws GameStateException;", "@Test\n public void destiny2GetClanWeeklyRewardStateTest() {\n Long groupId = null;\n InlineResponse20039 response = api.destiny2GetClanWeeklyRewardState(groupId);\n\n // TODO: test validations\n }", "public Action[] getFeasibleActions(int[] state)\n\t{\n\t int x = state[0];\n\t int y = state[1];\n\t\tArrayList<Action> actionsList = new ArrayList<Action>();\n\n\t\tif ( x == 0) {\n\t\t\t// Action for filling x from tap\n\t\t actionsList.add(new Action(\"tap\", \"x\", 4));\n\t\t}\n\n\t\tif (y == 0) {\n\t\t\t// Action for filling y from tap\n\t\t actionsList.add(new Action(\"tap\", \"y\", 3));\n\t\t}\n\n\t\tif (x == 4) {\n\t\t\t// Action for emptying x\n\t\t\tactionsList.add(new Action(\"x\", \"ground\", x));\n\t\t}\n\n\t\tif (y == 3) {\n\t\t\t// Action for emptying y\n\t\t\tactionsList.add(new Action(\"y\", \"ground\", y));\n\t\t}\n\n // Add action for filling one jug with another\n // if only it is possible to and there is the need for it\n if ((x > 0) && ((3-y) > 0)) {\n \t// if (x >= (3 - y)) fill with ( 3 - y) else fill with x\n\t\t\tactionsList.add(new Action(\"x\", \"y\", Math.min((3-y), x)));\n }\n\n if ((y > 0) && ((4 -x) > 0)) {\n \t// If (y >= (4-x) fill with (4-x)) else fill with y\n\t actionsList.add(new Action(\"y\", \"x\", Math.min((4-x), y)));\t \n\t }\n\n Action[] actionsArray = new Action[actionsList.size()];\n\t\treturn actionsList.toArray(actionsArray);\n\t}", "public int getAction(int state) {\n return explorationPolicy.ChooseAction(qvalues[state]);\n }", "boolean isWinner() {\n boolean win = true;\n // first method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if ((state[i][j] == 'X' && stateGame[i][j] != '*') || (state[i][j] != 'X' && stateGame[i][j] == '*'))\n win = false;\n }\n }\n if (win)\n return true;\n\n win = true;\n // second method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if (state[i][j] == '.' && stateGame[i][j] == '.')\n win = false;\n }\n }\n return win;\n }", "public int winner(){\n getValidMoves();\n if(check(1)!=0) return 1;\n else if(check(-1)!=0) return -1;\n else if(validX.size()==0) return 2;\n else return 0;\n }", "public Action getActionBasedOnProbability(final State state) {\r\n final double decision = Math.random();\r\n double decisionCount = 0;\r\n\r\n for (final Map.Entry<Action, Double> actionProb : getProperties(state).getActionProbabilities().entrySet()) {\r\n decisionCount += actionProb.getValue();\r\n if (decisionCount >= decision) {\r\n return actionProb.getKey();\r\n }\r\n }\r\n\r\n System.err.println(\"Error: cannot choose action!\");\r\n System.err.println(getProperties(state).getActionProbabilities());\r\n return null;\r\n }", "@Override\r\n\tpublic void getLegalMoves() {\r\n\t\tint pawnX = this.getX();\r\n\t\tint pawnY = this.getY();\r\n\t\tchar pawnColor = getColor();\r\n\t\tTile[][] chessBoard = SimpleChess.getChessBoard();\r\n\t\tcheckInFront(chessBoard,pawnX,pawnY,pawnColor);\r\n\t\tcheckDiagonal(chessBoard,pawnX,pawnY,pawnColor);\r\n\t}", "public int[][] getLegalMoves(Piece p, Board b) {\n this.b = b;\n int checkMate[][] = new int[8][8];\n if (p instanceof King) {\n\n return getMovesKing(p);\n }\n if (p instanceof Rook) {\n\n return getMovesRook(p);\n }\n if (p instanceof Pawn) {\n if (!p.isWhite()) {\n\n return getMovesBlackPawn((Pawn) p);\n } else {\n\n return getMovesWhitePawn((Pawn) p);\n }\n }\n if (p instanceof Knight) {\n\n return getMovesKnight(p);\n }\n if (p instanceof Bishop) {\n\n return getMovesBishop(p);\n }\n if (p instanceof Queen) {\n\n return getMovesQueen(p);\n }\n return checkMate;\n \n }", "private List<int[]> generatePossibleMoveActions(LabyrinthGameState state) {\n List<Tile> tiles = new ArrayList<>();\n Tile orig = state.getPlayerLoc(Player.values()[playerNum]);\n tiles.add(orig);\n this.calculatePossibleMoves(orig, tiles);\n List<int[]> locations = new ArrayList<>();\n for (Tile spot : tiles) {\n int[] loc = new int[2];\n loc[0] = spot.getX();\n loc[1] = spot.getY();\n locations.add(loc);\n }\n return locations;\n }", "@Test\n void testAllLegalMoves() {\n \tplayer1 = new HumanPlayer(\"Arnold\");\n player2 = new HumanPlayer(\"Intelligent Twig\");\n gameState = new GameState(Arrays.asList(player1, player2));\n board = gameState.getBoard();\n \n Set<PlayableMove> moves = Move.allLegalMoves(gameState);\n\n assertTrue(moves.stream().allMatch(e -> e.isLegal()));\n assertEquals(44, moves.size());\n }", "public PentagoMove quickwin(PentagoBoardState boardState) {\n PentagoBoardState pbs = (PentagoBoardState) boardState.clone();\n ArrayList<PentagoMove> legalmoves = pbs.getAllLegalMoves();\n //ArrayList<Integer> scores = new ArrayList<Integer>();\n for (int i = 0; i < legalmoves.size(); i++) { //loop through all my moves and see if they are a winner\n\n PentagoBoardState newboard = (PentagoBoardState) pbs.clone();\n PentagoMove next = legalmoves.get(i);\n newboard.processMove(next);\n int score = evaluate(newboard);\n if (score > 1200000) { //check if winner if score above 1 200 000\n //System.out.println(\"FOUND A WINNER\" + score);\n return next;\n }\n }\n return null; // if no winner return null\n }", "public static Move openingStrategy(PentagoBoardState boardState, int player) {\n\t Move firstMoveOne = new PentagoMove(1, 0, Quadrant.BL, Quadrant.BR, player);\r\n\t Move firstMoveTwo = new PentagoMove(1, 3, Quadrant.BL, Quadrant.BR, player);\r\n\t Move moveThree = new PentagoMove(0, 1, Quadrant.BL, Quadrant.TR, player);\r\n\t Move moveFour = new PentagoMove(0, 4, Quadrant.TL, Quadrant.BR, player);\r\n\t Move moveFive = new PentagoMove(3, 1, Quadrant.BL, Quadrant.TL, player);\r\n\t Move moveSix = new PentagoMove(3, 4, Quadrant.TL, Quadrant.TR, player);\r\n\t Move moveSeven = new PentagoMove(2, 2, Quadrant.TL, Quadrant.TR, player);\r\n\t Move moveEight = new PentagoMove(2, 5, Quadrant.TL, Quadrant.BR, player);\r\n\t Move moveNine = new PentagoMove(5, 2, Quadrant.BL, Quadrant.TL, player);\r\n\t Move moveTen = new PentagoMove(5, 5, Quadrant.TL, Quadrant.TR, player);\r\n\t \r\n\t //First turn as either Black or White\r\n\t if(boardState.getTurnNumber() == 0 || boardState.getTurnNumber() == 1) {\r\n\t if(boardState.isLegal((PentagoMove) firstMoveOne)) {\r\n\t \treturn firstMoveOne;\r\n\t }\r\n\t else if(boardState.isLegal((PentagoMove) firstMoveTwo)) {\r\n\t \treturn firstMoveTwo;\r\n\t }\r\n\t else {\r\n\t \t/* If something goes awry, play the first legal move (will place pieces in TL quadrant usually).\r\n\t \t * Same error condition for the following moves as well.\r\n\t \t **/\r\n\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t \treturn legalMoves.get(0);\r\n\t }\r\n\t }\r\n\t else if(boardState.getTurnNumber() == 2 || boardState.getTurnNumber() == 3) {\r\n\t \t//White player turn 2 & 3 set up\r\n\t \tif(player == 0) {\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveThree) && boardState.getPieceAt(1, 0).toString().equals(\"w\")) {\r\n\t\t \treturn moveThree;\r\n\t\t }\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveFour) && boardState.getPieceAt(1, 3).toString().equals(\"w\")) {\r\n\t\t \t\treturn moveFour;\r\n\t\t \t}\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveFive) && boardState.getPieceAt(4, 0).toString().equals(\"w\")) {\r\n\t\t \treturn moveFive;\r\n\t\t }\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveSix) && boardState.getPieceAt(4, 3).toString().equals(\"w\")) {\r\n\t\t \t\treturn moveSix;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(0, 1).toString().equals(\"b\") && boardState.getPieceAt(1, 0).toString().equals(\"w\")\t\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveSeven)) {\r\n\t\t \treturn moveSeven;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(0, 4).toString().equals(\"b\") && boardState.getPieceAt(1, 3).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveEight)) {\r\n\t\t \t\treturn moveEight;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(3, 1).toString().equals(\"b\") && boardState.getPieceAt(4, 0).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveNine)) {\r\n\t\t \treturn moveNine;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(3, 4).toString().equals(\"b\") && boardState.getPieceAt(4, 3).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveTen)) {\r\n\t\t \t\treturn moveTen;\r\n\t\t \t}\r\n\t\t else {\r\n\t\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t\t \treturn legalMoves.get(0);\r\n\t\t }\r\n\t \t} \r\n\t \t//Black player turn 2 & 3 set up\r\n\t \telse {\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveThree) && boardState.getPieceAt(1, 0).toString().equals(\"b\")) {\r\n\t\t \treturn moveThree;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveFour) && boardState.getPieceAt(1, 3).toString().equals(\"b\")) {\r\n\t\t \treturn moveFour;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveFive) && boardState.getPieceAt(4, 0).toString().equals(\"b\")) {\r\n\t\t \treturn moveFive;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveSix) && boardState.getPieceAt(4, 3).toString().equals(\"b\")) {\r\n\t\t \treturn moveSix;\r\n\t\t }\r\n\t \t\tif(boardState.getPieceAt(0, 1).toString().equals(\"w\") && boardState.getPieceAt(1, 0).toString().equals(\"b\")\r\n\t \t\t\t\t&& boardState.isLegal((PentagoMove) moveSeven)) {\r\n\t\t \treturn moveSeven;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(0, 4).toString().equals(\"w\") && boardState.getPieceAt(1, 3).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveEight)) {\r\n\t\t \t\treturn moveEight;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(3, 1).toString().equals(\"w\") && boardState.getPieceAt(4, 0).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveNine)) {\r\n\t\t \treturn moveNine;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(3, 4).toString().equals(\"w\") && boardState.getPieceAt(4, 3).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveTen)) {\r\n\t\t \t\treturn moveTen;\r\n\t\t \t}\r\n\t\t else {\r\n\t\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t\t \treturn legalMoves.get(0);\r\n\t\t }\r\n\t \t}\t \r\n\t }\r\n\t else {\r\n\t \t//If we are past Player's Turn 3, start using MiniMax with a-b pruning\r\n\t \tMiniMaxABPruning instc = new MiniMaxABPruning();\r\n\t \treturn instc.abPruningStrategy(boardState, boardState.getTurnPlayer());\r\n\t }\r\n\t}", "public List<boolean[]> getValidActions()\n\t{\n\t\tList<boolean[]> validActions = new ArrayList<boolean[]>(allActions);\n\t\t//TODO remove actions that contain jump if environment.mayMarioJump() is false\n\t\treturn validActions;\n\t}", "public PentagoMove alphabetaw(PentagoBoardState boardState){\n PentagoBoardState pbs = (PentagoBoardState) boardState.clone();\n ArrayList<PentagoMove> legalmoves = pbs.getAllLegalMoves();\n\n PentagoMove bestmove = legalmoves.get(0);\n PentagoMove bestopponentmove = new PentagoMove(0,0,0,0,0);\n int bestmovescore = -9999999;\n int bestwhitescore = 0;\n //ArrayList<Integer> scores = new ArrayList<Integer>();\n for(int i = 0;i<legalmoves.size()-1;i++){\n\n PentagoBoardState newboard = (PentagoBoardState) pbs.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove next = legalmoves.get(i);\n\n newboard.processMove(next);\n\n int score = evaluate(newboard);\n //scores.add(score);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n\n if(score > 100000){\n newboard.getWinner();\n newboard.printBoard();\n System.out.println(\"FOUND A WINNER\" + score);\n return next;\n }\n\n\n PentagoMove currentopponentmove;\n ArrayList<PentagoMove> opponentlegalmoves = newboard.getAllLegalMoves();\n if (opponentlegalmoves.size()!=0){\n currentopponentmove = opponentlegalmoves.get(0);\n }\n\n int minopponentmovescore = 999999;\n int thismovescore = -9999;\n ArrayList<PentagoMove> bestopponentmoves = new ArrayList<PentagoMove>();\n PentagoMove currentbestopponentmove = new PentagoMove(0,0,0,0,0);\n\n for(int a = 0;a<opponentlegalmoves.size()-1;a++){\n\n PentagoBoardState pbsopponent = (PentagoBoardState) newboard.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove opponentnext = opponentlegalmoves.get(a);\n\n pbsopponent.processMove(opponentnext);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n //pbs.printBoard();\n\n int opponentscore = evaluate(pbsopponent);\n\n\n\n\n\n if (minopponentmovescore>opponentscore){\n //currentopponentmove = opponentnext;\n minopponentmovescore = opponentscore;\n bestopponentmoves.add(opponentnext);\n currentbestopponentmove = opponentnext;\n }\n\n\n }\n bestopponentmove = currentbestopponentmove;\n //lvl 3\n /*\n\n int lvl3minscore =99999;\n PentagoMove currentmaxmove;\n for (int r = 0;r<bestopponentmoves.size()-1;r++) {\n PentagoBoardState pbsopponent = (PentagoBoardState) newboard.clone();\n pbsopponent.processMove(bestopponentmoves.get(r));\n\n ArrayList<PentagoMove> maxlegalmoves = pbsopponent.getAllLegalMoves();\n if (maxlegalmoves.size() != 0) {\n currentmaxmove = maxlegalmoves.get(0);\n }\n int opponentscore = evaluate(pbsopponent);\n int findminmaxmovescore = -99999;\n for (int s = 0; s < maxlegalmoves.size() - 1; s++) {\n\n PentagoBoardState maxboard = (PentagoBoardState) pbsopponent.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove maxnext = maxlegalmoves.get(s);\n\n maxboard.processMove(maxnext);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n //pbs.printBoard();\n\n int maxnextscore = evaluate(pbsopponent);\n if (findminmaxmovescore < maxnextscore) {\n currentmaxmove = maxnext;\n findminmaxmovescore = maxnextscore;\n }\n }\n if (thismovescore<findminmaxmovescore){\n //currentopponentmove = opponentnext;\n thismovescore = findminmaxmovescore;\n }\n\n //opponentscore = maxmovescore;\n }\n\n //end experiment\n\n\n\n\n if (mycolour ==1){\n lvl3minscore =minopponentmovescore;\n }\n */\n if (minopponentmovescore>bestmovescore){//minopponentmovescore\n System.out.println(\"max player move score: \"+score + \"Min : \" + minopponentmovescore);\n bestmovescore = minopponentmovescore;\n bestmove = next;\n bestwhitescore = score;\n\n }\n else if (minopponentmovescore == bestmovescore){\n if (score > bestwhitescore){\n System.out.println(\"max player move score: \"+score + \"Min : \" + minopponentmovescore);\n bestmovescore = minopponentmovescore;\n bestmove = next;\n bestwhitescore = score;\n }\n\n\n\n }\n\n\n }\n System.out.println(\"final max player move score: \"+ bestmovescore + \"\\n My best move: \"+bestmove.toPrettyString() + \"\\n My best move: \"+ bestopponentmove.toPrettyString());\n return bestmove;\n }", "private WeightedSampler<String> getPossibleLethalActions(int team) {\n if (this.b.getCurrentPlayerTurn() != team || this.b.getWinner() != 0) {\n return null;\n }\n Player p = this.b.getPlayer(team);\n WeightedSampler<String> poss = new WeightedOrderedSampler<>();\n List<Minion> minions = this.b.getMinions(team, false, true).collect(Collectors.toList());\n for (Minion m : minions) {\n if (p.canUnleashCard(m)) {\n double totalWeight = UNLEASH_TOTAL_WEIGHT + UNLEASH_WEIGHT_PER_PRESENCE * m.getTotalEffectValueOf(e -> e.getPresenceValue(5));\n List<List<List<TargetList<?>>>> targetSearchSpace = new LinkedList<>();\n this.getPossibleListTargets(m.getUnleashTargetingSchemes(), new LinkedList<>(), targetSearchSpace);\n if (targetSearchSpace.isEmpty()) {\n targetSearchSpace.add(List.of());\n }\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new UnleashMinionAction(p, m, targets).toString().intern(), totalWeight / targetSearchSpace.size());\n }\n }\n }\n if (this.b.getMinions(team * -1, false, true).anyMatch(m -> m.finalStats.get(Stat.WARD) > 0)) {\n // find ways to break through the wards\n for (Minion m : minions) {\n if (m.canAttack()) {\n double totalWeight = ATTACK_TOTAL_WEIGHT + ATTACK_WEIGHT_MULTIPLIER * m.finalStats.get(Stat.ATTACK);\n List<Minion> searchSpace = m.getAttackableTargets().collect(Collectors.toList());\n double weight = totalWeight / searchSpace.size();\n for (Minion target : searchSpace) {\n double overkillMultiplier = Math.pow(ATTACK_WEIGHT_OVERKILL_PENALTY, Math.max(0, m.finalStats.get(Stat.ATTACK) - target.health));\n poss.add(new OrderAttackAction(m, target).toString().intern(), overkillMultiplier * weight);\n }\n }\n }\n } else {\n // just go face\n this.b.getPlayer(team * -1).getLeader().ifPresent(l -> {\n for (Minion m : minions) {\n if (m.canAttack(l)) {\n double totalWeight = ATTACK_TOTAL_WEIGHT + ATTACK_WEIGHT_MULTIPLIER * m.finalStats.get(Stat.ATTACK);\n poss.add(new OrderAttackAction(m, l).toString().intern(), totalWeight);\n }\n }\n });\n }\n poss.add(new EndTurnAction(team).toString().intern(), END_TURN_WEIGHT);\n return poss;\n }", "List<ValidMove> getValidMoves();", "private int evaluateState() {\r\n\r\n\t\t// add up score\r\n\t\t//\r\n\t\tint scoreWhite = 0;\r\n\t\tint scoreBlack = 0;\r\n\t\tfor (Piece piece : this.chessGame.getPieces()) {\r\n\t\t\tif(piece.getColor() == Piece.COLOR_BLACK){\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else if( piece.getColor() == Piece.COLOR_WHITE){\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else{\r\n\t\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\t\"unknown piece color found: \"+piece.getColor());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// return evaluation result depending on who's turn it is\r\n\t\tint gameState = this.chessGame.getGameState();\r\n\t\t\r\n\t\tif( gameState == ChessGame.GAME_STATE_BLACK){\r\n\t\t\treturn scoreBlack - scoreWhite;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_WHITE){\r\n\t\t\treturn scoreWhite - scoreBlack;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_END_WHITE_WON\r\n\t\t\t\t|| gameState == ChessGame.GAME_STATE_END_BLACK_WON){\r\n\t\t\treturn Integer.MIN_VALUE + 1;\r\n\t\t\r\n\t\t}else{\r\n\t\t\tthrow new IllegalStateException(\"unknown game state: \"+gameState);\r\n\t\t}\r\n\t}", "public Action getActionBasedOnValueEpsilonGreedy(final State state, final double epsilon) {\r\n final double decision = Math.random();\r\n final List<Action> allActions = new LinkedList<Action>();\r\n final List<Action> bestActions = new LinkedList<Action>();\r\n double bestValue = Integer.MIN_VALUE;\r\n\r\n // Determine the best action(s)\r\n for (final Map.Entry<Action, Double> actionValue : getProperties(state).getActionValues().entrySet()) {\r\n final Action action = actionValue.getKey();\r\n final double value = actionValue.getValue();\r\n\r\n allActions.add(action);\r\n\r\n if (value > bestValue) {\r\n bestActions.clear();\r\n bestValue = value;\r\n }\r\n if (value >= bestValue) {\r\n bestActions.add(action);\r\n }\r\n }\r\n\r\n if (decision > epsilon || allActions.size() == bestActions.size()) {\r\n // Pick a best action\r\n return bestActions.get((int) Math.floor(Math.random() * bestActions.size()));\r\n } else {\r\n // Pick a non-best action for exploration\r\n for (final Action bestAction : bestActions) {\r\n allActions.remove(bestAction);\r\n }\r\n return allActions.get((int) Math.floor(Math.random() * allActions.size()));\r\n }\r\n }", "public int getWinner() {return winner();}", "public int[][] getMovesKnight(Piece p) {\n x = p.getX();\n y = p.getY();\n int[][] legalMoves = new int[8][8];\n\n if ((x + 2) < 8 && (y + 1) < 8) {\n if (b.getPieceAt((y + 1), (x + 2)) != null) {\n if (b.getPieceAt((y + 1), (x + 2)).isWhite() != p.isWhite()) {\n legalMoves[y + 1][x + 2] = 1;\n }\n } else {\n legalMoves[y + 1][x + 2] = 1;\n }\n }\n if ((x + 2) < 8 && (y - 1) > -1) {\n if (b.getPieceAt((y - 1), (x + 2)) != null) {\n if (b.getPieceAt((y - 1), (x + 2)).isWhite() != p.isWhite()) {\n legalMoves[y - 1][x + 2] = 1;\n }\n } else {\n legalMoves[y - 1][x + 2] = 1;\n }\n }\n if ((x - 2) > -1 && (y + 1) < 8) {\n if (b.getPieceAt((y + 1), (x - 2)) != null) {\n if (b.getPieceAt((y + 1), (x - 2)).isWhite() != p.isWhite()) {\n legalMoves[y + 1][x - 2] = 1;\n }\n } else {\n legalMoves[y + 1][x - 2] = 1;\n }\n }\n if ((x - 2) > -1 && (y - 1) > -1) {\n if (b.getPieceAt((y - 1), (x - 2)) != null) {\n if (b.getPieceAt((y - 1), (x - 2)).isWhite() != p.isWhite()) {\n legalMoves[y - 1][x - 2] = 1;\n }\n } else {\n legalMoves[y - 1][x - 2] = 1;\n }\n }\n if ((x + 1) < 8 && (y + 2) < 8) {\n if (b.getPieceAt((y + 2), (x + 1)) != null) {\n if (b.getPieceAt((y + 2), (x + 1)).isWhite() != p.isWhite()) {\n legalMoves[y + 2][x + 1] = 1;\n }\n } else {\n legalMoves[y + 2][x + 1] = 1;\n }\n }\n if ((x - 1) > -1 && (y + 2) < 8) {\n if (b.getPieceAt((y + 2), (x - 1)) != null) {\n if (b.getPieceAt((y + 2), (x - 1)).isWhite() != p.isWhite()) {\n legalMoves[y + 2][x - 1] = 1;\n }\n } else {\n legalMoves[y + 2][x - 1] = 1;\n }\n }\n if ((x - 1) > -1 && (y - 2) > -1) {\n if (b.getPieceAt((y - 2), (x - 1)) != null) {\n if (b.getPieceAt((y - 2), (x - 1)).isWhite() != p.isWhite()) {\n legalMoves[y - 2][x - 1] = 1;\n }\n } else {\n legalMoves[y - 2][x - 1] = 1;\n }\n }\n if ((x + 1) < 8 && (y - 2) > -1) {\n if (b.getPieceAt((y - 2), (x + 1)) != null) {\n if (b.getPieceAt((y - 2), (x + 1)).isWhite() != p.isWhite()) {\n legalMoves[y - 2][x + 1] = 1;\n }\n } else {\n legalMoves[y - 2][x + 1] = 1;\n }\n }\n return legalMoves;\n }", "public ArrayList<PuzzleState> getNeighbors() {\n\t\tArrayList<PuzzleState> neighbors = new ArrayList<PuzzleState>();\n\t\tPuzzleState neighbor;\n\t\t//System.out.println(\"getting neighbors.\");\n\t\tfor (String act: ACTIONS) {\n\t\t\tif (current.validAction(act)){\n\t\t\t\t//System.out.println(\"Action: \" + act + \" on \" + current.getString());\n\t\t\t\tneighbor = new PuzzleState(current.getString(current.getState()),\n\t\t\t\t\t\t\t\t\t\t\tcurrent.getString(current.getGoalState()));\n\t\t\t\tsearchCost++;\n\t\t\t\tneighbor.act(act);\n\t\t\t\tneighbors.add(neighbor);\n\t\t\t}\t\n\t\t}\n\t\treturn neighbors;\n\t}", "@Test\r\n\tpublic void gameWinCheckCallsCorrectWinner() {\r\n\t\tBowl bowl = new Bowl();\r\n\t\tvar answer = bowl.gameWinCheck();\r\n\t\tassertEquals(-1,answer);\r\n\t\tbowl = setupGame(bowl);\r\n\t\tanswer = bowl.gameWinCheck();\r\n\t\tassertEquals(1,answer);\r\n\t\tbowl.getNeighbor(6).passTheft(49);\r\n\t\tanswer = bowl.getNeighbor(2).gameWinCheck();\r\n\t\tassertEquals(0,answer);\r\n\t}", "public ArrayList<MoveType> getMoves(BotState state, long timeout) {\n ArrayList<MoveType> moves = new ArrayList<MoveType>();\n\n Field field = state.getMyField();\n ShapeType current = state.getCurrentShape();\n ShapeType next = state.getNextShape();\n int myCombo = state.getMyCombo();\n\n Shape piece = new Shape(current, field, state.getShapeLocation());\n Shape nextPiece = new Shape(next, field, (next == ShapeType.O) ? new Point(4, -1) : new Point(3, -1));\n\n Best best = getBestFitness(field, piece, myCombo, nextPiece);\n\n int bestRot = best.bestRot;\n int bestLeft = best.bestLeft;\n\n for (; bestRot > 0; bestRot--)\n moves.add(MoveType.TURNRIGHT);\n if (bestLeft < 0)\n for (; bestLeft < 0; bestLeft++)\n moves.add(MoveType.RIGHT);\n else\n for (; bestLeft > 0; bestLeft--)\n moves.add(MoveType.LEFT);\n\n moves.add(MoveType.DROP);\n return moves;\n }", "public Player getWinner();", "@Override\n\tpublic State doAction(State state) {\n\t\tPoint oldPoint = state.findCell(Keys.MOUSE);\n\t\tPoint newPoint = new Point(oldPoint.x+this.x,oldPoint.y+this.y);\n\t\tState newState = new State(state);\n\t\tnewState.setMode(Keys.IN_PROGRESS);\n\t\tif (newState.cellExists(newPoint.x, newPoint.y) && newState.getCell(newPoint.x, newPoint.y) != -1 && newState.getCell(newPoint.x, newPoint.y) != Keys.WALL) {\n\t\t\tnewState.setCell(oldPoint.x,oldPoint.y , Keys.EMPTY);\n\t\t\t\n\t\t\tif(this.x == 0 ^ this.y == 0)\n\t\t\t\tnewState.setScore(state.getScore()+10);\n\t\t\t\n\t\t\telse if(this.x != 0 && this.y != 0){\n\t\t\t\tnewState.setScore(state.getScore()+15);\n\t\t\t}\n\t\t\t\n\t\t\tif(newPoint.equals(state.findCell(Keys.CHEESE))) {\n\t\t\t\tnewState.setCell(newPoint.x, newPoint.y, Keys.MOUSE_AND_CHEESE);\n\t\t\t} else\n\t\t\t\tnewState.setCell(newPoint.x, newPoint.y, Keys.MOUSE);\n\t\t\t\n\t\t}\n\t\treturn newState;\n\t}", "public double obtainReward(List<Integer> newState) {\n\t\tdouble totalFortnightReward = 0;\n\t\tfor (int w =0;w<ventureManager.getNumVentures();w++ ) {\n\t\t\tdouble individualExpected = 0;\n\t\t\tfor (int i = 0; i < probabilities.get(w).getNumCols(); i++) {\n\t\t\t\tint sold = Math.min(newState.get(w), i);\n\t individualExpected += (sold) * spec.getSalePrices().get(w) *\n\t \t\t0.6 * probabilities.get(w).get(newState.get(w), i);\n\t \n\t int missed = i - sold;\n\t individualExpected -= missed * spec.getSalePrices().get(w) \n\t \t\t* 0.25 * probabilities.get(w).get(newState.get(w), i);\n\t\t\t}\n\t\t\ttotalFortnightReward += individualExpected;\n\t\t}\n\t\t\t\n\t\treturn totalFortnightReward;\n\t}", "@Override\n public A makeDecision(S state) {\n metrics = new Metrics();\n StringBuffer logText = null;\n P player = game.getPlayer(state);\n List<A> results = orderActions(state, game.getActions(state), player, 0);\n timer.start();\n currDepthLimit = 0;\n do {\n incrementDepthLimit();\n if (logEnabled)\n logText = new StringBuffer(\"depth \" + currDepthLimit + \": \");\n heuristicEvaluationUsed = false;\n ActionStore<A> newResults = new ActionStore<>();\n for (A action : results) {\n double value = minValue(game.getResult(state, action), player, Double.NEGATIVE_INFINITY,\n Double.POSITIVE_INFINITY, 1);\n if (timer.timeOutOccurred())\n break; // exit from action loop\n newResults.add(action, value);\n if (logEnabled)\n logText.append(action).append(\"->\").append(value).append(\" \");\n }\n if (logEnabled)\n System.out.println(logText);\n if (newResults.size() > 0) {\n results = newResults.actions;\n if (!timer.timeOutOccurred()) {\n if (hasSafeWinner(newResults.utilValues.get(0)))\n break; // exit from iterative deepening loop\n else if (newResults.size() > 1\n && isSignificantlyBetter(newResults.utilValues.get(0), newResults.utilValues.get(1)))\n break; // exit from iterative deepening loop\n }\n }\n } while (!timer.timeOutOccurred() && heuristicEvaluationUsed);\n return results.get(0);\n }", "private WeightedSampler<String> getPossibleActions(int team) {\n if (this.b.getCurrentPlayerTurn() != team || this.b.getWinner() != 0) {\n return null;\n }\n Player p = this.b.getPlayer(team);\n WeightedSampler<String> poss = new WeightedRandomSampler<>();\n // playing cards & selecting targets\n List<Card> hand = p.getHand();\n for (Card c : hand) {\n if (p.canPlayCard(c)) {\n double totalWeight = PLAY_CARD_TOTAL_WEIGHT + PLAY_CARD_COST_WEIGHT_MULTIPLIER * c.finalStats.get(Stat.COST);\n List<List<List<TargetList<?>>>> targetSearchSpace = new LinkedList<>();\n this.getPossibleListTargets(c.getBattlecryTargetingSchemes(), new LinkedList<>(), targetSearchSpace);\n if (targetSearchSpace.isEmpty()) {\n targetSearchSpace.add(List.of());\n }\n if (c instanceof BoardObject) {\n double weightPerPos = totalWeight / (p.getPlayArea().size() + 1);\n // rip my branching factor lol\n for (int playPos = 0; playPos <= p.getPlayArea().size(); playPos++) {\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new PlayCardAction(p, c, playPos, targets).toString().intern(), weightPerPos / targetSearchSpace.size());\n }\n }\n } else {\n // spells don't require positioning\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new PlayCardAction(p, c, 0, targets).toString().intern(), totalWeight / targetSearchSpace.size());\n }\n }\n }\n }\n this.b.getMinions(team, false, true).forEachOrdered(m -> {\n // unleashing cards & selecting targets\n if (p.canUnleashCard(m)) {\n List<List<List<TargetList<?>>>> targetSearchSpace = new LinkedList<>();\n this.getPossibleListTargets(m.getUnleashTargetingSchemes(), new LinkedList<>(), targetSearchSpace);\n if (targetSearchSpace.isEmpty()) {\n targetSearchSpace.add(List.of());\n }\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new UnleashMinionAction(p, m, targets).toString().intern(), UNLEASH_TOTAL_WEIGHT / targetSearchSpace.size());\n }\n }\n // minion attack\n if (m.canAttack()) {\n double totalWeight = ATTACK_TOTAL_WEIGHT + ATTACK_WEIGHT_MULTIPLIER * m.finalStats.get(Stat.ATTACK);\n double weight = totalWeight / m.getAttackableTargets().count();\n m.getAttackableTargets().forEachOrdered(target -> {\n double bonus = target instanceof Leader ? ATTACK_TARGET_LEADER_MULTIPLIER : 1;\n double overkillMultiplier = Math.pow(ATTACK_WEIGHT_OVERKILL_PENALTY, Math.max(0, m.finalStats.get(Stat.ATTACK) - target.health));\n poss.add(new OrderAttackAction(m, target).toString().intern(), overkillMultiplier * bonus * weight);\n });\n }\n });\n // ending turn\n poss.add(new EndTurnAction(team).toString().intern(), END_TURN_WEIGHT);\n return poss;\n }", "List<Move> getLegalMoves(Player player);", "public BuyMonsterMove getBuyMonster(GameState state) {\n if (Tony == null) assignPlayers(state);\n if (castle1 == null) assignCastles(state);\n\n //TODO: Make Tony Smart\n List<Move> leg_moves = GameRules.getLegalMoves(state);\n\n int i = rand.nextInt(leg_moves.size());\n return (BuyMonsterMove) leg_moves.get(i);\n }", "public boolean[] getAction(Environment environment)\n\t{\n\t\tstate = createState(environment, oldState); // added oldSTate for non static\n\n\t\t//update reward values in screen\n\t\tdouble reward = state.getReward();\n\t\trewardSoFar += reward;\n\t\tcurrentReward = reward;\n\t\t\n\t\t// update q and return action\n\t\tupdateQValue();\n\t\t\n\t\t// only pick a new action every 2nd question\n\t\treturnAction = eGreedyAction();\n\n\t\t// update oldState for updateQValue()\n\t oldState = state.clone();\n\t \n\t return returnAction;\n\n\t}", "public abstract List<ThingNode> getFutureWorldStates(Instruction action);", "@Test\n\tpublic void testIsWon() {\n\t\tGameState test = new GameState();\n\t\ttest.blankBoard();\n\t\tassertTrue(test.isWon());\n\t}", "public abstract Chip checkWinner();", "public GameState won() {\n if ( (board[0][0] != TileState.BLANK) && (board[0][0] == board[0][1]) && (board[0][0] == board[0][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[1][0] != TileState.BLANK) && (board[1][0] == board[1][1]) && (board[1][0] == board[1][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[2][0] != TileState.BLANK) && (board[2][0] == board[2][1]) && (board[2][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][1]) && (board[0][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ( (board[0][2] != TileState.BLANK) && (board[0][2] == board[1][1]) && (board[0][2] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][0]) && (board[0][0] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][1] != TileState.BLANK) && (board[0][1] == board[1][1]) && (board[0][1] == board[2][1])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][2] != TileState.BLANK) && (board[0][2] == board[1][2]) && (board[0][2] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if (movesPlayed == 9)\n return GameState.DRAW;\n return GameState.IN_PROGRESS;\n }", "private RouteAction Best(RouteState state) {\r\n\t\treturn V.get(state).action;\r\n\t}", "List<S> getAllPossibleStates(S state);", "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "private Action bestActionFromFinishedTree() {\n return Collections.max(validActionsDiscretized, Comparator.comparing(\n c -> root.getActionReward(c) / (double) root.getActionVisits(c)));\n }", "private void dealWithState(FindPairLogic.State state) {\n buttons[state.getI()][state.getJ()].setText(Integer.toString(state.getN()));\n buttons[state.getI()][state.getJ()].setDisable(true);\n if (state.hasResult()) {\n if (!state.isSuccess()) {\n isGameEnable.set(false);\n threadPool.schedule(() -> Platform.runLater(() -> {\n buttons[state.getI()][state.getJ()].setText(\"\");\n buttons[state.getI()][state.getJ()].setDisable(false);\n buttons[state.getPreviousI()][state.getPreviousJ()].setText(\"\");\n buttons[state.getPreviousI()][state.getPreviousJ()].setDisable(false);\n isGameEnable.set(true);\n }), 1, TimeUnit.SECONDS);\n }\n }\n if (state.isEndGame()) {\n endGame();\n }\n }", "GameState requestActionGamePiece();", "String getWinner();", "private boolean checkPlayerActionAvailability(List<PlayerAction> playerActionList, Game game, Player player) {\n List<CompositeAction> possibleActions = player.getCharacterState().getPossibleActions(game.isFrenzy());\n return possibleActions.stream()\n // checks whether the different lists of Ids of the possible actions contain the list of Ids of the input\n .filter(composite ->\n composite.getAction().stream()\n .map(Targetable::getId)\n .collect(Collectors.toList()) // list of Ids of a particular possible action\n .containsAll\n (playerActionList.stream() // list of Ids of the input\n .map(Targetable::getId)\n .collect(Collectors.toList())))\n .anyMatch(composite -> { // checks whether among the possible actions that have the same Ids as the input, the move action has an allowed distance\n Supplier<Stream<PlayerAction>> supplier = () ->\n composite.getAction().stream()\n .filter(possiblePlayerAction -> possiblePlayerAction.getId().equals(Constants.MOVE)); // gets only the Move action\n if (supplier.get().count()==0) { // checks the presence of possible actions,\n return true; // if there is none it returns true,\n } // otherwise anyMatch would return false with no elements in the stream\n boolean res = supplier.get()\n .anyMatch(possiblePlayerAction -> { // the actual anyMatch that performs the check of the Move's distance\n MovePlayerAction mpa = playerActionList.stream()\n .filter(playerAction -> playerAction.getId().equals(Constants.MOVE))\n .map(pa -> (MovePlayerAction) pa)\n .findFirst().orElseThrow(IllegalStateException::new);\n int distance = game.getBoard().getTileTree()\n .distance(mpa.getPlayer().getCharacterState().getTile(), mpa.getMoveList().get(0));\n Logger.getGlobal().info(\"allowed distance :\" + possiblePlayerAction.getAmount());\n Logger.getGlobal().info(\"actual distance:\" + distance);\n if (possiblePlayerAction.getAmount() < distance || distance == -1) {\n // the predicate that checks the distance, if the selected tile gives a\n // greater distance then the action is not allowed\n // also checks reachability\n return false;\n }\n return true;\n });\n Logger.getGlobal().info(String.valueOf(res));\n\n if (!res) {\n addErrorMessage(MOVE_ACTION_ERROR_MESSAGE);\n } else {\n resetErrorMessages();\n }\n\n return res; // the result of the the internal anyMatch, it is returned as value of the external anyMatch\n }\n );\n }", "public int getMoves(int choose)\r\n {\r\n int uWinMov=0, uFavMov=0, cWinMov=0;\r\n \r\n switch (choose)\r\n {case 1: //AI uses code number \"1\" to get User's winning moves\r\n if ((uRockW>uPapW)&&(uRockW>uSciW))\r\n {uWinMov=3;}\r\n else if ((uPapW>uRockW)&&(uPapW>uSciW))\r\n {uWinMov=2;}\r\n else\r\n {uWinMov=1;}\r\n return uWinMov;\r\n \r\n case 2: //AI uses code number \"2\" to get User's most used move\r\n if ((uRock>uPap)&&(uRock>uSci))\r\n {uFavMov=3;}\r\n else if ((uPap>uRock)&&(uPap>uSci))\r\n {uFavMov=2;}\r\n else\r\n {uFavMov=1;}\r\n return uWinMov;\r\n \r\n case 3: //AI uses code number \"3\" to get its own winning moves\r\n if ((cRockW>cPapW)&&(cRockW>cSciW))\r\n {cWinMov=3;}\r\n else if ((cPapW>cRockW)&&(cPapW>cSciW))\r\n {cWinMov=2;}\r\n else\r\n {cWinMov=1;}\r\n return cWinMov;\r\n \r\n default: //Error message for erronous input by AI\r\n {JOptionPane.showMessageDialog(null, \r\n \"Error: unknown chooser value - WinCalc.getMoves 272\", \r\n \"digiRPS - ERROR\", \r\n JOptionPane.ERROR_MESSAGE);\r\n break;\r\n }\r\n }\r\n \r\n return uWinMov;\r\n }", "@Override\n public Map<Coordinate, List<Coordinate>> getAllLegalMoves(List<Integer> playerStates) {\n Map<Coordinate, List<Coordinate>> allLegalMoves = new TreeMap<>();\n for (List<GamePiece> row: myGamePieces) {\n for(GamePiece currPiece: row){\n if (playerStates.contains(currPiece.getState()) || currPiece.getState() == myEmptyState) {\n Coordinate currCoord = currPiece.getPosition();\n List<Coordinate> moves = currPiece.calculateAllPossibleMoves(getNeighbors(currPiece), playerStates.get(0));\n if (moves.size() > 0) {\n allLegalMoves.put(currCoord, moves);\n }\n }\n }\n }\n return allLegalMoves;\n }", "private ArrayList<String> getPossibleActions() {\n\t\t\n\t\tRandom r = new Random();\n\t\tArrayList<String> possibleActions = new ArrayList<String>();\n\t\tfor (String actionTitle : getAllActions()) {\n\t\t\tif (r.nextDouble() < 0.3) {\n\t\t\t\tpossibleActions.add(actionTitle);\n\t\t\t}\n\t\t}\n\t\treturn possibleActions;\n\t}", "public int getWinner();", "private HashMap<List<Integer>,List<Integer>> obtainValidActions(){\n\t\tHashMap<List<Integer>,List<Integer>> mapp= new HashMap<List<Integer>,List<Integer>>();\n\t\tfor (int i = 0;i<states.size();i++) {\n\t\t\tList<Integer> act= new ArrayList<Integer>();\n\t\t\tfor (int j = 0; j < actions.size(); j++) {\n\t\t\t\tif (isActionValid(states.get(i), actions.get(j))) \n\t\t\t\t\t//System.out.println(\"Inside Validation if\\n\");\n\t\t\t\t\tact.add(j);\n\t\t\t}\n\t\t\tmapp.put(states.get(i),act);\n\t\t}\n\t\treturn mapp;\n\t}", "public List<ScoredMove> allValidMoves(GameState gm){\n\t\tList<ScoredMove> validMoves = new ArrayList<ScoredMove>();\n\t\t\n\t\t// check for draw move\n\t\tif (getDeckSize() > 0) {\n\t\t\tvalidMoves.add(new ScoredMove(ACTION.DRAW, null, null));\n\t\t}\n\t\t/*\n\t\telse {\n\t\t\t// check for discarding move (note: only allowing if decksize is empty)\n\t\t\tfor (Card c: getHand().getCards()){\n\t\t\t\tif (!(c instanceof MerchantShip)) {\n\t\t\t\t\tvalidMoves.add(new ScoredMove(ACTION.DISCARD, c, null));\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\t\t\n\t\tvalidMoves.addAll(allDiscardMoves(gm));\n\t\t\n\t\t// check for playing merchant ships\n\t\tvalidMoves.addAll(allmShipMoves(gm));\n\t\t\n\t\t// add all attacks\n\t\tvalidMoves.addAll(allAttackMoves(gm));\n\t\t\n\t\tif (super.getVerbosity()) {\n\t\t\tSystem.out.println(\"Valid moves found: \" + validMoves.size());\n\t\t}\n\t\treturn validMoves;\n\t}", "@Override\n\tpublic Map<Integer, Action> middleStep(StateView newstate,\n\t\t\tHistoryView statehistory) {\n\t\tMap<Integer, Action> actions = new HashMap<Integer, Action>();\n\t\t\n\t\t// This is a list of enemy units\n\t\tList<Integer> enemyUnitIDs = newstate.getUnitIds(enemyPlayerNum);\n\t\t\n\t\tList<Integer> myUnitIDs = newstate.getUnitIds(1);\n\t\t\n\t\tif(enemyUnitIDs.size() == 0) //Changed to accommodate unitIDs\n\t\t{\n\t\t\t// Nothing to do because there is no one left to attack\n\t\t\treturn actions;\n\t\t}\n\t\t\n\t\tint currentStep = newstate.getTurnNumber();\n\n\t\t// go through the action history\n\t\tfor(ActionResult feedback : statehistory.getCommandFeedback(playernum, currentStep-1).values())\n\t\t{\n\n\t\t\tint unitID = feedback.getAction().getUnitId();\n\t\t\tUnitView unitView = newstate.getUnit(unitID);\n\t\t\t\n\t\t\t// if the previous action is no longer in progress (either due to failure or completion)\n\t\t\tif(feedback.getFeedback() != ActionFeedback.INCOMPLETE)\n\t\t\t{\n\t\t\t\t//This moves the singular runner footman into the proper defense position.\n\t\t\t\tif (unitID == 8 && enemyUnitIDs.size() == 6) {\n\t\t\t\t\tactions.put(unitID, Action.createCompoundMove(unitID, 1, 17));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Once the runner is in the correct defense position, then the ballistas attack all enemy footmen.\n\t\t\t\tif (unitID == 8 && (unitView.getXPosition() == 1 && unitView.getYPosition() == 17)) {\n\t\t\t\t\t\n\t\t\t\t\tfor(int i = 0; i < enemyUnitIDs.size() - 1; i++) {\n\t\t\t\t\t\tactions.put(11, Action.createCompoundAttack(11, enemyUnitIDs.get(i)));\n\t\t\t\t\t\tactions.put(12, Action.createCompoundAttack(12, enemyUnitIDs.get(i)));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (feedback.getAction().getType() == ActionType.COMPOUNDATTACK) {\n\t\t\t\t\t\n\t\t\t\t\t//If the last move was an attack and there are still enemy footmen on the board, attack the enemy footmen.\n\t\t\t\t\tif (enemyUnitIDs.size() != 1) {\n\t\t\t\t\t\tfor(int i = 0; i < enemyUnitIDs.size() - 1; i++) {\n\t\t\t\t\t\t\tactions.put(11, Action.createCompoundAttack(11, enemyUnitIDs.get(i)));\n\t\t\t\t\t\t\tactions.put(12, Action.createCompoundAttack(12, enemyUnitIDs.get(i)));\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t\telse { //Otherwise, attack the enemy tower.\n\t\t\t\t\t\tactions.put(myUnitIDs.get(5), Action.createCompoundAttack(myUnitIDs.get(5), enemyUnitIDs.get(0)));\n\t\t\t\t\t\tactions.put(myUnitIDs.get(6), Action.createCompoundAttack(myUnitIDs.get(6), enemyUnitIDs.get(0)));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//If only the tower is left, move one of the archers out of the way, and let the ballistas reposition to attack said tower.\n\t\t\t\tif (enemyUnitIDs.size() == 1) {\n\t\t\t\t\t\n\t\t\t\t\tactions.put(myUnitIDs.get(4), Action.createCompoundMove(myUnitIDs.get(4), 24, 18));\n\t\t\t\t\tactions.put(myUnitIDs.get(5), Action.createCompoundAttack(myUnitIDs.get(5), enemyUnitIDs.get(0)));\n\t\t\t\t\tactions.put(myUnitIDs.get(6), Action.createCompoundAttack(myUnitIDs.get(6), enemyUnitIDs.get(0)));\n\t\t\t\t}\n\n\t\t\t} \n\t\t\t\n\t\t\t//If, by any chance, a unit is unable to reach his destination by the end of the turn, then tell him to move to that same position again.\n\t\t\tif(feedback.getFeedback() == ActionFeedback.FAILED && feedback.getAction().getType() == ActionType.COMPOUNDMOVE && enemyUnitIDs.size() != 1) {\n\t\t\t\t\n\t\t\t\tint[] unitXPosition = {1, 2, 2, 0, 2, 0, 1};\n\t\t\t\tint[] unitYPosition = {16, 17, 16, 16, 18, 17, 18};\n\t\t\t\t\n\t\t\t\tint unitPositionInList = myUnitIDs.indexOf(unitID);\n\t\t\t\tactions.put(unitID, Action.createCompoundMove(unitID, unitXPosition[unitPositionInList], unitYPosition[unitPositionInList]));\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\treturn actions;\n\t}", "public Action getActionBasedOnPolicyOrRandom(final State state, final double epsilon) {\r\n \tfinal double decision = Math.random();\r\n \tif (decision > epsilon) {\r\n \t\t// Random action\r\n \t\treturn Action.values()[(int) Math.floor(Math.random() * Action.values().length)];\r\n \t} else {\r\n \t\t// Policy action\r\n \t\treturn getActionBasedOnProbability(state);\r\n \t}\r\n }", "@Test\n public void isActionLegal()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final Agent agentWhite = agents.get(1);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n final Adjudicator adjudicator = injector.injectAdjudicator();\n\n // Agent white can move his token to an adjacent empty space.\n {\n final CheckersMoveAction action = new CheckersMoveAction(environment, agentWhite, CheckersPosition.P09,\n CheckersPosition.P13);\n assertTrue(adjudicator.isActionLegal(action));\n }\n\n // Agent white cannot move backwards.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P09,\n CheckersPosition.P05)));\n\n // Agent white cannot move to an occupied space.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P04,\n CheckersPosition.P08)));\n\n // Agent white cannot move a red token.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P21,\n CheckersPosition.P17)));\n\n // Agent white cannot move too far.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P09,\n CheckersPosition.P18)));\n }", "@Test\n public void testBasicScorer() {\n assertEquals(0, stateScorer.scoreState(builder().build(), TwoPlayerKey.PLAYER_1));\n\n //The other player has won if they occupy every node on the board:\n assertEquals(-1, stateScorer.scoreState(builder().allOccupiedBy(TwoPlayerKey.PLAYER_2).build(), TwoPlayerKey.PLAYER_1));\n\n //I have won if I occupy every node on the board:\n assertEquals(1, stateScorer.scoreState(builder().allOccupiedBy(TwoPlayerKey.PLAYER_1).build(), TwoPlayerKey.PLAYER_1));\n }", "public List<HealthCheck> getChecksByState(String state);", "public Action chooseAction(Map<Direction, Occupant> neighbors) {\n // Rule 1\n Deque<Direction> emptyNeighbors = new ArrayDeque<>();\n Deque<Direction> plipNeighbors = new ArrayDeque<>();\n boolean anyPlip = false;\n for (Direction key : neighbors.keySet()) {\n Occupant value = neighbors.get(key);\n if (value.name().equals(\"empty\")) {\n emptyNeighbors.add(key);\n }\n if (value.name().equals(\"plip\")) {\n plipNeighbors.add(key);\n anyPlip = true;\n }\n }\n if (emptyNeighbors.isEmpty()) {\n return new Action(Action.ActionType.STAY);\n }\n\n // Rule 2\n if (anyPlip) {\n int i = HugLifeUtils.randomInt(1, emptyNeighbors.size());\n while (i > 1) {\n Direction removeres = plipNeighbors.removeFirst();\n plipNeighbors.addLast(removeres);\n i -= 1;\n }\n Direction result = plipNeighbors.getFirst();\n return new Action(Action.ActionType.ATTACK,result);\n }\n\n // Rule 3\n if (energy >= 1.0) {\n int i = HugLifeUtils.randomInt(1, emptyNeighbors.size());\n while (i > 1) {\n Direction removeres = emptyNeighbors.removeFirst();\n emptyNeighbors.addLast(removeres);\n i -= 1;\n }\n Direction result = emptyNeighbors.getFirst();\n return new Action(Action.ActionType.REPLICATE,result);\n }\n\n // Rule 4\n int i = HugLifeUtils.randomInt(1, emptyNeighbors.size());\n while (i > 1) {\n Direction removeres = emptyNeighbors.removeFirst();\n emptyNeighbors.addLast(removeres);\n i -= 1;\n }\n Direction result = emptyNeighbors.getFirst();\n return new Action(Action.ActionType.MOVE,result);\n }", "public int getResult() {\n whiteTotal = 0;\n blackTotal = 0;\n rest = 0;\n for (int row = 0; row < BOARD_SIZE; row++) {\n for (int column = 0; column < BOARD_SIZE; column++) {\n if (board[row][column] == BLACK) {\n blackTotal++;\n } else if (board[row][column] == WHITE) {\n whiteTotal++;\n } else {\n rest++;\n }\n }\n }\n int winner = -1;\n if (rest == 0) {\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n\n if (blackTotal == 0 || whiteTotal == 0) {\n\n if (blackTotal != 0) {\n winner = 2;\n } else if (whiteTotal != 0) {\n winner = 1;\n }\n }\n\n if (getValidateMoveList('W', 'B').isEmpty() && getValidateMoveList('B', 'W').isEmpty()) {\n\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n return winner;\n }", "public static List<String> getValidActions() {\n return VALID_ACTIONS;\n }", "@Test\n\tpublic void testGetMoves() {\n\t\tGameState test = new GameState();\n\t\ttest.move(4);\n\t\ttest.move(7);\n\t\ttest.move(15);\n\t\ttest.move(20);\n\t\tassertEquals(4, test.getMoves());\n\t\ttest.move(24);\n\t\ttest.move(16);\n\t\tassertEquals(6, test.getMoves());\n\t}", "public ArrayList<Pair<Coord,Coord>> returnMoves(Board b) {\r\n\t\t//copy Piece grid\r\n\t\tPiece[][] g = b.getGrid();\r\n\t\t\r\n\t\t//return array of all the possible moves\r\n\t\tArrayList<Pair<Coord,Coord>> possibleMoves = new ArrayList<Pair<Coord,Coord>>();\r\n\r\n\t\t//System.out.println(team + \": (\" + c.y + \", \" + c.x + \")\");\r\n\t\t//if the team is moving north (white team)\r\n\t\tif(team) {\r\n\t\t\t//first move, two square pawn advance\r\n\t\t\tif(moves==0 && g[c.y-1][c.x] == null && g[c.y-2][c.x] == null)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y-2,c.x),null));\r\n\t\t\t\r\n\t\t\t//single square pawn advance\r\n\t\t\tif(g[c.y-1][c.x] == null)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y-1,c.x),null));\r\n\t\t\t\r\n\t\t\t//capture diagonally west\r\n\t\t\tif(c.x-1>=0 && c.x-1<=7 && g[c.y-1][c.x-1]!=null && (!g[c.y-1][c.x-1].team))\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y-1,c.x-1),null));\r\n\t\t\t\r\n\t\t\t//capture diagonally east\r\n\t\t\tif(c.x+1>=0 && c.x+1<=7 && g[c.y-1][c.x+1]!=null && (!g[c.y-1][c.x+1].team))\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y-1,c.x+1),null));\r\n\t\t\t\r\n\t\t\t//en passant west\r\n\t\t\tif(c.x-1>=0 && c.y==3 && g[c.y-1][c.x-1]==null && g[c.y][c.x-1]!=null && !g[c.y][c.x-1].team \r\n\t\t\t\t\t&& g[c.y][c.x-1].toString().equals(\"P\") && g[c.y][c.x-1].moves==1)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y-1,c.x-1),new Coord(c.y, c.x-1)));\r\n\t\t\t\r\n\t\t\t//en passant east\r\n\t\t\tif(c.x+1<=7 && c.y==3 && g[c.y-1][c.x+1]==null && g[c.y][c.x+1]!=null && !g[c.y][c.x+1].team\r\n\t\t\t\t\t&& g[c.y][c.x+1].toString().equals(\"P\") && g[c.y][c.x+1].moves==1)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y-1,c.x+1),new Coord(c.y, c.x+1)));\r\n\t\t\t\r\n\t\t//if the team is moving south (black team)\r\n\t\t} else {\r\n\t\t\t//first move, two square pawn advance\r\n\t\t\tif(moves==0 && g[c.y+1][c.x] == null && g[c.y+2][c.x] == null)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y+2,c.x),null));\r\n\r\n\t\t\t//single square pawn advance\r\n\t\t\tif(g[c.y+1][c.x] == null)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y+1,c.x),null));\r\n\t\t\t\r\n\t\t\t//capture diagonally west\r\n\t\t\tif(c.x-1>=0 && c.x-1<=7 && g[c.y+1][c.x-1]!=null && (g[c.y+1][c.x-1].team))\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y+1,c.x-1),null));\r\n\t\t\t\r\n\t\t\t//capture diagonally east\r\n\t\t\tif(c.x+1>=0 && c.x+1<=7 && g[c.y+1][c.x+1]!=null && (g[c.y+1][c.x+1].team))\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y+1,c.x+1),null));\r\n\t\t\t\r\n\t\t\t//en passant west\r\n\t\t\tif(c.x-1>=0 && c.y==4 && g[c.y+1][c.x-1]==null && g[c.y][c.x-1]!=null && g[c.y][c.x-1].team \r\n\t\t\t\t\t&& g[c.y][c.x-1].toString().equals(\"P\") && g[c.y][c.x-1].moves==1)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y+1,c.x-1),new Coord(c.y, c.x-1)));\r\n\t\t\t\r\n\t\t\t//en passant east\r\n\t\t\tif(c.x+1<=7 && c.y==4 && g[c.y-1][c.x+1]==null && g[c.y][c.x+1]!=null && g[c.y][c.x+1].team \r\n\t\t\t\t\t&& g[c.y][c.x+1].toString().equals(\"P\") && g[c.y][c.x+1].moves==1)\r\n\t\t\t\tpossibleMoves.add(new Pair<Coord, Coord>(new Coord(c.y+1,c.x+1),new Coord(c.y, c.x+1)));\r\n\t\t\t\r\n\t\t}\t\t\r\n\r\n\t\treturn possibleMoves;\r\n\t}", "public String getWinnerName(String state) {\r\n \r\n result = table.get(state);\r\n String winner = result.get(1); // getting name of winner from array list and storing it\r\n \r\n return winner;\r\n }", "public abstract List<Instruction> getPossibleActions();", "protected void actionConfirmed()\r\n\t\t{\n\r\n\t\t\tif ( actionSelect.getSelectedItem() == null )\r\n\t\t\t\tDEFAULT_SHELL.executeLine( \"set battleAction=attack\" );\r\n\r\n\t\t\tRunnable request = (Runnable) locationSelect.getSelectedItem();\r\n\t\t\tif ( request == null )\r\n\t\t\t\treturn;\r\n\r\n\t\t\tsetProperty( \"lastAdventure\", request.toString() );\r\n\r\n\t\t\t// If there are conditions in the condition field, be\r\n\t\t\t// sure to process them.\r\n\r\n\t\t\tString conditionList = conditionField.getText().trim();\r\n\t\t\tif ( conditionList.equalsIgnoreCase( \"none\" ) )\r\n\t\t\t\tconditionList = \"\";\r\n\r\n\t\t\tif ( conditionList.length() > 0 )\r\n\t\t\t{\r\n\t\t\t\tDEFAULT_SHELL.executeLine( \"conditions clear\" );\r\n\r\n\t\t\t\tboolean verifyConditions = false;\r\n\t\t\t\tboolean useDisjunction = false;\r\n\t\t\t\tString [] conditions = conditionList.split( \"\\\\s*,\\\\s*\" );\r\n\r\n\t\t\t\tfor ( int i = 0; i < conditions.length; ++i )\r\n\t\t\t\t{\r\n\t\t\t\t\tif ( conditions[i].equals( \"check\" ) )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Postpone verification of conditions\r\n\t\t\t\t\t\t// until all other conditions added.\r\n\r\n\t\t\t\t\t\tverifyConditions = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if ( conditions[i].equals( \"outfit\" ) )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Determine where you're adventuring and use\r\n\t\t\t\t\t\t// that to determine which components make up\r\n\t\t\t\t\t\t// the outfit pulled from that area.\r\n\r\n\t\t\t\t\t\tif ( !(request instanceof KoLAdventure) || !EquipmentDatabase.addOutfitConditions( (KoLAdventure) request ) )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tsetStatusMessage( \"No outfit corresponds to this zone.\" );\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tverifyConditions = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if ( conditions[i].equals( \"or\" ) || conditions[i].equals( \"and\" ) || conditions[i].startsWith( \"conjunction\" ) || conditions[i].startsWith( \"disjunction\" ) )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tuseDisjunction = conditions[i].equals( \"or\" ) || conditions[i].startsWith( \"disjunction\" );\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ( !DEFAULT_SHELL.executeConditionsCommand( \"add \" + conditions[i] ) )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tKoLmafia.enableDisplay();\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( verifyConditions )\r\n\t\t\t\t{\r\n\t\t\t\t\tDEFAULT_SHELL.executeConditionsCommand( \"check\" );\r\n\t\t\t\t\tif ( StaticEntity.getClient().conditions.isEmpty() )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tKoLmafia.updateDisplay( \"All conditions already satisfied.\" );\r\n\t\t\t\t\t\tKoLmafia.enableDisplay();\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( StaticEntity.getClient().conditions.size() > 1 )\r\n\t\t\t\t\tDEFAULT_SHELL.executeConditionsCommand( useDisjunction ? \"mode disjunction\" : \"mode conjunction\" );\r\n\r\n\t\t\t\tconditionField.setText( \"\" );\r\n\t\t\t\tif ( countField.getText().equals( \"\" ) )\r\n\t\t\t\t\tcountField.setText( String.valueOf( KoLCharacter.getAdventuresLeft() ) );\r\n\t\t\t}\r\n\r\n\t\t\t(new RequestThread( request, getValue( countField ) )).start();\r\n\t\t\tcountField.setText( \"\" );\r\n\t\t}", "List<Jewel> getValidMovePair();", "@Override\n public ArrayList<xMCTSStringGameState> getPossibleMoves(xMCTSStringGameState gameState)\n {\n\t ArrayList<xMCTSStringGameState> posMoves = new ArrayList<xMCTSStringGameState>();\n\t if (gameStatus(gameState) == xMCTSGame.status.ONGOING) {\n\t \t String activeCard = gameState.toString().substring(gameState.toString().length() - 2, gameState.toString().length());\n\t \t int gridSize = SIZE*2;\n\t for (int i = 0; i < gridSize; i += 2) {\n\t for (int j = 0; j < gridSize; j += 2) {\n\t int pos = i * SIZE + j;\n\t if (gameState.toString().charAt(pos) == '_') {\n\t String temp = gameState.toString().substring(0, pos)\n\t \t\t + activeCard\n\t + gameState.toString().substring(pos + 2,\n\t gameState.toString().length());\n\t posMoves.add(new xMCTSStringGameState(temp, 0.0, 0));\n\t }\n\t }\n\n\t }\n\t }\n\t else {\n\t \t // System.out.println(\"No moves can be made from this state\");\n\t \t// callsFromFullBoards++;\n\t \t// System.out.println(\"There have been \" + callsFromFullBoards + \"attempts to get possible moves from a full board\");\n\t }\n\t return posMoves;\n }", "@Test\n public void getEventTest() {\n Event[] event = new Event[3];\n event[0] = Event.ZERO;\n god.getEvent(event, board, actions);\n assertEquals(actions[2][3][0].getStatus(), true);\n assertEquals(actions[4][3][0].getStatus(), false);\n assertEquals(actions[2][2][0].getStatus(), true);\n assertEquals(actions[2][4][0].getStatus(), false);\n assertEquals(actions[0][0][0].getStatus(), false);\n event[0] = Event.BUILD;\n god.getEvent(event, board, actions);\n assertEquals(actions[2][3][0].getStatus(), true);\n assertEquals(actions[4][3][0].getStatus(), false);\n assertEquals(actions[2][2][0].getStatus(), true);\n assertEquals(actions[2][4][0].getStatus(), false);\n assertEquals(actions[0][0][0].getStatus(), false);\n event[0] = Event.MOVE;\n event[1] = Event.UP;\n god.getEvent(event, board, actions);\n for (int i = 2; i < 5; i++) {\n for (int j = 2; j < 5; j++) {\n if ((i == 3 && j\n == 3) || (i == 2 && j == 4) || (i == 4 && j == 3)) {\n assertEquals(actions[i][j][1].getStatus(), false);\n } else if (i == 2 && j ==\n 2) {\n assertEquals(actions[i][j][2].getStatus(), true);\n } else {\n assertEquals(actions[i][j][1].getStatus(), true);\n }\n }\n }\n board[2][2].addBlock(new Block(TypeBlock.WORKER));\n god.setWorker(new int[]{\n 2, 2});\n event[0] = Event.MOVE;\n event[1] = Event.UP;\n god.getEvent(event,\n board, actions);\n assertEquals(StatusPlayer.WIN, god.getPlayerStatus());\n event[0] = Event.BUILD;\n god.getEvent(event, board, actions);\n event[0] =\n Event.ONE;\n god.getEvent(event, board, actions);\n assertEquals(StatusPlayer.WIN, god.getPlayerStatus());\n god.setStatusPlayer(StatusPlayer.GAMING);\n god.getEvent(event, board,\n actions);\n assertEquals(StatusPlayer.IDLE, god.getPlayerStatus());\n for (int i\n = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n\n actions[i][j][0].set(false);\n actions[i][j][1].set(false);\n actions[i][j][2].set(false);\n }\n }\n event[0] = Event.ONE;\n god.getEvent(event, board, actions);\n assertEquals(StatusPlayer.LOSE, god.getPlayerStatus());\n event[0] = Event.ONE;\n actions[0][0][0].set(true);\n god.getEvent(event, board, actions);\n\n assertEquals(StatusPlayer.GAMING, god.getPlayerStatus());\n event[0] =\n Event.MOVE;\n event[1] = Event.ZERO;\n god.getEvent(event, board, actions);\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n\n actions[i][j][0].set(false);\n actions[i][j][1].set(false);\n actions[i][j][2].set(false);\n }\n }\n actions[0][0][1].set(true);\n event[0] = Event.ONE;\n god.getEvent(event, board,\n actions);\n assertEquals(StatusPlayer.GAMING, god.getPlayerStatus());\n event[0]\n = Event.MOVE;\n god.getEvent(event, board, actions);\n\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n\n actions[i][j][0].set(false);\n actions[i][j][1].set(false);\n actions[i][j][2].set(false);\n }\n }\n\n actions[0][0][2].set(true);\n\n event[0] = Event.ONE;\n god.getEvent(event, board, actions);\n assertEquals(StatusPlayer.GAMING, god.getPlayerStatus());\n\n event[0] = Event.BUILD;\n god.getEvent(event, board, actions);\n for (int i = 0;\n i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n\n actions[i][j][0].set(false);\n actions[i][j][1].set(false);\n actions[i][j][2].set(false);\n }\n }\n event[0] = Event.TWO;\n god.getEvent(event,\n board, actions);\n assertEquals(StatusPlayer.IDLE, god.getPlayerStatus());\n\n god.setStatusPlayer(StatusPlayer.WIN);\n event[0] = Event.TWO;\n god.getEvent(event, board, actions);\n assertEquals(StatusPlayer.WIN,\n god.getPlayerStatus());\n event[0] = Event.ONE;\n god.getEvent(event, board,\n actions);\n assertEquals(StatusPlayer.WIN, god.getPlayerStatus());\n }", "public abstract Player getWinner();", "public abstract List<Move> getLegalMoves(MachineState state, Role role) throws MoveDefinitionException, StateMachineException;", "public void MovesRemainingExists() {\n InsideMovesRemainingExists = 1;\n NoMovesRemaining = 1;\n Beginning:\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n previousX = i;\n previousY = j + 1;\n if ((i + 1) < 9) {\n ValidSwitch(i + 1, j + 1);\n if (NoMovesRemaining == 0) { //checks the candies to the right\n ResetState();\n break Beginning; //breaks the loop\n }\n }\n\n if ((i - 1) >= 0) {\n ValidSwitch(i - 1, j + 1);\n if (NoMovesRemaining == 0) { //checks the candies to the left\n ResetState();\n break Beginning;\n }\n }\n\n if ((j + 1) < 9) {\n ValidSwitch(i, j + 2);\n if (NoMovesRemaining == 0) { //checks the candies on the bottom\n ResetState();\n break Beginning;\n }\n }\n\n if ((j - 1) >= 0) {\n ValidSwitch(i, j);\n if (NoMovesRemaining == 0) { //checks the candies at the top\n ResetState();\n break Beginning;\n }\n }\n }\n\n }\n InsideMovesRemainingExists = 0;\n\n}", "int getBattlesWon();", "@Test\n public void isMoveActionLegalFor()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Agent white can move his token to an adjacent empty space.\n assertTrue(adjudicator.isMoveActionLegalFor(environment, CheckersTeam.WHITE, CheckersPosition.P09,\n CheckersPosition.P13));\n\n // Agent white cannot move backwards.\n assertFalse(adjudicator.isMoveActionLegalFor(environment, CheckersTeam.WHITE, CheckersPosition.P09,\n CheckersPosition.P05));\n\n // Agent white cannot move to an occupied space.\n assertFalse(adjudicator.isMoveActionLegalFor(environment, CheckersTeam.WHITE, CheckersPosition.P04,\n CheckersPosition.P08));\n\n // Agent white cannot move a red token.\n assertFalse(adjudicator.isMoveActionLegalFor(environment, CheckersTeam.WHITE, CheckersPosition.P21,\n CheckersPosition.P17));\n\n // Agent white cannot move too far.\n assertFalse(adjudicator.isMoveActionLegalFor(environment, CheckersTeam.WHITE, CheckersPosition.P09,\n CheckersPosition.P18));\n }", "public boolean[] getAction()\n {\n cleanActions();\n \n //Execute BT to get the action to do.\n m_behaviorTree.execute();\n \n //keep track of last set of actions.\n //recordActions();\n\n if(m_resetThisCycle)\n {\n resetAgent();\n }\n\n //And this is the action that must be taken:\n return action;\n }", "public static int generateMoves(BoardState bs, long[] moves) {\n int count = 0;\n //int from, int to, int special, int movPiece, int content, int pawnStart\n int piece, tmp_piece, pIndex, index;\n int sq, tmp_sq, pieceNum, dir;\n\n int turn = bs.turn;\n int opponent = turn ^ 1;\n int pawn = PAWN_BY_COLOR[turn];\n\n //PAWNS\n for (pieceNum = 0; pieceNum < bs.pieceNum[pawn]; pieceNum++) {\n sq = bs.pieceArray[pawn][pieceNum];\n assert (isOnboard(sq));\n\n tmp_sq = sq + MOVES_PAWN_STRAIGHT[turn];\n if (bs.pieces[tmp_sq] == EMPTY) {\n count = addPawnMove(bs, sq, tmp_sq, 0, 0, turn, moves, count);\n tmp_sq += MOVES_PAWN_STRAIGHT[turn];\n if (((RANKS_MAP[sq] == RANK_7 && turn == BLACK)\n || (RANKS_MAP[sq] == RANK_2 && turn == WHITE))\n && bs.pieces[tmp_sq] == EMPTY) {\n count = addPawnMove(bs, sq, tmp_sq, 0, 1, turn, moves, count);\n }\n }\n\n tmp_sq = sq + MOVES_PAWNS[turn][0];\n if (isOnboard(tmp_sq) && PIECE_COLORS[bs.pieces[tmp_sq]] == opponent) {\n count = addPawnMove(bs, sq, tmp_sq, bs.pieces[tmp_sq], 0, turn, moves, count);\n }\n if (isOnboard(bs.enPas) && bs.enPas == tmp_sq) { //En passant check\n int move = Moves.generateMove(sq, tmp_sq, 1, pawn, EMPTY, 0);\n count = addMove(move, moves, count, 105);\n }\n\n tmp_sq = sq + MOVES_PAWNS[turn][1];\n if (isOnboard(tmp_sq) && PIECE_COLORS[bs.pieces[tmp_sq]] == opponent) {\n count = addPawnMove(bs, sq, tmp_sq, bs.pieces[tmp_sq], 0, turn, moves, count);\n }\n if (isOnboard(bs.enPas) && bs.enPas == tmp_sq) { //En passant check\n int move = Moves.generateMove(sq, tmp_sq, 1, pawn, EMPTY, 0);\n count = addMove(move, moves, count, 105);\n }\n }\n\n //Bishops, Rooks & Queens\n pIndex = SLIDERS_INDEX[turn];\n piece = SLIDERS[pIndex++];\n while (piece != -1) {\n for (pieceNum = 0; pieceNum < bs.pieceNum[piece]; pieceNum++) {\n sq = bs.pieceArray[piece][pieceNum];\n for (index = 0; index < MOVES_ALL[piece].length; index++) {\n dir = MOVES_ALL[piece][index];\n tmp_sq = sq;\n\n //Slide loop\n while (isOnboard(tmp_sq += dir)) {\n tmp_piece = bs.pieces[tmp_sq];\n if (tmp_piece != EMPTY) {\n if (PIECE_COLORS[tmp_piece] == opponent) {\n int move = Moves.generateMove(sq, tmp_sq, 0, piece, tmp_piece, 0);\n count = addCaptureMove(bs, move, moves, count);\n }\n break; //Stop sliding\n } else {\n int move = Moves.generateMove(sq, tmp_sq, 0, piece, EMPTY, 0);\n count = addMove(bs, move, moves, count);\n }\n }\n }\n }\n piece = SLIDERS[pIndex++];\n }\n //Kings & Knights\n pIndex = MOVERS_INDEX[turn];\n while ((piece = MOVERS[pIndex]) != -1) {\n for (pieceNum = 0; pieceNum < bs.pieceNum[piece]; pieceNum++) {\n sq = bs.pieceArray[piece][pieceNum];\n for (index = 0; index < MOVES_ALL[piece].length; index++) {\n dir = MOVES_ALL[piece][index];\n tmp_sq = sq + dir;\n if (isOnboard(tmp_sq)) {\n tmp_piece = bs.pieces[tmp_sq];\n if (tmp_piece != EMPTY) {\n if (PIECE_COLORS[tmp_piece] == opponent) {\n int move = Moves.generateMove(sq, tmp_sq, 0, piece, tmp_piece, 0);\n count = addCaptureMove(bs, move, moves, count);\n }\n } else {\n int move = Moves.generateMove(sq, tmp_sq, 0, piece, EMPTY, 0);\n count = addMove(bs, move, moves, count);\n }\n }\n }\n }\n pIndex++;\n }\n\n //Castling\n if (turn == WHITE) {\n if ((bs.castlePerms & WKCA) != 0\n && bs.pieces[F1] == EMPTY\n && bs.pieces[G1] == EMPTY\n && !bs.isSquareThreatened(E1, BLACK)\n && !bs.isSquareThreatened(F1, BLACK)) {\n int move = Moves.generateMove(E1, G1, 1, W_KING, EMPTY, 0);\n count = addMove(bs, move, moves, count);\n }\n if ((bs.castlePerms & WQCA) != 0\n && bs.pieces[D1] == EMPTY\n && bs.pieces[C1] == EMPTY\n && bs.pieces[B1] == EMPTY\n && !bs.isSquareThreatened(E1, BLACK)\n && !bs.isSquareThreatened(D1, BLACK)) {\n int move = Moves.generateMove(E1, C1, 1, W_KING, EMPTY, 0);\n count = addMove(bs, move, moves, count);\n }\n } else {\n if ((bs.castlePerms & BKCA) != 0\n && bs.pieces[F8] == EMPTY\n && bs.pieces[G8] == EMPTY\n && !bs.isSquareThreatened(E8, WHITE)\n && !bs.isSquareThreatened(F8, WHITE)) {\n int move = Moves.generateMove(E8, G8, 1, B_KING, EMPTY, 0);\n count = addMove(bs, move, moves, count);\n }\n if ((bs.castlePerms & BQCA) != 0\n && bs.pieces[D8] == EMPTY\n && bs.pieces[C8] == EMPTY\n && bs.pieces[B8] == EMPTY\n && !bs.isSquareThreatened(E8, WHITE)\n && !bs.isSquareThreatened(D8, WHITE)) {\n int move = Moves.generateMove(E8, C8, 1, B_KING, EMPTY, 0);\n count = addMove(bs, move, moves, count);\n }\n }\n\n return count;\n }", "public List<GamePlayer> getActionAccept() {\n return actionAccept;\n }", "Piece winner() {\r\n return _winner;\r\n }", "private static int evalState(GameState state){\n Move m = state.getMove();\n int counter = 0;\n\n // return directly if we encouter win or loss\n if(m.isXWin()){\n return 10000;\n }\n else if(m.isOWin()){\n return -1;\n }\n\n Vector<Integer> points = new Vector<Integer>();\n points.setSize(state.BOARD_SIZE*2+2);\n int player;\n Collections.fill(points, 1);\n int scaling = 4;\n int value = 0;\n\n for(int row = 0; row < state.BOARD_SIZE; row ++){\n for(int col = 0; col < state.BOARD_SIZE; col ++){\n player = state.at(row, col);\n\n // add points to the vector, increase by a factor for every new entry\n if(player == 1){\n points.set(row, points.get(row)*scaling);\n points.add(state.BOARD_SIZE + col, points.get(state.BOARD_SIZE - 1 + col)*scaling);\n\n // if it's in the first diagonal\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, points.get(state.BOARD_SIZE*2)*scaling);\n }\n\n // checking other diagonal\n if(counter%state.BOARD_SIZE-1 == 0 && row+col != 0){\n points.add(state.BOARD_SIZE*2 + 1, points.get(state.BOARD_SIZE*2)*scaling);\n }\n }\n // if an enemy player is encoutered null the value of the row/col\n else if(player == 2){\n points.set(row, 0);\n points.set(state.BOARD_SIZE + col, 0);\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, 0);\n }\n if(counter%state.BOARD_SIZE-1 == 0){\n points.add(state.BOARD_SIZE*2 + 1, 0);\n }\n }\n counter++;\n }\n }\n\n // if we have nulled the point we don't count it for the value of the state\n for(Integer i: points){\n if(i > 1){\n value += i;\n }\n }\n //System.err.println(\"Value: \" + value);\n return value;\n }", "public void actionPerformed(ActionEvent evt) {\n if ( player == 0 ) { // Player O - blackstone\n if (jButton[j].getIcon().equals(B)) {\n jButton[j].setIcon(O); // value of current button read left to right and then top to bottom\n \n board[j/csize][j%csize] = 0;\n int win = 1;\n win = checkrow(board,j/csize,0);\n if ( win == 0 ) {\n win = checkcol(board,j%csize,0);\n }\n if ( win == 0 ) {\n win = checkdiag(board,0 , j/csize, j%csize);\n }\n player = 1; // switches player\n markers++;\n\n if ( win == 1 ) {\n exitAction(\"Blackstone wins!\\n\");\n }\n if ( markers == gsize ) { // if all blocks have been taken\n exitAction(\"Draw!\\n\");\n }\n } \n } else { // Player X - whitestone = 1\n if (jButton[j].getIcon().equals(B)) {\n jButton[j].setIcon(X);\n board[j/csize][j%csize] = 1;\n int win = 1;\n win = checkrow(board,j/csize,1);\n if ( win == 0 ) {\n win = checkcol(board,j%csize,1);\n }\n if ( win == 0 ) {\n win = checkdiag(board, 1, j/csize, j%csize );\n }\n player = 0;\n markers++;\n\n if ( win == 1 ) {\n exitAction(\"Whitestone wins!\\n\");\n }\n if ( markers == gsize ) {\n exitAction(\"Draw!\\n\");\n }\n } \n }\n }", "public static void outcomes(){\n switch(outcome){\n case 1:\n System.out.println(\"Player 1 is the Winner\");\n System.exit(0);\n break;\n case 2:\n System.out.println(\"Player 2 is the Winner\");\n System.exit(0);\n break;\n case 3:\n System.out.println(\"Tie\");\n System.exit(0);\n break;\n\n }\n }", "public int[][] getMovesRook(Piece p) {\n x = p.getX();\n y = p.getY();\n int legalMoves[][] = new int[8][8];\n\n for (int i = x + 1; i < 8; i++) {//Traversing from piece coords, right till end of board.\n if (b.getPieceAt(y, i) != null) {\n if (p.isWhite() == b.getPieceAt(y, i).isWhite()) {\n break;\n } else {\n legalMoves[y][i] = 1;\n break;\n }\n } else {\n legalMoves[y][i] = 1;\n }\n }\n for (int i = x - 1; i > -1; i--) {//Traversing from piece coords, left till end of board.\n if (b.getPieceAt((y), i) != null) {\n if (p.isWhite() == b.getPieceAt((y), i).isWhite()) {\n break;\n } else {\n legalMoves[(y)][i] = 1;\n break;\n }\n } else {\n legalMoves[y][i] = 1;\n }\n }\n for (int i = y - 1; i > -1; i--) { //Traversing from piece coords, downwards till end of board.\n if (b.getPieceAt((i), x) != null) {\n if (p.isWhite() == b.getPieceAt(i, x).isWhite()) {\n break;\n } else {\n legalMoves[i][x] = 1;\n break;\n }\n } else {\n legalMoves[i][x] = 1;\n }\n }\n for (int i = y + 1; i < 8; i++) { //Traversing from piece coords, upwards till end of board.\n if (b.getPieceAt((i), x) != null) {\n if (p.isWhite() == b.getPieceAt(i, x).isWhite()) {\n break;\n } else {\n legalMoves[i][x] = 1;\n break;\n }\n } else {\n legalMoves[i][x] = 1;\n }\n }\n return legalMoves;\n }", "public boolean legalMove(ArrayList<Point2D> inputMove,ArrayList<Object> Gamestate){\n FooHistory currentGameState = (FooHistory) Gamestate.get(0);\n ArrayList<Point2D> player1moves= currentGameState.getCurrentState().get(0);\n ArrayList<Point2D> player2moves= currentGameState.getCurrentState().get(1);\n //System.out.println(\"Player1 moves in FooRules: \"+ player1moves);\n \n if(inputMove.size()==1){\n for(ArrayList<Point2D> array: currentGameState.getCurrentState()){\n for(Point2D point:array){\n if(inputMove.get(0).getX()==point.getX() && inputMove.get(0).getY()==point.getY()){\n System.out.println(\"Ilegal Move\");\n return false;\n }\n }\n }\n return true;\n }\n else{//Deals with moving a piece to take pieces\n if(adjacent(inputMove.get(0),inputMove.get(1))){//Makes sure the two input moves are adjacent\n if(currentGameState.getTurnCount()%2==1){ //Player 1's turn\n for(Point2D point:player2moves){\n if(point.getX()==inputMove.get(1).getX() && point.getY()==inputMove.get(1).getY()){\n return true;\n }\n }\n }\n if(currentGameState.getTurnCount()%2==0){//Player 2's turn\n for(Point2D point:player1moves){\n if(point.getX()==inputMove.get(1).getX() && point.getY()==inputMove.get(1).getY()){\n return true;\n }\n }\n }\n }\n System.out.println(\"Ilegal Move\"); \n return false; \n }\n \n }", "@Override\n public Position[] getCanMoves() {\n PieceWay way = new PieceWay(getPosition());\n Position[] PawnWay = way.waysPawnPos(color);\n return PawnWay;\n }", "private void declareWinner(){\r\n System.out.println(\"All proposals received\");\r\n AID best = proposals.get(0).getSender();\r\n for(ACLMessage proposal: proposals){\r\n String time = proposal.getContent().replaceFirst(\"bid\\\\(\", \"\");\r\n time = time.replaceFirst(\" sec\\\\)\", \"\");\r\n String bestTimeString = \r\n proposal.getContent().\r\n replaceFirst(\"bid\\\\(\", \"\").\r\n replaceFirst(\" sec\\\\)\", \"\");\r\n int bestTime = Integer.parseInt(bestTimeString);\r\n int propTime = Integer.parseInt(time);\r\n if (bestTime > propTime) {\r\n best = proposal.getSender();\r\n }\r\n }\r\n sendMessage(best, \"\", ACLMessage.ACCEPT_PROPOSAL);\r\n Object[] ob = new Object[2];\r\n ob[0] = best;\r\n ob[1] = currentPartial;\r\n expectedReturn.add(ob);\r\n System.out.println(\"Accepting proposal from \" + best.getLocalName());\r\n for(ACLMessage proposal: proposals){\r\n if(!proposal.getSender().equals(best)){\r\n sendMessage(proposal.getSender(), \"\", ACLMessage.REJECT_PROPOSAL);\r\n }\r\n }\r\n proposals.clear();\r\n solvables.remove(0);\r\n if(!solvables.isEmpty()){\r\n \r\n auctionJob(solvables.get(0));\r\n }\r\n }" ]
[ "0.6311692", "0.61323047", "0.60714966", "0.6023356", "0.5933484", "0.5912388", "0.58025265", "0.57984656", "0.5756727", "0.57540816", "0.5742192", "0.5734948", "0.56643957", "0.5661657", "0.55893624", "0.55698216", "0.55402493", "0.5500501", "0.5496368", "0.5474002", "0.54718846", "0.5466953", "0.545638", "0.5447555", "0.5427183", "0.5404161", "0.5397679", "0.5373306", "0.5364585", "0.53489107", "0.53477347", "0.53286964", "0.5318421", "0.52975196", "0.52928174", "0.52777207", "0.527709", "0.524595", "0.52409273", "0.5227103", "0.5224949", "0.5221361", "0.52209693", "0.5213509", "0.521149", "0.5207579", "0.5192021", "0.5189202", "0.5185358", "0.5182749", "0.5172367", "0.5171045", "0.51709867", "0.5170787", "0.5166841", "0.5162433", "0.5156957", "0.5153764", "0.5142283", "0.5140368", "0.5138755", "0.5135022", "0.5119954", "0.5118823", "0.5114635", "0.51075536", "0.5102747", "0.51005006", "0.5095412", "0.5091259", "0.5085106", "0.507208", "0.5069008", "0.50683266", "0.506135", "0.5057005", "0.50403726", "0.5034069", "0.5031868", "0.5027028", "0.50261754", "0.5025777", "0.50234413", "0.5020962", "0.5014717", "0.5012992", "0.500735", "0.5003448", "0.50024045", "0.49991438", "0.49940875", "0.4991954", "0.499039", "0.4990138", "0.49896103", "0.49887472", "0.49865174", "0.49791804", "0.4974641", "0.49665764" ]
0.5427167
25
Of getValidActions Go one step with the given action.
public void step(int paraAction) throws IllegalActionException { // Step 1. Is this action legal? int tempRow = paraAction / SIZE; int tempColumn = paraAction % SIZE; if (checkerboard[tempRow][tempColumn] != EMPTY) { System.out.println("The checkerboard state is: " + Arrays.deepToString(checkerboard)); throw new IllegalActionException("The position (" + tempRow + ", " + tempColumn + " is already occupied " + checkerboard[tempRow][tempColumn]); } // Of if // Step 2. Change the state of the checkerboard. //SimpleTools.variableTrackingOutput( // "Assign " + currentPlayer + " to (" + tempRow + ", " + tempColumn + ")."); SimpleTools.variableTrackingOutput("" + paraAction + ", "); checkerboard[tempRow][tempColumn] = currentPlayer; currentState = checkerboardToState(checkerboard); gameSituation = computeGameSituation(); //SimpleTools.variableTrackingOutput("Environment current stage: " + currentState + ", "); //SimpleTools.variableTrackingOutput("gameSituation: " + gameSituation + ", "); currentRouteStates[currentRouteLength] = currentState; currentRouteLength++; // Step 3. Now it's the turn of the other player. if (currentPlayer == WHITE) { currentPlayer = BLACK; } else { currentPlayer = WHITE; } // Of if }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void getValidActionsTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 6643 };\n\n\t\tint[] tempResultArray;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResultArray = tempEnvironment.getValidActions(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The valid actions of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.toString(tempResultArray));\n\t\t} // Of for i\n\t}", "private ActionStepOrResult executeAction(ExtendedEventHandler eventHandler, Action action)\n throws LostInputsActionExecutionException, InterruptedException {\n ActionResult result;\n try (SilentCloseable c = profiler.profile(ProfilerTask.INFO, \"Action.execute\")) {\n checkForUnsoundDirectoryInputs(action, actionExecutionContext.getInputMetadataProvider());\n\n result = action.execute(actionExecutionContext);\n\n // An action's result (or intermediate state) may have been affected by lost inputs. If an\n // action filesystem is used, it may know whether inputs were lost. We should fail fast if\n // any were; rewinding may be able to fix it.\n checkActionFileSystemForLostInputs(\n actionExecutionContext.getActionFileSystem(), action, outputService);\n } catch (ActionExecutionException e) {\n Path primaryOutputPath = actionExecutionContext.getInputPath(action.getPrimaryOutput());\n maybeSignalLostInputs(e, primaryOutputPath);\n return ActionStepOrResult.of(\n processAndGetExceptionToThrow(\n eventHandler,\n primaryOutputPath,\n action,\n e,\n actionExecutionContext.getFileOutErr(),\n ErrorTiming.AFTER_EXECUTION));\n } catch (InterruptedException e) {\n return ActionStepOrResult.of(e);\n }\n\n try {\n ActionExecutionValue actionExecutionValue;\n try (SilentCloseable c =\n profiler.profile(ProfilerTask.ACTION_COMPLETE, \"actuallyCompleteAction\")) {\n actionExecutionValue = actuallyCompleteAction(eventHandler, result);\n }\n return new ActionPostprocessingStep(actionExecutionValue);\n } catch (ActionExecutionException e) {\n return ActionStepOrResult.of(e);\n }\n }", "private void checkAction() {\n if (action == Consts.CREATE_ACTION) {\n createAction();\n } else {\n updateAction(getArguments().getString(\"taskId\"));\n }\n }", "public void checkActions() {\n\t\tfor (BaseAction ba : this.actions) {\n\t\t\tba.checkAction();\n\t\t}\n\t}", "protected boolean validateActions(PDPage page, DocumentHandler handler,\n List<ValidationError> result) throws ValidationException {\n // ---- get AA (additional actions) entry if it is present\n List<AbstractActionManager> lActions = this.actionFact.getActions(page\n .getCOSDictionary(), handler.getDocument().getDocument());\n for (AbstractActionManager action : lActions) {\n if (!action.valid(true, result)) {\n return false;\n }\n }\n\n return true;\n }", "public int[] getValidActions() {\n\t\treturn getValidActions(currentState);\n\t}", "public List<boolean[]> getValidActions()\n\t{\n\t\tList<boolean[]> validActions = new ArrayList<boolean[]>(allActions);\n\t\t//TODO remove actions that contain jump if environment.mayMarioJump() is false\n\t\treturn validActions;\n\t}", "public void action(Runnable action) {\n if (this.condition == null) {\n throw new APSValidationException( \"Cannot execute action, no condition has been provided!\" );\n }\n if (this.condition.met()) {\n runAction( action );\n }\n else {\n this.todo.add(action);\n }\n }", "@Override\n\t\tprotected boolean validateAction(int actionID, String... arguments) {\n\t\t\treturn false;\n\t\t}", "public static void performAction(int action) {\n\t\tArrayList<Double> data;\n\t\tswitch (action) {\n\t\tcase MANUAL_INPUT:\n\t\t\tdata = manualInput();\n\t\t\tbreak;\n\t\tcase AUTO_INPUT:\n\t\t\tdata = autoInput();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new IllegalArgumentException();\n\t\t}\n\t\tanalyze(data);\n\t}", "public boolean[] getAction()\n {\n cleanActions();\n \n //Execute BT to get the action to do.\n m_behaviorTree.execute();\n \n //keep track of last set of actions.\n //recordActions();\n\n if(m_resetThisCycle)\n {\n resetAgent();\n }\n\n //And this is the action that must be taken:\n return action;\n }", "public static List<String> getValidActions() {\n return VALID_ACTIONS;\n }", "void determineNextAction();", "private HashMap<List<Integer>,List<Integer>> obtainValidActions(){\n\t\tHashMap<List<Integer>,List<Integer>> mapp= new HashMap<List<Integer>,List<Integer>>();\n\t\tfor (int i = 0;i<states.size();i++) {\n\t\t\tList<Integer> act= new ArrayList<Integer>();\n\t\t\tfor (int j = 0; j < actions.size(); j++) {\n\t\t\t\tif (isActionValid(states.get(i), actions.get(j))) \n\t\t\t\t\t//System.out.println(\"Inside Validation if\\n\");\n\t\t\t\t\tact.add(j);\n\t\t\t}\n\t\t\tmapp.put(states.get(i),act);\n\t\t}\n\t\treturn mapp;\n\t}", "public boolean isValidAction(Action action) {\n return getActions().contains(action) || Action.cancel.equals(action);\n }", "protected HashSet<GoapAction> extractPossibleActions() {\r\n\t\tHashSet<GoapAction> possibleActions = new HashSet<GoapAction>();\r\n\r\n\t\ttry {\r\n\t\t\tfor (GoapAction goapAction : this.goapUnit.getAvailableActions()) {\r\n\t\t\t\tif (goapAction.checkProceduralPrecondition(this.goapUnit)) {\r\n\t\t\t\t\tpossibleActions.add(goapAction);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn possibleActions;\r\n\t}", "void checkPrerequisite() throws ActionNotPossibleException;", "@Override\r\n protected boolean validateAction() {\n Set inputNames = getInputNames();\r\n Iterator inputNamesIterator = inputNames.iterator();\r\n String inputName;\r\n IActionParameter actionParameter;\r\n while (inputNamesIterator.hasNext()) {\r\n inputName = (String) inputNamesIterator.next();\r\n actionParameter = getInputParameter(inputName);\r\n message(Messages.getString(\"TestComponent.DEBUG_INPUT_DESCRIPTION\", inputName, actionParameter.getType())); //$NON-NLS-1$\r\n }\r\n\r\n Set outputNames = getOutputNames();\r\n Iterator outputNamesIterator = outputNames.iterator();\r\n String outputName;\r\n while (outputNamesIterator.hasNext()) {\r\n outputName = (String) outputNamesIterator.next();\r\n actionParameter = getOutputItem(outputName);\r\n message(Messages.getString(\"TestComponent.DEBUG_OUTPUT_DESCRIPTION\", outputName, actionParameter.getType())); //$NON-NLS-1$\r\n }\r\n\r\n Set resourceNames = getResourceNames();\r\n Iterator resourceNamesIterator = resourceNames.iterator();\r\n String resourceName;\r\n IActionSequenceResource actionResource;\r\n while (resourceNamesIterator.hasNext()) {\r\n resourceName = (String) resourceNamesIterator.next();\r\n actionResource = getResource(resourceName);\r\n message(Messages\r\n .getString(\r\n \"TestComponent.DEBUG_RESOURCE_DESCRIPTION\", resourceName, actionResource.getMimeType(), PentahoSystem.getApplicationContext().getSolutionPath(actionResource.getAddress()))); //$NON-NLS-1$\r\n try {\r\n String content = getResourceAsString(actionResource);\r\n message(Messages.getString(\r\n \"TestComponent.DEBUG_RESOURCE_CONTENTS\", ((content == null) ? \"null\" : content.substring(0, 100)))); //$NON-NLS-1$ //$NON-NLS-2$\r\n } catch (Exception e) {\r\n message(Messages.getString(\"TestComponent.ERROR_0005_RESOURCE_NOT_LOADED\", e.getMessage())); //$NON-NLS-1$\r\n }\r\n }\r\n\r\n return true;\r\n }", "@Override\n\tpublic void step(int actionType) {\n\n\t}", "private boolean actionIsValid(Action a) {\n\t\tif(board[horizontal-1][a.getColumn() ] != Player.NOT_PLAYED.ordinal()\t) {\n\t\t\treturn false;\n\t\t}else {\n\t\t\treturn true;\n\t\t}\n\t\n\t}", "private void makeValidActionsDiscretized() {\n validActionsDiscretized = new ArrayList<>();\n\n List<ActionType> actionTypes = problemSpec.getLevel().getAvailableActions();\n\n // Valid tire pressures\n List<TirePressure> tirePressures = Arrays.asList(\n TirePressure.FIFTY_PERCENT,\n TirePressure.SEVENTY_FIVE_PERCENT,\n TirePressure.ONE_HUNDRED_PERCENT\n );\n\n // Valid fuel levels (note that this is an arbitrary discretization)\n List<Integer> fuelLevels = new ArrayList<>();\n int fuelInterval = ProblemSpec.FUEL_MAX / FUEL_DISCRETE_INTERVALS;\n\n for (int i = 0; i < FUEL_DISCRETE_INTERVALS; i++) {\n fuelLevels.add(fuelInterval * i);\n }\n\n // Go through A1-A8 and add all possible combinations of the parameters\n for (ActionType actionType : actionTypes) {\n switch (actionType.getActionNo()) {\n case 1:\n validActionsDiscretized.add(new Action(actionType));\n break;\n\n case 2:\n for (String car : problemSpec.getCarOrder()) {\n validActionsDiscretized.add(new Action(actionType, car));\n }\n\n break;\n\n case 3:\n for (String driver : problemSpec.getDriverOrder()) {\n validActionsDiscretized.add(new Action(actionType, driver));\n }\n\n break;\n\n case 4:\n for (Tire tire : problemSpec.getTireOrder()) {\n validActionsDiscretized.add(new Action(actionType, tire));\n }\n\n break;\n\n case 5:\n for (int fuel : fuelLevels) {\n validActionsDiscretized.add(new Action(actionType, fuel));\n }\n\n break;\n\n case 6:\n for (TirePressure pressure : tirePressures) {\n validActionsDiscretized.add(new Action(actionType, pressure));\n }\n\n break;\n case 7:\n for (String car : problemSpec.getCarOrder()) {\n for (String driver : problemSpec.getDriverOrder()) {\n validActionsDiscretized.add(new Action(actionType, car, driver));\n }\n }\n\n break;\n\n case 8:\n for (TirePressure pressure : tirePressures) {\n for (int fuel : fuelLevels) {\n for (Tire tire : problemSpec.getTireOrder()) {\n validActionsDiscretized.add(new Action(actionType, tire, fuel,\n pressure));\n }\n }\n }\n\n break;\n }\n }\n }", "public double getReward(List<Integer> state, List<Integer> action) {\n\t\tList<Integer> newState=sumLists(state,action);\n\t\tif (listElementSum(newState)>this.ventureManager.getMaxManufacturingFunds()) {\n\t\t\tthrow new IllegalArgumentException(\"Action not Valid for given state at getReward(state,action)\");\n\t\t}\n\t\t\n\t\treturn this.futureRewards.get(newState);\n\t\t\n\t}", "public abstract List<Instruction> getPossibleActions();", "public String[] getStepActions() {\r\n HistoryStep[] steps = currentProcessInstance.getHistorySteps();\r\n String[] actions = new String[steps.length];\r\n Action action = null;\r\n \r\n for (int i = 0; i < steps.length; i++) {\r\n try {\r\n if (steps[i].getAction().equals(\"#question#\"))\r\n actions[i] = getString(\"processManager.question\");\r\n \r\n else if (steps[i].getAction().equals(\"#response#\"))\r\n actions[i] = getString(\"processManager.response\");\r\n \r\n else if (steps[i].getAction().equals(\"#reAssign#\"))\r\n actions[i] = getString(\"processManager.reAffectation\");\r\n \r\n else {\r\n action = processModel.getAction(steps[i].getAction());\r\n actions[i] = action.getLabel(currentRole, getLanguage());\r\n }\r\n } catch (WorkflowException we) {\r\n actions[i] = \"##\";\r\n }\r\n }\r\n \r\n return actions;\r\n }", "public List<RequiredAction> getActions() {\n return this.actions;\n }", "@Override\n public boolean tryAdvance(DoubleConsumer action){\n Objects.requireNonNull(action);\n if(count==-2){\n action.accept(first);\n count=-1;\n return true;\n }else{\n return false;\n }\n }", "public List<ActionValue> getActions(State state);", "public void execute(A action) {\n\t\tS testState=action.applyTo(currentState);\n\t\tif (stop ||testState.equals(null)){\n\t\t\tString text=\"Impossible to make the action: \";\n\t\t\t\n\t\t\tif(stop){\n\t\t\t\ttext+=\"The game was stopped before \";\n\t\t\t}\n\t\t\telse if(testState.equals(null)){\n\t\t\t\ttext+=\"The game should start before realize an action\";\n\t\t\t}\n\t\t\t\n\t\t\tGameError error=new GameError(text);\n\t\t\tnotifyObservers(new GameEvent<S, A>(EventType.Error, null,currentState, error, error.getMessage()));\n\t\t\tthrow error;\n\t\t\t\n\t\t\t\t\t\n\t\t}else{\n\t\t\tthis.currentState=testState;\n\t\t\tnotifyObservers(new GameEvent<S, A>(EventType.Change, action, currentState, null,\"The game has change\"));\n\t\t\t\t\n\t\t}\n\t\t\t\n\t\n \t}", "public ActionsValidator() {\n super();\n }", "public static List<Action> getActions (List<Action> list) {\n\n // This can be fairly easy with lambda (but lambdas are not supported in Java 7)\n Predicate<Action> condition = new Predicate<Action>()\n {\n @Override\n public boolean test(Action action) {\n return action.isValid();\n }\n };\n\n Supplier<List<Action>> supplier = new Supplier<List<Action>>() {\n @Override\n public List<Action> get() {\n return new ArrayList<Action>();\n }\n };\n\n List<Action> filtered = list.stream()\n .filter( condition ).collect(Collectors.toCollection(supplier));\n return filtered;\n }", "public void choosedAction(int action) {\r\n countActions[action]++;\r\n }", "@Override\n public boolean tryAdvance(IntConsumer action){\n Objects.requireNonNull(action);\n if(count==-2){\n action.accept(first);\n count=-1;\n return true;\n }else{\n return false;\n }\n }", "@Override\r\n\t\t\tpublic void actionExecuted(GameAction action) {\r\n\t\t\t\tif(action != selectAction) return;\r\n\t\t\t\tattackedCollector = action.getCard().getCollector();\r\n\t\t\t}", "public void action() {\n action.action();\n }", "public void setAction(String action) {\n\t\tthis.action = action;\n\t}", "@Test\n public void isActionLegal()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final Agent agentWhite = agents.get(1);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n final Adjudicator adjudicator = injector.injectAdjudicator();\n\n // Agent white can move his token to an adjacent empty space.\n {\n final CheckersMoveAction action = new CheckersMoveAction(environment, agentWhite, CheckersPosition.P09,\n CheckersPosition.P13);\n assertTrue(adjudicator.isActionLegal(action));\n }\n\n // Agent white cannot move backwards.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P09,\n CheckersPosition.P05)));\n\n // Agent white cannot move to an occupied space.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P04,\n CheckersPosition.P08)));\n\n // Agent white cannot move a red token.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P21,\n CheckersPosition.P17)));\n\n // Agent white cannot move too far.\n assertFalse(adjudicator.isActionLegal(new CheckersMoveAction(environment, agentWhite, CheckersPosition.P09,\n CheckersPosition.P18)));\n }", "public void setAction(String action) {\n this.action = action;\n }", "public void setAction(String action) {\n this.action = action;\n }", "public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {\r\n ActionErrors actionErrors = new ActionErrors();\r\n try {\r\n UserDAO gObjUserDAO = new UserDAOImpl();\r\n if (userFirstName == null || userFirstName.length() < 1) {\r\n\r\n actionErrors.add(\"userFirstName\", new ActionMessage(\"error.userFirstName\"));\r\n // TODO: add 'error.name.required' key to your resources\r\n }\r\n if (getUserName() == null || getUserName().length() < 1) {\r\n\r\n actionErrors.add(\"userName\", new ActionMessage(\"error.userName\"));\r\n // TODO: add 'error.name.required' key to your resources\r\n }\r\n if (getUserPassword() == null || getUserPassword().length() < 1) {\r\n actionErrors.add(\"userPassword\", new ActionMessage(\"error.userPassword\"));\r\n // TODO: add 'error.name.required' key to your resources\r\n }\r\n if (getUserActivationCode() == null || getUserActivationCode().length() < 1) {\r\n actionErrors.add(\"userActivationCode\", new ActionMessage(\"error.userActivationCode\"));\r\n // TODO: add 'error.name.required' key to your resources\r\n }\r\n if (getUserName() != null && getUserName().length() > 0) {\r\n\r\n List<CmnUserMst> lLstCmnUserMst = new ArrayList<CmnUserMst>();\r\n lLstCmnUserMst = gObjUserDAO.validateUserName(getUserName().toUpperCase());\r\n if (!lLstCmnUserMst.isEmpty()) {\r\n actionErrors.add(\"userName\", new ActionMessage(\"error.duplicateUserName\"));\r\n\r\n }\r\n\r\n }\r\n if (getUserActivationCode() != null && getUserActivationCode().length() > 0) {\r\n\r\n System.out.println(\"userType.....\" + userType);\r\n logger.info(\"userType......\" + userType);\r\n if (userType != null && !\"\".equals(userType) && \"H\".equals(userType)) {\r\n roleActivationMpgList = gObjUserDAO.validateActivationCodeForHR(getUserActivationCode());\r\n if (roleActivationMpgList != null && !roleActivationMpgList.isEmpty()) {\r\n PcHrDtls lObjPcHrDtls = (PcHrDtls) roleActivationMpgList.get(0);\r\n universityId = lObjPcHrDtls.getUniversityId();\r\n }\r\n }\r\n else if (userType != null && !\"\".equals(userType) && (\"S\".equals(userType) || \"A\".equals(userType) || \"F\".equals(userType))) {\r\n roleActivationMpgList = gObjUserDAO.validateActnCodeForStudOrAlumniOfFaculty(userType,userActivationCode);\r\n if(roleActivationMpgList != null && !roleActivationMpgList.isEmpty())\r\n {\r\n List lLstResult = gObjUserDAO.validateActivationCodeWithExistingCode(userActivationCode);\r\n if(lLstResult != null && !lLstResult.isEmpty())\r\n {\r\n actionErrors.add(\"userActivationCode\", new ActionMessage(\"error.validateUserActivationCodeWithExistingCode\")); \r\n }\r\n else\r\n {\r\n TmpUserExcelData lObjTmpUserExcelData = (TmpUserExcelData) roleActivationMpgList.get(0);\r\n universityId = lObjTmpUserExcelData.getUniversityId();\r\n }\r\n }\r\n } \r\n else {\r\n roleActivationMpgList = gObjUserDAO.validateActivationCode(getUserActivationCode());\r\n if (roleActivationMpgList != null && !roleActivationMpgList.isEmpty()) {\r\n CmnRoleActivationMpg lObjCmnRoleActivationMpg = (CmnRoleActivationMpg) roleActivationMpgList.get(0);\r\n universityId = lObjCmnRoleActivationMpg.getUniversityId();\r\n }\r\n }\r\n\r\n if (roleActivationMpgList == null || roleActivationMpgList.isEmpty()) {\r\n actionErrors.add(\"userActivationCode\", new ActionMessage(\"error.validateUserActivationCode\"));\r\n\r\n }\r\n }\r\n request.setAttribute(\"fromFlag\", \"signUp\");\r\n } catch (Exception ex) {\r\n logger.error(\"Error while validating user data : \" + ex, ex);\r\n }\r\n return actionErrors;\r\n }", "public GameAction runTurnAction() {\r\n // Is the game over? If so return\r\n if (this.isGameOver) {\r\n return this.currentAction;\r\n }\r\n \r\n // Get the next game action for this turn\r\n GameAction currentTurnAction = this.turnActions.get(turnActionLocation);\r\n \r\n // Clear out the return values for this gameAction\r\n currentTurnAction.clearActionReturnValues();\r\n \r\n // Set the currentAction (used for setting return values)\r\n this.currentAction = currentTurnAction;\r\n \r\n // Process the next action for this turn\r\n this.processGameAction(currentTurnAction);\r\n \r\n // Increment the turn action location or loop back to 0\r\n this.turnActionLocation++;\r\n \r\n // Check to make sure we haven't gone over the turn list size\r\n if (this.turnActionLocation >= this.turnActions.size()) {\r\n turnActionLocation = 0;\r\n }\r\n\r\n // Return any necessary values to the caller as a gameAction\r\n return currentTurnAction;\r\n }", "private boolean canPerformAction(String actionName, Action action, Value value) {\n\t\tif (actions.get(actionName) != null && actions.get(actionName).compareTo(String.valueOf(action) + \"_\" + String.valueOf(value)) == 0) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public void setAction (String action) {\n this.action = action;\n }", "public void setAction(@NotNull Action action) {\n this.action = action;\n }", "private void processGameAction(GameAction gameAction) {\r\n // Get all of the methods to be called by this setting as strings\r\n ArrayList<String> methods = gameAction.getGameActionMethods();\r\n \r\n // Set each method into an array to be run using the mapMethodSetting\r\n for (String methodName : methods) {\r\n try {\r\n // Get the specific method to run from this class \r\n Method method = GameManager.class.getMethod(methodName, \r\n this.methodMapGameActions.get(methodName));\r\n \r\n // Set an array to hold the arguments for this \r\n Object[] arguments = \r\n new Object[method.getParameterTypes().length];\r\n \r\n // Loop through the values and add them to the arguments list\r\n for (int i = 0; i < arguments.length; i++) {\r\n arguments[i] = gameAction.getNextActionValue();\r\n }\r\n \r\n // Invoke the method with the arguments array\r\n method.invoke(this, arguments);\r\n }\r\n catch (NoSuchMethodException|IllegalAccessException|\r\n InvocationTargetException e) {\r\n System.out.println(e.getCause());\r\n }\r\n }\r\n }", "public void setAction(String action) { this.action = action; }", "public ActionList getActions();", "public boolean execute(byte action) {\n if (diff[0] != 0 || diff[1] != 0) {\n return false;\n } else {\n getPoint(currentPoint);\n if (currentPointAction == FInteractionUtils.ACTION_NONE) {\n switch (action) {\n case ACTION_NEXT_POINT:\n currentPoint++;\n if (currentPoint > endPoint) {\n currentPoint = endPoint;\n }\n startTimeout();\n runFocusPoint();\n break;\n case ACTION_PREV_POINT:\n currentPoint--;\n if (currentPoint < firstPoint) {\n currentPoint = firstPoint;\n }\n startTimeout();\n runFocusPoint();\n break;\n case FInteractionUtils.ACTION_FOCUS_TO_HOVER_MENU:\n FInteractionUtils.setFocusToHoverMenu();\n break;\n case FInteractionUtils.ACTION_CHANGE_TO_MAIN_MENU:\n FMap.cancelTask();\n FInteractionUtils.changeToMainMenu();\n break;\n default:\n FMap.cancelTask();\n //add the scroll\n fi.execute(action);\n break;\n }\n } else {\n FMap.cancelTask();\n //execute the point action\n switch (currentPointAction) {\n case FInteractionUtils.ACTION_CHANGE_TO_MAIN_MENU:\n FInteractionUtils.changeToMainMenu();\n break;\n case ACTION_LOAD_MAP:\n FRutePlanner.currentRute++;\n if (FRutePlanner.currentRute >= FRutePlanner.rutes.length) {\n return this.execute(FInteractionUtils.ACTION_CHANGE_TO_MAIN_MENU);\n }\n init(FRutePlanner.rutes[FRutePlanner.currentRute]);\n break;\n }\n }\n }\n return false;\n }", "public void goToPermissions(String action) {\n boolean allowed = false;\n if (selectedSubject instanceof Subject) {\n allowed = isAuthorized((Subject) selectedSubject, \"grant\".equals(action) ? Action.GRANT : Action.REVOKE);\n } else {\n allowed = isAuthorized((Role) selectedSubject, \"grant\".equals(action) ? Action.GRANT : Action.REVOKE);\n }\n if (!allowed) {\n return;\n }\n if (selectedSubject != null\n && (!selectedActions.isEmpty() || (!selectedCollectionActions.isEmpty() && isSelectedFields(selectedCarrierModel.getCollectionFields().values())))) {\n\n if (getTabEntity() instanceof Carrier) {\n goToObjectResourceManagement(action, (IdHolder<?>) selectedSubject, selectedActions, selectedCollectionActions, selectedCarrierModel, carriers);\n } else {\n if (getTabEntity() instanceof Party) {\n if (partyModel.getEntity().getId() != null) {\n List<RowModel> ret = new ArrayList<RowModel>();\n ret.add(new RowModel(partyModel.getEntity(), partyModel.isSelected(), \"Party-\" + ((Party) partyModel.getEntity()).getPartyField1() + \", \"\n + ((Party) partyModel.getEntity()).getPartyField2()));\n if (isSelected(ret)) {\n goToObjectResourceManagement(action, (IdHolder<?>) selectedSubject, selectedActions, selectedCollectionActions, partyModel, ret);\n } else {\n System.err.println(\"Select party\");\n }\n }\n } else {\n if (getTabEntity() instanceof Contact) {\n if (isSelected(contacts)) {\n goToObjectResourceManagement(action, (IdHolder<?>) selectedSubject, selectedActions, selectedCollectionActions, selectedContactModel, contacts);\n } else {\n System.err.println(\"Select contact\");\n }\n }\n }\n }\n }\n\n }", "private ArrayList<String> getPossibleActions() {\n\t\t\n\t\tRandom r = new Random();\n\t\tArrayList<String> possibleActions = new ArrayList<String>();\n\t\tfor (String actionTitle : getAllActions()) {\n\t\t\tif (r.nextDouble() < 0.3) {\n\t\t\t\tpossibleActions.add(actionTitle);\n\t\t\t}\n\t\t}\n\t\treturn possibleActions;\n\t}", "private void executeAction(ElevatorAction first) {\n\n\t}", "private boolean checkPlayerActionAvailability(List<PlayerAction> playerActionList, Game game, Player player) {\n List<CompositeAction> possibleActions = player.getCharacterState().getPossibleActions(game.isFrenzy());\n return possibleActions.stream()\n // checks whether the different lists of Ids of the possible actions contain the list of Ids of the input\n .filter(composite ->\n composite.getAction().stream()\n .map(Targetable::getId)\n .collect(Collectors.toList()) // list of Ids of a particular possible action\n .containsAll\n (playerActionList.stream() // list of Ids of the input\n .map(Targetable::getId)\n .collect(Collectors.toList())))\n .anyMatch(composite -> { // checks whether among the possible actions that have the same Ids as the input, the move action has an allowed distance\n Supplier<Stream<PlayerAction>> supplier = () ->\n composite.getAction().stream()\n .filter(possiblePlayerAction -> possiblePlayerAction.getId().equals(Constants.MOVE)); // gets only the Move action\n if (supplier.get().count()==0) { // checks the presence of possible actions,\n return true; // if there is none it returns true,\n } // otherwise anyMatch would return false with no elements in the stream\n boolean res = supplier.get()\n .anyMatch(possiblePlayerAction -> { // the actual anyMatch that performs the check of the Move's distance\n MovePlayerAction mpa = playerActionList.stream()\n .filter(playerAction -> playerAction.getId().equals(Constants.MOVE))\n .map(pa -> (MovePlayerAction) pa)\n .findFirst().orElseThrow(IllegalStateException::new);\n int distance = game.getBoard().getTileTree()\n .distance(mpa.getPlayer().getCharacterState().getTile(), mpa.getMoveList().get(0));\n Logger.getGlobal().info(\"allowed distance :\" + possiblePlayerAction.getAmount());\n Logger.getGlobal().info(\"actual distance:\" + distance);\n if (possiblePlayerAction.getAmount() < distance || distance == -1) {\n // the predicate that checks the distance, if the selected tile gives a\n // greater distance then the action is not allowed\n // also checks reachability\n return false;\n }\n return true;\n });\n Logger.getGlobal().info(String.valueOf(res));\n\n if (!res) {\n addErrorMessage(MOVE_ACTION_ERROR_MESSAGE);\n } else {\n resetErrorMessages();\n }\n\n return res; // the result of the the internal anyMatch, it is returned as value of the external anyMatch\n }\n );\n }", "public CheckPrincipalAccessRequest setActions(List<RequiredAction> actions) {\n this.actions = actions;\n return this;\n }", "public void computeActions(List<Action> result, DiagramContext context);", "private static boolean computeNextStep(FsmModel fsm, HashMap<Method, Double> actionsAndProbabilities) {\n double sum = 0;\n double rand = 0;\n HashMap<Method, Double> actionsReady = getActivableActions(fsm, actionsAndProbabilities);\n if (actionsReady.isEmpty()) {\n return false;\n }\n do {\n sum = 0;\n rand = Math.random();\n for (Method act : actionsReady.keySet()) {\n sum += actionsReady.get(act);\n if (rand <= sum) {\n try {\n System.out.println(\"\\nInvoking: \" + act.getName()) ;\n act.invoke(fsm);\n return true;\n } catch (IllegalAccessException e) {\n System.err.println(\"Illegal access to \" + act.getName());\n System.err.println(\"Shouldn't have happened\");\n // e.printStackTrace(System.err);\n } catch (InvocationTargetException e) {\n System.err.println(\"Exception on target invocation on \" + act.getName());\n System.err.println(\"Shouldn't have happened\");\n e.printStackTrace(System.err);\n }\n }\n }\n }\n while (rand > sum);\n\n return false;\n }", "void noteActionEvaluationStarted(ActionLookupData actionLookupData, Action action);", "public boolean action_allowed(){\r\n\t\treturn action_holds.size()==0;\r\n\t}", "public void processAction(CIDAction action);", "public Action getAction(int index) { return actions.get(index); }", "@Override\r\n\tprotected boolean validateFields(String action) {\r\n\t\t// Booleano para indicar que hubo error\r\n\t\tisError = false;\r\n\t\t// IRI Concepto\r\n\t\tif (this.isBlanks(object.getDcoiricaf())) {\r\n\t\t\tisError = true;\r\n\t\t\tthis.getErrorMessages().add(\r\n\t\t\t\t\tApplicationMessages.getMessage(\"USR0008\",\r\n\t\t\t\t\t\t\tApplicationMessages.getMessage(\"se010_iriDetail\")));\r\n\t\t}\r\n\t\t// Concepto Semántico\r\n\t\tif (this.isBlanks(object.getCosccosak())) {\r\n\t\t\tisError = true;\r\n\t\t\tthis.getErrorMessages().add(\r\n\t\t\t\t\tApplicationMessages.getMessage(\"USR0008\",\r\n\t\t\t\t\t\t\tApplicationMessages\r\n\t\t\t\t\t\t\t\t\t.getMessage(\"se010_semanticConcept\")));\r\n\t\t}\r\n\t\t// Valida relaciones\r\n\t\tfor (Sedrelco relco : object.getRelcos()) {\r\n\t\t\t// Valor Relacion\r\n\t\t\tif (this.isBlanks(relco.getDrcvalraf())) {\r\n\t\t\t\tisError = true;\r\n\t\t\t\tthis.getErrorMessages().add(\r\n\t\t\t\t\t\tApplicationMessages.getMessage(\"USR0008\",\r\n\t\t\t\t\t\t\t\tApplicationMessages\r\n\t\t\t\t\t\t\t\t\t\t.getMessage(\"se010_valueRelation\")));\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Retorna\r\n\t\treturn !isError;\r\n\t}", "public SPResponse completeAction(User user, Object[] params) {\n final SPResponse resp = new SPResponse();\n \n final String actionPlanId = (String) params[0];\n final String stepId = (String) params[1];\n final String uid = (String) params[2];\n final boolean completed = (boolean) params[3];\n \n Assert.hasText(actionPlanId, \"Organization Plan id is required.\");\n Assert.hasText(uid, \"UID uinique id is required.\");\n \n // get the users action plan\n UserActionPlan userActionPlan = actionPlanFactory.getUserActionPlan(user);\n \n // Removing this check as with action plans they can now complet any action plan\n // validate if the action plan is what the user is working on\n // final String selectedActionPlan = userActionPlan.getSelectedActionPlan();\n // if (!StringUtils.equals(selectedActionPlan, actionPlanId)) {\n // throw new DashboardRedirectException(\"Organization Plan not currently selected by user.\");\n // }\n \n // validate the action plan\n ActionPlanDao actionPlan = getActionPlan(actionPlanId);\n \n // validate if the uid is still applicable\n if (completed) {\n if (!actionPlan.validateUID(stepId, uid)) {\n throw new DashboardRedirectException(MessagesHelper.getMessage(\"service.growl.message5\"));\n }\n }\n \n // Marking the action complete or removing it from the completion list\n ActionPlanProgress actionPlanProgress = userActionPlan.addCompletion(actionPlanId, stepId, uid,\n completed);\n \n UserTodoRequests userTodoRequests = todoFactory.getUserTodoRequests(user);\n if (actionPlan.getStepType() == StepType.TimeBasedWithCompletion) {\n final Set<String> completedActions = actionPlanProgress.getCompletedActions(stepId);\n boolean noActionLeft = checkIfAllStepActionsCompleted(stepId, completedActions);\n TodoRequest todoRequest = userTodoRequests.findRequest(stepId, actionPlanId);\n if (noActionLeft || todoRequest == null) {\n int sizeBefore = actionPlanProgress.getCompletedActionsForStep().size();\n actionPlanFactory.addUpdateActionPlanProgress(user, userActionPlan, actionPlan,\n Operation.UPDATE);\n int sizeAfter = actionPlanProgress.getCompletedActionsForStep().size();\n if (sizeAfter != sizeBefore) {\n resp.add(Constants.PARAM_ACTION_PLAN_ENABLE_NEXT_STEP, true);\n }\n userTodoRequests = todoFactory.getUserTodoRequests(user);\n }\n } else {\n if (actionPlanProgress.getCompletedCount() == actionPlan.getActionCount()) {\n todoFactory.removeAllTasksWithParentId(user, actionPlanId, userTodoRequests);\n } else {\n ParentTodoTaskRequests parentTodoTaskRequest = userTodoRequests\n .getParentTodoTaskRequest(actionPlanId);\n if (parentTodoTaskRequest == null) {\n actionPlanFactory.addUpdateActionPlanProgress(user, userActionPlan, actionPlan,\n Operation.UPDATE);\n userTodoRequests = todoFactory.getUserTodoRequests(user);\n }\n }\n }\n \n // update the changed data to the repository\n actionPlanFactory.updateUserActionPlan(userActionPlan);\n \n // update the tasks\n ParentTodoTaskRequests parentTodoTaskRequest = userTodoRequests\n .getParentTodoTaskRequest(actionPlanId);\n if (parentTodoTaskRequest != null) {\n todoFactory.updateTask(user, actionPlanId);\n }\n \n // update the badge\n badgeFactory.updateBadgeProgress(user, actionPlanId, BadgeType.OrgPlan, actionPlan);\n return resp.isSuccess();\n }", "@NonNull\n public Action getAction() {\n return this.action;\n }", "public CisaData withAction(String action) {\n setAction(action);\n return this;\n }", "@NotNull public Builder potentialAction(@NotNull Action.Builder action) {\n putValue(\"potentialAction\", action.build());\n return this;\n }", "@NotNull public Builder potentialAction(@NotNull Action.Builder action) {\n putValue(\"potentialAction\", action.build());\n return this;\n }", "@NotNull public Builder potentialAction(@NotNull Action.Builder action) {\n putValue(\"potentialAction\", action.build());\n return this;\n }", "@NotNull public Builder potentialAction(@NotNull Action action) {\n putValue(\"potentialAction\", action);\n return this;\n }", "@NotNull public Builder potentialAction(@NotNull Action action) {\n putValue(\"potentialAction\", action);\n return this;\n }", "@NotNull public Builder potentialAction(@NotNull Action action) {\n putValue(\"potentialAction\", action);\n return this;\n }", "public boolean[] eGreedyAction()\n\t{\n\t\t// initialize variables\n\t\tRandom generator = new Random();\n\t\t\n\t\t// find best action\n\t\tList<boolean[]> validActions = getValidActions();\n\t\t\n\t\t// initiate values for comparison\n\t\tStateActionPair sap = new StateActionPair(state, validActions.get(0));\n\t\tboolean[] bestAction = sap.action;\n\t\t\n\t\tdouble bestValue= getStateActionValue(sap);\n\t\t\n\t\tfor(int i=1; i<validActions.size(); i++)\n\t\t{\n\t\t\tsap = new StateActionPair(state, validActions.get(i));\n\t\t\tdouble qValue = getStateActionValue(sap);\n\t\t\tif( qValue > bestValue )\n\t\t\t{\n\t\t\t\tbestAction = sap.action;\n\t\t\t\tbestValue = qValue;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// choose random action\n\t\tif( generator.nextDouble() < epsilon )\t\n\t\t{\n\t\t\tList<boolean[]> randomActions = new ArrayList<boolean[]>(validActions);\n\t\t\trandomActions.remove(bestAction);\t// don't choose the best action\n\t\t\tboolean[] randomAction = randomActions.get(generator.nextInt(randomActions.size()));\n\t\t\treturn randomAction;\n\t\t}\n\t\t\n\n\t\treturn bestAction;\t// choose best action\n\t}", "public Collection<Action> getActions() {\n\t\treturn Collections.unmodifiableCollection(actionList);\n\t}", "public DeferredExecutionActionProxy(FormAction actionToProxy) {\n\t\tif (actionToProxy == null) {\n\t\t\tthrow new IllegalArgumentException(\"Undefined form action!\");\n\t\t}\n\t\tthis.action = actionToProxy;\n\t}", "@Override\n\tpublic int getAction() {\n\t\tint bstar = -1;\n\t\tdouble bstarval = Double.NEGATIVE_INFINITY;\n\t\tfor (int b : actions) {\n\t\t\t// now we need to look at each possible state transition\n\t\t\tdouble newStateSum = 0;\n\t\t\t// which means for every possible next state\n\t\t\tfor (int newX = 0; newX < beliefs.length; newX++) {\n\t\t\t\tfor (int newY = 0; newY < beliefs[0].length; newY++) {\n\t\t\t\t\tint[] newState = new int[]{newX,newY};\n\t\t\t\t\t// we need to look at every possible previous state\n\t\t\t\t\tdouble stateSum = 0;\n\t\t\t\t\tfor (int x = 0; x < beliefs.length; x++) {\n\t\t\t\t\t\tfor (int y = 0; y < beliefs[0].length; y++) {\n\t\t\t\t\t\t\tstateSum += beliefs[x][y] * // belief in CURRENT state if we were to make the observation, times\n\t\t\t\t\t\t\t\t\t\tworld.transitionProbability(newX, newY, x, y, b) * // probability of getting into the new state\n\t\t\t\t\t\t\t\t\t\tworld.getReward(newState);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewStateSum += stateSum;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (newStateSum > bstarval) {\n\t\t\t\tbstar = b;\n\t\t\t\tbstarval = newStateSum;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"(EntropicExplorer) Choosing action: \" + world.actionToString(bstar) + \" (value = \" + bstarval + \")\");\n\t\tlastAction = bstar;\n\t\tadvanceBeliefs(bstar);\n\t\treturn bstar;\n\t}", "protected abstract void executeActionsIfError();", "void actionProcessed(Action action, ActionResult res, int round);", "private TraversalResult traverseAction(DeterministicBoardStateNode current, String currentState, String action, int depth, double sampleRate, double maxSamples,\n boolean filterLethal, RNGBoardStateNode nextRNG) {\n ResolutionResult result = this.b.executePlayerAction(new StringTokenizer(action));\n BoardStateNode node;\n double nextMaxSamples = maxSamples;\n double nextSampleRate = sampleRate;\n if (depth + 1 >= SAMPLING_MIN_DEPTH) {\n if (depth + 1 == SAMPLING_MIN_DEPTH) {\n nextMaxSamples = this.config.maxSamples;\n } else {\n nextMaxSamples = maxSamples * this.config.maxSamplesMultiplier;\n }\n nextSampleRate = sampleRate * current.getWeightedProportionOfAction(action) * this.config.sampleRateMultiplier;\n }\n if (result.rng) {\n // the number of trials we've already done to get to this node\n int cumTrials = 0;\n if (nextRNG != null) {\n String state = this.b.stateToString();\n UUID stateHash = UUID.nameUUIDFromBytes(state.getBytes());\n cumTrials += nextRNG.getCount(this.nodeMap.get(stateHash));\n }\n nextSampleRate *= 1 - (this.config.rngPenalty * Math.pow(this.config.rngPenaltyReduction, cumTrials));\n }\n if (this.b.getWinner() != 0 || depth == SAMPLING_MAX_DEPTH) {\n // no more actions can be taken\n node = new TerminalBoardStateNode(current.team, evaluateAdvantage(this.b, current.team));\n if (!result.rng && this.b.getWinner() == current.team) {\n current.lethal = true; // the current node has an action that results in a lethal 100% of the time\n }\n } else if (Integer.parseInt(action.substring(0, 1)) == EndTurnAction.ID || this.b.getCurrentPlayerTurn() != current.team) {\n // assess what's the worst the opponent can do\n if (filterLethal) {\n // not part of my pay grade\n node = new TerminalBoardStateNode(current.team * -1, evaluateAdvantage(this.b, current.team * -1));\n } else {\n node = this.getBestTurn(current.team * -1, depth + 1,\n Math.max(nextSampleRate, this.config.enemySampleRate),\n Math.max(nextMaxSamples, this.config.maxSamplesEnemy),\n true);\n }\n } else {\n DeterministicBoardStateNode dbsn = this.getBestTurn(current.team, depth + 1, nextSampleRate, nextMaxSamples, filterLethal);\n if (dbsn == null) {\n // something went wrong, here's a bandaid\n node = new TerminalBoardStateNode(current.team, evaluateAdvantage(this.b, current.team));\n } else {\n if (dbsn.lethal) {\n current.lethal = true; // the current node has an action that leads to a node that eventually results in lethal\n }\n node = dbsn;\n }\n }\n List<Event> undoStack = new LinkedList<>(result.events);\n while (!undoStack.isEmpty()) {\n undoStack.get(undoStack.size() - 1).undo(this.b);\n undoStack.remove(undoStack.size() - 1);\n }\n // aura difference checking isn't updated by undoing, we have to update it ourselves\n this.b.updateAuraLastCheck();\n this.b.updateDependentStatsLastCheck();\n String stateAfterUndo = this.b.stateToString();\n if (!currentState.equals(stateAfterUndo)) {\n System.out.println(\n \"Discrepancy after executing \" + action + \", rng = \" + result.rng + \", depth = \" + depth);\n for (Event e : result.events) {\n System.out.print(e.toString());\n }\n System.out.println(\"Before:\");\n System.out.println(currentState);\n System.out.println(\"After:\");\n System.out.println(stateAfterUndo);\n throw new RuntimeException();\n }\n return new TraversalResult(node, result.rng);\n }", "public boolean doAction(final String action) {\n return doAction(action, null);\n }", "public static Action action(String id) {\n/* 205 */ return actions.get(id);\n/* */ }", "@Override\r\n\tList<SDAction> getNextActions(SRParserState s, SDAction goldAct, IndexWord nextWord)\r\n\t{\r\n\t\tList<SDAction> l = new ArrayList<SDAction>();\r\n\t\tif (isEnd(s))\r\n\t\t{\r\n\t\t\tl.add(SDAction.END_STATE);\r\n\t\t\treturn l;\r\n\t\t}\r\n\r\n\t\tDepChunkTree ws0 = s.pstck[0];\r\n\t\tDepChunkTree ws1 = s.pstck[1];\r\n\t\t\r\n\t\tUnsegmentedSentence sent = s.sent;\r\n\t\tint sent_len = sent.length();\r\n\t\tint ws0c_size = ws0.children.size();\r\n\r\n//\t\tboolean bGoldArc = conf.getConf(\"gold-arc\");\r\n//\t\tif (bGoldArc && goldAct == Action.NOT_AVAILABLE)\r\n//\t\t\tgoldAct = (s.curidx < s.sent.length()) ? !(ws1 != null && ws1.isRoot()) ? Action.APPEND : Action.getShiftTagAction(\"NN\") : Action.REDUCE_RIGHT;\r\n//\t\tassert (!bGoldArc || goldAct != null && goldAct != Action.NOT_AVAILABLE);\r\n\r\n\t\t/* to avoid redundant validation of chunk and tag pair */\r\n\t\t\r\n\t\tboolean bValidated = false;\r\n\t\tboolean bValid = false;\r\n\t\t\r\n\t\t/* the condition for the shift/chunk actions to be applied */\r\n\t\t\r\n\t\tif (s.curidx < sent_len)\r\n\t\t{\r\n\t\t\tDecision ds = s.decision != null && s.curidx > 0 ? s.decision[s.curidx - 1] : Decision.NA;\r\n\r\n\t\t\tif (ds != Decision.SEGMENT && !ws0.isRoot() && ws0c_size == 0)\r\n\t\t\t\tif (!m_bValidateTag || m_dict.validateTagForSequence(sent.substring(s.idbgn, sent_len), ws0.tag, s.idend - s.idbgn + 1))\r\n\t\t\t\t\tl.add(SDAction.APPEND);\r\n\t\t\tif (ds != Decision.IN_WORD && (!m_bGoldArc || goldAct.isShiftTagAction() || goldAct == SDAction.APPEND || goldAct == SDAction.NOT_AVAILABLE))\r\n\t\t\t{\r\n\t\t\t\tif (ws0c_size > 0 || ws0.isRoot() ||\r\n\t\t\t\t\t\t(!m_bValidateTag || (bValidated = true) && (bValid = m_dict.validateTagForChunk(ws0.form, ws0.tag))))\r\n\t\t\t\t{\r\n\t\t\t\t\tString seq = sent.substring(s.curidx, sent_len);\r\n\t\t\t\t\tfor (String spqf1: m_dict.getTagCandidatesForSequence(seq))\r\n\t\t\t\t\t\tl.add(SDAction.getShiftTagAction(spqf1));\r\n\t\t\t\t}\r\n\t\t\t}\r\n//\t\t\tif (l.size() == 0) Console.writeLine(s.toString());\r\n\t\t\tassert (ds != Decision.NA || l.size() > 0);\r\n\t\t}\r\n\r\n\t\tif (m_bParse && ws1 != null)\r\n\t\t{\r\n\t\t\t/* If the word has a child, its tag has been already validated. */\r\n\t\t\tif (ws0c_size > 0 || s.idend < s.curidx ||\r\n\t\t\t\t\t(!m_bValidateTag || (!bValidated || bValid) && (bValidated || m_dict.validateTagForChunk(ws0.form, ws0.tag)) ))\r\n\t\t\t{\r\n\t\t\t\tif (!ws1.isRoot() && (!m_bGoldArc || goldAct == SDAction.REDUCE_LEFT || goldAct == SDAction.APPEND || goldAct == SDAction.NOT_AVAILABLE))\r\n\t\t\t\t\tl.add(SDAction.REDUCE_LEFT);\r\n\t\t\t\tif ((!ws1.isRoot() || s.curidx == sent_len) && (!m_bGoldArc || goldAct == SDAction.REDUCE_RIGHT || goldAct == SDAction.APPEND || goldAct == SDAction.NOT_AVAILABLE))\r\n\t\t\t\t\tl.add(SDAction.REDUCE_RIGHT);\r\n\t\t\t}\r\n\t\t}\r\n\r\n//\t\tif (l.size() == 0) Console.writeLine(s.toString());\r\n\t\tassert (!l.contains(null));\r\n\t\tassert (l.size() > 0);\r\n\t\t\r\n\t\treturn l;\r\n\t}", "private Action bestActionFromFinishedTree() {\n return Collections.max(validActionsDiscretized, Comparator.comparing(\n c -> root.getActionReward(c) / (double) root.getActionVisits(c)));\n }", "public List<Action> getActions(){return actions;}", "public ActionUtilisateur choisirUneAction() ;", "void doNextPlannedAction(ArrayList<WebElement> possibleTargets) {\n String action = futureTargets.pop();\n\n if (action.equals(composeWebviewBackMessage())) {pathFromStart.remove(pathFromStart.size()-1);}\n else if (isClickButton(action) && !isInput(possibleTargets.get(0))) {pathFromStart.add(action);}\n\n doAction(action, possibleTargets);\n }", "@SuppressWarnings(\"LogAndThrow\") // Thrown exception shown in user output, not info logs.\n @Override\n public ActionStepOrResult run(Environment env)\n throws LostInputsActionExecutionException, InterruptedException {\n try (SilentCloseable c =\n profiler.profileAction(\n ProfilerTask.ACTION,\n action.getMnemonic(),\n action.describe(),\n action.getPrimaryOutput().getExecPathString(),\n getOwnerLabelAsString(action))) {\n String message = action.getProgressMessage();\n if (message != null) {\n reporter.startTask(null, prependExecPhaseStats(message));\n }\n\n boolean lostInputs = false;\n\n try {\n ActionStartedEvent event = new ActionStartedEvent(action, actionStartTimeNanos);\n if (statusReporter != null) {\n statusReporter.updateStatus(event);\n }\n env.getListener().post(event);\n if (actionFileSystemType().supportsLocalActions()) {\n try (SilentCloseable d = profiler.profile(ProfilerTask.INFO, \"action.prepare\")) {\n // This call generally deletes any files at locations that are declared outputs of the\n // action, although some actions perform additional work, while others intentionally\n // keep previous outputs in place.\n action.prepare(\n actionExecutionContext.getExecRoot(),\n actionExecutionContext.getPathResolver(),\n outputService != null ? outputService.bulkDeleter() : null,\n useArchivedTreeArtifacts(action));\n } catch (IOException e) {\n logger.atWarning().withCause(e).log(\n \"failed to delete output files before executing action: '%s'\", action);\n throw toActionExecutionException(\n \"failed to delete output files before executing action\",\n e,\n action,\n null,\n Code.ACTION_OUTPUTS_DELETION_FAILURE);\n }\n }\n\n if (actionFileSystemType().inMemoryFileSystem()) {\n // There's nothing to delete when the action file system is used, but we must ensure\n // that the output directories for stdout and stderr exist.\n setupActionFsFileOutErr(actionExecutionContext.getFileOutErr(), action);\n createActionFsOutputDirectories(action, actionExecutionContext.getPathResolver());\n } else {\n createOutputDirectories(action);\n }\n\n return executeAction(env.getListener(), action);\n } catch (LostInputsActionExecutionException e) {\n lostInputs = true;\n throw e;\n } catch (ActionExecutionException e) {\n return ActionStepOrResult.of(e);\n } finally {\n notifyActionCompletion(env.getListener(), !lostInputs);\n }\n }\n }", "private boolean isActionValid(List<Integer> list,List<Integer> list2) {\n\t\tint sum = listElementSum(sumLists(list,list2));\n\t\tif (sum>ventureManager.getMaxManufacturingFunds()) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public List<Action> getActions() {\n\n if (actions != null)\n return new ArrayList<>(actions.values());\n else\n return new ArrayList<>();\n\n }", "public abstract Action getAction();", "public abstract ActionInMatch act();", "public boolean hasAction() {\n return Check.hasLength(action);\n }", "public Action getAction(String actionName) {\r\n try {\r\n return processModel.getAction(actionName);\r\n } catch (WorkflowException we) {\r\n return null;\r\n }\r\n }", "public boolean check(String action) {\n final boolean isMappingUpdateAction = isMappingUpdateAction(action);\n for (Group group : groups) {\n if (group.checkAction(action) || (isMappingUpdateAction && containsPrivilegeThatGrantsMappingUpdatesForBwc(group))) {\n return true;\n }\n }\n return false;\n }", "protected boolean invokeAction( int action )\n {\n switch ( action )\n {\n case ACTION_INVOKE:\n {\n clickButton();\n return true;\n }\n }\n return super.invokeAction( action );\n }", "private void usersCheckPermission(PermissionRequest.ActionType grantedAction, IEntity entity)\n {\n authGrantedUser();\n try {\n executeAction(grantedAction, entity);\n } catch (AccessDeniedException e) {\n fail(\"Action \" + grantedAction.name() + \" was granted but could not be executed \" + entity.getEntityName());\n }\n\n authNotGrantedUser();\n try {\n executeAction(grantedAction, entity);\n fail(\"Action \" + grantedAction.name() + \" was not granted but could be executed \" + entity.getEntityName());\n } catch (AccessDeniedException e) {\n //\n }\n }", "private List<Action> getActions(JSONArray actionsJsonArray) {\n List<Action> actions = null;\n\n try {\n if (actionsJsonArray != null) {\n actions = new ArrayList<Action>();\n for (int i = 0; i < actionsJsonArray.size(); i++) {\n JSONObject actionJsonObject = (JSONObject) actionsJsonArray.get(i);\n\n Action action = new Action();\n action.setType(((Integer) actionJsonObject.get(\"type\")).intValue());\n action.setQuestionSetId(getOptionalInteger(actionJsonObject, \"questionSetId\"));\n action.setMessageSetId(getOptionalInteger(actionJsonObject, \"messageSetId\"));\n action.setRuleSetId(getOptionalInteger(actionJsonObject, \"ruleSetId\"));\n\n actions.add(action);\n }\n }\n } catch (Exception ex) {\n logger.error(\"JSON - failed to deserialize actions\", ex);\n actions = null;\n }\n\n return actions;\n }", "public ReportResult validateStages() {\n\t\tReportResult report = new ReportResult(scriptName + \" Script Report\");\n\n\t\tLocation lastApplicableLocation; // The last location that the entity was moved to\n\t\tif (getActionsForStage(1).containsKey(StageAction.START)) {\n\t\t\treport.addCheckMessage(\"Stage 1 contains a starting point for the entity\", ResultType.SUCCESS);\n\t\t\tlastApplicableLocation = ((LocationComponent) getActionsForStage(1).get(StageAction.START)).getValue();\n\t\t} else {\n\t\t\treport.addCheckMessage(\"Stage 1 does NOT contain a starting point for the entity\", ResultType.ERROR);\n\t\t\treturn report; // Further validation requires a starting position as reference\n\t\t}\n\n\t\tfor (int i = 1; i <= amountOfStages; i++) {\n\t\t\tMap<StageAction, StageComponent> actions = getActionsForStage(i);\n\n\t\t\tif (actions.isEmpty()) {\n\t\t\t\treport.addCheckMessage(\"Stage \" + i + \" is redundant: Has no actions\", ResultType.WARN);\n\t\t\t\tcontinue; // Without any actions, there is nothing more to validate here\n\t\t\t}\n\n\t\t\tint stopActionOccurrences = 0;\n\t\t\tfor (StageAction action : actions.keySet()) {\n\t\t\t\tif (action.equals(StageAction.WALK_TO)) {\n\t\t\t\t\tLocation location = ((LocationComponent) actions.get(action)).getValue();\n\t\t\t\t\tif (location.distance(lastApplicableLocation) > 20) {\n\t\t\t\t\t\treport.addCheckMessage(\"A \" + StageAction.WALK_TO.name()\n\t\t\t\t\t\t\t\t\t\t+ \" (Stage \" + i + \") action is more than 20 blocks from the last location, \"\n\t\t\t\t\t\t\t\t\t\t+ \"which will cause an execution error\",\n\t\t\t\t\t\t\t\tResultType.ERROR);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treport.addCheckMessage(\n\t\t\t\t\t\t\t\t\"The entity at Stage \" + i + \" walks no more than 20 blocks from the last location\",\n\t\t\t\t\t\t\t\tResultType.SUCCESS);\n\t\t\t\t\t}\n\n\t\t\t\t\tlastApplicableLocation = location;\n\t\t\t\t} else if (action.equals(StageAction.STOP)) {\n\t\t\t\t\tstopActionOccurrences++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stopActionOccurrences == 0) {\n\t\t\t\treport.addCheckMessage(\"The script has no stop action meaning the entity won't despawn\",\n\t\t\t\t\t\tResultType.WARN);\n\t\t\t} else if (stopActionOccurrences > 1) {\n\t\t\t\treport.addCheckMessage(\"The script has a redundant stop action: More than 1 stop action found\",\n\t\t\t\t\t\tResultType.WARN);\n\t\t\t} else {\n\t\t\t\treport.addCheckMessage(\"There is a single stop action to end the script properly\", ResultType.SUCCESS);\n\t\t\t}\n\t\t}\n\n\t\treturn report;\n\t}", "public A getAction() {\r\n\t\treturn action;\r\n\t}", "public static void executeTask(Context context, String action) {\n if (ACTION_FETCH_NEXT_PAGE.equals(action)) {\n fetchNextPage(context);\n }\n }", "@Override\n\tpublic boolean setUp(Action action) {\n\t\tif (action == null)\n\t\t\treturn false;\n\t\t\n\t\t// ACTIONS THAT LEAD TO THIS STATE\n\t\tif (action.ID == StateActionRegistry.A.GO)\n\t\t{\n\t\t\tGo g = (Go) action;\n\t\t\tif (g.owner == null || (g.loc == null && g.locationOf == null))\n\t\t\t\t\treturn false;\n\t\t\towner = g.owner;\n\t\t\tif (g.loc != null)\n\t\t\t{\n\t\t\t\tloc = g.loc;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlocationOf = g.locationOf;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t\n\t\t// ACTIONS WHOSE PRECOND INCLUDES THIS STATE\n\t\tif (action.ID == StateActionRegistry.A.TAKE)\n\t\t{\n\t\t\tTake t = (Take) action;\n\t\t\tif (t.owner == null || t.taken == null)\n\t\t\t\treturn false;\n\t\t\towner = t.owner;\n\t\t\tlocationOf = t.taken;\n\t\t\treturn true;\n\t\t} else if (action.ID == StateActionRegistry.A.STEAL)\n\t\t{\n\t\t\t\n\t\t\tSteal s = (Steal) action;\n\t\t\tif (s.owner == null || s.stolen == null)\n\t\t\t\treturn false;\n\t\t\towner = s.owner;\n\t\t\tlocationOf = s.stolen;\n\t\t\treturn true;\n\t\t} else if (action.ID == StateActionRegistry.A.ASKTO)\n\t\t{\n\t\t\tAskTo a = (AskTo) action;\n\t\t\tif (a.asker == null || a.askee == null)\n\t\t\t\treturn false;\n\t\t\towner = a.asker;\n\t\t\tlocationOf = a.askee;\n\t\t\treturn true;\n\t\t} else if (action.ID == StateActionRegistry.A.GIVE)\n\t\t{\n\t\t\tGive g = (Give) action;\n\t\t\tif (g.giver == null || g.givee == null || g.obj == null || g.obj.owner != g.giver)\n\t\t\t\treturn false;\n\t\t\towner = g.giver;\n\t\t\tlocationOf = g.givee;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t\n\t\treturn false;\n\t}", "@SuppressWarnings(\"unchecked\")\n private static void parseActions() throws DataConversionException {\n \t\n \tlogger.info(\"Parsing actions !\");\n \t\n imagingActions = new ArrayList<ImagingAction>();\n \n SAXBuilder sxb = new SAXBuilder();\n Document document = null;\n try {\n String url = \"imaging-fdsdocument-actions.xml\";\n URI uri = ImagingActionsParser.class.getClassLoader().getResource(url).toURI();\n File actionsFileDefinition = new File(uri);\n document = sxb.build(actionsFileDefinition);\n } catch (Exception e) {\n logger.error(\"Cannot parse imaging actions xml !\");\n }\n\n Element racine = document.getRootElement();\n List<Element> actions = (List<Element>) racine.getChildren(\"action\");\n Iterator<Element> actionsIterator = actions.iterator();\n while (actionsIterator.hasNext()) {\n Element currentAction = actionsIterator.next();\n \n //Constructor put default values\n ImagingAction imagingAction = new ImagingAction();\n //ACTION NAME\n imagingAction.setName(currentAction.getChild(\"name\").getText());\n //ACTION TYPE\n Attribute attrType = currentAction.getAttribute(\"type\");\n if (attrType != null) {\n imagingAction.setType(attrType.getValue());\n if (attrType.getValue().equals(\"url\")) {\n \t//ACTION URL TARGET\n \tAttribute attrTarget = currentAction.getAttribute(\"target\");\n \timagingAction.setUrlTarget(attrTarget.getValue());\n }\n }\n //ACTION URL\n Element urlElement = currentAction.getChild(\"url\");\n if (urlElement != null) {\n imagingAction.setUrl(urlElement.getText());\n }\n //ACTION EVALUATOR\n Element evaluatorsElement = currentAction.getChild(\"evaluators\");\n if (evaluatorsElement != null) {\n\t List<Element> evaluators = (List<Element>) evaluatorsElement.getChildren(\"evaluator\");\n\t Iterator<Element> evalIterator = evaluators.iterator();\n\t while (evalIterator.hasNext()) {\n\t Element evaluator = evalIterator.next();\n\t Attribute negateAttribute = evaluator.getAttribute(\"negate\");\n\t boolean negate = false;\n\t if (negateAttribute != null && negateAttribute.getBooleanValue()) {\n\t negate = true;\n\t }\n\t imagingAction.addEvaluator(new ImagingActionEvaluator(evaluator.getText(), negate));\n\t }\n }\n //ACTION DISPLAY VIEWS\n Element displayElement = currentAction.getChild(\"display\");\n if (displayElement != null) {\n\t List<Element> views = (List<Element>) displayElement.getChildren(\"view\");\n\t Iterator<Element> viewIterator = views.iterator();\n\t while (viewIterator.hasNext()) {\n\t Element view = viewIterator.next();\n\t imagingAction.addView(view.getText());\n\t }\n }\n imagingActions.add(imagingAction);\n }\n }", "public void actions() {\n\t\t\tProvider p = array_provider[theTask.int_list_providers_that_tried_task.get(0)];\n\t\t\t\n\t\t\t//there is a percentage of probability that the user will fail to complete the task\n\t\t\tif(random.draw((double)PERCENTAGE_TASK_FAILURE/100)){ // SUCCESS\n\n\t\t\t\ttot_success_tasks++;\n\t \tthrough_time += time() - theTask.entryTime;\n\t\t\t\ttheTask.out();\n\t\t\t\t\n\t\t\t\tif(FIXED_EARNING_FOR_TASK) earning_McSense = earning_McSense + FIXED_EARNING_VALUE;\n\t\t\t\telse {\n\n\t\t\t\t\t//Provider p = (Provider) theTask.providers_that_tried_task.first();\n\t\t\t\t\tearning_McSense = earning_McSense + (p.min_price*PERCENTAGE_EARNING)/100;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\t\t\telse { // FAILURE\n\t\t\t\t//we should check again and if the check fails insert the task in rescheduled_waiting\n\t\t\t\ttheTask.into(taskrescheduled);\n\t\t\t\ttot_failed_tasks++;\n\t\t\t\t//new StartTaskExecution(theTask).schedule(time());\n\n\t\t\t}\n\t\t\t// the provider frees one slot\n\t\t\tp.number_of_task_executing--;\n\t\t\ttot_scheduled_completed_in_good_or_bad_tasks++;\n\n \t}", "public void clickFailure(ActionEvent actionEvent) {\n current.getSelector().update(Selector.AnswerType.FAILURE);\n nextCard();\n }" ]
[ "0.57666147", "0.57427406", "0.5741162", "0.5718773", "0.57117635", "0.55471325", "0.55257547", "0.5508923", "0.5445909", "0.5426014", "0.54076415", "0.53779525", "0.535552", "0.534268", "0.5270795", "0.52272403", "0.5215759", "0.5213977", "0.5159851", "0.51562417", "0.5145186", "0.51210994", "0.51061857", "0.50600076", "0.50401545", "0.50198674", "0.5004663", "0.5003488", "0.49760735", "0.49611744", "0.49392295", "0.49277315", "0.49108794", "0.4892733", "0.48846316", "0.48681477", "0.48663235", "0.48663235", "0.4863317", "0.48613894", "0.4860598", "0.48478225", "0.48403955", "0.48298806", "0.4827059", "0.48237616", "0.48237213", "0.48145488", "0.4813461", "0.48097515", "0.48070726", "0.4801775", "0.47750524", "0.47722584", "0.4753846", "0.47493523", "0.4748166", "0.47388622", "0.4726129", "0.47143438", "0.47093555", "0.47004157", "0.46968362", "0.46968362", "0.46968362", "0.46948484", "0.46948484", "0.46948484", "0.46933743", "0.46865627", "0.46851063", "0.46827522", "0.46765435", "0.4674685", "0.46735746", "0.46718416", "0.46659356", "0.46625376", "0.46603557", "0.46594715", "0.46583116", "0.46437162", "0.4625805", "0.46253312", "0.46238038", "0.4613413", "0.46018842", "0.45927745", "0.45862588", "0.4583709", "0.4580418", "0.45740545", "0.45685643", "0.4568235", "0.45639008", "0.4560846", "0.45581236", "0.45544082", "0.4549091", "0.45482755" ]
0.48790807
35
Of step Convert as state to a checkerboard.
public int[][] stateToCheckerboard(int paraState) { int[][] resultCheckerboard = new int[SIZE][SIZE]; int tempValue = paraState; for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { resultCheckerboard[i][j] = (tempValue % SIZE); tempValue /= SIZE; } // Of for j } // Of for i return resultCheckerboard; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void stateCheckerboardConvertionTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17087 };\n\n\t\tint tempState;\n\t\tint[][] tempCheckerboard;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempCheckerboard = tempEnvironment.stateToCheckerboard(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The checkerboard of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.deepToString(tempCheckerboard));\n\t\t\ttempState = tempEnvironment.checkerboardToState(tempCheckerboard);\n\t\t\tSystem.out.println(\"The state ID is \" + tempState);\n\t\t} // Of for i\n\n\t}", "private int checkerboardToState(int[][] paraCheckerboard) {\n\t\tint resultState = 0;\n\t\tint tempExponential = 1;\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultState += paraCheckerboard[i][j] * tempExponential;\n\t\t\t\ttempExponential *= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultState;\n\t}", "protected void takeTurn(int[][] boardState)\n {\n \n }", "private void bfs(int[][] board){\n int[][] original = {{1,2,3},{4,5,0}};\n LinkedList<Cell> queue = new LinkedList<>();\n HashMap<Cell,int[][]> states = new HashMap<Cell,int[][]>();\n Set<String> seen = new HashSet<>();\n queue.offer(new Cell(1,2));\n states.put(queue.peekFirst(),original);\n int step = 0;\n while(step <= maxStep){\n int sz = queue.size();\n while(sz-- > 0){\n Cell cur = queue.pollFirst();\n int[][] curBoard = states.get(cur);\n if(seen.contains(this.toStr(curBoard))){\n continue;\n }\n seen.add(this.toStr(curBoard));\n \n if (isSame(curBoard,board)){\n this.res = step;\n return;\n }\n // move around\n for(int i = 0; i < 4; ++i){\n int r = cur.row + dr[i];\n int c = cur.col + dc[i];\n if(r < 0 || c < 0 || r > 1 || c > 2) continue; \n Cell next = new Cell(r, c);\n queue.offer(next);\n int[][] nextboard = this.clone(curBoard);\n nextboard[cur.row][cur.col] = nextboard[r][c];\n nextboard[r][c] = 0;\n states.put(next,nextboard);\n }\n }\n ++step;\n }\n return;\n }", "public int stepTwo(int step)\n\t{\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tfor(int j=0;j<n;j++)\n\t\t\t{\n\t\t\t\tif(cost[i][j]==0 && rowLabelMultiple[i]==0 && columnLabelMultiple[j]==0)\n\t\t\t\t{\n\t\t\t\t\tmatrix[i][j]=1;\n\t\t\t\t\trowLabelMultiple[i]=1;\n\t\t\t\t\tcolumnLabelMultiple[j]=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int k=0;k<n;k++)\n\t\t{\n\t\t\trowLabelMultiple[k]=0;\n\t\t\tcolumnLabelMultiple[k]=0;\n\t\t}\n\t\tstep=3;\n\t\treturn step;\n\t}", "public void step() {\n\t\t// calculate new values\n\t\tfor (int x = 0; x < gridX; x++) {\n\t\t\tfor (int y = 0; y < gridY; y++) {\n\t\t\t\tCell c = cells[x + (y * gridX)];\n\t\t\t\tCell newCell = newCells[x + (y * gridX)];\n\n\t\t\t\tint neighborCount = sameNeighborCount(x, y);\n\n\t\t\t\tif (c.isActive) {\n\t\t\t\t\tif (neighborCount < 2) {\n\t\t\t\t\t\t// all alone, die of loneliness\n\t\t\t\t\t\tnewCell.isActive = false;\n\t\t\t\t\t\tnewCell.cellColor = app.color(deadColor);\n\t\t\t\t\t}\n\t\t\t\t\telse if (neighborCount > 3) {\n\t\t\t\t\t\tnewCell.isActive = false;\n\t\t\t\t\t\tnewCell.cellColor = app.color(deadColor);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Dead cells can be reborn if surrounded by enough neighbors of the same\n\t\t\t\t\t// color. The cell will be reborn using the most prominent color.\n\t\t\t\t\tint populousColor = mostPopulousColor(x, y);\n\t\t\t\t\tif (populousColor > Integer.MIN_VALUE) {\n\t\t\t\t\t\tnewCell.isActive = true;\n\t\t\t\t\t\tnewCell.cellColor = populousColor;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// update to new state\n\t\tfor (int i = 0; i < cells.length; i++) {\n\t\t\tcells[i].isActive = newCells[i].isActive;\n\t\t\tcells[i].cellColor = newCells[i].cellColor;\n\t\t}\n\t}", "public static int activityStateToWorkItemState( int newState )\r\n {\r\n // The states actually have the same ordinals.\r\n return newState;\r\n }", "public void oneStep(){\n // the rules\n\n for(int i = 0; i< board.length; i++){\n for(int j = 0; j <board[0].length; j++){\n if((neighbors(i,j) ==3)){\n\n board[i][j] = 1;\n }\n else if( (neighbors(i,j) == 2 && previous[i][j] == 1)){\n board[i][j] = 1;\n }\n else {\n board[i][j] = 0;\n }\n System.out.print(board[i][j]);\n }\n System.out.println(\"\");\n }\n for(int i = 0; i <board.length; i++){\n for(int j = 0; j < board[0].length; j++){\n previous[i][j] = board[i][j];\n }\n }\n }", "public Result(BoardState board) {\n this.board = board;\n time = 0;\n }", "@Test\n public void genStateTransferMetric() {\n TreeMap<String, Integer> stat = new TreeMap<>();\n int currState = 8;\n for (int i = 1; i < numSteps; i++) {\n int nextStates = getNextState(currState);\n stat.compute(currState + \"-\" + nextStates, (k, v) -> v == null ? 1 : v + 1);\n currState = nextStates;\n }\n stat.forEach((k, v) -> System.out.printf(\"%s:%f\\n\", k.replace('-', ':'), (double) v / numSteps));\n }", "LabState state();", "public void testStep() {\n\n DT_TractographyImage crossing = Images.getCrossing();\n\n FACT_FibreTracker tracker = new FACT_FibreTracker(crossing);\n\n Vector3D[] pds = crossing.getPDs(1,1,1);\n\n Vector3D step = tracker.getFirstStep(new Point3D(1.5 * Images.xVoxelDim, 1.2 * Images.yVoxelDim, 1.1 * Images.zVoxelDim), 0, true);\n\n assertEquals(1.0, pds[0].dot(step.normalized()), 1E-8);\n\n assertEquals(Images.xVoxelDim / 2.0, step.mod(), 0.05);\n \n step = tracker.getFirstStep(new Point3D(1.5 * Images.xVoxelDim, 1.2 * Images.yVoxelDim, 1.1 * Images.zVoxelDim), 0, false);\n\n assertEquals(-1.0, pds[0].dot(step.normalized()), 1E-8);\n\n step = tracker.getFirstStep(new Point3D(1.5 * Images.xVoxelDim, 1.2 * Images.yVoxelDim, 1.1 * Images.zVoxelDim), 1, true);\n\n assertEquals(1.0, pds[1].dot(step.normalized()), 1E-8);\n\n\n for (int i = 0; i < 2; i++) {\n\n step = tracker.getNextStep(new Point3D(1.5 * Images.xVoxelDim, 1.2 * Images.yVoxelDim, 1.1 * Images.zVoxelDim), new Vector3D(pds[i].x + 0.01, pds[i].y + 0.02, pds[i].z + 0.03).normalized());\n\n assertEquals(1.0, pds[i].dot(step.normalized()), 1E-8);\n\n }\n\n \n }", "public String stateToCheckerboardString(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\tString resultString = \"\\r\\n\";\n\t\t//resultString += \"Checkerboard state: \\r\\n\";\n\t\tfor (int i = 0; i < tempCheckerboard.length; i++) {\n\t\t\tfor (int j = 0; j < tempCheckerboard[0].length; j++) {\n\t\t\t\tif (tempCheckerboard[i][j] == WHITE) {\n\t\t\t\t\tresultString += \"o \";\n\t\t\t\t} else if (tempCheckerboard[i][j] == BLACK) {\n\t\t\t\t\tresultString += \"x \";\n\t\t\t\t} else {\n\t\t\t\t\tresultString += \"- \";\n\t\t\t\t}//Of if\n\t\t\t}//Of for j\n\t\t\tresultString += \"\\r\\n\";\n\t\t}//Of for i\n\t\t\n\t\t//resultString += currentState;\n\t\treturn resultString;\n\t}", "public void step(){\n //System.out.println(\"step\");\n //display();\n Cell[][] copy = new Cell[world.length][world.length];\n for(int r = 0; r<world.length;r++){\n for(int c=0; c<world[r].length;c++){\n copy [r][c] = new Cell();\n copy[r][c].setState(world[r][c].isAlive());\n }\n }\n\n for(int r = 0; r<world.length;r++){\n for(int c=0; c<world[r].length;c++){ \n int n = getNumberOfLiveNeighbours(r,c);\n if(world[r][c].isAlive()){\n if(n<2||n>3){\n copy[r][c].setState(false);\n }\n }else{\n if(n==3){\n copy[r][c].setState(true);\n }\n }\n }\n }\n for(int r = 0; r<world.length;r++){\n for(int c=0; c<world[r].length;c++){\n world[r][c].setState(copy[r][c].isAlive());\n }\n }\n }", "public TurnState step() {\n ReadOnlyHistory history = board.viewHistory();\n \n if (!isGameOver) {\n Player next = nextPlayer();\n Move move = null;\n \n try {\n final long startTime = System.currentTimeMillis();\n move = next.play(history);\n next.addTime(System.currentTimeMillis() - startTime);\n \n if (next.getTime() >= timeLimit || !board.isValid(move)){\n isGameOver = true;\n }\n else {\n board.set(move);\n }\n }\n catch (IllegalArgumentException ex) {\n System.err.println(\"Player \" + next.getName() + \": \" + ex.getMessage());\n isGameOver = true;\n }\n catch (ArrayIndexOutOfBoundsException ex) {\n System.err.println(\"Player \" + next.getName() + \": \" + ex.getMessage());\n isGameOver = true;\n }\n \n return new TurnState(next, move, isGameOver);\n }\n else {\n return new TurnState(null, null, true);\n }\n }", "State(int[][] startBoardState, int [][] goalBoardState){\n this.currentBoardState = startBoardState;\n this.goalBoardState = goalBoardState;\n this.g_cost = 0;\n this.parentState = null;\n }", "@Override\n public WorkflowStep fail() {\n this.boardChangeDetected = 0;\n QQTetris.calculationThread.cancel();\n return INITIAL_BOARD.execute(false);\n }", "@Test\r\n\tpublic void testDirectCheck() {\n\t\tBoard b = new Board();\r\n\t\tb.state = new Piece[][] //set up the board in the standard way\r\n\t\t\t\t{\r\n\t\t\t\t{new Rook(\"b\"), new Knight(\"b\"),new Bishop(\"b\"),new Queen(\"b\"), new King(\"b\"), new Bishop(\"b\"),\r\n\t\t\t\t\tnew Knight(\"b\"), new Rook(\"b\")},\r\n\t\t\t\t{new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),\r\n\t\t\t\t\t\tnew Pawn(\"b\")},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,new Knight(\"b\"),null,null},\r\n\t\t\t\t{new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),\r\n\t\t\t\t\tnew Pawn(\"w\")},\r\n\t\t\t\t{new Rook(\"w\"), new Knight(\"w\"),new Bishop(\"w\"),new Queen(\"w\"), new King(\"w\"), new Bishop(\"w\"),\r\n\t\t\t\t\tnew Knight(\"w\"), new Rook(\"w\")}\r\n\t\t\t\t};\r\n\t\tassertTrue(b.whiteCheck());\t\r\n\t}", "public void step(int paraAction) throws IllegalActionException {\n\t\t// Step 1. Is this action legal?\n\t\tint tempRow = paraAction / SIZE;\n\t\tint tempColumn = paraAction % SIZE;\n\t\tif (checkerboard[tempRow][tempColumn] != EMPTY) {\n\t\t\tSystem.out.println(\"The checkerboard state is: \" + Arrays.deepToString(checkerboard));\n\t\t\tthrow new IllegalActionException(\"The position (\" + tempRow + \", \" + tempColumn\n\t\t\t\t\t+ \" is already occupied \" + checkerboard[tempRow][tempColumn]);\n\t\t} // Of if\n\n\t\t// Step 2. Change the state of the checkerboard.\n\t\t//SimpleTools.variableTrackingOutput(\n\t\t//\t\t\"Assign \" + currentPlayer + \" to (\" + tempRow + \", \" + tempColumn + \").\");\n\t\tSimpleTools.variableTrackingOutput(\"\" + paraAction + \", \");\n\t\tcheckerboard[tempRow][tempColumn] = currentPlayer;\n\t\tcurrentState = checkerboardToState(checkerboard);\n\n\t\tgameSituation = computeGameSituation();\n\t\t//SimpleTools.variableTrackingOutput(\"Environment current stage: \" + currentState + \", \");\n\t\t//SimpleTools.variableTrackingOutput(\"gameSituation: \" + gameSituation + \", \");\n\n\t\tcurrentRouteStates[currentRouteLength] = currentState;\n\t\tcurrentRouteLength++;\n\t\t\n\t\t// Step 3. Now it's the turn of the other player.\n\t\tif (currentPlayer == WHITE) {\n\t\t\tcurrentPlayer = BLACK;\n\t\t} else {\n\t\t\tcurrentPlayer = WHITE;\n\t\t} // Of if\n\t}", "public java.lang.Byte getCheckStep () {\n\t\treturn checkStep;\n\t}", "public abstract ExplicitMachineState convertToExplicitMachineState(MachineState state);", "public void startGameState(){\n\n ArrayList<Integer> checkeredSpaces = new ArrayList<Integer>(Arrays.asList(1, 3, 5, 7, 8, 10, 12, 14, 17, 19, 21,\n 23, 24, 26, 28, 30, 33, 35, 37, 39, 41, 42, 44, 46, 48,\n 51, 53, 55, 56, 58, 60, 62));\n\n\n\n for(int i =0; i < 63; i++){\n if(!checkeredSpaces.contains(i)){\n //set all black spaces to null on the board\n mCheckerBoard.add(null);\n }\n else if(i < 24){\n //set first three rows to red checkers\n mCheckerBoard.add(new Checker((i/2), true));\n }\n else if(i < 40){\n //set middle two rows to null\n mCheckerBoard.add(null);\n }\n else{\n //set top three row to black checkers\n mCheckerBoard.add(new Checker((i/2), false));\n }\n }\n\n }", "public State getState(Action action) { \n\t\tState newstate = new State(getTractor(), getK(), getMax(), getRows(), getColumns());\n\t\tfor (int i = 0; i < getRows(); i++) {\n\t\t\tfor (int j = 0; j < getColumns(); j++) {\n\t\t\t\tnewstate.cells[i][j] = new Square(i, j, cells[i][j].getSand()); \n\t\t\t}\n\t\t} \n\t\tnewstate.getSquare(newstate.getTractor()).setSand(newstate.getSquare(newstate.getTractor()).getSand()-action.distributedAmount());\n\t\tnewstate.tractor=(Square) action.getMovement();\n\t\tSquare[] adjacents = action.getAdjacents();\n\t\tint[] values = action.getValues();\n\n\t\tfor (int i = 0; i < adjacents.length; i++) {\n\t\t\tnewstate.getSquare(adjacents[i]).setSand(newstate.getSquare(adjacents[i]).getSand()+values[i]);\n\t\t}\n\t\treturn newstate;\n\t}", "@Override\n public void onAnimationStepDone(Board3D board) {\n boardIterator.next();\n listener.onBoardStateChanged(this);\n }", "StepFSM(StepDetector detector) {\n super(\"StepStateful FSM\", new MemoryPersisterImpl<>(getStates(), s0));\n initTransitions();\n this.detector = detector;\n }", "private void nextState() {\n int x;\n int y;\n y = st3;\n x = (st0 & MASK) ^ st1 ^ st2;\n x ^= (x << SH0);\n y ^= (y >>> SH0) ^ x;\n st0 = st1;\n st1 = st2;\n st2 = x ^ (y << SH1);\n st3 = y;\n st1 ^= parameter.getMat1(y);\n st2 ^= parameter.getMat2(y);\n }", "public void stepSeven(int step)\n\t{\n\t\tassignCounter=n;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tfor(int j=0;j<n;j++)\n\t\t\t{\n\t\t\t\tif(matrix[i][j]==1)\n\t\t\t\t{\n\t\t\t\t\trowLabelFinalValues[i]=j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public CheckerBoard(int size) {\n super(new int[size * tilesPerSide][size * tilesPerSide][3]);\n for (int y = 0; y < this.getHeight(); ++y) {\n for (int x = 0; x < this.getWidth(); ++x) {\n for (int channel = 0; channel < 3; ++channel) {\n this.data[y][x][channel] = ((x / size + y / size) % 2 == 1) ? 0 : 255;\n }\n }\n }\n }", "@Test\n public void stateExample2() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl(7);\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \" O O O O O\\n\" +\n \" O O O O O O\\n\" +\n \"O O O O O O O\", exampleBoard.getGameState());\n }", "public abstract TrackBehaviourStateful convertToStateful(World world, BlockPos pos, IBlockState state);", "void printBoardState(Piece[] B,Player J,int N);", "public IFsm transitionTo(Class<? extends IState> p_newState) throws Exception;", "@Override\r\n\tpublic void step(SimState state) {\r\n\r\n\t}", "public void gameOfLife(int[][] board) {\n int m = board.length;\n int n = ( m > 0 ? board[0].length : 0);\n int[] dx = {-1, -1, -1, 0, 1, 1, 1, 0};\n int[] dy = {-1, 0, 1, 1, 1, 0, -1, -1};\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n int cnt = 0;\n /**\n * Count the neighbors with live status.\n */\n for (int k = 0; k < 8; k++) {\n int x = i + dx[k];\n int y = j + dy[k];\n /**\n * Notice using board[x][y] here, not board[i][j]\n * The next state is created by applying the above rules simultaneously to every cell in the current state,\n * so we concern state==1 and state==2(both states indicate live)\n */\n if (x >= 0 && x < m && y >= 0 && y < n && (board[x][y] == 1 || board[x][y] == 2)) {\n cnt++;\n }\n }\n if (board[i][j] == 1 && (cnt < 2 || cnt > 3)) {\n /**\n * From live to dead.\n */\n board[i][j] = 2;\n }\n if (board[i][j] == 0 && cnt == 3) {\n /**\n * From dead to live\n */\n board[i][j] = 3;\n }\n }\n }\n /**\n * Restore state back to 0 and 1.\n */\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n board[i][j] %= 2;\n }\n }\n }", "private static List<State<StepStateful>> getStates() {\n List<State<StepStateful>> states = new LinkedList<>();\n states.add(s0);\n states.add(s1);\n states.add(s2);\n states.add(s3);\n states.add(s4);\n states.add(s5);\n states.add(s6);\n return states;\n }", "void changeState(Spreadable spreadable, State from, State to, int count);", "@Test\n public void stateExample4() {\n MarbleSolitaireModel exampleBoard =\n new TriangleSolitaireModelImpl(7, 6, 6);\n assertEquals(\" O\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \" O O O O O\\n\" +\n \" O O O O O O\\n\" +\n \"O O O O O O _\", exampleBoard.getGameState());\n }", "public void step() {\n\n if (n8) {\n // Your code here\n \n \n //by here, after your code, the cellsNext array should be updated properly\n }\n\n if (!n8) { // neighbours-4\n // your code here\n\n //by here, after your code, the cellsNext array should be updated properly\n }\n\n // Flip the arrays now.\n stepCounter++;\n\ttmp = cellsNow;\n cellsNow = cellsNext;\n\tcellsNext = tmp;\n\n }", "void checkerboard(int checkerSquareArea);", "public interface AbstractState {\r\n abstract void toNextState(ChessBoard chessBoard,AbstractState state);\r\n}", "protected abstract int newState();", "public static int activityStateToProcessState( int newState )\r\n {\r\n // The states actually have the same ordinals.\r\n return newState;\r\n }", "@Test\n public void stateExample1() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl();\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \"O O O O O\", exampleBoard.getGameState());\n }", "public int computeGameSituation(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\t// System.out.println(\"The checkerboard is: \" +\n\t\t// Arrays.deepToString(tempCheckerboard));\n\n\t\treturn computeGameSituation(tempCheckerboard);\n\t}", "private static int evalState(GameState state){\n Move m = state.getMove();\n int counter = 0;\n\n // return directly if we encouter win or loss\n if(m.isXWin()){\n return 10000;\n }\n else if(m.isOWin()){\n return -1;\n }\n\n Vector<Integer> points = new Vector<Integer>();\n points.setSize(state.BOARD_SIZE*2+2);\n int player;\n Collections.fill(points, 1);\n int scaling = 4;\n int value = 0;\n\n for(int row = 0; row < state.BOARD_SIZE; row ++){\n for(int col = 0; col < state.BOARD_SIZE; col ++){\n player = state.at(row, col);\n\n // add points to the vector, increase by a factor for every new entry\n if(player == 1){\n points.set(row, points.get(row)*scaling);\n points.add(state.BOARD_SIZE + col, points.get(state.BOARD_SIZE - 1 + col)*scaling);\n\n // if it's in the first diagonal\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, points.get(state.BOARD_SIZE*2)*scaling);\n }\n\n // checking other diagonal\n if(counter%state.BOARD_SIZE-1 == 0 && row+col != 0){\n points.add(state.BOARD_SIZE*2 + 1, points.get(state.BOARD_SIZE*2)*scaling);\n }\n }\n // if an enemy player is encoutered null the value of the row/col\n else if(player == 2){\n points.set(row, 0);\n points.set(state.BOARD_SIZE + col, 0);\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, 0);\n }\n if(counter%state.BOARD_SIZE-1 == 0){\n points.add(state.BOARD_SIZE*2 + 1, 0);\n }\n }\n counter++;\n }\n }\n\n // if we have nulled the point we don't count it for the value of the state\n for(Integer i: points){\n if(i > 1){\n value += i;\n }\n }\n //System.err.println(\"Value: \" + value);\n return value;\n }", "public StateofPancakes(StateofPancakes state) {\r\n N = state.N;\r\n\tcurr_state = new int[N];\r\n for(int i=0; i<N; i++) \r\n curr_state[i] = state.curr_state[i];\r\n}", "private MyGameState(int[][] board, int turn) {\n this.board = board;\n this.turn = turn;\n }", "void applyToComputationState();", "public void setCheckStep (java.lang.Byte checkStep) {\n\t\tthis.checkStep = checkStep;\n\t}", "@Test\n public void stateExample3() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl(3, 1);\n assertEquals(\" O\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O _ O O\\n\" +\n \"O O O O O\", exampleBoard.getGameState());\n }", "public int[][] toMatrix() \n {\n \tint[][] matrix = new int[2][7];\n \tfor (int i = 0; i < 14; ++i)\n \t\tmatrix[i/7][i%7] = state[i];\n \treturn matrix;\n }", "public static String[][] createBoardState() {\n String[][] initialBoardState = {\n {\"Rw\", \"Nw\", \"Bw\", \"Qw\", \"Kw\", \"Bw\", \"Nw\", \"Rw\"},\n {\"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\"},\n {\"Rb\", \"Nb\", \"Bb\", \"Qb\", \"Kb\", \"Bb\", \"Nb\", \"Rb\"}\n };\n\n return initialBoardState;\n }", "int getStep();", "int getStep();", "int getStep();", "@Test\n void step() {\n Fb2ConverterStateMachine state = new Fb2ConverterStateMachine();\n StringBuilder sb = new StringBuilder();\n WordsTokenizer wt = new WordsTokenizer(getOriginalText());\n while (wt.hasMoreTokens()) {\n String word = wt.nextToken();\n if (state.step(word)) {\n sb.append(word).append(\" \");\n }\n }\n assertEquals(\"test 1 . text- 2 text 0 text 6111 222 \", sb.toString());\n }", "@Override\n\tpublic void setState(State state) \n\t\t{ current = new PuzzleState(state.getString(state.getState()),\n\t\t\t\t\t\t\t\t\tstate.getString(state.getGoalState())); \n\t\t}", "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "public static void makeBoardChess() {\r\n \r\n white = new AllPiece(\"White\");\r\n black = new AllPiece(\"Black\");\r\n \r\n }", "@Override\n public WorkflowStep fail() {\n this.boardChangeDetected = 0;\n this.missingFutures = 0;\n this.missingTetromino = 0;\n return INITIAL_BOARD.execute(false);\n }", "public Checker convertToKing(Checker checker, Move move) {\n\t\t int type = 0;\n\t\t if(checker.getType() == 1) {\n\t\t\t checker.setType(3);\n\t\t\t type = 3;\n\t\t } else if (checker.getType() == 2) {\n\t\t\t checker.setType(4);\n\t\t\t type = 4;\n\t\t }\n\t\t \n\t\t board.getBoard()[move.getyOrigin()][move.getxOrigin()] = 0;\n\t\tboard.getBoard()[move.getyMove()][move.getxMove()] = type;\n\t\t \n\t\treturn checker;\n\t\t \n\t\t \n\t }", "void onCheck(Chess.Color inCheckColor);", "public Sudoku(int[][] state) {\n\t\tfor (int i = 0; i < 9; i++) {\n\t\t\tfor (int j = 0; j < 9; j++) {\n\t\t\t\tthis.initialState[i][j] = this.currentState[i][j] = state[i][j];\n\t\t\t}\n\t\t}\n\t}", "@Override\n public WorkflowStep next() {\n QQTetris.captureScreenThread.setStarted(true);\n QQTetris.activate();\n return INITIAL_BOARD.execute();\n }", "public void oneTurn(){\n Integer[] previousTurn = Arrays.copyOf(this.board, this.board.length);\n\n // itero su previousTurn per costruire il board successivo\n for (int i=0;i<previousTurn.length;i++){\n\n // mi salvo la situazione della casella sx, se i==0 prendo l'ultima\n int left = previousTurn[previousTurn.length-1];\n if (i!=0)\n left = previousTurn[i-1];\n\n // mi salvo la situazione della casella dx, se i==ultima prendo zero\n int right = previousTurn[0];\n if (i!=previousTurn.length-1)\n right = previousTurn[i+1];\n \n // se a sx e dx c'è 0, metto 0\n // caso fine sottopopolazione (010->000)\n if (left == 0 && right == 0){\n this.board[i] = 0;\n \n // se a sx e dx c'è 1, metto 1 se c'era 0 e viceversa\n // caso nascita (101->111) e fine sovrappopolazione (111->101)\n } else if (left == 1 && right == 1)\n if (this.board[i] == 1)\n this.board[i] = 0;\n else\n this.board[i] = 1;\n \n // tutte le altre casistiche, lascio invariata la situazione\n \n }\n\n this.turn += 1;\n }", "public void next() {\n double[][] next = new double[size][size];\n for (int i = 0; i < size; i++) {\n for (int j = 0; j < size; j++) {\n double sum = 0.0;\n for (int k = 0; k < size; k++) {\n sum += state[i][k] * transition[k][j];\n }\n next[i][j] = sum;\n }\n }\n this.currentStep++;\n this.state = next;\n }", "abstract int steps();", "public int makeStep (int btnId, boolean isFlagUI){\n int indexY = btnId%cols;\n int indexX = btnId/cols;\n if (!isFlagUI)\n makeStepAuto(indexX,indexY);\n else {\n allTiles[indexX][indexY].setFlag(!allTiles[indexX][indexY].isFlag());\n if (!allTiles[indexX][indexY].isFlag())\n numOfFlagsLogic += 1;\n else\n numOfFlagsLogic -= 1;\n }\n return checksStatus(indexX,indexY);\n\n }", "@Override\n\tpublic String toString(){\n\t\treturn \"com.jcdeck.adversary.State Turn: \"+this.getTurn()+\" Depth: \"+this.depth;\n\t}", "public interface ScramState {\r\n\t/** Return the Node corresponding to McDiver's location in the graph. */\r\n\tNode currentNode();\r\n\r\n\t/** Return the Node associated with the exit from the sewer system.<br>\r\n\t * McDiver has to move to this Node in order to get out. */\r\n\tNode exit();\r\n\r\n\t/** Return a collection containing all the nodes in the graph.<br>\r\n\t * They are in no particular order. */\r\n\tCollection<Node> allNodes();\r\n\r\n\t/** Change McDiver's location to n.<br>\r\n\t * Throw an IllegalArgumentException if n is not directly connected to<br>\r\n\t * McDiver's location. */\r\n\tvoid moveTo(Node n);\r\n\r\n\t/** Return the steps remaining to get out of the sewer system.<br>\r\n\t * This value will change with every call to moveTo(Node),<br>\r\n\t * and if it reaches 0 before you get out, you have failed to get out. */\r\n\tint stepsToGo();\r\n}", "@Override\n public void toTurnPhase() {\n changePhase(new TurnPhase());\n }", "public void changeState(){\n\t\t//red - Green\n\t\tif (lights[0].isOn()){\n\t\t\tlights[0].turnOff();\n\t\t\tlights[2].turnOn();\n\t\t}\n\t\t\n\t\t//Green -yellow\n\t\telse if(lights[2].isOn()){\n\t\t\tlights[2].turnOff();\n\t\t\tlights[1].turnOn();\n\t\t}\n\t\t//yellow to red\n\t\telse if (lights[1].isOn()){\n\t\t\tlights[1].turnOff();\n\t\t\tlights[0].turnOn();\n\t\t}\n\t\t\n\t}", "public boolean Step(){\n\t\t\t\t\tboolean Result = true;\t\t\t\t\t\t// A vegso eredmeny: Stabil-e az aramkor\n\t\t\t\t\t_TEST stack = new _TEST();\t\t\t\t\t/* TEST */\n\t\t\t\t\tstack.PrintHeader(ID,\"\",\"true:boolean\");\t/* TEST */\n\t\t\t\t\tPreviousValue = Count();\t\t\t\t\t// Megnezzuk az elso futas erredmenyet\n\t\t\t\t\tinv0.Count();\t\t\t\t//feedback[0].Count(), elso ciklus\n\t\t\t\t\tPreviousValue = Count();\t//feedback 0 es 1 kozt magat frissiti\n\t\t\t\t\tinv0.Count();\t\t\t\t//feedback[0].Count(), masodik ciklus\n\t\t\t\t\tPreviousValue = Count();\t//frissiti magat. itt instabilitasi teszt jon a proto-ban\n\n\t\t\t\t\tstack.PrintTail(ID,\"\",Result + \":boolean\");\t/* TEST */\n\t\t\t\t\treturn Result;\n\t\t\t\t}", "void nextState();", "void runState() {\n\t\tp.displaySheet();\n\t\tcurState.run();\n\t}", "public List<Transition> getTransitionsToState(final State to) {\n\t\tList<Transition> toReturn = transitionArrayToStateMap.get(to);\n\t\tif (toReturn == null) {\n\t\t\tfinal List<Transition> list = transitionToStateMap.get(to);\n\t\t\ttoReturn = list;\n\t\t\ttransitionArrayToStateMap.put(to, toReturn);\n\t\t}\n\t\treturn toReturn;\n\t}", "public Cube222 () {\n\t\tstate_ = new Cubie[8];\n\t\tstate_[0] = new Cubie('O','W','G',0); // front, clockwise\n\t\tstate_[1] = new Cubie('O','W','B',1);\n\t\tstate_[2] = new Cubie('R','W','B',2);\n\t\tstate_[3] = new Cubie('R','W','G',3);\n\t\tstate_[4] = new Cubie('O','Y','G',4); // back, behind front\n\t\tstate_[5] = new Cubie('O','Y','B',5);\n\t\tstate_[6] = new Cubie('R','Y','B',6);\n\t\tstate_[7] = new Cubie('R','Y','G',7);\n\t}", "private void initializeBoard(){\r\n checks =new int[][]{{0,2,0,2,0,2,0,2},\r\n {2,0,2,0,2,0,2,0},\r\n {0,2,0,2,0,2,0,2},\r\n {0,0,0,0,0,0,0,0},\r\n {0,0,0,0,0,0,0,0},\r\n {1,0,1,0,1,0,1,0},\r\n {0,1,0,1,0,1,0,1},\r\n {1,0,1,0,1,0,1,0}};\r\n }", "@Override\n public WorkflowStep next() {\n this.boardChangeDetected = 0;\n this.missingFutures = 0;\n this.missingTetromino = 0;\n startCalculator(false);\n return DETECT_ANOMALIES;\n }", "void passivateFlowStorer();", "private void Step() {\n\t\tif (numberOfColumns == currentCycle) {\n\t\t\treturn;\n\t\t}\n\t\tif (numberOfRows != 1) {\n\n\t\t\tstall = 0;\n\t\t\tx = 0;\n\n\t\t\twhile (x < numberOfRows) {\n\t\t\t\tif (lstInstructionsPipeLine.get(x).issue_cycle == null) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (stall == 1) {\n\t\t\t\t\tDisplay_Stall(x, currentCycle);\n\t\t\t\t} else {\n\t\t\t\t\tswitch (lstInstructionsPipeLine.get(x).pipeline_stage) {\n\n\t\t\t\t\tcase \"IF\":\n\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \"ID\";\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\tfor (int i = (x - 1); i >= 0; i--) {\n\n\t\t\t\t\t\t\tif (lstInstructionsPipeLine.get(i).pipeline_stage.equals(\"EX\")\n\t\t\t\t\t\t\t\t\t&& lstInstructionsPipeLine.get(i).operator.functional_unit\n\t\t\t\t\t\t\t\t\t\t\t.equals(lstInstructionsPipeLine.get(x).operator.functional_unit)) {\n\t\t\t\t\t\t\t\t// *** Structural Hazard ***\n\t\t\t\t\t\t\t\tstall = 1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telse if ((lstInstructionsPipeLine.get(i).destination_register\n\t\t\t\t\t\t\t\t\t.equals(lstInstructionsPipeLine.get(x).source_register1)\n\t\t\t\t\t\t\t\t\t|| lstInstructionsPipeLine.get(i).destination_register\n\t\t\t\t\t\t\t\t\t\t\t.equals(lstInstructionsPipeLine.get(x).source_register2))) {\n\t\t\t\t\t\t\t\tif (dataForwarding == 1) {\n\n\t\t\t\t\t\t\t\t\tif (lstInstructionsPipeLine.get(i).operator.name.equals(\"ld\")\n\t\t\t\t\t\t\t\t\t\t\t|| lstInstructionsPipeLine.get(i).operator.name.equals(\"sd\")) {\n\t\t\t\t\t\t\t\t\t\tif (!lstInstructionsPipeLine.get(i).pipeline_stage.equals(\"WB\")\n\t\t\t\t\t\t\t\t\t\t\t\t&& !lstInstructionsPipeLine.get(i).pipeline_stage.equals(\" \")) {\n\t\t\t\t\t\t\t\t\t\t\t// ** RAW Hazard **\n\t\t\t\t\t\t\t\t\t\t\tstall = 1;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tif (!lstInstructionsPipeLine.get(i).pipeline_stage.equals(\"MEM\")\n\t\t\t\t\t\t\t\t\t\t\t\t&& !lstInstructionsPipeLine.get(i).pipeline_stage.equals(\"WB\")\n\t\t\t\t\t\t\t\t\t\t\t\t&& !lstInstructionsPipeLine.get(i).pipeline_stage.equals(\" \")) {\n\t\t\t\t\t\t\t\t\t\t\t// *** RAW Hazard **\n\t\t\t\t\t\t\t\t\t\t\tstall = 1;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\telse if (dataForwarding == 0) {\n\t\t\t\t\t\t\t\t\t// If forwarding is disabled and the\n\t\t\t\t\t\t\t\t\t// previous instruction is not completed,\n\t\t\t\t\t\t\t\t\t// stall.\n\t\t\t\t\t\t\t\t\tif (!lstInstructionsPipeLine.get(i).pipeline_stage.equals(\" \")) {\n\t\t\t\t\t\t\t\t\t\t// *** RAW Hazard **\n\t\t\t\t\t\t\t\t\t\tstall = 1;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telse if ((lstInstructionsPipeLine.get(i).destination_register\n\t\t\t\t\t\t\t\t\t.equals(lstInstructionsPipeLine.get(x).destination_register))\n\t\t\t\t\t\t\t\t\t&& (!lstInstructionsPipeLine.get(i).destination_register.equals(\"null\"))) {\n\n\t\t\t\t\t\t\t\tif ((lstInstructionsPipeLine.get(i).pipeline_stage.equals(\"EX\"))\n\t\t\t\t\t\t\t\t\t\t&& ((lstInstructionsPipeLine.get(i).operator.execution_cycles\n\t\t\t\t\t\t\t\t\t\t\t\t- lstInstructionsPipeLine\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.get(i).execute_counter) >= (lstInstructionsPipeLine\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.get(x).operator.execution_cycles - 1))) {\n\t\t\t\t\t\t\t\t\t// *** WAW Hazard ***\n\t\t\t\t\t\t\t\t\tstall = 1;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telse if ((lstInstructionsPipeLine.get(i).pipeline_stage.equals(\"EX\"))\n\t\t\t\t\t\t\t\t\t&& ((lstInstructionsPipeLine.get(i).operator.execution_cycles\n\t\t\t\t\t\t\t\t\t\t\t- lstInstructionsPipeLine\n\t\t\t\t\t\t\t\t\t\t\t\t\t.get(i).execute_counter) == (lstInstructionsPipeLine\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.get(x).operator.execution_cycles - 1))) {\n\n\t\t\t\t\t\t\t\t// *** WB will happen at the same time ***\n\t\t\t\t\t\t\t\tstall = 1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (stall != 1) {\n\t\t\t\t\t\t\tif (lstInstructionsPipeLine.get(x).operator.name == \"br_taken\") {\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \" \";\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).execute_counter++;\n\t\t\t\t\t\t\t\tif ((x + 1) < numberOfRows) {\n\t\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x + 1).pipeline_stage = \" \";\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Complete the execution of the branch.\n\t\t\t\t\t\t\telse if (lstInstructionsPipeLine.get(x).operator.name == \"br_untaken\") {\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \" \";\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).execute_counter++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Move the instruction into the EX stage.\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \"EX\";\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).execute_counter++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"EX\":\n\t\t\t\t\t\tif (lstInstructionsPipeLine\n\t\t\t\t\t\t\t\t.get(x).execute_counter < lstInstructionsPipeLine.get(x).operator.execution_cycles) {\n\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \"EX\";\n\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).execute_counter++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \"MEM\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"MEM\":\n\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \"WB\";\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"WB\":\n\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \" \";\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \" \":\n\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \" \";\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tJOptionPane.showMessageDialog(new JFrame(), \"Unrecognized Pipeline Stage!\", \"Dialog\",\n\t\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (stall == 1) {\n\t\t\t\t\t\tDisplay_Stall(x, currentCycle);\n\t\t\t\t\t} else if (lstInstructionsPipeLine.get(x).pipeline_stage == \"EX\") {\n\t\t\t\t\t\tSystem.out.println(lstInstructionsPipeLine.get(x).operator.display_value + \" - row=\" + x\n\t\t\t\t\t\t\t\t+ \" col=\" + currentCycle);\n\t\t\t\t\t\tJPanel pnl_EXE_tmp = new JPanel();\n\t\t\t\t\t\tpnl_EXE_tmp.setBackground(col_EXE);\n\t\t\t\t\t\tpnl_EXE_tmp.setBounds(currentCycle * 40 + (50 + 100), x * 20 + 20, 40, 20);// (w+row_x)\n\t\t\t\t\t\tpanelShowResult.add(pnl_EXE_tmp);\n\t\t\t\t\t\tJLabel lblExe_tmp = new JLabel(lstInstructionsPipeLine.get(x).operator.display_value);\n\t\t\t\t\t\tpnl_EXE_tmp.add(lblExe_tmp);\n\t\t\t\t\t\tpanelShowResult.revalidate();\n\t\t\t\t\t\tpanelShowResult.repaint();\n\n\t\t\t\t\t\tmapAnswer.put(\"txt_\" + currentCycle + \"_\" + x,\"EX\");/// k,v\n\t\t\t\t\t}\n\t\t\t\t\t// Output the pipeline stage.\n\t\t\t\t\telse {\n\t\t\t\t\t\tJPanel pnl_tmp = new JPanel();\n\t\t\t\t\t\tswitch (lstInstructionsPipeLine.get(x).pipeline_stage) {\n\t\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\t\tpnl_tmp.setBackground(col_ID);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"MEM\":\n\t\t\t\t\t\t\tpnl_tmp.setBackground(col_MEM);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"WB\":\n\t\t\t\t\t\t\tpnl_tmp.setBackground(col_WB);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// pnl_tmp.setBackground(col_EXE);\n\t\t\t\t\t\tpnl_tmp.setBounds(currentCycle * 40 + (50 + 100), x * 20 + 20, 40, 20);// (w+row_x)\n\t\t\t\t\t\tpanelShowResult.add(pnl_tmp);\n\t\t\t\t\t\tJLabel lbl_tmp = new JLabel(lstInstructionsPipeLine.get(x).pipeline_stage);\n\t\t\t\t\t\tpnl_tmp.add(lbl_tmp);\n\t\t\t\t\t\tpanelShowResult.revalidate();\n\t\t\t\t\t\tpanelShowResult.repaint();\n\n\t\t\t\t\t\tmapAnswer.put(\"txt_\" + currentCycle + \"_\" + x, lstInstructionsPipeLine.get(x).pipeline_stage);/// k\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// v\n\n\t\t\t\t\t\tSystem.out.println(\n\t\t\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage + \" - row=\" + x + \" col=\" + currentCycle);\n\t\t\t\t\t}\n\t\t\t\t\t;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"x:\" + x);\n\t\t\t\tx++;\n\t\t\t} // End of while loop\n\n\t\t\tif (stall != 1 && x < numberOfRows) {\n\t\t\t\t// Issue a new instruction.\n\t\t\t\tlstInstructionsPipeLine.get(x).issue_cycle = Integer.toString(currentCycle);\n\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage = \"IF\";\n\t\t\t\tJPanel pnl_IF_tmp = new JPanel();\n\t\t\t\tpnl_IF_tmp.setBackground(col_IF);\n\t\t\t\tpnl_IF_tmp.setBounds(currentCycle * 40 + (50 + 100), x * 20 + 20, 40, 20);// (w+row_x)\n\t\t\t\tpanelShowResult.add(pnl_IF_tmp);\n\t\t\t\tJLabel lblIF_tmp = new JLabel(lstInstructionsPipeLine.get(x).pipeline_stage);\n\t\t\t\tpnl_IF_tmp.add(lblIF_tmp);\n\t\t\t\tpanelShowResult.revalidate();\n\t\t\t\tpanelShowResult.repaint();\n\t\t\t\tmapAnswer.put(\"txt_\" + currentCycle + \"_\" + x, lstInstructionsPipeLine.get(x).pipeline_stage);/// k\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// ,v\n\n\t\t\t\tSystem.out.println(\n\t\t\t\t\t\tlstInstructionsPipeLine.get(x).pipeline_stage + \" - row=\" + x + \" col=\" + currentCycle);\n\t\t\t}\n\n\t\t\tSystem.out.println(\"Clk:\" + currentCycle);\n\t\t\tcurrentCycle++;\n\t\t} else {\n\n\t\t\tif (currentCycle == 0) {\n\t\t\t\tlstInstructionsPipeLine.get(0).issue_cycle = Integer.toString(currentCycle);\n\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \"IF\";\n\t\t\t\tJPanel pnl_IF_tmp = new JPanel();\n\t\t\t\tpnl_IF_tmp.setBackground(col_IF);\n\t\t\t\tpnl_IF_tmp.setBounds(x * 40 + x, currentCycle * 20 + (20), 40, 20);// (w+row_x)\n\t\t\t\tpanelShowResult.add(pnl_IF_tmp);\n\t\t\t\tJLabel lblIF_tmp = new JLabel(lstInstructionsPipeLine.get(0).getPipeline_stage());\n\t\t\t\tpnl_IF_tmp.add(lblIF_tmp);\n\t\t\t\tpanelShowResult.revalidate();\n\t\t\t\tpanelShowResult.repaint();\n\t\t\t\tmapAnswer.put(\"txt_\" + currentCycle + \"_\" + x, lstInstructionsPipeLine.get(0).pipeline_stage);/// k\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// v\n\n\t\t\t\tSystem.out.println(\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage + \" - row=\" + x + \" col=\" + currentCycle);\n\t\t\t\tSystem.out.println(\"Clk:\" + currentCycle);\n\t\t\t\tcurrentCycle++;\n\t\t\t} else {\n\t\t\t\tswitch (lstInstructionsPipeLine.get(0).pipeline_stage) {\n\t\t\t\tcase \"IF\":\n\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \"ID\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ID\":\n\n\t\t\t\t\t// If branch is taken, complete this instruction.\n\t\t\t\t\tif (lstInstructionsPipeLine.get(0).operator.name.substring(0, 2) == \"br\") {\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \" \";\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).execute_counter++;\n\t\t\t\t\t}\n\t\t\t\t\t// Move the instruction into the EX stage.\n\t\t\t\t\telse {\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \"EX\";\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).execute_counter++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"EX\":\n\t\t\t\t\t// If the instruction hasn't completed.\n\t\t\t\t\tif (lstInstructionsPipeLine\n\t\t\t\t\t\t\t.get(0).execute_counter < lstInstructionsPipeLine.get(0).operator.execution_cycles) {\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \"EX\";\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).execute_counter++;\n\t\t\t\t\t}\n\t\t\t\t\t// Move the instruction to the MEM stage.\n\t\t\t\t\telse {\n\t\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \"MEM\";\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"MEM\":\n\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \"WB\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"WB\":\n\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \" \";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \" \":\n\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage = \" \";\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tJOptionPane.showMessageDialog(new JFrame(), \"Unrecognized Pipeline Stage!\", \"Dialog\",\n\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t\t\t\t}\n\n\t\t\t\t// If the instruction is in the EX stage, display the functional\n\t\t\t\t// unit.\n\t\t\t\tif (lstInstructionsPipeLine.get(0).pipeline_stage == \"EX\") {\n\t\t\t\t\tJPanel pnl_IF_tmp = new JPanel();\n\t\t\t\t\tpnl_IF_tmp.setBackground(col_EXE);\n\t\t\t\t\tpnl_IF_tmp.setBounds(x * 40 + x, currentCycle * 20 + (20), 40, 20);// (w+row_x)\n\t\t\t\t\tpanelShowResult.add(pnl_IF_tmp);\n\t\t\t\t\tJLabel lblIF_tmp = new JLabel(lstInstructionsPipeLine.get(0).pipeline_stage);\n\t\t\t\t\tpnl_IF_tmp.add(lblIF_tmp);\n\t\t\t\t\tpanelShowResult.revalidate();\n\t\t\t\t\tpanelShowResult.repaint();\n\t\t\t\t\tmapAnswer.put(\"txt_\" + currentCycle + \"_\" + x,\"EX\");/// k\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// ,v\n\n\t\t\t\t\tSystem.out.println(lstInstructionsPipeLine.get(0).operator.display_value + \" - row=\" + x + \" col=\"\n\t\t\t\t\t\t\t+ currentCycle);\n\t\t\t\t} else {\n\t\t\t\t\tJPanel pnl_IF_tmp = new JPanel();\n\t\t\t\t\tswitch (lstInstructionsPipeLine.get(0).pipeline_stage) {\n\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\tpnl_IF_tmp.setBackground(col_ID);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"MEM\":\n\t\t\t\t\t\tpnl_IF_tmp.setBackground(col_MEM);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"WB\":\n\t\t\t\t\t\tpnl_IF_tmp.setBackground(col_WB);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// pnl_IF_tmp.setBackground(col_IF);\n\t\t\t\t\tpnl_IF_tmp.setBounds(x * 40 + x, currentCycle * 20 + (20), 40, 20);// (w+row_x)\n\t\t\t\t\tpanelShowResult.add(pnl_IF_tmp);\n\t\t\t\t\tJLabel lblIF_tmp = new JLabel(lstInstructionsPipeLine.get(0).pipeline_stage);\n\t\t\t\t\tpnl_IF_tmp.add(lblIF_tmp);\n\t\t\t\t\tpanelShowResult.revalidate();\n\t\t\t\t\tpanelShowResult.repaint();\n\t\t\t\t\tmapAnswer.put(\"txt_\" + currentCycle + \"_\" + x, lstInstructionsPipeLine.get(x).pipeline_stage);/// k\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// v\n\n\t\t\t\t\t// s = \"document.instruction_table.column\" + currentCycle +\n\t\t\t\t\t// \".value =\n\t\t\t\t\t// parent.top_frame.lstInstructions[0].pipeline_stage;\";\n\t\t\t\t\tSystem.out.println(\n\t\t\t\t\t\t\tlstInstructionsPipeLine.get(0).pipeline_stage + \" - row=\" + x + \" col=\" + currentCycle);\n\t\t\t\t}\n\t\t\t\t// eval(s);\n\t\t\t\tSystem.out.println(\"Clk:\" + currentCycle);\n\t\t\t\tcurrentCycle++;\n\t\t\t}\n\t\t}\n\t}", "private int[][] copyState(int[][] stateToBeCopied) {\n\t\tint[][] tempState = new int[9][9];\n\n\t\tfor (int i = 0; i < 9; i++) {\n\t\t\tfor (int j = 0; j < 9; j++) {\n\t\t\t\ttempState[i][j] = stateToBeCopied[i][j];\n\t\t\t}\n\t\t}\n\n\t\treturn tempState;\n\t}", "void onCheckedTriStateChanged(TriStateCheckBox triStateCheckBox, State state);", "public NewTransitionRecord(){\r\n fromstate = 0;\r\n tostate = 0;\r\n rate = 0.0;\r\n }", "public int getBoardState(boolean whiteTeamMoving) {\n\t\tint result = 0;\n\t\tboolean moves = doMovesExist(whiteTeamMoving);\n\n\t\tresult |= moves ? 0 : 1;\n\t\tresult |= isWhiteCheck() ? 1<<1 : 0;\n\t\tresult |= isBlackCheck() ? 1<<2 : 0;\n\t\tresult |= result == 1 ? 0 : 1<<3;\n\n\t\treturn result;\n\t}", "private int evaluateState() {\r\n\r\n\t\t// add up score\r\n\t\t//\r\n\t\tint scoreWhite = 0;\r\n\t\tint scoreBlack = 0;\r\n\t\tfor (Piece piece : this.chessGame.getPieces()) {\r\n\t\t\tif(piece.getColor() == Piece.COLOR_BLACK){\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else if( piece.getColor() == Piece.COLOR_WHITE){\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else{\r\n\t\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\t\"unknown piece color found: \"+piece.getColor());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// return evaluation result depending on who's turn it is\r\n\t\tint gameState = this.chessGame.getGameState();\r\n\t\t\r\n\t\tif( gameState == ChessGame.GAME_STATE_BLACK){\r\n\t\t\treturn scoreBlack - scoreWhite;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_WHITE){\r\n\t\t\treturn scoreWhite - scoreBlack;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_END_WHITE_WON\r\n\t\t\t\t|| gameState == ChessGame.GAME_STATE_END_BLACK_WON){\r\n\t\t\treturn Integer.MIN_VALUE + 1;\r\n\t\t\r\n\t\t}else{\r\n\t\t\tthrow new IllegalStateException(\"unknown game state: \"+gameState);\r\n\t\t}\r\n\t}", "public void advance()\n\t{\n\t\t//calling copy function\n\t\tcopy(); \n\t\t//for loop for row \n\t\tfor(int row =0; row<this.currentVersion.length; row++)\n\t\t{\t//for loop for column\n\t\t\tfor(int column =0; column<this.currentVersion[row].length; column++)\n\t\t\t{\n\t\t\t\t//if statements to implement 2D CA rules\n\t\t\t\tif (column == 0 && row == 0)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row+1][column] == currentVersion[row][column] + 1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row+1][column];\n\t\t\t\t\telse if(currentVersion[row][column+1] == currentVersion[row][column] +1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column +1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\tif (row == 0 && column == currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row][column - 1] == currentVersion[row][column] +1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column - 1];\n\t\t\t\t\telse if (currentVersion[row+1][column] == currentVersion [row][column] +1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row+1][column];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\tif (row == 0 && column > 0 && column < currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row][column-1] == currentVersion[row][column] + 1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column-1];\n\t\t\t\t\telse if(currentVersion[row+1][column] == currentVersion[row][column] + 1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row+1][column];\n\t\t\t\t\telse if(currentVersion[row][column+1] == currentVersion[row][column] +1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column+1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\tif (row == currentVersion.length-1 && column == 0)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row-1][column] == currentVersion[row][column] + 1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row -1][column]; \n\t\t\t\t\telse if(currentVersion[row][column+1] == currentVersion[row][column] + 1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column+1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\tif (row > 0 && column ==0 && row < currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row+1][column] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row+1][column];\n\t\t\t\t\tif(currentVersion[row][column+1] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column+1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\tif(row == currentVersion.length-1 && column == currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row-1][column] == currentVersion[row][column] +1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row-1][column];\n\t\t\t\t\telse if(currentVersion[row][column-1] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column-1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif(row == currentVersion.length-1 && column > 0 && column < currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif(currentVersion[row-1][column] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row-1][column];\n\t\t\t\t\telse if(currentVersion[row][column-1] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column-1]; \n\t\t\t\t\telse if(currentVersion[row][column+1] == currentVersion[row][column] +1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column+1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\t\n\t\t\t\tif(row>0 && row < currentVersion.length-1 && column == currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif (currentVersion[row-1][column] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row-1][column];\n\t\t\t\t\telse if(currentVersion[row+1][column] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row+1][column]; \n\t\t\t\t\telse if(currentVersion[row][column-1] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column-1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0; \n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\tif(row>0 && row < currentVersion.length-1 && column > 0 && column < currentVersion.length-1)\n\t\t\t\t{\n\t\t\t\t\tif (currentVersion[row-1][column] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row-1][column];\n\t\t\t\t\telse if(currentVersion[row+1][column] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row+1][column]; \n\t\t\t\t\telse if(currentVersion[row][column-1] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column-1];\n\t\t\t\t\telse if(currentVersion[row][column+1] == currentVersion[row][column]+1)\n\t\t\t\t\t\tnextVersion[row][column] = currentVersion[row][column+1];\n\t\t\t\t\telse if (currentVersion[row][column] == 0)\n\t\t\t\t\t\tnextVersion[row][column] = 1; \n\t\t\t\t\telse if (currentVersion[row][column] == state-1)\n\t\t\t\t\t\tnextVersion[row][column] = 0;\n\t\t\t\t\telse if(currentVersion[row][column] == state-2)\n\t\t\t\t\t\tnextVersion[row][column] = (byte) (state-1);\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t//passing new nextVersion array to currentVersion array\n\tsetUniverse(nextVersion);\n\t}", "public int[] getValidActions(int paraState) {\n\t\t// Step 1. Construct the checkerboard.\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\tint[] tempValidActions = new int[SIZE * SIZE];\n\t\tint tempNumValidActions = 0;\n\n\t\t// Step 1. Check all states.\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tif (tempCheckerboard[i][j] == EMPTY) {\n\t\t\t\t\ttempValidActions[tempNumValidActions] = i * SIZE + j;\n\t\t\t\t\ttempNumValidActions++;\n\t\t\t\t} // Of if\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\t// Step 2. Compress.\n\t\tint[] resultActions = new int[tempNumValidActions];\n\t\tfor (int i = 0; i < tempNumValidActions; i++) {\n\t\t\tresultActions[i] = tempValidActions[i];\n\t\t} // Of for i\n\n\t\t// SimpleTools.variableTrackingOutput(\"Valid actions: \" +\n\t\t// Arrays.toString(resultActions));\n\n\t\treturn resultActions;\n\t}", "void computeTurn(Input input);", "boolean nextStep();", "void step () {\n if (gameOver)\n return;\n if (!isFalling) {\n // if last piece finished falling, spawn a new one\n spawnNewPiece();\n // if it can't move, game over\n if (!canMove(currentRow + 1, currentColumn)) {\n endGame();\n }\n updateView();\n }\n else if (canMove(currentRow + 1, currentColumn)) {\n currentRow += 1;\n updateView();\n } else {\n // the piece fell!\n isFalling = false;\n // draw current shape to the board\n drawCurrentToBoard();\n currentPiece.blocks = new int[currentPiece.blocks.length][currentPiece.blocks[0].length];\n increaseScore(board.clearFullRows(this));\n }\n }", "public void computersTurn(int focusedSquare){//gives the index of the focused square.\n if (focusedSquare ==-1)\n focusedSquare = changeFocus();\n System.out.println(\"\\n\\n\\n\\n\"+focusedSquare);\n boolean squareAlreadyPicked = false;\n int square = -1;\n double sum=0;\n modifiedMark = createModifiedMarkovModel(focusedSquare);\n double rand;\n while(!squareAlreadyPicked){//checking if square has already been picked before.\n \n if(stepsCompleted<25){\n rand = getRand(0); //generates random number based on sum of existing probabilities in modifiedMarkov\n square = caseBased(rand, sum, 0, 0);\n }\n \n else if((stepsCompleted>=25)&&(stepsCompleted<=50)){\n rand = getRand(1);\n square = caseBased(rand,sum,1,0);\n }\n\n else if (stepsCompleted>50){\n rand = getRand(2);\n square = caseBased(rand,sum,2,0);\n }\n squareAlreadyPicked=true;\n\n }\n System.out.println(square);\n bSquares.get(focusedSquare).getSmallSquare(square).setOwnership(1);\n bSquares.get(focusedSquare).getSmallSquare(square).setCommitted(true);\n stepsCompleted++;\n updateDatabase(focusedSquare,square, false); //updates the database with the player's move B4 the focus is changed\n for (int t = 0; t<9; t++){//removes focus everywhere else.\n bSquares.get(t).sethasFocus(false);\n }\n \n bSquares.get(square).sethasFocus(true);//tells which square has focus\n \n }", "public void step();", "public void step();", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "public static void create(int steps) {\n\t\tlocalPlaces = 40;\n\t\toutPlaces = 3;\n\n\t\t// Initial marking: \n\t\tinitPlaces = new int[] {0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0};\n\t\ttileInitPlaces = 20;\n\n\t\t// Output mapping:\n\t\tint offs = 0;\n\t\ttOutMap = new OutMap[outPlaces];\n\t\ttOutMap[offs++] = new OutMap(-1, 37);\n\t\ttOutMap[offs++] = new OutMap(-1, 35);\n\t\ttOutMap[offs++] = new OutMap(1, 0);\n\n\t\t// Transitions:\n\t\toffs = 0;\n\t\ttransitions = 24; // (12 aligned to 4) x 2 steps\n\t\ttmap = new Transition[transitions];\n\n\t\t// {0xoi, inp-s, outp-s}\n\t\ttmap[offs++] = new Transition(0x22, 4, 1, 41 /* out */ , 40 /* out */ ); // 0: ccw_take_left_fork *choice\n\t\ttmap[offs++] = new Transition(0x22, 4, 12, 9, 5); // 1: take_right_fork *choice\n\t\ttmap[offs++] = new Transition(0x21, 0, 1, 4); // 2: ccw_put_left_fork\n\t\ttmap[offs++] = new Transition(0x21, 10, 11, 3); // 3: put_left_fork\n\n\t\ttmap[offs++] = new Transition(0x31, 7, 10, 2, 8); // 4: start_thinking\n\t\ttmap[offs++] = new Transition(0x13, 9, 6, 8, 7); // 5: start_eating\n\t\ttmap[offs++] = new Transition(0x21, 2, 4, 12); // 6: put_right_fork\n\t\ttmap[offs++] = new Transition(0x31, 13, 20 /* next */ , 18, 14); // 7: cw_start_thinking\n\n\t\ttmap[offs++] = new Transition(0x13, 11, 3, 5, 6); // 8: take_left_fork *choice\n\t\ttmap[offs++] = new Transition(0x13, 11, 16, 17, 19); // 9: cw_take_right_fork *choice\n\t\ttmap[offs++] = new Transition(0x21, 18, 16, 11); // 10: cw_put_right_fork\n\t\ttmap[offs++] = new Transition(0x13, 14, 19, 15, 13); // 11: cw_start_eating\n\n\t\ttmap[offs++] = new Transition(0x22, 24, 21, 15 /* prev */ , 17 /* prev */ ); // 0: ccw_take_left_fork *choice\n\t\ttmap[offs++] = new Transition(0x22, 24, 32, 29, 25); // 1: take_right_fork *choice\n\t\ttmap[offs++] = new Transition(0x21, 20, 21, 24); // 2: ccw_put_left_fork\n\t\ttmap[offs++] = new Transition(0x21, 30, 31, 23); // 3: put_left_fork\n\n\t\ttmap[offs++] = new Transition(0x31, 27, 30, 22, 28); // 4: start_thinking\n\t\ttmap[offs++] = new Transition(0x13, 29, 26, 28, 27); // 5: start_eating\n\t\ttmap[offs++] = new Transition(0x21, 22, 24, 32); // 6: put_right_fork\n\t\ttmap[offs++] = new Transition(0x31, 33, 42 /* out */ , 38, 34); // 7: cw_start_thinking\n\n\t\ttmap[offs++] = new Transition(0x13, 31, 23, 25, 26); // 8: take_left_fork *choice\n\t\ttmap[offs++] = new Transition(0x13, 31, 36, 37, 39); // 9: cw_take_right_fork *choice\n\t\ttmap[offs++] = new Transition(0x21, 38, 36, 31); // 10: cw_put_right_fork\n\t\ttmap[offs++] = new Transition(0x13, 34, 39, 35, 33); // 11: cw_start_eating\n\n\t\tif(PPNDevice.logMessages)\n\t\t\tSystem.out.printf(\"localPlaces: %d\\ntransitions: %d\\n\", localPlaces, transitions);\n\t}", "public void arrayToState(int[] gX){\r\n int i = 0;\r\n int j = 0;\r\n int count = 0;\r\n while(count < gX.length){\r\n this.setState(i, j, gX[count]);\r\n count++;\r\n if(j == 3){\r\n i++;\r\n j = 0;\r\n }\r\n else\r\n j++;\r\n }\r\n }", "private void checkState() {\r\n\t\tswitch (this.stepPanel.getStep()) {\r\n\t\tcase StepPanel.STEP_HOST_GRAPH:\r\n\t\t\tcheckHostGraphAndNextStep();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_STOP_GRAPH:\r\n\t\t\tcheckStopGraphAndNextStep();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_CRITICAL_PAIRS:\r\n\t\t\tcheckPairsAndNextStep();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_FINISH:\r\n\t\t\tcheckIfReadyToParse();\r\n\t\t\tquitDialog();\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "public Check_State(Factory factory) {\n this.factory = factory;\n }", "public PieceColor colorGoing()\n {\n if (turn%2==0)\n return PieceColor.WHITE;\n else return PieceColor.BLACK;\n }" ]
[ "0.7139349", "0.6814071", "0.5916615", "0.5404535", "0.53456384", "0.5314295", "0.5306421", "0.52896863", "0.52495193", "0.52420396", "0.5205805", "0.52057046", "0.5193636", "0.51736856", "0.51390016", "0.5137358", "0.50959355", "0.5076431", "0.50736547", "0.5072042", "0.5067814", "0.50304896", "0.5023104", "0.5016933", "0.50157064", "0.50035495", "0.49982297", "0.49833134", "0.49781734", "0.49740127", "0.49628398", "0.4957887", "0.4956977", "0.49200243", "0.48898563", "0.48841622", "0.488006", "0.48730648", "0.48709124", "0.48705596", "0.48657054", "0.48649037", "0.48505387", "0.48406774", "0.4837512", "0.4823781", "0.4818402", "0.48151314", "0.48080224", "0.4805461", "0.48034096", "0.47992507", "0.47982472", "0.47982472", "0.47982472", "0.47970003", "0.47932178", "0.47855666", "0.4778853", "0.47761068", "0.47727358", "0.4772021", "0.4765966", "0.47638854", "0.47533688", "0.47522", "0.47444957", "0.473786", "0.47285843", "0.47268957", "0.4725432", "0.4724388", "0.4723239", "0.47187635", "0.4717686", "0.47132328", "0.47117367", "0.47077176", "0.47044715", "0.4703538", "0.47031164", "0.46989304", "0.46959212", "0.46956962", "0.46911615", "0.46684778", "0.4656969", "0.46564645", "0.4654162", "0.46437737", "0.46427414", "0.46360806", "0.463223", "0.463223", "0.4630687", "0.46251646", "0.4622007", "0.46203217", "0.4614256", "0.4612921" ]
0.6169785
2
Of stateToCheckerboard Convert as state to a checkerboard.
public String stateToCheckerboardString(int paraState) { int[][] tempCheckerboard = stateToCheckerboard(paraState); String resultString = "\r\n"; //resultString += "Checkerboard state: \r\n"; for (int i = 0; i < tempCheckerboard.length; i++) { for (int j = 0; j < tempCheckerboard[0].length; j++) { if (tempCheckerboard[i][j] == WHITE) { resultString += "o "; } else if (tempCheckerboard[i][j] == BLACK) { resultString += "x "; } else { resultString += "- "; }//Of if }//Of for j resultString += "\r\n"; }//Of for i //resultString += currentState; return resultString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void stateCheckerboardConvertionTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17087 };\n\n\t\tint tempState;\n\t\tint[][] tempCheckerboard;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempCheckerboard = tempEnvironment.stateToCheckerboard(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The checkerboard of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.deepToString(tempCheckerboard));\n\t\t\ttempState = tempEnvironment.checkerboardToState(tempCheckerboard);\n\t\t\tSystem.out.println(\"The state ID is \" + tempState);\n\t\t} // Of for i\n\n\t}", "private int checkerboardToState(int[][] paraCheckerboard) {\n\t\tint resultState = 0;\n\t\tint tempExponential = 1;\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultState += paraCheckerboard[i][j] * tempExponential;\n\t\t\t\ttempExponential *= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultState;\n\t}", "public int[][] stateToCheckerboard(int paraState) {\n\t\tint[][] resultCheckerboard = new int[SIZE][SIZE];\n\t\tint tempValue = paraState;\n\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultCheckerboard[i][j] = (tempValue % SIZE);\n\t\t\t\ttempValue /= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultCheckerboard;\n\t}", "public abstract ExplicitMachineState convertToExplicitMachineState(MachineState state);", "public Checker convertToKing(Checker checker, Move move) {\n\t\t int type = 0;\n\t\t if(checker.getType() == 1) {\n\t\t\t checker.setType(3);\n\t\t\t type = 3;\n\t\t } else if (checker.getType() == 2) {\n\t\t\t checker.setType(4);\n\t\t\t type = 4;\n\t\t }\n\t\t \n\t\t board.getBoard()[move.getyOrigin()][move.getxOrigin()] = 0;\n\t\tboard.getBoard()[move.getyMove()][move.getxMove()] = type;\n\t\t \n\t\treturn checker;\n\t\t \n\t\t \n\t }", "protected void takeTurn(int[][] boardState)\n {\n \n }", "public static int activityStateToWorkItemState( int newState )\r\n {\r\n // The states actually have the same ordinals.\r\n return newState;\r\n }", "public IFsm transitionTo(Class<? extends IState> p_newState) throws Exception;", "State.Builder<E, S, A> to(S state);", "public String idToState(int id);", "public abstract TrackBehaviourStateful convertToStateful(World world, BlockPos pos, IBlockState state);", "void changeState(Spreadable spreadable, State from, State to, int count);", "public List<Transition> getTransitionsToState(final State to) {\n\t\tList<Transition> toReturn = transitionArrayToStateMap.get(to);\n\t\tif (toReturn == null) {\n\t\t\tfinal List<Transition> list = transitionToStateMap.get(to);\n\t\t\ttoReturn = list;\n\t\t\ttransitionArrayToStateMap.put(to, toReturn);\n\t\t}\n\t\treturn toReturn;\n\t}", "private void bfs(int[][] board){\n int[][] original = {{1,2,3},{4,5,0}};\n LinkedList<Cell> queue = new LinkedList<>();\n HashMap<Cell,int[][]> states = new HashMap<Cell,int[][]>();\n Set<String> seen = new HashSet<>();\n queue.offer(new Cell(1,2));\n states.put(queue.peekFirst(),original);\n int step = 0;\n while(step <= maxStep){\n int sz = queue.size();\n while(sz-- > 0){\n Cell cur = queue.pollFirst();\n int[][] curBoard = states.get(cur);\n if(seen.contains(this.toStr(curBoard))){\n continue;\n }\n seen.add(this.toStr(curBoard));\n \n if (isSame(curBoard,board)){\n this.res = step;\n return;\n }\n // move around\n for(int i = 0; i < 4; ++i){\n int r = cur.row + dr[i];\n int c = cur.col + dc[i];\n if(r < 0 || c < 0 || r > 1 || c > 2) continue; \n Cell next = new Cell(r, c);\n queue.offer(next);\n int[][] nextboard = this.clone(curBoard);\n nextboard[cur.row][cur.col] = nextboard[r][c];\n nextboard[r][c] = 0;\n states.put(next,nextboard);\n }\n }\n ++step;\n }\n return;\n }", "public interface AbstractState {\r\n abstract void toNextState(ChessBoard chessBoard,AbstractState state);\r\n}", "private ScanState switchState(ScanState desired,EnumSet<ScanState> allowed) {\n final ScanState old;\n final long timestamp;\n final long sequence;\n synchronized(this) {\n old = state;\n if (!allowed.contains(state))\n throw new IllegalStateException(state.toString());\n state = desired;\n timestamp = System.currentTimeMillis();\n sequence = getNextSeqNumber();\n }\n LOG.fine(\"switched state: \"+old+\" -> \"+desired);\n if (old != desired)\n queueStateChangedNotification(sequence,timestamp,old,desired);\n return old;\n }", "@Test\r\n\tpublic void testDirectCheck() {\n\t\tBoard b = new Board();\r\n\t\tb.state = new Piece[][] //set up the board in the standard way\r\n\t\t\t\t{\r\n\t\t\t\t{new Rook(\"b\"), new Knight(\"b\"),new Bishop(\"b\"),new Queen(\"b\"), new King(\"b\"), new Bishop(\"b\"),\r\n\t\t\t\t\tnew Knight(\"b\"), new Rook(\"b\")},\r\n\t\t\t\t{new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),\r\n\t\t\t\t\t\tnew Pawn(\"b\")},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,new Knight(\"b\"),null,null},\r\n\t\t\t\t{new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),\r\n\t\t\t\t\tnew Pawn(\"w\")},\r\n\t\t\t\t{new Rook(\"w\"), new Knight(\"w\"),new Bishop(\"w\"),new Queen(\"w\"), new King(\"w\"), new Bishop(\"w\"),\r\n\t\t\t\t\tnew Knight(\"w\"), new Rook(\"w\")}\r\n\t\t\t\t};\r\n\t\tassertTrue(b.whiteCheck());\t\r\n\t}", "protected StateAnimationConfig getConfigForStates(\n LauncherState fromState, LauncherState toState) {\n return new StateAnimationConfig();\n }", "public static String[][] createBoardState() {\n String[][] initialBoardState = {\n {\"Rw\", \"Nw\", \"Bw\", \"Qw\", \"Kw\", \"Bw\", \"Nw\", \"Rw\"},\n {\"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\"},\n {\"Rb\", \"Nb\", \"Bb\", \"Qb\", \"Kb\", \"Bb\", \"Nb\", \"Rb\"}\n };\n\n return initialBoardState;\n }", "public int getBoardState(boolean whiteTeamMoving) {\n\t\tint result = 0;\n\t\tboolean moves = doMovesExist(whiteTeamMoving);\n\n\t\tresult |= moves ? 0 : 1;\n\t\tresult |= isWhiteCheck() ? 1<<1 : 0;\n\t\tresult |= isBlackCheck() ? 1<<2 : 0;\n\t\tresult |= result == 1 ? 0 : 1<<3;\n\n\t\treturn result;\n\t}", "public static final String numberToState(int stateNumber)\r\n {\r\n if (stateNumber == NUMBER_OF_MISSING_STATE)\r\n {\r\n return \"Missing\";\r\n }\r\n if (stateNumber == NUMBER_OF_OMITTED_STATE)\r\n {\r\n return \"Omitted\";\r\n }\r\n int[] array = new int[3];\r\n if (3 != NUMBER_OF_PROVERS)\r\n {\r\n Activator.getDefault().logDebug(\"Method ColorPredicate.numberToState must be reimplemented\"\r\n + \" when number of provers changes\");\r\n }\r\n for (int i = 0; i < PROVER_STATUSES[0].length; i++)\r\n {\r\n array[0] = i;\r\n for (int j = 0; j < PROVER_STATUSES[1].length; j++)\r\n {\r\n array[1] = j;\r\n for (int k = 0; k < PROVER_STATUSES[2].length; k++)\r\n {\r\n array[2] = k;\r\n if (numberOfState(array) == stateNumber)\r\n {\r\n return \"(\" + PROVER_STATUSES[0][i] + \", \" + PROVER_STATUSES[1][j] + \", \"\r\n + PROVER_STATUSES[2][k] + \")\";\r\n }\r\n }\r\n }\r\n }\r\n return \"No state with number \" + stateNumber;\r\n }", "private int[][] copyState(int[][] stateToBeCopied) {\n\t\tint[][] tempState = new int[9][9];\n\n\t\tfor (int i = 0; i < 9; i++) {\n\t\t\tfor (int j = 0; j < 9; j++) {\n\t\t\t\ttempState[i][j] = stateToBeCopied[i][j];\n\t\t\t}\n\t\t}\n\n\t\treturn tempState;\n\t}", "public int[][] toMatrix() \n {\n \tint[][] matrix = new int[2][7];\n \tfor (int i = 0; i < 14; ++i)\n \t\tmatrix[i/7][i%7] = state[i];\n \treturn matrix;\n }", "public State getState(Action action) { \n\t\tState newstate = new State(getTractor(), getK(), getMax(), getRows(), getColumns());\n\t\tfor (int i = 0; i < getRows(); i++) {\n\t\t\tfor (int j = 0; j < getColumns(); j++) {\n\t\t\t\tnewstate.cells[i][j] = new Square(i, j, cells[i][j].getSand()); \n\t\t\t}\n\t\t} \n\t\tnewstate.getSquare(newstate.getTractor()).setSand(newstate.getSquare(newstate.getTractor()).getSand()-action.distributedAmount());\n\t\tnewstate.tractor=(Square) action.getMovement();\n\t\tSquare[] adjacents = action.getAdjacents();\n\t\tint[] values = action.getValues();\n\n\t\tfor (int i = 0; i < adjacents.length; i++) {\n\t\t\tnewstate.getSquare(adjacents[i]).setSand(newstate.getSquare(adjacents[i]).getSand()+values[i]);\n\t\t}\n\t\treturn newstate;\n\t}", "public static int activityStateToProcessState( int newState )\r\n {\r\n // The states actually have the same ordinals.\r\n return newState;\r\n }", "public String toString() {\n\t\tString resultString = \"\\r\\n\";\n\t\t//resultString += \"Checkerboard state: \\r\\n\";\n\t\tfor (int i = 0; i < checkerboard.length; i++) {\n\t\t\tfor (int j = 0; j < checkerboard.length; j++) {\n\t\t\t\tif (checkerboard[i][j] == WHITE) {\n\t\t\t\t\tresultString += \"o \";\n\t\t\t\t} else if (checkerboard[i][j] == BLACK) {\n\t\t\t\t\tresultString += \"x \";\n\t\t\t\t} else {\n\t\t\t\t\tresultString += \"- \";\n\t\t\t\t}//Of if\n\t\t\t}//Of for j\n\t\t\tresultString += \"\\r\\n\";\n\t\t}//Of for i\n\t\t\n\t\tresultString += currentState;\n\n\t\t//resultString += \"\\r\\nThe current situation is: \" + gameSituation;\n\t\treturn resultString;\n\t}", "public static void makeBoardChess() {\r\n \r\n white = new AllPiece(\"White\");\r\n black = new AllPiece(\"Black\");\r\n \r\n }", "@Override\n\tpublic void setState(State state) \n\t\t{ current = new PuzzleState(state.getString(state.getState()),\n\t\t\t\t\t\t\t\t\tstate.getString(state.getGoalState())); \n\t\t}", "public static final String numberToState(int stateNumber)\r\n {\r\n if (stateNumber == NUMBER_OF_MISSING_STATE)\r\n {\r\n return \"Missing\";\r\n }\r\n if (stateNumber == NUMBER_OF_OMITTED_STATE)\r\n {\r\n return \"Omitted\";\r\n }\r\n int[] array = new int[3];\r\n if (3 != NUMBER_OF_PROVERS)\r\n {\r\n Activator.getDefault().logDebug(\"Method ColorPredicate.numberToState must be reimplemented\"\r\n + \" when number of provers changes\");\r\n }\r\n for (int i = 0; i < PROVER_STATUSES[0].length; i++)\r\n {\r\n array[0] = i;\r\n for (int j = 0; j < PROVER_STATUSES[1].length; j++)\r\n {\r\n array[1] = j;\r\n for (int k = 0; k < PROVER_STATUSES[2].length; k++)\r\n {\r\n array[2] = k;\r\n if (numberOfState(array) == stateNumber)\r\n {\r\n return PROVER_NAMES[0] + \" : \" + PROVER_STATUSES[0][i] + \", \" + PROVER_NAMES[1] + \" : \"\r\n + PROVER_STATUSES[1][j] + \", \" + PROVER_NAMES[2] + \" : \" + PROVER_STATUSES[2][k];\r\n }\r\n }\r\n }\r\n }\r\n return \"No state with number \" + stateNumber;\r\n }", "private void restoreBoard(int[]board, boolean[] state)\n {\n int [] ids = new int[]{\n R.id.box1, R.id.box2, R.id.box3, R.id.box4, R.id.box5, R.id.box6,\n R.id.box7, R.id.box8, R.id.box9\n };\n\n for (int i = 0; i < board.length; i++)\n {\n\n ImageButton btn = (ImageButton)findViewById(ids[i]);\n if (board[i] == 1)\n {\n btn.setBackgroundResource(R.drawable.x);\n\n }\n else if (board[i] == 2)\n {\n btn.setBackgroundResource(R.drawable.o);\n\n }\n else if(board[i] ==0)\n {\n\n btn.setBackgroundResource(R.drawable.tile);\n }\n\n btn.setEnabled(state[i]);\n }\n\n\n }", "public Piece flip(){\n if(this == BLACK){\n return WHITE;\n }\n else{\n return BLACK;\n }\n }", "public CheckerBoard(int size) {\n super(new int[size * tilesPerSide][size * tilesPerSide][3]);\n for (int y = 0; y < this.getHeight(); ++y) {\n for (int x = 0; x < this.getWidth(); ++x) {\n for (int channel = 0; channel < 3; ++channel) {\n this.data[y][x][channel] = ((x / size + y / size) % 2 == 1) ? 0 : 255;\n }\n }\n }\n }", "State(int[][] startBoardState, int [][] goalBoardState){\n this.currentBoardState = startBoardState;\n this.goalBoardState = goalBoardState;\n this.g_cost = 0;\n this.parentState = null;\n }", "@Override\r\n\tpublic void setState(final SubcherryTreeNode.Check state) {\n\t\tif(Check.GRAYED == state) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t// propagate the new state to all changes\r\n\t\tfor(final SubcherryTreeRevisionNode change : getChanges()) {\r\n\t\t\tchange.setState(state);\r\n\t\t}\r\n\t}", "public Result(BoardState board) {\n this.board = board;\n time = 0;\n }", "public static String[][] getBoardState() {\n return boardState;\n }", "@Override\n\tpublic void changeStateTo(String complainId, String state) throws Exception {\n\t\tIBOOrderComplainsValue ivalue = getOrderComplainsById(complainId);\n\t\tivalue.setState(state);\n\t\tBOOrderComplainsEngine.save(ivalue);\n\t}", "LabState state();", "private ScanState switchState(ScanState desired,String forOperation) {\n return switchState(desired,allowedStates.get(forOperation));\n }", "public IBlockState getConverted(IBlockState state) {\n\t\tfor (IStateMapping i : this) {\n\t\t\tif (i.canConvert(state)) return i.getConverted(state);\n\t\t}\n\t\treturn null;\n\t}", "void checkerboard(int checkerSquareArea);", "public void gameOfLife(int[][] board) {\n int m = board.length;\n int n = ( m > 0 ? board[0].length : 0);\n int[] dx = {-1, -1, -1, 0, 1, 1, 1, 0};\n int[] dy = {-1, 0, 1, 1, 1, 0, -1, -1};\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n int cnt = 0;\n /**\n * Count the neighbors with live status.\n */\n for (int k = 0; k < 8; k++) {\n int x = i + dx[k];\n int y = j + dy[k];\n /**\n * Notice using board[x][y] here, not board[i][j]\n * The next state is created by applying the above rules simultaneously to every cell in the current state,\n * so we concern state==1 and state==2(both states indicate live)\n */\n if (x >= 0 && x < m && y >= 0 && y < n && (board[x][y] == 1 || board[x][y] == 2)) {\n cnt++;\n }\n }\n if (board[i][j] == 1 && (cnt < 2 || cnt > 3)) {\n /**\n * From live to dead.\n */\n board[i][j] = 2;\n }\n if (board[i][j] == 0 && cnt == 3) {\n /**\n * From dead to live\n */\n board[i][j] = 3;\n }\n }\n }\n /**\n * Restore state back to 0 and 1.\n */\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n board[i][j] %= 2;\n }\n }\n }", "public static int processStateToActivityState(int newState) {\r\n // The states actually have the same ordinals.\r\n return newState;\r\n }", "public void changeState(){\n\t\t//red - Green\n\t\tif (lights[0].isOn()){\n\t\t\tlights[0].turnOff();\n\t\t\tlights[2].turnOn();\n\t\t}\n\t\t\n\t\t//Green -yellow\n\t\telse if(lights[2].isOn()){\n\t\t\tlights[2].turnOff();\n\t\t\tlights[1].turnOn();\n\t\t}\n\t\t//yellow to red\n\t\telse if (lights[1].isOn()){\n\t\t\tlights[1].turnOff();\n\t\t\tlights[0].turnOn();\n\t\t}\n\t\t\n\t}", "private static ContextState stringToContextState(String s) \n {\n for (ContextState enumVal : ContextState.values())\n {\n if (enumVal.toString().equals(s))\n return enumVal;\n }\n \n // in case of failure:\n return ContextState.PUBLISHED;\n }", "public ActionState createActionState();", "public List<Cell> getCellsToFlip( Board board, Point p, Color color) {\n return this.getCellsToFlip(board, p.getRow(), p.getCol(), color);\n }", "public CheckerBoard(){\n mCheckerBoard = new ArrayList<>(64);\n }", "private static void trans(Board board) {\n\t\tint[][] M = new int[board.size][board.size];\n\t\tfor (int i = 0; i < board.size; i++)\n\t\t\tfor (int j = 0; j < board.size; j++)\n\t\t\t\tM[i][j] = board.board[j][i];\n\t\tboard.board = M.clone();\n\t}", "private LogicStatus updateState(Board thing) {\n count(thing);\n CellType curstate = thing.getCellType(x,y);\n\n // is it a terminal?\n if (walls.size() == 3) {\n if (curstate == CellType.NOTTERMINAL) return LogicStatus.CONTRADICTION;\n thing.setCellType(x,y,CellType.TERMINAL);\n return LogicStatus.LOGICED;\n }\n\n // the other states (BEND,STRAIGHT) require two paths.\n if (paths.size() < 2) return LogicStatus.STYMIED;\n\n Iterator<Direction> dit = paths.iterator();\n Direction d1 = dit.next();\n Direction d2 = dit.next();\n\n CellType nextct = d1 == d2.getOpp() ? CellType.STRAIGHT : CellType.BEND;\n\n if (nextct == CellType.STRAIGHT) {\n thing.setCellType(x,y,nextct);\n return LogicStatus.LOGICED;\n }\n\n if (curstate == CellType.NOTBEND) return LogicStatus.CONTRADICTION;\n\n thing.setCellType(x,y,nextct);\n return LogicStatus.LOGICED;\n }", "public State(char[] arr) {\r\n\t\tthis.board = Arrays.copyOf(arr, arr.length);\r\n\t}", "public IImage createCheckerboard() {\n List<List<Pixel>> grid = new ArrayList<>();\n for (int i = 0; i < this.height; i++) {\n List<Pixel> row;\n // alternating between making rows starting with black or white tiles\n if (i % 2 == 0) {\n // start white\n for (int j = 0; j < this.tileSize; j++) {\n row = createRow(255, 0, (i * this.tileSize) + j);\n grid.add(row);\n }\n }\n else {\n // start black\n for (int m = 0; m < this.tileSize; m++) {\n row = createRow(0, 255, (i * this.tileSize) + m);\n grid.add(row);\n }\n }\n }\n return new Image(grid, 255);\n }", "public static ElevatorState changeStateFactory(String stateElavator) {\n\t\tif(stateElavator==\"UP\") {\n\t\t\treturn new UpState();\n\t\t}else if(stateElavator==\"DOWN\") {\n\t\t\treturn new DownState();\n\t\t}else {\n\t\t\treturn new StopState();\n\t\t}\n\t}", "protected void alter_for_neighbour_switch() {\n\t\tint this_l, tother_l, ns_i, ns_j, ns_n;\n\t\t\n\t\t// Let the user know...\n\t\tSystem.out.println(\" H THIS IS IN N_SWITCH (nn comparison) mode, for structure \"+INIT_NPHASE);\n\t\tSystem.out.println(\" H en_shift = \"+EN_SHIFT);\n\t\t\n\t\t// Check that there is room at the inn:\n\t\tif( n > MAX_NNS ) {\n\t\t\tthrow( new LSSimException(LSSimException.PARAM,\n\t\t\t\"neighbour switch needs \"+n+\" neighbours in MAX_NNS!\\n\"));\n\t\t}\n\t\t\n\t\t// Make both structures the same:\n\t\tthis_l = INIT_NPHASE;\n\t\ttother_l = 1 - this_l;\n\t\tfor( ns_i = 0; ns_i < n; ns_i++ ) {\n\t\t\tlatt[tother_l][ns_i].x = latt[this_l][ns_i].x;\n\t\t\tlatt[tother_l][ns_i].y = latt[this_l][ns_i].y;\n\t\t\tlatt[tother_l][ns_i].z = latt[this_l][ns_i].z;\n\t\t\t// copy nn lists as well!\n\t\t\tns_n = 0; ns_j = nns[this_l][ns_i][ns_n];\n\t\t\twhile ( ns_j != NO_MORE_NNS ) {\n\t\t\t\tnns[tother_l][ns_i][ns_n] = nns[this_l][ns_i][ns_n];\n\t\t\t\tns_n++; ns_j = nns[this_l][ns_i][ns_n];\n\t\t\t}\n\t\t\tnns[tother_l][ns_i][ns_n] = NO_MORE_NNS;\n\t\t}\n\t\t\n\t\t// Alter the neighbour list for structure 1;\n\t\tmake_it_order_n_squared(1);\n\t}", "public IFsm initFsm(Class<? extends IState> p_newState) throws Exception;", "Board(Board board) {\n copyFrom(board);\n }", "public List<Cell> getCellsToFlip( Board board, int row, int col, Color color) {\n List<Cell> cells_to_flip = new ArrayList<Cell>();\n //find cells to flip in all directions\n for (Direction d : Direction.values()) {\n List<Cell> cells_d = new ArrayList<Cell>(this.cellsToFlipInDirection(board, row, col,\n color, d));\n cells_to_flip.addAll(cells_d);\n cells_d.clear();\n }\n return cells_to_flip;\n }", "public TaskState getNewTaskState(){\n\n TaskState newState = new TaskState();\n\n newState.graph = new DescGraph();\n newState.moveStack = new Stack<>();\n newState.hasSolution = false;\n newState.isNew = true;\n\n newState.moveStack.push(\n new HorseMove(newState.graph.getFirst())\n );\n\n return newState;\n\n }", "void printBoardState(Piece[] B,Player J,int N);", "protected PuzzleState swapTilesNewState(PuzzleState state, int row1, int col1, int row2, int col2) {\r\n PuzzleState newState = state.copy();\r\n int temp = newState.getTile(row1, col1);\r\n newState.setTile(row1, col1, newState.getTile(row2, col2));\r\n newState.setTile(row2, col2, temp);\r\n return newState;\r\n }", "@Override\r\n\tpublic Move validateMove(Piece[][] state, Coordinate from, Coordinate to) throws InvalidMoveException {\r\n\t\tList<Coordinate> possibles = getPossibleLocations(from);\r\n\t\tif (!possibles.contains(to))\r\n\t\t\tthrow new InvalidMoveException();\r\n\r\n\t\tMove result = new Move();\r\n\r\n\t\tMoveType type = MoveTypeChecker.getMoveType(getColor(), state, to);\r\n\t\tif (type == null)\r\n\t\t\treturn null;\r\n\r\n\t\tresult.setType(type);\r\n\t\tresult.setFrom(from);\r\n\t\tresult.setTo(to);\r\n\t\tresult.setMovedPiece(this);\r\n\r\n\t\tint i = 1;\r\n\t\tif (to.getX() < from.getX()) {\r\n\t\t\tif (to.getY() < from.getY()) {\r\n\t\t\t\twhile (from.getX() - i > to.getX()) {\r\n\t\t\t\t\tif (state[from.getX() - i][from.getY() - i] != null)\r\n\t\t\t\t\t\tthrow new InvalidMoveException();\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\twhile (from.getX() - i > to.getX()) {\r\n\t\t\t\t\tif (state[from.getX() - i][from.getY() + i] != null)\r\n\t\t\t\t\t\tthrow new InvalidMoveException();\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (to.getY() < from.getY()) {\r\n\t\t\twhile (from.getX() + i < to.getX()) {\r\n\t\t\t\tif (state[from.getX() + i][from.getY() - i] != null)\r\n\t\t\t\t\tthrow new InvalidMoveException();\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\twhile (from.getX() + i < to.getX()) {\r\n\t\t\t\tif (state[from.getX() + i][from.getY() + i] != null)\r\n\t\t\t\t\tthrow new InvalidMoveException();\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "public Check_State(Factory factory) {\n this.factory = factory;\n }", "Board (boolean[][] board, List<Piece> pieces) {\n\n this.board = board;\n unusedPieces = new ArrayList<>(pieces);\n List<Piece> possiblePieces = new ArrayList<>(pieces);\n tessellate(possiblePieces.get(0));\n }", "public abstract State getSourceState ();", "public AeBpelState getState();", "public void arrayToState(int[] gX){\r\n int i = 0;\r\n int j = 0;\r\n int count = 0;\r\n while(count < gX.length){\r\n this.setState(i, j, gX[count]);\r\n count++;\r\n if(j == 3){\r\n i++;\r\n j = 0;\r\n }\r\n else\r\n j++;\r\n }\r\n }", "private BoardState makeMove(ChessGameNode rootNodeCurr, NewMove nextMoveCurr) {\r\n \tTile[][] currentBoard = rootNodeCurr.getBoardState().getBoard();\r\n \tUnit[] unitListcB = rootNodeCurr.getBoardState().getUnitList();\r\n\r\n \tUnit unitThatMoves = nextMoveCurr.getUnit();\r\n \tMoves moveToMake = nextMoveCurr.getMove();\r\n\r\n \tTile oldSquare = currentBoard[unitThatMoves.getX()][unitThatMoves.getY()];\r\n Tile newSquare = chessBoard[moveToMake.getX()][moveToMake.getY()];\r\n\r\n Unit oldUnit = oldSquare.getPiece();\r\n Unit targetUnit = newSquare.getPiece();\r\n\r\n BoardState newBoard;\r\n\r\n if (targetUnit != null) {\r\n for (int i = 0; i < unitListcB.length; i++) {\r\n if (unitListcB[i] == targetUnit) {\r\n unitListcB[i] = null;\r\n }\r\n } \r\n }\r\n\r\n // update the coordinates of the piece\r\n\t\toldUnit.setCoordinates(moveToMake.getX(),moveToMake.getY());\r\n\t\t// doesn;t update the unit in the unitlist i think\r\n oldSquare.setPiece(null);\r\n newSquare.setPiece(oldUnit);\r\n newBoard = new BoardState(currentBoard, unitListcB);\r\n\r\n \treturn newBoard;\r\n }", "public void startGameState(){\n\n ArrayList<Integer> checkeredSpaces = new ArrayList<Integer>(Arrays.asList(1, 3, 5, 7, 8, 10, 12, 14, 17, 19, 21,\n 23, 24, 26, 28, 30, 33, 35, 37, 39, 41, 42, 44, 46, 48,\n 51, 53, 55, 56, 58, 60, 62));\n\n\n\n for(int i =0; i < 63; i++){\n if(!checkeredSpaces.contains(i)){\n //set all black spaces to null on the board\n mCheckerBoard.add(null);\n }\n else if(i < 24){\n //set first three rows to red checkers\n mCheckerBoard.add(new Checker((i/2), true));\n }\n else if(i < 40){\n //set middle two rows to null\n mCheckerBoard.add(null);\n }\n else{\n //set top three row to black checkers\n mCheckerBoard.add(new Checker((i/2), false));\n }\n }\n\n }", "protected abstract int newState();", "public void convertPawnToKing() {\n pawn.convertToKing();\n }", "public interface NNStateConverter<StateT extends State> {\n\n void getStateInput(StateT state, FloatPointer input);\n\n void saveMemoryState(String filePrefix);\n void loadMemoryState(String filePrefix);\n}", "private int getStateOfPositionFromBoard(positionTicTacToe position, List<positionTicTacToe> targetBoard)\n\t{\n\t\tint index = position.x*16+position.y*4+position.z;\n\t\treturn targetBoard.get(index).state;\n\t}", "@Internal\n\tpublic static <T> Map<String, State<T>> migrateGraph(State<T> oldStartState) {\n\t\tState<T> oldFirst = oldStartState;\n\t\tState<T> oldSecond = oldStartState.getStateTransitions().iterator().next().getTargetState();\n\n\t\tStateTransition<T> oldFirstToSecondTake = Iterators.find(\n\t\t\toldFirst.getStateTransitions().iterator(),\n\t\t\tnew Predicate<StateTransition<T>>() {\n\t\t\t\t@Override\n\t\t\t\tpublic boolean apply(@Nullable StateTransition<T> input) {\n\t\t\t\t\treturn input != null && input.getAction() == StateTransitionAction.TAKE;\n\t\t\t\t}\n\n\t\t\t});\n\n\t\tStateTransition<T> oldFirstIgnore = Iterators.find(\n\t\t\toldFirst.getStateTransitions().iterator(),\n\t\t\tnew Predicate<StateTransition<T>>() {\n\t\t\t\t@Override\n\t\t\t\tpublic boolean apply(@Nullable StateTransition<T> input) {\n\t\t\t\t\treturn input != null && input.getAction() == StateTransitionAction.IGNORE;\n\t\t\t\t}\n\n\t\t\t}, null);\n\n\t\tStateTransition<T> oldSecondToThirdTake = Iterators.find(\n\t\t\toldSecond.getStateTransitions().iterator(),\n\t\t\tnew Predicate<StateTransition<T>>() {\n\t\t\t\t@Override\n\t\t\t\tpublic boolean apply(@Nullable StateTransition<T> input) {\n\t\t\t\t\treturn input != null && input.getAction() == StateTransitionAction.TAKE;\n\t\t\t\t}\n\n\t\t\t}, null);\n\n\t\tfinal Map<String, State<T>> convertedStates = new HashMap<>();\n\t\tState<T> newSecond;\n\t\tState<T> newFirst = new State<>(oldSecond.getName(), State.StateType.Start);\n\t\tconvertedStates.put(newFirst.getName(), newFirst);\n\t\twhile (oldSecondToThirdTake != null) {\n\n\t\t\tnewSecond = new State<T>(oldSecondToThirdTake.getTargetState().getName(), State.StateType.Normal);\n\t\t\tconvertedStates.put(newSecond.getName(), newSecond);\n\t\t\tnewFirst.addTake(newSecond, oldFirstToSecondTake.getCondition());\n\n\t\t\tif (oldFirstIgnore != null) {\n\t\t\t\tnewFirst.addIgnore(oldFirstIgnore.getCondition());\n\t\t\t}\n\n\t\t\toldFirst = oldSecond;\n\n\t\t\toldFirstToSecondTake = Iterators.find(\n\t\t\t\toldFirst.getStateTransitions().iterator(),\n\t\t\t\tnew Predicate<StateTransition<T>>() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic boolean apply(@Nullable StateTransition<T> input) {\n\t\t\t\t\t\treturn input != null && input.getAction() == StateTransitionAction.TAKE;\n\t\t\t\t\t}\n\n\t\t\t\t});\n\n\t\t\toldFirstIgnore = Iterators.find(\n\t\t\t\toldFirst.getStateTransitions().iterator(),\n\t\t\t\tnew Predicate<StateTransition<T>>() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic boolean apply(@Nullable StateTransition<T> input) {\n\t\t\t\t\t\treturn input != null && input.getAction() == StateTransitionAction.IGNORE;\n\t\t\t\t\t}\n\n\t\t\t\t}, null);\n\n\t\t\toldSecond = oldSecondToThirdTake.getTargetState();\n\n\t\t\toldSecondToThirdTake = Iterators.find(\n\t\t\t\toldSecond.getStateTransitions().iterator(),\n\t\t\t\tnew Predicate<StateTransition<T>>() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic boolean apply(@Nullable StateTransition<T> input) {\n\t\t\t\t\t\treturn input != null && input.getAction() == StateTransitionAction.TAKE;\n\t\t\t\t\t}\n\n\t\t\t\t}, null);\n\n\t\t\tnewFirst = newSecond;\n\t\t}\n\n\t\tfinal State<T> endingState = new State<>(ENDING_STATE_NAME, State.StateType.Final);\n\n\t\tnewFirst.addTake(endingState, oldFirstToSecondTake.getCondition());\n\n\t\tif (oldFirstIgnore != null) {\n\t\t\tnewFirst.addIgnore(oldFirstIgnore.getCondition());\n\t\t}\n\n\t\tconvertedStates.put(endingState.getName(), endingState);\n\n\t\treturn convertedStates;\n\t}", "protected BattleSecondMoveState secondMoveState(){\n return new BattleSecondMoveState(\n this.mFightButton,\n this.mPokemonButton,\n this.mBagButton,\n this.mRunButton,\n this.mActionButton,\n this.mOptionList,\n this.mBattle,\n this.mMessage\n );\n }", "public String getStateOfBoard()\n {\n // This function is used to print state of the board. such as number of coins present on the board\n String str=\"\";\n str += \"Black_Coins Count:\"+this.gameController.getCoinsCount(CoinType.BLACK) +\" Red_Coins Count:\"+this.gameController.getCoinsCount(CoinType.RED);\n return str;\n }", "public int computeGameSituation(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\t// System.out.println(\"The checkerboard is: \" +\n\t\t// Arrays.deepToString(tempCheckerboard));\n\n\t\treturn computeGameSituation(tempCheckerboard);\n\t}", "@Test\n public void stateExample2() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl(7);\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \" O O O O O\\n\" +\n \" O O O O O O\\n\" +\n \"O O O O O O O\", exampleBoard.getGameState());\n }", "@Override\n\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\tstate = !state;\n\t\t\tRequestController controller = new RequestController();\n\t\t\tcontroller.flipTile(index, state);\n\t\t}", "@Override\n\tpublic State doAction(State state) {\n\t\tPoint oldPoint = state.findCell(Keys.MOUSE);\n\t\tPoint newPoint = new Point(oldPoint.x+this.x,oldPoint.y+this.y);\n\t\tState newState = new State(state);\n\t\tnewState.setMode(Keys.IN_PROGRESS);\n\t\tif (newState.cellExists(newPoint.x, newPoint.y) && newState.getCell(newPoint.x, newPoint.y) != -1 && newState.getCell(newPoint.x, newPoint.y) != Keys.WALL) {\n\t\t\tnewState.setCell(oldPoint.x,oldPoint.y , Keys.EMPTY);\n\t\t\t\n\t\t\tif(this.x == 0 ^ this.y == 0)\n\t\t\t\tnewState.setScore(state.getScore()+10);\n\t\t\t\n\t\t\telse if(this.x != 0 && this.y != 0){\n\t\t\t\tnewState.setScore(state.getScore()+15);\n\t\t\t}\n\t\t\t\n\t\t\tif(newPoint.equals(state.findCell(Keys.CHEESE))) {\n\t\t\t\tnewState.setCell(newPoint.x, newPoint.y, Keys.MOUSE_AND_CHEESE);\n\t\t\t} else\n\t\t\t\tnewState.setCell(newPoint.x, newPoint.y, Keys.MOUSE);\n\t\t\t\n\t\t}\n\t\treturn newState;\n\t}", "void onBoardStateChanged(BoardView view);", "CompositeState createCompositeState();", "private List<Cell> cellsToFlipInDirection( Board board,\n int row, int col, Color color, Direction dir) {\n List<Cell> cells_to_flip = new ArrayList<Cell>();\n Cell next = board.getNeighboringCell(row, col, dir);\n //no disks to flip in this direction\n if (next == null || !next.hasDisk() ||\n next.getDisk().getColor() == color) {\n return cells_to_flip;\n //might be disks to flip in this direction\n } else {\n while (next.getDisk().getColor() != color) {\n cells_to_flip.add(next);\n int curr_row = next.getLocation().getRow();\n int curr_col = next.getLocation().getCol();\n next = board.getNeighboringCell(curr_row, curr_col, dir);\n //flip in this direction\n if (next != null && next.hasDisk()\n && next.getDisk().getColor() == color) {\n break;\n //don't flip in this direction\n } else if (next == null || !next.hasDisk()) {\n cells_to_flip.clear();\n break;\n }\n }\n return cells_to_flip;\n }\n }", "public FSMTransitionHandlerBuilder<S> state(\n final S fromState, final S toState, final FI.UnitApply2<S, S> apply) {\n builder.match(\n Tuple2.class,\n new FI.TypedPredicate<Tuple2>() {\n @Override\n public boolean defined(Tuple2 t) {\n return (fromState == null || fromState.equals(t._1()))\n && (toState == null || toState.equals(t._2()));\n }\n },\n new FI.UnitApply<Tuple2>() {\n @Override\n public void apply(Tuple2 t) throws Exception {\n @SuppressWarnings(\"unchecked\")\n S sf = (S) t._1();\n @SuppressWarnings(\"unchecked\")\n S st = (S) t._2();\n apply.apply(sf, st);\n }\n });\n return this;\n }", "IfaceState createState(int nlocal,IfaceSafetyStatus sts);", "public void updateCellState(Move move)\r\n\t{\r\n\t\tCellState color = this.grid[move.getMovedMarbleInitialPosition(0).getX()][move.getMovedMarbleInitialPosition(0).getY()];\r\n\t\t\r\n\t\tfor(int i = 0;i < move.getMovedMarblesCount();i++)\r\n\t\t{\r\n\t\t\tthis.grid[move.getMovedMarbleInitialPosition(i).getX()][move.getMovedMarbleInitialPosition(i).getY()] = CellState.EMPTY;\r\n\t\t}\r\n\t\tfor(int i = 0; i < move.getMovedMarblesFinalCount();i++)\r\n\t\t{\r\n\t\t\tif(isPositionValid(move.getMovedMarbleFinalPosition(i)))\r\n\t\t\t{\r\n\t\t\t\tthis.grid[move.getMovedMarbleFinalPosition(i).getX()][move.getMovedMarbleFinalPosition(i).getY()] = color;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(color == CellState.BLACK_MARBLE) this.blackMarblesCount --;\r\n\t\t\t\tif(color == CellState.WHITE_MARBLE) this.whiteMarblesCount --;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public Sudoku(int[][] state) {\n\t\tfor (int i = 0; i < 9; i++) {\n\t\t\tfor (int j = 0; j < 9; j++) {\n\t\t\t\tthis.initialState[i][j] = this.currentState[i][j] = state[i][j];\n\t\t\t}\n\t\t}\n\t}", "public int[] boardConvertto1d() {\n for (int i = 0; i < 9; i++) {\n int row = i / 3;\n int col = i % 3;\n board[i] = board2d[row][col];\n }\n return board;\n }", "private static int downScore(char piece, State state, int row, int col) {\n\t\tif(row != state.getGrid().length-1 && state.getGrid()[row+1][col] == piece) {\n\t\t\treturn NEXT_TO;\n\t\t}\n\t\telse {\n\t\t\treturn ZERO;\n\t\t}\n\t}", "Object getState();", "void loadCheckerBoard(int tileSize);", "public BoardView(GameController controller, Text state, Rectangle sideRect,\n Text sideStatus, RadioMenuItem playerGameMenuItem, Text tType,\n Label whitePiecesEaten, Label blackPiecesEaten,\n ObservableList<String> moveHistory, Label lblCurrentPiece) {\n\n this.controller = controller;\n this.state = state;\n this.sideRect = sideRect;\n this.sideStatus = sideStatus;\n\n this.playerGameMenuItem = playerGameMenuItem;\n\n this.tType = tType;\n\n this.whitePiecesEaten = whitePiecesEaten;\n this.blackPiecesEaten = blackPiecesEaten;\n\n this.moveHistory = moveHistory;\n this.lblCurrentPiece = lblCurrentPiece;\n\n tiles = new Tile[8][8];\n gridPane = new GridPane();\n gridPane.setStyle(\"-fx-background-color : darkcyan;\");\n reset(controller);\n\n isFirstClick = true;\n hasStarted = false;\n promotionEventHappened = false;\n }", "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "public CheckersGame(CheckersData passedBoard) {\n boardData = passedBoard;\n }", "public ATNState newState(GrammarAST node) {\n ATNState n = new BasicState();\n if (currentRule != null) {\n n.setRuleIndex(currentRule.index);\n }\n atn.addState(n);\n return n;\n }", "public static void setBoardState(String[][] bs) {\n boardState = bs;\n }", "public Rules(ChessboardMatrix chessboard) {\n\t\tthis.chessboard = chessboard;\n\t}", "void convertToLeader() {\n state = InstanceState.LEADER;\n controller = new LeaderController(this, executor, clock, transport);\n }", "@Override\n\tpublic LabelledTransitionSystem apply(LabelledTransitionSystem s) {\n\n\t\tPreconditions.checkNotNull(s, \"The automaton to be considered cannot be null\");\n\t\tLabelledTransitionSystem ret = s.myclone();\n\n\t\tSet<Integer> states = this.getStatesFromWichReachableAccepting(ret);\n\n\t\tlogger.debug(\"States from which an accepting state can be reached: \" + states);\n\n\t\tSet<Integer> allStates = new HashSet<>();\n\t\tfor (int i = 0; i < ret.getNumberOfStates(); i++) {\n\t\t\tallStates.add(i);\n\t\t}\n\t\tallStates.removeAll(states);\n\t\tlogger.debug(\"States from which an accepting state can not be reached: \" + allStates);\n\n\t\tret.removeStates(allStates);\n\n\t\treturn ret;\n\t}", "GameState(GameState b) {\n //System.out.println( \"Just Copied GameState\\n\" + b.toString() +\"\\n\");\n board = new int[SIZE][];\n for (int i = 0; i < SIZE; i++) {\n this.board[i] = b.board[i].clone();\n }\n this.blankRow = b.blankRow;\n this.blankCol = b.blankCol;\n\n this.prevMoves = b.prevMoves;\n this.rank = setRank();\n }", "StateType createStateType();" ]
[ "0.7120906", "0.661587", "0.6335837", "0.5584998", "0.55728334", "0.51386076", "0.51259226", "0.5123811", "0.509091", "0.50477135", "0.5034861", "0.50162035", "0.4950549", "0.4910697", "0.49057177", "0.48807058", "0.48526734", "0.480927", "0.48048028", "0.479971", "0.4746367", "0.47071597", "0.47017455", "0.46998006", "0.46831024", "0.4650499", "0.46393082", "0.4634005", "0.46163616", "0.46052232", "0.45809215", "0.45800242", "0.45792565", "0.45725662", "0.4565817", "0.45373467", "0.45353273", "0.45325297", "0.45315683", "0.45224637", "0.45002508", "0.44830072", "0.44829723", "0.4481659", "0.44785064", "0.44739366", "0.4461732", "0.44591227", "0.44508085", "0.44178692", "0.441553", "0.44143054", "0.4409396", "0.43960708", "0.43916237", "0.4377773", "0.43758512", "0.4368817", "0.4368291", "0.43647233", "0.4359765", "0.43586403", "0.4353485", "0.43400267", "0.43278727", "0.43261886", "0.43229264", "0.43148834", "0.43112856", "0.43073013", "0.4295743", "0.42946205", "0.42939216", "0.42841727", "0.42839366", "0.42814735", "0.42758667", "0.42728224", "0.42634428", "0.42616546", "0.42565408", "0.4252653", "0.42512414", "0.42453167", "0.4244419", "0.42334756", "0.42291138", "0.4222389", "0.42180562", "0.42173186", "0.42158797", "0.42151016", "0.42109656", "0.42044207", "0.4202835", "0.4201037", "0.4200929", "0.41990316", "0.41919652", "0.41916868" ]
0.56947535
3
Of stateToCheckerboardString Convert a checkerboard to a state.
private int checkerboardToState(int[][] paraCheckerboard) { int resultState = 0; int tempExponential = 1; for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { resultState += paraCheckerboard[i][j] * tempExponential; tempExponential *= SIZE; } // Of for j } // Of for i return resultState; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String stateToCheckerboardString(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\tString resultString = \"\\r\\n\";\n\t\t//resultString += \"Checkerboard state: \\r\\n\";\n\t\tfor (int i = 0; i < tempCheckerboard.length; i++) {\n\t\t\tfor (int j = 0; j < tempCheckerboard[0].length; j++) {\n\t\t\t\tif (tempCheckerboard[i][j] == WHITE) {\n\t\t\t\t\tresultString += \"o \";\n\t\t\t\t} else if (tempCheckerboard[i][j] == BLACK) {\n\t\t\t\t\tresultString += \"x \";\n\t\t\t\t} else {\n\t\t\t\t\tresultString += \"- \";\n\t\t\t\t}//Of if\n\t\t\t}//Of for j\n\t\t\tresultString += \"\\r\\n\";\n\t\t}//Of for i\n\t\t\n\t\t//resultString += currentState;\n\t\treturn resultString;\n\t}", "public static void stateCheckerboardConvertionTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17087 };\n\n\t\tint tempState;\n\t\tint[][] tempCheckerboard;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempCheckerboard = tempEnvironment.stateToCheckerboard(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The checkerboard of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.deepToString(tempCheckerboard));\n\t\t\ttempState = tempEnvironment.checkerboardToState(tempCheckerboard);\n\t\t\tSystem.out.println(\"The state ID is \" + tempState);\n\t\t} // Of for i\n\n\t}", "public String idToState(int id);", "public static final String numberToState(int stateNumber)\r\n {\r\n if (stateNumber == NUMBER_OF_MISSING_STATE)\r\n {\r\n return \"Missing\";\r\n }\r\n if (stateNumber == NUMBER_OF_OMITTED_STATE)\r\n {\r\n return \"Omitted\";\r\n }\r\n int[] array = new int[3];\r\n if (3 != NUMBER_OF_PROVERS)\r\n {\r\n Activator.getDefault().logDebug(\"Method ColorPredicate.numberToState must be reimplemented\"\r\n + \" when number of provers changes\");\r\n }\r\n for (int i = 0; i < PROVER_STATUSES[0].length; i++)\r\n {\r\n array[0] = i;\r\n for (int j = 0; j < PROVER_STATUSES[1].length; j++)\r\n {\r\n array[1] = j;\r\n for (int k = 0; k < PROVER_STATUSES[2].length; k++)\r\n {\r\n array[2] = k;\r\n if (numberOfState(array) == stateNumber)\r\n {\r\n return \"(\" + PROVER_STATUSES[0][i] + \", \" + PROVER_STATUSES[1][j] + \", \"\r\n + PROVER_STATUSES[2][k] + \")\";\r\n }\r\n }\r\n }\r\n }\r\n return \"No state with number \" + stateNumber;\r\n }", "public static final String numberToState(int stateNumber)\r\n {\r\n if (stateNumber == NUMBER_OF_MISSING_STATE)\r\n {\r\n return \"Missing\";\r\n }\r\n if (stateNumber == NUMBER_OF_OMITTED_STATE)\r\n {\r\n return \"Omitted\";\r\n }\r\n int[] array = new int[3];\r\n if (3 != NUMBER_OF_PROVERS)\r\n {\r\n Activator.getDefault().logDebug(\"Method ColorPredicate.numberToState must be reimplemented\"\r\n + \" when number of provers changes\");\r\n }\r\n for (int i = 0; i < PROVER_STATUSES[0].length; i++)\r\n {\r\n array[0] = i;\r\n for (int j = 0; j < PROVER_STATUSES[1].length; j++)\r\n {\r\n array[1] = j;\r\n for (int k = 0; k < PROVER_STATUSES[2].length; k++)\r\n {\r\n array[2] = k;\r\n if (numberOfState(array) == stateNumber)\r\n {\r\n return PROVER_NAMES[0] + \" : \" + PROVER_STATUSES[0][i] + \", \" + PROVER_NAMES[1] + \" : \"\r\n + PROVER_STATUSES[1][j] + \", \" + PROVER_NAMES[2] + \" : \" + PROVER_STATUSES[2][k];\r\n }\r\n }\r\n }\r\n }\r\n return \"No state with number \" + stateNumber;\r\n }", "private static ContextState stringToContextState(String s) \n {\n for (ContextState enumVal : ContextState.values())\n {\n if (enumVal.toString().equals(s))\n return enumVal;\n }\n \n // in case of failure:\n return ContextState.PUBLISHED;\n }", "public String toString() {\n\t\tString resultString = \"\\r\\n\";\n\t\t//resultString += \"Checkerboard state: \\r\\n\";\n\t\tfor (int i = 0; i < checkerboard.length; i++) {\n\t\t\tfor (int j = 0; j < checkerboard.length; j++) {\n\t\t\t\tif (checkerboard[i][j] == WHITE) {\n\t\t\t\t\tresultString += \"o \";\n\t\t\t\t} else if (checkerboard[i][j] == BLACK) {\n\t\t\t\t\tresultString += \"x \";\n\t\t\t\t} else {\n\t\t\t\t\tresultString += \"- \";\n\t\t\t\t}//Of if\n\t\t\t}//Of for j\n\t\t\tresultString += \"\\r\\n\";\n\t\t}//Of for i\n\t\t\n\t\tresultString += currentState;\n\n\t\t//resultString += \"\\r\\nThe current situation is: \" + gameSituation;\n\t\treturn resultString;\n\t}", "private String gameStateToString() // Convert the game state into a string type.\n\t{\n\t\tString getGameStateString = \"\";\n\n\t\tswitch (gameState) // Check the state of the game and change the messages as needed.\n\t\t{\n\t\tcase waitingForStart:\n\t\t\tgetGameStateString = \"waitingForStart\";\n\t\t\tbreak;\n\t\tcase gameWelcome:\n\t\t\tgetGameStateString = \"gameWelcome\";\n\t\t\tbreak;\n\t\tcase decideWhoGoesFirst:\n\t\t\tgetGameStateString = \"decideWhoGoesFirst\";\n\t\t\tbreak;\n\t\tcase twoPlayersPlayerOneGoesFirst:\n\t\t\tgetGameStateString = \"twoPlayersPlayerOneGoesFirst\";\n\t\t\tbreak;\n\t\tcase twoPlayersPlayerTwoGoesFirst:\n\t\t\tgetGameStateString = \"twoPlayersPlayerTwoGoesFirst\";\n\t\t\tbreak;\n\t\tcase twoPlayersNowPlayerOnesTurn: \n\t\t\tgetGameStateString = \"twoPlayersNowPlayerOnesTurn\";\n\t\t\tbreak;\n\t\tcase twoPlayersNowPlayerTwosTurn:\n\t\t\tgetGameStateString = \"twoPlayersNowPlayerTwosTurn\";\n\t\t\tbreak;\n\t\tcase aPlayerHasWon:\n\t\t\tgetGameStateString = \"aPlayerHasWon\";\n\t\t\tbreak;\t\n\t\t}\n\n\t\treturn getGameStateString;\n\n\t}", "java.lang.String getState();", "String convertTransition(Transition instanceValue);", "public abstract ExplicitMachineState convertToExplicitMachineState(MachineState state);", "String getState();", "String getState();", "String getState();", "public String getStateOfBoard()\n {\n // This function is used to print state of the board. such as number of coins present on the board\n String str=\"\";\n str += \"Black_Coins Count:\"+this.gameController.getCoinsCount(CoinType.BLACK) +\" Red_Coins Count:\"+this.gameController.getCoinsCount(CoinType.RED);\n return str;\n }", "String getBoardString();", "public java.lang.String getState() {\n java.lang.Object ref = state_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n state_ = s;\n }\n return s;\n }\n }", "public void testToString()\n {\n // An empty board\n assertEquals(b1.toString(), \"EEEEEEEEE\");\n\n // A more complex case\n b1.fromString(\"RRRBEEBBE\");\n assertEquals(b1.toString(), \"RRRBEEBBE\");\n }", "public boolean loadState(String newState) {\n // Tokenize newState using whitespace as delimiter\n String[] tokenized = newState.split(\" \");\n\n // Ensure the length\n if (tokenized.length != 82)\n return false;\n\n // Validate first item, whose turn it is\n if (!tokenized[0].equals(\"1\") && !tokenized[0].equals(\"2\"))\n return false;\n\n try {\n currentPlayer = Integer.parseInt(tokenized[0]);\n } catch (NumberFormatException e) {\n return false;\n }\n\n // Ensure rest of tokens are valid\n for (int i = 1, e = tokenized.length; i != e; ++i) {\n try {\n int val = Integer.parseInt(tokenized[i]);\n if (0 <= val && val <= 2)\n board[i - 1] = val;\n else\n return false;\n } catch (NumberFormatException ex) {\n return false;\n }\n }\n return true;\n }", "public java.lang.String getState() {\n java.lang.Object ref = state_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n state_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public static String[][] createBoardState() {\n String[][] initialBoardState = {\n {\"Rw\", \"Nw\", \"Bw\", \"Qw\", \"Kw\", \"Bw\", \"Nw\", \"Rw\"},\n {\"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\", \"Pw\"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"},\n {\"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\", \"Pb\"},\n {\"Rb\", \"Nb\", \"Bb\", \"Qb\", \"Kb\", \"Bb\", \"Nb\", \"Rb\"}\n };\n\n return initialBoardState;\n }", "public int[][] stateToCheckerboard(int paraState) {\n\t\tint[][] resultCheckerboard = new int[SIZE][SIZE];\n\t\tint tempValue = paraState;\n\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultCheckerboard[i][j] = (tempValue % SIZE);\n\t\t\t\ttempValue /= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultCheckerboard;\n\t}", "private void setGameState() // Convert the string version of the game state to the GameState version.\n\t{\n\t\tif (gameStateString.equalsIgnoreCase(\"waitingForStart\"))\n\t\t{\n\t\t\tgameState = GameState.waitingForStart;\n\t\t}\n\t\telse if (gameStateString.equalsIgnoreCase(\"gameWelcome\"))\n\t\t{\n\t\t\tgameState = GameState.gameWelcome;\n\t\t} \n\t\telse if (gameStateString.equalsIgnoreCase(\"decideWhoGoesFirst\"))\n\t\t{\n\t\t\tgameState = GameState.decideWhoGoesFirst;\n\t\t} \n\t\telse if (gameStateString.equalsIgnoreCase(\"twoPlayersPlayerOneGoesFirst\"))\n\t\t{\n\t\t\tgameState = GameState.twoPlayersPlayerOneGoesFirst;\n\t\t} \n\t\telse if (gameStateString.equalsIgnoreCase(\"twoPlayersPlayerTwoGoesFirst\"))\n\t\t{\n\t\t\tgameState = GameState.twoPlayersPlayerTwoGoesFirst;\n\t\t} \n\t\telse if (gameStateString.equalsIgnoreCase(\"twoPlayersNowPlayerOnesTurn\"))\n\t\t{\n\t\t\tgameState = GameState.twoPlayersNowPlayerOnesTurn;\n\t\t} \n\t\telse if (gameStateString.equalsIgnoreCase(\"twoPlayersNowPlayerTwosTurn\"))\n\t\t{\n\t\t\tgameState = GameState.twoPlayersNowPlayerTwosTurn;\n\t\t} \n\t\telse if (gameStateString.equalsIgnoreCase(\"aPlayerHasWon\"))\n\t\t{\n\t\t\tgameState = GameState.aPlayerHasWon;\n\t\t} \n\n\t}", "Update withState(String state);", "public State(String fromString)\n {\n// Metrics.increment(\"State count\");\n //...\n }", "public ArrayList<State> stringArraytoStateArray (ArrayList<String> pArray)\r\n\t{\r\n\t\tArrayList<State> sArray = new ArrayList<State>();\r\n\t\tfor (Iterator<String> iterator = pArray.iterator(); iterator.hasNext();) \r\n\t\t{\r\n\t\t\tString string1 = (String) iterator.next();\r\n\t\t\tState sTemp = new State(string1);\r\n\t\t\tsTemp.toString();\r\n\t\t\tsArray.add(sTemp);\r\n\t\t}\r\n\t\treturn sArray;\r\n\t}", "public String FormatState(String state)\n {\n String formatState = state;\n \n if(formatState.length() == 2)\n {\n formatState = formatState.toUpperCase();\n } else\n {\n formatState = formatState.toLowerCase().replaceAll(\" \", \"\"); //replace all spaces with a blank\n\n if(formatState.contains(\"new\"))\n {\n //grab the string \"new\" and put a space after it\n formatState = formatState.substring(0, 2) + \" \" + formatState.substring(3);\n } else if(formatState.contains(\"rhode\") || formatState.contains(\"north\") || formatState.contains(\"south\"))\n {\n //grab the string \"rhode\" and put a space after it\n formatState = formatState.substring(0, 4) + \" \" + formatState.substring(5);\n } else if(formatState.contains(\"district\"))\n {\n //grab the string \"district\" and put a space after it\n formatState = formatState.substring(0, 7) + \" \" + formatState.substring(8, 9) + \" \" + formatState.substring(10);\n } else if(formatState.contains(\"west\"))\n {\n //grab the string \"west\" and put a space after it\n formatState = formatState.substring(0, 3) + \" \" + formatState.substring(4);\n }\n\n char[] stateChar = formatState.toCharArray(); //convert the formatted string to a character array\n boolean previousCharIsLetter = false;\n formatState = \"\";\n \n /**\n * This for loop loops through the character array. It attempts to find the start of a word and capitalize it.\n * If a word is after a space, it is a new word. If not, it will keep looping until the character array has been\n * completely gone through to reformat the string (ex: new york -> New York .. if it were somehow nEw yOrK -> New York).\n */\n for(int i = 0; i < stateChar.length; i++)\n {\n if(!previousCharIsLetter && Character.isLetter(stateChar[i]))\n {\n stateChar[i] = Character.toUpperCase(stateChar[i]);\n previousCharIsLetter = true;\n } else if(Character.isWhitespace(stateChar[i])) //if the character is a space\n {\n previousCharIsLetter = false;\n }\n \n formatState += stateChar[i];\n }\n }\n \n return formatState;\n }", "State.Builder<E, S, A> to(S state);", "private String transitionTable() {\r\n\r\n\t\tString transitionTable = \"\t\";\r\n\t\tchar[][] matrix = new char[numStates.size() + 1][alphabet.size() + 1];\r\n\t\tStringBuilder bldmatrix = new StringBuilder();\r\n\r\n\t\tfor (int i = 0; i < matrix.length; i++) {\r\n\t\t\tfor (int j = 0; j < matrix[i].length; j++) {\r\n\t\t\t\tif (i == 0) {\r\n\t\t\t\t\tif (j == 0) {\r\n\t\t\t\t\t\tmatrix[i][j] = ' ';\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tArrayList<Character> trans = new ArrayList<>(alphabet);\r\n\t\t\t\t\t\tmatrix[i][j] = trans.get(j - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (j == 0) {\r\n\t\t\t\t\t\tmatrix[i][j] = numStates.get(i - 1).getName().charAt(0);\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tArrayList<Character> trans2 = new ArrayList<>(alphabet);\r\n\t\t\t\t\t\tmatrix[i][j] = ((NFAState) getToState(numStates.get(i - 1), trans2.get(j - 1))).getName()\r\n\t\t\t\t\t\t\t\t.charAt(0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (int x = 0; x < matrix.length; x++) {\r\n\t\t\tfor (int y = 0; y < matrix[x].length; y++) {\r\n\t\t\t\tbldmatrix.append(\"\\t\" + matrix[x][y]);\r\n\r\n\t\t\t}\r\n\t\t\tbldmatrix.append(\"\\n\");\r\n\t\t}\r\n\r\n\t\ttransitionTable = bldmatrix.toString();\r\n\r\n\t\treturn transitionTable;\r\n\r\n\t}", "public String getStateString()\n {\n return stateString;\n }", "public static String[][] getBoardState() {\n return boardState;\n }", "@Test\n\tpublic void testBoardMoveToString() {\n\t\t\tboard.initNewGame();\n\t\t\tbyte[] move = new byte[2];\n\t\t\tmove[0]=0;\n\t\t\tmove[1]=2;\n\t\t\tAssert.assertEquals(\"A1C1\",Board.moveToString(move));\n\t\t\t\n\t\t\t// reverse test\n\t\t\ttry {\n\t\t\t\tbyte[] reverse=Board.stringToMove(\"A1C1\");\n\t\t\t\t\n\t\t\t\tAssert.assertTrue(move[0]==reverse[0]);\n\t\t\t\tAssert.assertTrue(move[1]==reverse[1]);\n\t\t\t} catch (IllegalBoardException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tAssert.fail();\n\t\t\t}\n\t}", "public String getStateString()\r\n\t{\r\n\t\treturn stateString;\r\n\t}", "public String toString() {\n\tStringBuffer buffer = new StringBuffer();\n\t//\tbuffer.append(\" 6 5 4 3 2 1 \\n\");\n\tbuffer.append(\"+---------------------------------------+\\n\");\n\t\n\tbuffer.append(\"| |\");\n\tfor (int i = 12; i >= 7; --i) {\n\t buffer.append(toString(state[i]));\n\t}\n\tbuffer.append(\" |\\n\");\n\t\n\tbuffer.append(\"|\");\n\tbuffer.append(toString(state[13]));\n\tbuffer.append(\"-----------------------------|\");\n\tbuffer.append(toString(state[6]));\n\tbuffer.append(\"\\n\");\n\t\n\tbuffer.append(\"| |\");\n\tfor (int i = 0; i <= 5; ++i) {\n\t buffer.append(toString(state[i]));\n\t}\n\tbuffer.append(\" |\\n\");\n\t\n\tbuffer.append(\"+---------------------------------------+\\n\");\n\tbuffer.append(\" 0 1 2 3 4 5 \\n\");\n\t\n\treturn buffer.toString();\n }", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n String expResult = \"Pendente\";\n String result = ReviewState.PENDING.toString();\n assertEquals(expResult, result);\n expResult = \"Terminada\";\n result = ReviewState.FINISHED.toString();\n assertEquals(expResult, result);\n }", "public String stateToString(int row, int col) {\r\n if (!isValid(row, col)) {\r\n return INDEX_ERROR_MESSAGE;\r\n } else if (!isFree(row, col)) {\r\n return \"P\" + getState(row, col);\r\n }\r\n return \"**\";\r\n }", "public static void setBoardState(String[][] bs) {\n boardState = bs;\n }", "public String getState() {\n StringBuilder builder = new StringBuilder();\n //builder.append(muteMusic.getBackground().getLevel());\n //builder.append(',');\n builder.append(muteClicked);\n builder.append(',');\n builder.append(gameOver);\n builder.append(',');\n builder.append(wordsDetectedByUser.size());\n builder.append(',');\n for(int i =0;i<wordsDetectedByUser.size();i++)\n { builder.append(wordsDetectedByUser.get(i));\n builder.append(',');}\n builder.append(notValidWord);\n builder.append(',');\n // m1Handler.removeCallbacks(m1Runnable);\n mHandler.removeCallbacks(mRunnable);\n builder.append(phaseTwo);\n builder.append(',');\n builder.append(currentScore); //storing current score\n builder.append(',');\n builder.append(t); //storing timer state\n builder.append(',');\n Object a[] = DoneTiles.toArray();\n builder.append(a.length);\n builder.append(',');\n for(int i=0;i<a.length;i++) {\n builder.append(a[i].toString());\n builder.append(',');\n }\n builder.append(mLastLarge);\n builder.append(',');\n builder.append(mLastSmall);\n builder.append(',');\n for (int large = 0; large < 9; large++) {\n for (int small = 0; small < 9; small++) {\n builder.append(mSmallTiles[large][small].getOwner().name());\n builder.append(',');\n builder.append((((Button)mSmallTiles[large][small].getView()).getText()).toString());\n builder.append(',');\n //Log.d(DoneTiles);\n }\n }\n return builder.toString();\n }", "public static int activityStateToWorkItemState( int newState )\r\n {\r\n // The states actually have the same ordinals.\r\n return newState;\r\n }", "@Override\n\tpublic void changeStateTo(String complainId, String state) throws Exception {\n\t\tIBOOrderComplainsValue ivalue = getOrderComplainsById(complainId);\n\t\tivalue.setState(state);\n\t\tBOOrderComplainsEngine.save(ivalue);\n\t}", "@JsonCreator\n public static TestMigrationState fromString(String name) {\n return fromString(name, TestMigrationState.class);\n }", "public IFsm transitionTo(Class<? extends IState> p_newState) throws Exception;", "void changeState(Spreadable spreadable, State from, State to, int count);", "public static State fromString(String s) {\n if (s != null) {\n State[] vs = values();\n for (int i = 0; i < vs.length; i++) {\n if (vs[i].toString().equalsIgnoreCase(s)) {\n return vs[i];\n }\n }\n }\n return null;\n }", "@Override\n\tpublic void setState(State state) \n\t\t{ current = new PuzzleState(state.getString(state.getState()),\n\t\t\t\t\t\t\t\t\tstate.getString(state.getGoalState())); \n\t\t}", "public void testFromString()\n {\n // An empty board\n assertEquals(b1.toString(), \"EEEEEEEEE\");\n b1.fromString(\"EEEEEEEEE\");\n assertEquals(b1.toString(), \"EEEEEEEEE\");\n\n // An arbitrary complex but valid case\n b1.fromString(\"RRRBEEBBE\");\n assertEquals(b1.toString(), \"RRRBEEBBE\");\n\n // Wrong string length\n try { b1.fromString(\"E\"); }\n catch (Exception e)\n {\n assertEquals(e.getClass(),\n (new IllegalArgumentException()).getClass());\n assertEquals(e.getMessage(), \"Your state identifying \" +\n \"string is the wrong length. It must be nine characters\" +\n \" long with no spaces.\");\n }\n\n // Invalid cell characters\n try { b1.fromString(\"XXXXXXXXX\"); }\n catch (Exception e)\n {\n assertEquals(e.getClass(),\n (new IllegalArgumentException()).getClass());\n assertEquals(e.getMessage(), \"Your string has a \" +\n \"value in it that doesn't match one of our cell \" +\n \"types.\");\n }\n\n }", "public String warStateToString() {\n StringBuilder s = new StringBuilder();\n\n if (aggressor instanceof Nation) {\n s.append(((Nation) aggressor).getName());\n } else if (aggressor instanceof Town) {\n s.append(((Town) aggressor).getName());\n }\n\n s.append(\" \");\n\n if (defender instanceof Nation) {\n s.append(((Nation) defender).getName());\n } else if (defender instanceof Town) {\n s.append(((Town) defender).getName());\n }\n\n s.append(\" \");\n\n s.append(aggressorPoints).append(\" \");\n s.append(defenderPoints).append(\" \");\n\n for (Town town : towns.keySet()) {\n s.append(town.getName()).append(\" \");\n s.append(towns.get(town)).append(\" \");\n }\n\n if (rebelwar != null)\n s.append(\" \").append(rebelwar.getName());\n else\n s.append(\" \" + \"n u l l\");\n\n return s.toString();\n }", "public String dumpState() {\n StringBuilder out = new StringBuilder();\n out.append(currentPlayer);\n for (int i = 0; i < board.length; ++i)\n out.append(\" \" + board[i]);\n\n return out.toString();\n }", "public String toString() {\r\n\t\treturn gameState;\r\n\t}", "public static String pgnToFen() {\n String fen = \"\";\n\n for (int i = getBoardState().length - 1; i >= 0; i--) {\n String fenLine = \"\";\n\n int spaceStreak = 0;\n\n for (String file: getBoardState()[i]) {\n String piece = Character.toString(file.charAt(0));\n char color = file.charAt(1);\n\n if (color == ' ') {\n spaceStreak++;\n\n continue;\n } else if (spaceStreak > 0) {\n fenLine += spaceStreak;\n\n spaceStreak = 0;\n }\n\n String square = color == 'w' ? piece : piece.toLowerCase();\n\n fenLine += square;\n }\n\n if (spaceStreak > 0) {\n fenLine += spaceStreak;\n }\n\n fen += fenLine + (i != 0 ? \"/\" : \"\");\n }\n\n return fen;\n }", "public String toString(){\n \tif(state){\n\t\treturn (\"1\");\n\t }\n\t else{\n\t\t return(\"0\");\n\t }\n }", "State mo5880e(String str);", "public ControllerState(String stateString)\n {\n if (stateString == null)\n throw new IllegalArgumentException(\"Null state string\");\n this.stateString = stateString;\n }", "void printBoardState(Piece[] B,Player J,int N);", "public static String parseSelectedState(String s) {\n if (!fullMap.containsKey(s)) {\n return \"\";\n } else {\n return fullMap.get(s);\n }\n/* if (s.equals(\"Alabama\")) {\n return \"AL\";\n }\n if (s.equals(\"Alaska\")) {\n return \"AK\";\n }\n if (s.equals(\"Arizona\")) {\n return \"AZ\";\n }\n if (s.equals(\"Arkansas\")) {\n return \"AR\";\n }\n if (s.equals(\"California\")) {\n return \"CA\";\n }\n // more states here*/\n }", "com.google.protobuf.StringValue getConversionAction();", "private String makeStateName(int id, boolean guided) {\n\n\t\tif (guided) {\n\t\t\treturn \"guided\" + id;\n\t\t}\n\n\t\treturn \"state\" + id;\n\t}", "public Checker convertToKing(Checker checker, Move move) {\n\t\t int type = 0;\n\t\t if(checker.getType() == 1) {\n\t\t\t checker.setType(3);\n\t\t\t type = 3;\n\t\t } else if (checker.getType() == 2) {\n\t\t\t checker.setType(4);\n\t\t\t type = 4;\n\t\t }\n\t\t \n\t\t board.getBoard()[move.getyOrigin()][move.getxOrigin()] = 0;\n\t\tboard.getBoard()[move.getyMove()][move.getxMove()] = type;\n\t\t \n\t\treturn checker;\n\t\t \n\t\t \n\t }", "public static Board fen(String str) {\n\t\tPiece[][] b = new Piece[8][8];\n\t\tbyte r = 7, c = 0;\n\t\tString[] s = str.split(\" \");\n\t\t\n\t\tfor (int i = 0; i < s[0].length(); i++) {\n\t\t\tif (s[0].charAt(i) == '/') {\n\t\t\t\tr--;\n\t\t\t\tc = -1;\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'P') {\n\t\t\t\tb[r][c] = new Pawn(true, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'N') {\n\t\t\t\tb[r][c] = new Knight(true, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'B') {\n\t\t\t\tb[r][c] = new Bishop(true, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'R') {\n\t\t\t\tb[r][c] = new Rook(true, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'Q') {\n\t\t\t\tb[r][c] = new Queen(true, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'K') {\n\t\t\t\tb[r][c] = new King(true, r, c, s[1].charAt(0)=='1', s[1].charAt(1)=='1');\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'p') {\n\t\t\t\tb[r][c] = new Pawn(false, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'n') {\n\t\t\t\tb[r][c] = new Knight(false, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'b') {\n\t\t\t\tb[r][c] = new Bishop(false, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'r') {\n\t\t\t\tb[r][c] = new Rook(false, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'q') {\n\t\t\t\tb[r][c] = new Queen(false, r, c);\n\t\t\t}\n\t\t\t\n\t\t\telse if (s[0].charAt(i) == 'k') {\n\t\t\t\tb[r][c] = new King(false, r, c, s[1].charAt(2)=='1', s[1].charAt(3)=='1');\n\t\t\t}\n\t\t\t\n\t\t\telse {\n\t\t\t\tfor (byte j = 0; j < Byte.parseByte(s[0].charAt(i)+\"\"); j++) {\n\t\t\t\t\tb[r][c+j] = new Null(r, (byte)(c+j));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tc += Byte.parseByte(s[0].charAt(i)+\"\") - 1;\n\t\t\t}\n\t\t\t\n\t\t\tc++;\n\t\t}\n\t\t\n\t\treturn new Board(b);\n\t}", "@Override\n\tpublic String toString()\n\t{\n\t\tStringBuilder stringBuilder = new StringBuilder();\n\t\tfor (int i = 0; i < 2 * size + 1; i++)\n\t\t{\n\t\t\tstringBuilder.append(\"-\");\n\t\t}\n\t\tstringBuilder.append(\"\\n|\");\n\t\tfor (int i = 0; i < state.size(); i++)\n\t\t{\n\t\t\tstringBuilder.append(state.get(i)).append(\"|\");\n\t\t\tif (i % size == size - 1 && i < state.size() - 1)\n\t\t\t{\n\t\t\t\tstringBuilder.append(\"\\n|\");\n\t\t\t}\n\t\t}\n\t\tstringBuilder.append(\"\\n\");\n\t\tfor (int i = 0; i < 2 * size + 1; i++)\n\t\t{\n\t\t\tstringBuilder.append(\"-\");\n\t\t}\n\t\treturn stringBuilder.toString();\n\t}", "private String convertBoolean(boolean booToConv) {\n\t\tString convText = \"\";\n\t\tif (booToConv) {\n\t\t\tconvText = \"Yes\";\n\t\t} else {\n\t\t\tconvText = \"No\";\n\t\t}\n\t\treturn convText;\n\t}", "@Override\n public String toString()\n {\n return state.toString();\n }", "@Override\r\n\tpublic String toString()\r\n\t{\r\n\t\treturn state.toString();\r\n\t}", "public State(char[] arr) {\r\n\t\tthis.board = Arrays.copyOf(arr, arr.length);\r\n\t}", "public String getShortState(String state) {\n\t\t\t\t\n\t\t\t\tStatement statement=null;\n\t\t\t\tResultSet rs=null;\n\t\t\t\tString shortState=\"\";\n\t\t\t\ttry {\n\t\t\t\t\tstatement = connection.createStatement();\n\t\t\t\t\tString sql=\"select LINK2 from config_master where NAME='EXE_STATE' and VALUE='\"+state+\"'\";\n\t\t\t\t\trs = statement.executeQuery(sql);\n\t\t\t\t\t\n\t\t\t\t\twhile (rs.next()) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tshortState=rs.getString(\"LINK2\");\n\t\t\t\t\t}\n\n\t\t\t\t\t\n\t\t\t\t} catch (SQLException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\treturn shortState;\n\t}", "public String getState() {\n Scanner scanner = new Scanner(System.in);\n\n // Tell User to enter two digit state\n System.out.println(\"Enter state name: \");\n\n // Get the two digit state\n String state = scanner.next();\n\n return state;\n }", "private static String getLabel(State from, State to) {\n String label = transitionLabels.get(hashOf(from, to));\n if (label != null)\n return label;\n else\n return \"\";\n }", "public String getMoveConverted(String move, boolean whiteTeamMoving) {\n\t\tif (move.startsWith(\"O-O-O\")) { //Queenside castle\n\t\t\tint row = whiteTeamMoving ? 0 : 7;\n\t\t\treturn row + \"\" + 4 + \";\" + row + \"\" + 0 + \";\" + (6 * (whiteTeamMoving ? 1 : -1)) + \";CASTLE\";\n\t\t} else if (move.startsWith(\"O-O\")) { //Kingside castle\n\t\t\tint row = whiteTeamMoving ? 0 : 7;\n\t\t\treturn row + \"\" + 4 + \";\" + row + \"\" + 7 + \";\" + (6 * (whiteTeamMoving ? 1 : -1)) + \";CASTLE\";\n\t\t}\n\n\t\tMatcher matcher = matchingPattern.matcher(move);\n\t\tmatcher.find();\n\n\t\t//Get the matching groups from the regex\n\t\tString pieceType = matcher.group(1);\n\t\tString fromSpecifier = matcher.group(2);\n\t\tString capture = matcher.group(3);\n\t\tString toLocation = matcher.group(4);\n\t\tString upgradeType = matcher.group(5);\n\n\t\tboolean isCapture = capture != null && capture.equals(\"x\");\n\n\t\t//Get the piece type\n\t\tint piece = getPieceNumFromStr(pieceType);\n\n\t\tif (piece != 1) {\n\t\t\tresetEnpassant(whiteTeamMoving ? 1 : -1);\n\t\t}\n\n\t\t//Get the already known row and column values\n\t\tint fromRow = -1;\n\t\tint fromCol = -1;\n\t\tif (fromSpecifier != null) {\n\t\t\tMatcher fromMatcher = positionPattern.matcher(fromSpecifier);\n\t\t\tfromMatcher.find();\n\n\t\t\tString col = fromMatcher.group(1);\n\t\t\tString row = fromMatcher.group(2);\n\n\t\t\tif (col != null) fromCol = (int)col.charAt(0) - (int)'a';\n\t\t\tif (row != null) fromRow = (int)row.charAt(0) - (int)'1';\n\t\t}\n\n\t\t//Get the to row and column values\n\t\tint toCol = (int)toLocation.charAt(0) - (int)'a';\n\t\tint toRow = (int)toLocation.charAt(1) - (int)'1';\n\n\t\t//Figure out what type of piece this will be when it is done\n\t\tint newType = piece;\n\t\tif (upgradeType != null) newType = getPieceNumFromStr(upgradeType);\n\n\t\tif (fromRow == -1 || fromCol == -1) {\n\t\t\tList<String> possibleFroms = new LinkedList<String>();\n\t\t\tif (piece == 1) { //If it is a pawn\n\t\t\t\tif (whiteTeamMoving) {\n\t\t\t\t\tif (isCapture) {\n\t\t\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol+1));\n\t\t\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol-1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol));\n\t\t\t\t\t\tif (toRow == 3) {\n\t\t\t\t\t\t\tpossibleFroms.add((toRow-2) + \"\" + (toCol));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isCapture) {\n\t\t\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol+1));\n\t\t\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol-1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol));\n\t\t\t\t\t\tif (toRow == 4) {\n\t\t\t\t\t\t\tpossibleFroms.add((toRow+2) + \"\" + (toCol));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (piece == 2) { //If it is a rook\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toCol) {\n\t\t\t\t\t\tpossibleFroms.add(toRow + \"\" + i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toRow) {\n\t\t\t\t\t\tpossibleFroms.add(i + \"\" + toCol);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (piece == 3) { //If it is a knight\n\t\t\t\tpossibleFroms.add((toRow+2) + \"\" + (toCol+1));\n\t\t\t\tpossibleFroms.add((toRow+2) + \"\" + (toCol-1));\n\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol+2));\n\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol-2));\n\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol+2));\n\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol-2));\n\t\t\t\tpossibleFroms.add((toRow-2) + \"\" + (toCol+1));\n\t\t\t\tpossibleFroms.add((toRow-2) + \"\" + (toCol-1));\n\t\t\t} else if (piece == 4) { //If it is a bishop\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toCol) {\n\t\t\t\t\t\tpossibleFroms.add((toRow - toCol + i) + \"\" + (i));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toRow) {\n\t\t\t\t\t\tpossibleFroms.add((i) + \"\" + (toRow + toCol - i));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (piece == 5) { //If it is a queen\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toCol) {\n\t\t\t\t\t\tpossibleFroms.add(toRow + \"\" + i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toRow) {\n\t\t\t\t\t\tpossibleFroms.add(i + \"\" + toCol);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toCol) {\n\t\t\t\t\t\tpossibleFroms.add((toRow - toCol + i) + \"\" + (i));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i<8; i++) {\n\t\t\t\t\tif (i != toRow) {\n\t\t\t\t\t\tpossibleFroms.add((i) + \"\" + (toRow + toCol - i));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (piece == 6) { //If it is a king\n\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol));\n\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol));\n\t\t\t\tpossibleFroms.add((toRow) + \"\" + (toCol+1));\n\t\t\t\tpossibleFroms.add((toRow) + \"\" + (toCol-1));\n\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol+1));\n\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol-1));\n\t\t\t\tpossibleFroms.add((toRow-1) + \"\" + (toCol+1));\n\t\t\t\tpossibleFroms.add((toRow+1) + \"\" + (toCol-1));\n\t\t\t}\n\n\t\t\tfinal int fr = fromRow;\n\t\t\tfinal int fc = fromCol;\n\t\t\tOptional<String> originalLocationOP = possibleFroms.stream().filter((s)->{\n\t\t\t\tif (s.contains(\"-\")) return false;\n\n\t\t\t\tint r = Integer.parseInt(s.charAt(0)+\"\");\n\t\t\t\tint c = Integer.parseInt(s.charAt(1)+\"\");\n\n\t\t\t\tif (r < 0 || r > 7 || c < 0 || c > 7) return false;\n\n\t\t\t\tif (board[r][c] != piece * (whiteTeamMoving ? 1 : -1)) return false;\n\n\t\t\t\tif (fr != -1 && fr != r) return false;\n\t\t\t\tif (fc != -1 && fc != c) return false;\n\n\t\t\t\tif (!isLegalMove((r + \"\" + c) + \";\" + (toRow + \"\" + toCol) + \";\" + piece * (whiteTeamMoving ? 1 : -1))) return false;\n\n\t\t\t\treturn true;\n\t\t\t}).findAny(); \n\n\t\t\tString originalLoc = originalLocationOP.get();\n\t\t\tfromRow = Integer.parseInt(originalLoc.charAt(0)+\"\");\n\t\t\tfromCol = Integer.parseInt(originalLoc.charAt(1)+\"\");\n\t\t}\n\n\t\treturn (fromRow + \"\" + fromCol) + \";\" + (toRow + \"\" + toCol) + \";\" + newType * (whiteTeamMoving ? 1 : -1);\n\t}", "public String makeConversion(String value);", "public com.google.protobuf.ByteString\n getStateBytes() {\n java.lang.Object ref = state_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n state_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public int getBoardState(boolean whiteTeamMoving) {\n\t\tint result = 0;\n\t\tboolean moves = doMovesExist(whiteTeamMoving);\n\n\t\tresult |= moves ? 0 : 1;\n\t\tresult |= isWhiteCheck() ? 1<<1 : 0;\n\t\tresult |= isBlackCheck() ? 1<<2 : 0;\n\t\tresult |= result == 1 ? 0 : 1<<3;\n\n\t\treturn result;\n\t}", "@Test\n public void stateExample2() {\n MarbleSolitaireModel exampleBoard = new MarbleSolitaireModelImpl();\n assertEquals(\" O O O\\n\"\n + \" O O O\\n\"\n + \"O O O O O O O\\n\"\n + \"O O O _ O O O\\n\"\n + \"O O O O O O O\\n\"\n + \" O O O\\n\"\n + \" O O O\", exampleBoard.getGameState());\n }", "@java.lang.Override\n public java.lang.String getStateMessage() {\n java.lang.Object ref = stateMessage_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n stateMessage_ = s;\n return s;\n }\n }", "public StateTransition getStateTransition() {\n\t\treturn (sb);\n\t}", "public abstract String getState();", "@Test\n public void stateExample2() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl(7);\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \" O O O O O\\n\" +\n \" O O O O O O\\n\" +\n \"O O O O O O O\", exampleBoard.getGameState());\n }", "public static State findState(String string) {\n String find = string.toUpperCase();\n\n if (find.contains(WAITING.name())) {\n return WAITING;\n }\n else if (find.contains(STARTING.name())) {\n return STARTING;\n }\n else if (find.contains(PLAYING.name())) {\n return PLAYING;\n }\n else if (find.contains(ENDING.name())) {\n return ENDING;\n }\n else if (find.contains(ENDED.name())) {\n return ENDED;\n }\n else {\n return OFFLINE;\n }\n }", "public String getWinnerName(String state) {\r\n \r\n result = table.get(state);\r\n String winner = result.get(1); // getting name of winner from array list and storing it\r\n \r\n return winner;\r\n }", "public static ElevatorState changeStateFactory(String stateElavator) {\n\t\tif(stateElavator==\"UP\") {\n\t\t\treturn new UpState();\n\t\t}else if(stateElavator==\"DOWN\") {\n\t\t\treturn new DownState();\n\t\t}else {\n\t\t\treturn new StopState();\n\t\t}\n\t}", "public void setState(String s) {\r\n\t\tstate = s;\t\t\r\n\t}", "public String getStateAsString() {\n return storeStateIntoString();\n }", "String getBoard();", "public String toString() {\n\t\treturn \"PushObstacleState\";\n\t}", "LabState state();", "public String getNewState() {\n\t\treturn this.newState;\n\t}", "public interface AbstractState {\r\n abstract void toNextState(ChessBoard chessBoard,AbstractState state);\r\n}", "public static WsmResourceState fromDb(String dbString) {\n if (dbString == null) {\n return null;\n }\n for (var state : WsmResourceState.values()) {\n if (state.dbString.equals(dbString)) {\n if (state == NOT_EXISTS) {\n throw new InternalLogicException(\"Found NOT_EXISTS state in the database\");\n }\n return state;\n }\n }\n throw new SerializationException(\n \"Deserialization failed: no matching state type for \" + dbString);\n }", "public String getState() { return state; }", "protected void takeTurn(int[][] boardState)\n {\n \n }", "public AeBpelState getState();", "BGPv4FSMState state();", "void setState(String state);", "public void handleGameStateChange(GameState s) {\n if (s.isGameOver()) {\n state.setText(s.toString().toUpperCase());\n moveHistory.add(s.toString());\n //Alerts user that game has ended.\n Alert gameInfo = new Alert(AlertType.INFORMATION);\n gameInfo.setTitle(\"Interactive Chess\");\n gameInfo.setHeaderText(\"Game Over\");\n gameInfo.setContentText(s.toString() + \"!\");\n gameInfo.showAndWait();\n //Second Alert informing user game has resetted to new player game\n Alert gameNew = new Alert(AlertType.INFORMATION);\n gameNew.setTitle(\"Interactive Chess\");\n gameNew.setHeaderText(null);\n gameNew.setContentText(\"New default game mode (Player Game) will \"\n + \"now start. Check the \\\"Game\\\" Menu for more game options\");\n gameNew.showAndWait();\n\n //Update UI and code\n tType.setText(\"Player Match\");\n playerGameMenuItem.setSelected(true);\n reset(new ChessController());\n }\n }", "public String boardCellToString() {\n String str;\n Integer convertX, convertY;\n //adjusting the co'ordinates because the board starts at 1 not 0\n convertX=this.xCor + 1;\n convertY= this.yCor + 1;\n str = \"(\" + convertX.toString() + \",\" + convertY.toString() + \")\";\n return str;\n }", "public String toString()\n {\n \tint tempIndex;\n \tStringBuilder statesStr = new StringBuilder(\"States: { \");\n \tfor(ComplexState state: states)\n \t\tstatesStr.append(state.getName() + \", \");\n\t\ttempIndex = statesStr.lastIndexOf(\",\");\n \tif(tempIndex != -1)\n \t\tstatesStr.deleteCharAt(statesStr.lastIndexOf(\",\"));\n \tstatesStr.append(\"}\\n\");\n \tStringBuilder initStatesStr = new StringBuilder(\"Initial states: { \");\n \tfor(ComplexState state: initialStates)\n \t\tinitStatesStr.append(state.getName() + \", \");\n \ttempIndex = initStatesStr.lastIndexOf(\",\");\n \tif(tempIndex != -1)\n \t\tinitStatesStr.deleteCharAt(initStatesStr.lastIndexOf(\",\"));\n \tinitStatesStr.append(\"}\\n\");\n \tStringBuilder transitionFuncStr = new StringBuilder(\"Transition relation: { \");\n \tArrayList<ComplexState> destStates = new ArrayList<ComplexState>();\n \tfor(ComplexState srcState: states) \n \t{\n \t\tdestStates = transitionRelation.get(srcState);\n \t\tif(destStates != null)\n\t \t\tfor(ComplexState destState: destStates)\n\t \t\t\ttransitionFuncStr.append(\"( \" + srcState.getName() + \", \" + destState.getName() + \" ), \" );\t\n \t}\n \ttempIndex = transitionFuncStr.lastIndexOf(\",\");\n \tif(tempIndex != -1)\n \t\ttransitionFuncStr.deleteCharAt(transitionFuncStr.lastIndexOf(\",\"));\n \ttransitionFuncStr.append(\"}\\n\");\n \tStringBuilder labelingFuncStr = new StringBuilder(\"Labeling function: { \");\n \tArrayList<AtomicProp> atomicProps = new ArrayList<AtomicProp>();\n \tfor(ComplexState state: states) \n \t{\n \t\tlabelingFuncStr.append(\"( \" + state.getName() + \", { \");\n \t\tatomicProps = state.getLabels();\n \t\tif(atomicProps != null)\n \t\t\tfor(AtomicProp ap: state.getLabels())\n \t\t\t\tlabelingFuncStr.append(ap.getName() + \", \");\n \t\ttempIndex = labelingFuncStr.lastIndexOf(\",\");\n \tif(tempIndex != -1)\n \t\tlabelingFuncStr.deleteCharAt(labelingFuncStr.lastIndexOf(\",\"));\n \t\tlabelingFuncStr.append(\"} ), \");\n \t}\n \ttempIndex = labelingFuncStr.lastIndexOf(\",\");\n \tif(tempIndex != -1)\n \t\tlabelingFuncStr.deleteCharAt(labelingFuncStr.lastIndexOf(\",\"));\n \tlabelingFuncStr.append(\"}\\n\"); \t\n \tString result = statesStr.toString() + initStatesStr.toString() + transitionFuncStr.toString() + labelingFuncStr.toString() + \"Type: \" + type.toString();\n \treturn result;\n }", "public Tree<String> parse(Tree<State> tree) {\n\t\tTree<String> parsed = null;\n\t\ttry { // do NOT expect it to crash\n\t\t\tviterbiParse(tree);\n\t\t\tparsed = StateTreeList.stateTreeToStringTree(tree, Inferencer.grammar.numberer);\n\t\t\tparsed = Inferencer.extractBestMaxRuleParse(chart, parsed.getYield());\n\t\t} catch (Exception e) {\n\t\t\tparsed = new Tree<String>(Inferencer.DUMMY_TAG);\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn parsed;\n\t}", "@JsonCreator\n public static ProgrammingState fromString(String name) {\n return fromString(name, ProgrammingState.class);\n }", "public String convertBoardToString(){\n String tmp= \"\";\n\n for (int i=0; i<30; i++){\n for (int j=0; j<80; j++){\n if (board.getCharacter(j,i)==0){\n tmp += '-';\n } else {\n tmp += board.getCharacter(j,i);\n }\n }\n }\n return tmp;\n }", "@Test\n public void stateExample1() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl();\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \"O O O O O\", exampleBoard.getGameState());\n }", "public java.lang.String getStateMessage() {\n java.lang.Object ref = stateMessage_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n stateMessage_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }" ]
[ "0.6594786", "0.63187546", "0.59727037", "0.585304", "0.5758274", "0.56128484", "0.55573326", "0.54627436", "0.5322179", "0.5226553", "0.52006745", "0.51608723", "0.51608723", "0.51608723", "0.51270807", "0.5123028", "0.50166875", "0.49914828", "0.49888042", "0.49706024", "0.49369246", "0.49162567", "0.48922935", "0.48642406", "0.4862311", "0.4784542", "0.47763634", "0.47748962", "0.47741538", "0.476934", "0.47640008", "0.47584695", "0.4747607", "0.47420636", "0.47306716", "0.4728504", "0.47138354", "0.4702036", "0.46609107", "0.46603566", "0.46214285", "0.461749", "0.45986393", "0.4593393", "0.45803085", "0.45584705", "0.45544755", "0.4548093", "0.4546203", "0.45453513", "0.45391646", "0.45386663", "0.45361093", "0.45205736", "0.4502897", "0.4496938", "0.44955415", "0.44889304", "0.4488873", "0.448794", "0.4485373", "0.44774598", "0.44747517", "0.44650722", "0.44640025", "0.4459558", "0.44580522", "0.44575134", "0.44411272", "0.4439747", "0.4436067", "0.44320744", "0.44276416", "0.44248462", "0.4422713", "0.4420733", "0.44186166", "0.44111696", "0.44067183", "0.43845776", "0.43750566", "0.43668666", "0.43634763", "0.4359025", "0.4357209", "0.4352598", "0.43484834", "0.4344276", "0.43339574", "0.4333238", "0.4326148", "0.4322594", "0.4322156", "0.43079343", "0.43077272", "0.43047312", "0.43011802", "0.4290479", "0.42866698", "0.4285168" ]
0.5646544
5
Of stateToCheckerboard Determine current game situation for white: WHITE, BLACK, TIE, or UNFINISHED.
public int computeGameSituation() { return computeGameSituation(checkerboard); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "private int checkerboardToState(int[][] paraCheckerboard) {\n\t\tint resultState = 0;\n\t\tint tempExponential = 1;\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultState += paraCheckerboard[i][j] * tempExponential;\n\t\t\t\ttempExponential *= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultState;\n\t}", "public int getBoardState(boolean whiteTeamMoving) {\n\t\tint result = 0;\n\t\tboolean moves = doMovesExist(whiteTeamMoving);\n\n\t\tresult |= moves ? 0 : 1;\n\t\tresult |= isWhiteCheck() ? 1<<1 : 0;\n\t\tresult |= isBlackCheck() ? 1<<2 : 0;\n\t\tresult |= result == 1 ? 0 : 1<<3;\n\n\t\treturn result;\n\t}", "public GameState won() {\n if ( (board[0][0] != TileState.BLANK) && (board[0][0] == board[0][1]) && (board[0][0] == board[0][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[1][0] != TileState.BLANK) && (board[1][0] == board[1][1]) && (board[1][0] == board[1][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[2][0] != TileState.BLANK) && (board[2][0] == board[2][1]) && (board[2][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][1]) && (board[0][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ( (board[0][2] != TileState.BLANK) && (board[0][2] == board[1][1]) && (board[0][2] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][0]) && (board[0][0] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][1] != TileState.BLANK) && (board[0][1] == board[1][1]) && (board[0][1] == board[2][1])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][2] != TileState.BLANK) && (board[0][2] == board[1][2]) && (board[0][2] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if (movesPlayed == 9)\n return GameState.DRAW;\n return GameState.IN_PROGRESS;\n }", "public static void stateCheckerboardConvertionTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17087 };\n\n\t\tint tempState;\n\t\tint[][] tempCheckerboard;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempCheckerboard = tempEnvironment.stateToCheckerboard(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The checkerboard of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.deepToString(tempCheckerboard));\n\t\t\ttempState = tempEnvironment.checkerboardToState(tempCheckerboard);\n\t\t\tSystem.out.println(\"The state ID is \" + tempState);\n\t\t} // Of for i\n\n\t}", "public int hasBlackWon() {\n\t\tif(blackPieces == 0) {\n\t\t\treturn 1;\n\t\t} else if(whitePieces == 0) {\n\t\t\treturn 2;\n\t\t}\n\t\t\n\t\treturn 0;\n\t}", "public static int computeGameSituation(int[][] paraCheckerboard) {\n\t\t// Indicate whether or not the row/column/slope is the same.\n\t\tboolean tempSame = false;\n\n\t\t// Step 1. Horizontal\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tif (paraCheckerboard[i][0] == EMPTY) {\n\t\t\t\tcontinue;\n\t\t\t} // Of if\n\n\t\t\t// A whole row is the same.\n\t\t\ttempSame = true;\n\t\t\tfor (int j = 1; j < SIZE; j++) {\n\t\t\t\tif (paraCheckerboard[i][j] != paraCheckerboard[i][0]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for j\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[i][0];\n\t\t\t} // Of if\n\t\t} // Of for i\n\n\t\t// Step 2. Vertical\n\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\tif (paraCheckerboard[0][j] == EMPTY) {\n\t\t\t\tcontinue;\n\t\t\t} // Of if\n\n\t\t\t// A whole column is the same.\n\t\t\ttempSame = true;\n\t\t\tfor (int i = 1; i < SIZE; i++) {\n\t\t\t\tif (paraCheckerboard[i][j] != paraCheckerboard[0][j]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for i\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[0][j];\n\t\t\t} // Of if\n\t\t} // Of for i\n\n\t\t// Step 3. Slope: Left-top to right-bottom.\n\t\tif (paraCheckerboard[0][0] != EMPTY) {\n\t\t\ttempSame = true;\n\t\t\tfor (int i = 1; i < SIZE; i++) {\n\t\t\t\tif (paraCheckerboard[i][i] != paraCheckerboard[0][0]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for i\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[0][0];\n\t\t\t} // Of if\n\t\t} // Of if\n\n\t\t// Step 4. Slope: Right-top to left-bottom.\n\t\tif (paraCheckerboard[0][SIZE - 1] != EMPTY) {\n\t\t\tfor (int i = 1; i < SIZE; i++) {\n\t\t\t\ttempSame = true;\n\t\t\t\tif (paraCheckerboard[i][SIZE - i\n\t\t\t\t\t\t- 1] != paraCheckerboard[0][SIZE - 1]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for i\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[0][SIZE - 1];\n\t\t\t} // Of if\n\t\t} // Of if\n\n\t\t// Step 5. Checkboard full\n\t\tboolean tempHasEmpty = false;\n\t\tfor (int i = 0; i < paraCheckerboard.length; i++) {\n\t\t\tfor (int j = 0; j < paraCheckerboard.length; j++) {\n\t\t\t\tif (paraCheckerboard[i][j] == EMPTY) {\n\t\t\t\t\ttempHasEmpty = true;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for j\n\n\t\t\tif (tempHasEmpty) {\n\t\t\t\tbreak;\n\t\t\t} // Of if\n\t\t} // Of for i\n\t\tif (!tempHasEmpty) {\n\t\t\treturn TIE;\n\t\t} // Of if\n\n\t\treturn UNFINISHED;\n\t}", "public int determineWinner() {\n\t\tif(board[1][1] != 0 && (\n\t\t\t(board[1][1] == board[0][0] && board[1][1] == board[2][2]) ||\n\t\t\t(board[1][1] == board[0][2] && board[1][1] == board[2][0]) ||\n\t\t\t(board[1][1] == board[0][1] && board[1][1] == board[2][1]) ||\n\t\t\t(board[1][1] == board[1][0] && board[1][1] == board[1][2]))){\n\t\t\treturn board[1][1];\n\t\t}\n\t\telse if (board[0][0] != 0 &&(\n\t\t\t(board[0][0] == board[0][1] && board[0][0] == board[0][2]) ||\n\t\t\t(board[0][0] == board[1][0] && board[0][0] == board[2][0]))){\n\t\t\treturn board[0][0];\n\t\t}\n\t\telse if (board [2][2] != 0 && (\n\t\t\t(board[2][2] == board[2][0] && board[2][2] == board[2][1]) ||\n\t\t\t(board[2][2] == board[0][2] && board[2][2] == board[1][2]))) {\n\t\t\treturn board[2][2];\n\t\t}\n\t\t\n\t\t//See if every square has been marked, return still in progress if not\n\t\tfor(int i = 0; i < 3; ++i) {\n\t\t\tfor(int j = 0; j < 3; ++j) {\n\t\t\t\tif (board[i][j] == 0)\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Return tie\n\t\treturn 3;\n\t}", "public int getResult() {\n whiteTotal = 0;\n blackTotal = 0;\n rest = 0;\n for (int row = 0; row < BOARD_SIZE; row++) {\n for (int column = 0; column < BOARD_SIZE; column++) {\n if (board[row][column] == BLACK) {\n blackTotal++;\n } else if (board[row][column] == WHITE) {\n whiteTotal++;\n } else {\n rest++;\n }\n }\n }\n int winner = -1;\n if (rest == 0) {\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n\n if (blackTotal == 0 || whiteTotal == 0) {\n\n if (blackTotal != 0) {\n winner = 2;\n } else if (whiteTotal != 0) {\n winner = 1;\n }\n }\n\n if (getValidateMoveList('W', 'B').isEmpty() && getValidateMoveList('B', 'W').isEmpty()) {\n\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n return winner;\n }", "public int evaluate(PentagoBoardState pbs) {\n PentagoBoardState.Piece[][] pieces = pbs.getBoard();\n\n\n int whitescore =0; //keep track of white's total score\n int blackscore = 0;//keep track of black's total score\n\n //Check rows\n for (int x = 0; x <6 ; x++) {\n int countWHori = 0;\n int countBHori = 0;\n\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = 0; y <5 ; y++) {\n //Count how many black and white pieces\n if (pieces[x][y].ordinal() == 0 ) {\n\n //countBHori = countBHori + countvalue;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWHori = countWHori +countvalue;\n whites++;\n }\n\n //Check for consecutive\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n\n //Check for disjoint and joint set If * B B W * * then disjoint and * B B * B * Then joint set for B * B\n if (y!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 && pieces[x][y+2].ordinal() == 1){\n countBHori = countBHori +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 && pieces[x][y+2].ordinal() == 0){\n countWHori = countWHori +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 0){\n countBHori = countBHori +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 1){\n countWHori = countWHori +jointset;\n }\n }\n }\n //check if unwinnable\n if (blacks == 4 && whites==2){\n countBHori += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWHori += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countWHori += unwinnable;\n countBHori += unwinnable;\n }\n\n\n //Run value for row in evaluation scheme and add to total score\n int valuew = consecutivevalue(countWHori);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBHori);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec hori \" + valueb + \"White consec hori \" + valuew);\n\n }\n\n //Check Verticals\n for (int y = 0; y <6 ; y++) {\n int countWvert = 0;\n int countBvert = 0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int x = 0; x <5 ; x++) {\n if (pieces[x][y].ordinal() == 0) {\n\n //countBvert = countBvert +1;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWvert = countWvert +1;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n\n if (x!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 1){\n countBvert = countBvert +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 0){\n countWvert = countWvert +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0){\n countBvert = countBvert +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1){\n countWvert = countWvert +jointset;\n }\n }\n }\n\n if (blacks == 4 && whites==2){\n countBvert += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBvert += unwinnable;\n countWvert += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWvert += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBvert + \"White consec \" + countWvert);\n int valuew = consecutivevalue(countWvert);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBvert);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec VERT \" + valueb + \"White consec hori \" + valuew);\n }\n\n //S West N EAST Top\n for (int a = 1; a <6 ; a++) { //loop through all diagonal lines\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = a; y !=0 ; y--) { //loop through one diagonal line\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +2;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n // check for joint and disjoint set at these x y coordinates by looking 2 pieces ahead\n if (x==0 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==0 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n\n x++;\n\n\n }\n if (blacks == 4 && whites==2){\n countBdiagSoNe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n //S West N EAST Bot\n for (int a = 1; a <5 ; a++) {\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int y=5;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n if (x==1 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n //System.out.println(x + \" y:\" + y +\" Black consec DIAGOMAAL \" + countBdiagSoNe + \"White consec hori \" + countWdiagSoNe);\n y--;\n\n\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n /*if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }*/\n if (a==1&& blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n\n //NorthWest S EAST Left\n for (int a = 0; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int y=0;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n //System.out.println(pbs+\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n y++;\n\n\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n if (blacks == 4 && whites==2){\n countBdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagNoSe += unwinnable;\n countWdiagNoSe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n //NorthWest S EAST Right\n for (int a = 1; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n for (int y = a; y <5 ; y++) {\n //System.out.println(\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0 ) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n x++;\n\n\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n\n\n\n\n\n //System.out.println(\"Black consec score \" + blackscore +\" \" + \"White consec scpre \" + whitescore);\n //System.out.println(\"max player is \" + maxplayer + \"My colour is \" + mycolour);\n int i = -123456789;\n if (mycolour == 0){\n //System.out.println(blackscore-whitescore +\" I am black\");\n\n\n i= blackscore-whitescore;\n return i;\n\n }\n else {\n //System.out.println(whitescore-blackscore +\" I am white\");\n i= whitescore-blackscore;\n return i;\n }\n /*\n if(i>0 && i<1000){\n return 100; //i*2;\n }\n else if(i>=1000 && i<10000){\n return 1000; //i*10;\n }\n else if(i>=10000 && i<100000){\n return 10000; //i*50;\n }\n else if(i>=100000){\n return 100000;//i*500;\n }\n else if(i<=0 && i>-100){\n return -100; //i*2;\n }\n else if(i<=-100 && i>-1000){\n return -1000; //i*10;\n }\n else if(i<=-1000 && i>-10000){\n return -10000; //i*50;\n }\n else if(i<=0 && i>-100000){\n return -100000;//i*500;\n }\n\n */\n\n\n }", "private void getWinner() {\r\n int nWhite = 0, nBlack = 0;\r\n if(nextPlayer.getChecks() == 0 && nextPlayer.getQueens() == 0){\r\n winner = currentPlayer;\r\n }\r\n else if(currentPlayer.getQueens() == nextPlayer.getQueens()){\r\n for (int i = 1; i<8; i++){\r\n for (int x = 0; x<8; x++) {\r\n if (checks[i][x] == 1) nBlack++;\r\n if (checks[7 - i][x] == 2) nWhite++;\r\n }\r\n if (nWhite>nBlack) winner = getPlayer(WHITE);\r\n else if(nBlack>nWhite)winner = getPlayer(BLACK);\r\n nWhite = 0;\r\n nBlack = 0;\r\n }\r\n }\r\n else if (currentPlayer.getQueens() > nextPlayer.getQueens()){ winner = currentPlayer;}\r\n else{winner = nextPlayer; }\r\n }", "public String stateToCheckerboardString(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\tString resultString = \"\\r\\n\";\n\t\t//resultString += \"Checkerboard state: \\r\\n\";\n\t\tfor (int i = 0; i < tempCheckerboard.length; i++) {\n\t\t\tfor (int j = 0; j < tempCheckerboard[0].length; j++) {\n\t\t\t\tif (tempCheckerboard[i][j] == WHITE) {\n\t\t\t\t\tresultString += \"o \";\n\t\t\t\t} else if (tempCheckerboard[i][j] == BLACK) {\n\t\t\t\t\tresultString += \"x \";\n\t\t\t\t} else {\n\t\t\t\t\tresultString += \"- \";\n\t\t\t\t}//Of if\n\t\t\t}//Of for j\n\t\t\tresultString += \"\\r\\n\";\n\t\t}//Of for i\n\t\t\n\t\t//resultString += currentState;\n\t\treturn resultString;\n\t}", "@Override\n public int getWinner() {\n /*\n * To please the test as well as the game\n * Temporarily change the turn colour\n */\n int temp;\n if (whoseTurn() == RED) {\n temp = YELLOW;\n } else {\n temp = RED;\n }\n\n //test horizontally\n //set x to 1 as the placed counter will always be correct\n int x = 1;\n int i = 1;\n //to check if zero has been found\n boolean leftZeroFound = false;\n boolean rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check to right of last placed\n if (!rightZeroFound && inBounds(0, i)\n && board[lastPlacedRow][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check to left of last placed\n if (!leftZeroFound && inBounds(0, -i)\n && board[lastPlacedRow][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check vertically\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n boolean zeroFound = false;\n while (!zeroFound) {\n //check below last placed\n if (inBounds(-i, 0) && board[lastPlacedRow - i][lastPlacedCol] == temp) {\n x++;\n } else {\n zeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top right diagonal\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top right diagonal\n if (!rightZeroFound && inBounds(i, i)\n && board[lastPlacedRow + i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check bottom left\n if (!leftZeroFound && inBounds(-i, -i)\n && board[lastPlacedRow - i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top left\n //set x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top left\n if (!leftZeroFound && inBounds(i, -i)\n && board[lastPlacedRow + i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n //check bottom right\n if (!rightZeroFound && inBounds(-i, i)\n && board[lastPlacedRow - i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //return Empty if a winner has not been found\n return EMPTY;\n }", "public int gameStatus() {\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tif((Grid[x][0] == Grid[x][1]) && (Grid[x][1] == Grid[x][2]))\n \t\t\t\tif(Grid[x][0] != 0 && Grid[x][1] != 0 && Grid[x][2] != 0)\n \t\t\t\t\treturn Grid[x][0];\n \t\t}\n \t\tfor(int y=0;y<3;y++) {\n \t\t\tif((Grid[0][y] == Grid[1][y]) && (Grid[1][y] == Grid[2][y])) \n \t\t\t\tif(Grid[0][y] != 0 && Grid[1][y] != 0 && Grid[2][y] != 0)\n \t\t\t\t\treturn Grid[0][y];\n \t\t}\n \t\tif(Grid[0][0] == Grid[1][1] && Grid[1][1] == Grid[2][2]) \n \t\t\tif(Grid[0][0] != 0 && Grid[1][1] != 0 && Grid[2][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tif(Grid[2][0] == Grid[1][1] && Grid[1][1] == Grid[0][2])\n \t\t\tif(Grid[2][0] != 0 && Grid[1][1] != 0 && Grid[0][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tfor(int y = 0;y<3;y++) {\n \t\t\t\tif(Grid[x][y] == 0)\n \t\t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t\treturn 3;\t\t\n \t}", "@Override\r\n\tpublic BoardEvaluation evaluate(IBoard board, PlayerColor color) {\n\t\tBoardAnalyzer analyzer = board.getAnalyzer();\r\n\r\n\t\tBoardEvaluation e = new BoardEvaluation();\r\n\r\n\t\tint white = 0;\r\n\t\tint black = 0;\r\n\r\n\t\tList<IPiece> pieces = board.getAllPieces();\r\n\r\n\t\tint[] pawnCount = new int[2];\r\n\t\tint[] bishopCount = new int[2];\r\n\t\tint[] knightCount = new int[2];\r\n\t\tfor (IPiece piece : pieces) {\r\n\t\t\tif (piece.getColor() == PlayerColor.WHITE) {\r\n\t\t\t\twhite += piece.getPieceValue();\r\n\t\t\t} else {\r\n\t\t\t\tblack += piece.getPieceValue();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tint index = piece.getColor().ordinal();\r\n\t\t\tif (piece instanceof Pawn) {\r\n\t\t\t\tpawnCount[index]++;\r\n\t\t\t} else if (piece instanceof Bishop) {\r\n\t\t\t\tbishopCount[index]++;\r\n\t\t\t} else if (piece instanceof Knight) {\r\n\t\t\t\tknightCount[index]++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tint totalPieceValue = white + black;\r\n\t\tint blackIndex = PlayerColor.BLACK.ordinal();\r\n\t\tint whiteIndex = PlayerColor.WHITE.ordinal();\r\n\t\tblack += extraBishopValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\tblack += extraKnightValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\tblack += extraPawnValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\twhite += extraBishopValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\t\twhite += extraKnightValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\t\twhite += extraPawnValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\r\n\t\t// Stalemate\r\n\t\tif (analyzer.isStalemate()) {\r\n\t\t\te.draw = true;\r\n\t\t\tblack += 90;\r\n\t\t} else if (analyzer.canClaimDraw()) {\r\n\t\t\tif (board.getTurn() == PlayerColor.WHITE) {\r\n\t\t\t\t// White can stop black from claiming draw\r\n\t\t\t\t//black += 50;\r\n\t\t\t} else {\r\n\t\t\t\t// Black can claim draw immediately!\r\n\t\t\t\te.draw = true;\r\n\t\t\t\tblack += 4;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Checkmate ?\r\n\t\tif (analyzer.isCheckmate(PlayerColor.BLACK)) {\r\n\t\t\twhite += 100;\r\n\t\t\te.checkmate = true;\r\n\t\t}\r\n\r\n\t\tif (analyzer.isCheckmate(PlayerColor.WHITE)) {\r\n\t\t\tblack += 100;\r\n\t\t\te.checkmate = true;\r\n\t\t}\r\n\r\n\t\tif (color == null) {\r\n\t\t\te.value = white - black;\r\n\t\t} else if (color == PlayerColor.BLACK) {\r\n\t\t\te.value = Math.abs(white - FULL_BOARD_VALUE);\r\n\t\t} else {\r\n\t\t\te.value = Math.abs(black - FULL_BOARD_VALUE);\r\n\t\t}\r\n\r\n\t\treturn e;\r\n\t}", "public int computeGameSituation(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\t// System.out.println(\"The checkerboard is: \" +\n\t\t// Arrays.deepToString(tempCheckerboard));\n\n\t\treturn computeGameSituation(tempCheckerboard);\n\t}", "public String toString() {\n\t\tString resultString = \"\\r\\n\";\n\t\t//resultString += \"Checkerboard state: \\r\\n\";\n\t\tfor (int i = 0; i < checkerboard.length; i++) {\n\t\t\tfor (int j = 0; j < checkerboard.length; j++) {\n\t\t\t\tif (checkerboard[i][j] == WHITE) {\n\t\t\t\t\tresultString += \"o \";\n\t\t\t\t} else if (checkerboard[i][j] == BLACK) {\n\t\t\t\t\tresultString += \"x \";\n\t\t\t\t} else {\n\t\t\t\t\tresultString += \"- \";\n\t\t\t\t}//Of if\n\t\t\t}//Of for j\n\t\t\tresultString += \"\\r\\n\";\n\t\t}//Of for i\n\t\t\n\t\tresultString += currentState;\n\n\t\t//resultString += \"\\r\\nThe current situation is: \" + gameSituation;\n\t\treturn resultString;\n\t}", "void checkForPlayer(boolean checkForBlacks, int i, int j) {\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t//**Check vertical**\\\\\n\t\t// Check upwards\n\t\tfor (int n = j-1; n >= 0; --n) {\n\t\t\tif (!check(i, n, checkForBlacks))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check downwards\n\t\tfor (int n = j+1; n < dimensions.y; ++n) {\n\t\t\tif (!check (i, n, checkForBlacks))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t//**Check horizontal**\\\\\n\t\t// Check to left\n\t\tfor (int n = i-1; n >=0; --n) {\n\t\t\tif (!check(n, j, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check to right\n\t\tfor (int n = i+1; n < dimensions.x; ++n) {\n\t\t\tif (!check(n, j, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t//**Check diagonals**\\\\\n\t\t// Check North-East\n\t\tfor (int n = 1; i+n < dimensions.x && j-n >= 0; ++n) {\n\t\t\tif (!check(i+n, j-n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check North-West\n\t\tfor (int n = 1; i-n >= 0 && j-n >= 0; ++n) {\n\t\t\tif (!check(i-n, j-n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check South-East\n\t\tfor (int n = 1; i+n < dimensions.x && j+n < dimensions.y; ++n) {\n\t\t\tif (!check(i+n, j+n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check South-West\n\t\tfor (int n = 1; i-n >= 0 && j+n < dimensions.y; ++n) {\n\t\t\tif (!check(i-n, j+n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t}", "private int gameState() {\n\t\t\n\t\tint gameNotOver = 0;\n\t\tint gameOverWinnerX = 1;\n\t\tint gameOverWinnerO = 2;\n\t\tint gameOverTie = 3;\n\t\t\n\t\t\n\t\t\n\t\t//Win Vertically \n\t\t// 0 3 6 , 1 4 7 , 2 5 8\n\t\t\t\t\n\t\t//Win Horizontally\n\t\t//0 1 2 , 3 4 5 , 6 7 8 \n\t\t\t\t\n\t\t//Win Diagonally\n\t\t// 0 4 8 , 2 4 6\n\t\t\t\t\n\t\t//Assuming it's an equal grid\n\t\t\t\t\n\t\tMark winningMark = null;\n\t\t\t\t\n\t\tboolean hasFoundWinner = false;\n\t\t\t\t\n\t\tint row = 0;\n\t\tint column = 0;\n\t\t\t\t\n\t\t//Horizontal Winner Test\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\tcolumn ++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tcolumn = 0;\n\t\t\trow++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// Vertical Winner Test\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\n\t\twhile (!hasFoundWinner && column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\trow = 0;\n\t\t\tcolumn++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Winner Test \"\\\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Test \"/\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = COLUMN_COUNT - 1;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn--;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If there are no moves left, and there is no winner, game ends inn a tie \n\t\t\n\t\tboolean foundNoMove = false;\n\t\tfor (int i = 0; i < movesArray.length; i++) {\n\t\t\tif (movesArray[i] == NO_MOVE) {\n\t\t\t\tfoundNoMove = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!foundNoMove && !hasFoundWinner) {\n\t\t\treturn gameOverTie;\n\t\t}\n\t\t\n\t\t// If there is no winner and there are still moves left, game is not over\n\t\t\n\t\treturn gameNotOver;\n\t\t\n\t}", "private int evaluateState() {\r\n\r\n\t\t// add up score\r\n\t\t//\r\n\t\tint scoreWhite = 0;\r\n\t\tint scoreBlack = 0;\r\n\t\tfor (Piece piece : this.chessGame.getPieces()) {\r\n\t\t\tif(piece.getColor() == Piece.COLOR_BLACK){\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else if( piece.getColor() == Piece.COLOR_WHITE){\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else{\r\n\t\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\t\"unknown piece color found: \"+piece.getColor());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// return evaluation result depending on who's turn it is\r\n\t\tint gameState = this.chessGame.getGameState();\r\n\t\t\r\n\t\tif( gameState == ChessGame.GAME_STATE_BLACK){\r\n\t\t\treturn scoreBlack - scoreWhite;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_WHITE){\r\n\t\t\treturn scoreWhite - scoreBlack;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_END_WHITE_WON\r\n\t\t\t\t|| gameState == ChessGame.GAME_STATE_END_BLACK_WON){\r\n\t\t\treturn Integer.MIN_VALUE + 1;\r\n\t\t\r\n\t\t}else{\r\n\t\t\tthrow new IllegalStateException(\"unknown game state: \"+gameState);\r\n\t\t}\r\n\t}", "public static int heuristic(PentagoBoardState boardState) {\n\t\tint value = 0;\n\t\t\n\t\tfor (int i = 0; i<size; i++) {\n\t\t\tfor (int j = 0; j<size; j++) {\n\t\t\t\tif (boardState.getPieceAt(i, j) == PentagoBoardState.Piece.BLACK) {\n\t\t\t\t\tvalue += 10;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}", "public void startGameState(){\n\n ArrayList<Integer> checkeredSpaces = new ArrayList<Integer>(Arrays.asList(1, 3, 5, 7, 8, 10, 12, 14, 17, 19, 21,\n 23, 24, 26, 28, 30, 33, 35, 37, 39, 41, 42, 44, 46, 48,\n 51, 53, 55, 56, 58, 60, 62));\n\n\n\n for(int i =0; i < 63; i++){\n if(!checkeredSpaces.contains(i)){\n //set all black spaces to null on the board\n mCheckerBoard.add(null);\n }\n else if(i < 24){\n //set first three rows to red checkers\n mCheckerBoard.add(new Checker((i/2), true));\n }\n else if(i < 40){\n //set middle two rows to null\n mCheckerBoard.add(null);\n }\n else{\n //set top three row to black checkers\n mCheckerBoard.add(new Checker((i/2), false));\n }\n }\n\n }", "@Test\r\n\tpublic void testDirectCheck() {\n\t\tBoard b = new Board();\r\n\t\tb.state = new Piece[][] //set up the board in the standard way\r\n\t\t\t\t{\r\n\t\t\t\t{new Rook(\"b\"), new Knight(\"b\"),new Bishop(\"b\"),new Queen(\"b\"), new King(\"b\"), new Bishop(\"b\"),\r\n\t\t\t\t\tnew Knight(\"b\"), new Rook(\"b\")},\r\n\t\t\t\t{new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),\r\n\t\t\t\t\t\tnew Pawn(\"b\")},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,new Knight(\"b\"),null,null},\r\n\t\t\t\t{new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),\r\n\t\t\t\t\tnew Pawn(\"w\")},\r\n\t\t\t\t{new Rook(\"w\"), new Knight(\"w\"),new Bishop(\"w\"),new Queen(\"w\"), new King(\"w\"), new Bishop(\"w\"),\r\n\t\t\t\t\tnew Knight(\"w\"), new Rook(\"w\")}\r\n\t\t\t\t};\r\n\t\tassertTrue(b.whiteCheck());\t\r\n\t}", "private boolean checkOrTurn(int row,int column, ItemState itemStateCurrentPlayer, int x, int y) {\n\t\t if(column==Settings.nbrRowsColumns||column<0){\n\t\t\t return false; //Get the hell out\n\t\t }\n\t\t if(row==Settings.nbrRowsColumns||row<0){ \n\t\t\t return false; //Get the hell out\n\t\t }\n\t\t if (gameStateInt[row][column]==Helpers.getOpponentPlayerCorrespondingInt(itemStateCurrentPlayer)){ //Still another color\n\t\t\t if(checkOrTurn(row+y,column+x, itemStateCurrentPlayer, x, y)){ //continue check next\n\t\t\t\t\t changed.add(new Action(row,column));\n\t\t\t\t return true;\n\t\t\t }else{\n\t\t\t\t return false;\n\t\t\t }\n\t\t }else if (gameStateInt[row][column]==Helpers.getPlayerCorrespondingInt(itemStateCurrentPlayer)){\n\t\t\t return true; //found same color\n\t\t }else{\n\t\t\t return false; //found grass\n\t\t }\n\t }", "public PieceColor colorGoing()\n {\n if (turn%2==0)\n return PieceColor.WHITE;\n else return PieceColor.BLACK;\n }", "public String win() {\r\n\t\tint blackCount = 0;\r\n\t\tint whiteCount = 0;\r\n\t\tfor (int i=0; i<piece.size(); i++) {\r\n\t\t\tif (piece.get(order[i]).chessPlayer.equals(\"black\")) {\r\n\t\t\t\tblackCount++;\r\n\t\t\t} else if (piece.get(order[i]).chessPlayer.equals(\"white\")) {\r\n\t\t\t\twhiteCount++;\r\n\t\t\t} else continue;\r\n\t\t}\r\n\t\tif (blackCount == 0) {\r\n\t\t\treturn \"white\";\r\n\t\t} else if (whiteCount == 0) {\r\n\t\t\treturn \"black\";\r\n\t\t} else return null;\r\n\t}", "public String getStateOfBoard()\n {\n // This function is used to print state of the board. such as number of coins present on the board\n String str=\"\";\n str += \"Black_Coins Count:\"+this.gameController.getCoinsCount(CoinType.BLACK) +\" Red_Coins Count:\"+this.gameController.getCoinsCount(CoinType.RED);\n return str;\n }", "public char checkWinner() {\r\n // Vertical\r\n if (board[0][0] == board[0][1] && board[0][1] == board[0][2] && board[0][0] != '-') {\r\n return board[0][0];\r\n }\r\n else if (board[1][0] == board[1][1] && board[1][1] == board[1][2] && board[1][0] != '-') {\r\n return board[1][0];\r\n }\r\n else if (board[2][0] == board[2][1] && board[2][1] == board[2][2] && board[2][0] != '-') {\r\n return board[2][0];\r\n }\r\n // Horizontal\r\n else if (board[0][0] == board[1][0] && board[1][0] == board[2][0] && board[0][0] != '-') {\r\n return board[0][0];\r\n }\r\n else if (board[0][1] == board[1][1] && board[1][1] == board[2][1] && board[0][1] != '-') {\r\n return board[0][1];\r\n }\r\n else if (board[0][2] == board[1][2] && board[1][2] == board[2][2] && board[0][2] != '-') {\r\n return board[0][2];\r\n }\r\n // Diagonal\r\n else if (board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != '-') {\r\n return board[0][0];\r\n }\r\n else if (board[0][2] == board[1][1] && board[1][1] == board[2][0] && board[0][2] != '-') {\r\n return board[0][2];\r\n }\r\n // Tie\r\n else {\r\n for (int y = 0; y < 3; y++) {\r\n for (int x = 0; x < 3; x++) {\r\n if (board[x][y] == '-')\r\n return 'N';\r\n }\r\n }\r\n return 'T';\r\n }\r\n }", "private Color updateYourBoardHelper(int i, int j) {\n if (i == 0 && j == 0) {\n return Color.BLACK;\n }\n if (i == 0 || j == 0) {\n return Color.GRAY;\n }\n if (arePlayerShipsInitialized()) {\n try{\n TileStatus[][] b = p2.getPlayerStatusBoard();\n Color c = new Color(0);\n switch (b[j][i]) {\n case SHIP:\n case SUBSCANSHIP:\n case AIRCRAFTSCAN:\n switch (p2.getPlayerShipBoard()[j][i][0]) {\n case AIRCRAFTCARRIER:\n c = CARRIER_COLOR;\n break;\n case BATTLESHIP:\n c = BATTLESHIP_COLOR;\n break;\n case DESTROYER:\n c = DESTROYER_COLOR;\n break;\n case SUBMARINE:\n c = SUBMARINE_COLOR;\n break;\n case PATROLBOAT:\n c = PATROLBOAT_COLOR;\n break;\n default:\n break;\n }\n switch (p2.getPlayerShipBoard()[j][i][1]) {\n case AIRCRAFT1:\n if (!(((Aircraft) p2.getShip(5)).launched())) {\n c = AIRCRAFT1_COLOR;\n }\n break;\n case AIRCRAFT2:\n if (!(((Aircraft) p2.getShip(6)).launched())) {\n c = AIRCRAFT2_COLOR;\n }\n break;\n default:\n break;\n }\n break;\n case HIT:\n c = Color.RED;\n break;\n case MISS:\n c = Color.WHITE;\n break;\n case SUBSCANEMPTY:\n c = Color.CYAN;\n break;\n default:\n c = Color.DARK_GRAY;\n break;\n }\n return c;\n }catch(java.lang.NullPointerException n){\n System.err.println(\"Null pointer where p2 should be\");\n for(int ii=0; ii<7; ii++){\n for(int jj=0; jj<3; jj++){\n System.out.print(playerShips[ii][jj]+ \" \");\n }\n System.out.println();\n }\n// System.exit(1);\n return Color.DARK_GRAY;\n }\n } else{\n Color c = Color.DARK_GRAY;\n switch (yourBoard[i][j][0]) {\n case CR:\n if(yourBoard[i][j][1]==Statuses.AC1){\n c = AIRCRAFT1_COLOR;\n }else if(yourBoard[i][j][1]==Statuses.AC2){\n c = AIRCRAFT2_COLOR;\n }else{\n c = CARRIER_COLOR;\n }\n break;\n case BS:\n c = BATTLESHIP_COLOR;\n break;\n case DES:\n c = DESTROYER_COLOR;\n break;\n case SUB:\n c = SUBMARINE_COLOR;\n break;\n case PB:\n c = PATROLBOAT_COLOR;\n break;\n default:\n c = Color.DARK_GRAY;\n break;\n }\n return c;\n }\n }", "public void backGroundCheck(HexCell currentCell){\n // When Cell already clicked, do nothing\n boolean checkStatus = true;\n int checkLevel = 1;\n\n while (checkStatus){\n\n ArrayList<HexCell> toDoStack = new ArrayList<>();\n ArrayList<HexCell> checkedStack = new ArrayList<>();\n ArrayList<HexCell> appliedStack = new ArrayList<>();\n\n // fill all adjacent cells into toDoStack\n for(MyValues.HEX_POSITION position: MyValues.HEX_POSITION.values()){\n HexCell adjacentCell = getAdjacentCell(currentCell, position);\n if(adjacentCell != null && adjacentCell.level == checkLevel){\n toDoStack.add(adjacentCell);\n }\n // work off all todoStack elements\n while(!toDoStack.isEmpty()){\n HexCell currentTodo = toDoStack.get(0);\n if(currentTodo.level == checkLevel){\n if(!appliedStack.contains(currentTodo)){\n appliedStack.add(currentTodo);\n }\n if(!checkedStack.contains(currentTodo)) {\n checkedStack.add(currentTodo);\n }\n\n // check all adjacent cells\n for(MyValues.HEX_POSITION toDoPosition: MyValues.HEX_POSITION.values()){\n HexCell adjacentToDoCell = getAdjacentCell(currentTodo, toDoPosition);\n // if new Cell, add it\n if((adjacentToDoCell != null) && !toDoStack.contains(adjacentToDoCell) && !checkedStack.contains(adjacentToDoCell) && !appliedStack.contains(adjacentToDoCell)){\n toDoStack.add(adjacentToDoCell);\n }\n }\n }\n toDoStack.remove(0);\n }\n }\n // Raise Check level\n checkLevel +=1;\n\n if(appliedStack.size() >= MyValues.MERGE_THRESHOLD){\n // Sum up all scores of applied cells\n int summedScore = 0;\n for(HexCell toBeMergedCell: appliedStack){\n summedScore += toBeMergedCell.score;\n toBeMergedCell.setToZero();\n }\n currentCell.level=checkLevel;\n currentCell.score = summedScore;\n currentCell.drawHexCell();\n } else {\n checkStatus = false;\n break;\n }\n }\n }", "private static String gameStatus(char[][] board){\n\t\t\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\t// check horizontal lines && vertical lines for player x\n\t\t\tif ((board[i][0] == 'X' && board[i][1] == 'X' && board[i][2] == 'X') || \n\t\t\t\t\t(board[0][i] == 'X' && board[1][i] == 'X' && board[2][i] == 'X')){\n\t\t\t\twinner = 'X';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for x\n\t\tif ((board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X') || \n\t\t\t\t(board[0][2] == 'X' && board[1][1] == 'X' && board[2][0] == 'X')){\n\t\t\twinner = 'X';\n\t\t\treturn \"true\";\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 3 ; i++) {\n\t\t\t// check horizontal and vertical lines for player o\n\t\t\tif ((board[i][0] == 'O' && board[i][1] == 'O' && board[i][2] == 'O') || \n\t\t\t\t\t(board[0][i] == 'O' && board[1][i] == 'O' && board[2][i] == 'O')){\n\t\t\t\twinner = 'O';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for o\n\t\tif ((board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O') || \n\t\t\t\t(board[0][2] == 'O' && board[1][1] == 'O' && board[2][0] == 'O')){\n\t\t\twinner = 'O';\n\t\t\treturn \"true\";\n\t\t}\n\n\t\t// check for tie\n\t\tint emptyCells = 9;\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\tfor (int j = 0; j < 3; j++){\n\t\t\t\tif (board[i][j]!='\\0') emptyCells -= 1;\t\t\n\t\t\t}\n\t\t}\n\t\t// if all cells are filled, game is over with a tie\n\t\tif (emptyCells == 0) return \"tie\";\n\n\t\t// otherwise game is not over and return false\n\t\t//printBoard(board);\n\n\t\treturn \"false\";\n\t}", "@Override\n\tpublic void stateCheck() {\n\t\tif(balance<0 && balance>=-1000)\n\t\t{\n\t\t\tacc.setState(new YellowState(this));\n\t\t}\n\t\telse if(balance<-1000)\n\t\t{\n\t\t\tacc.setState(new RedState(this));\n\t\t}\n\t}", "private void displayBoard() {\r\n\r\n for (int r = 0; r < 8; r++) {\r\n for (int c = 0; c < 8; c++) {\r\n if (model.pieceAt(r, c) == null)\r\n board[r][c].setIcon(null);\r\n else if (model.pieceAt(r, c).player() == Player.WHITE) {\r\n if (model.pieceAt(r, c).type().equals(\"Pawn\"))\r\n board[r][c].setIcon(wPawn);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Rook\"))\r\n board[r][c].setIcon(wRook);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Knight\"))\r\n board[r][c].setIcon(wKnight);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Bishop\"))\r\n board[r][c].setIcon(wBishop);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Queen\"))\r\n board[r][c].setIcon(wQueen);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"King\"))\r\n board[r][c].setIcon(wKing);\r\n } else if (model.pieceAt(r, c).player() == Player.BLACK) {\r\n if (model.pieceAt(r, c).type().equals(\"Pawn\"))\r\n board[r][c].setIcon(bPawn);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Rook\"))\r\n board[r][c].setIcon(bRook);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Knight\"))\r\n board[r][c].setIcon(bKnight);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Bishop\"))\r\n board[r][c].setIcon(bBishop);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"Queen\"))\r\n board[r][c].setIcon(bQueen);\r\n\r\n if (model.pieceAt(r, c).type().equals(\"King\"))\r\n board[r][c].setIcon(bKing);\r\n }\r\n repaint();\r\n }\r\n }\r\n if (model.inCheck(Player.WHITE))\r\n JOptionPane.showMessageDialog(null, \"White King in Check\");\r\n if (model.inCheck(Player.BLACK))\r\n JOptionPane.showMessageDialog(null, \"Black King in Check\");\r\n if (model.movingIntoCheck())\r\n JOptionPane.showMessageDialog(null, \"Cannot move into check\");\r\n if (model.isComplete())\r\n JOptionPane.showMessageDialog(null, \"Checkmate\");\r\n }", "public void actionPerformed(ActionEvent evt) {\n if ( player == 0 ) { // Player O - blackstone\n if (jButton[j].getIcon().equals(B)) {\n jButton[j].setIcon(O); // value of current button read left to right and then top to bottom\n \n board[j/csize][j%csize] = 0;\n int win = 1;\n win = checkrow(board,j/csize,0);\n if ( win == 0 ) {\n win = checkcol(board,j%csize,0);\n }\n if ( win == 0 ) {\n win = checkdiag(board,0 , j/csize, j%csize);\n }\n player = 1; // switches player\n markers++;\n\n if ( win == 1 ) {\n exitAction(\"Blackstone wins!\\n\");\n }\n if ( markers == gsize ) { // if all blocks have been taken\n exitAction(\"Draw!\\n\");\n }\n } \n } else { // Player X - whitestone = 1\n if (jButton[j].getIcon().equals(B)) {\n jButton[j].setIcon(X);\n board[j/csize][j%csize] = 1;\n int win = 1;\n win = checkrow(board,j/csize,1);\n if ( win == 0 ) {\n win = checkcol(board,j%csize,1);\n }\n if ( win == 0 ) {\n win = checkdiag(board, 1, j/csize, j%csize );\n }\n player = 0;\n markers++;\n\n if ( win == 1 ) {\n exitAction(\"Whitestone wins!\\n\");\n }\n if ( markers == gsize ) {\n exitAction(\"Draw!\\n\");\n }\n } \n }\n }", "public int[][] stateToCheckerboard(int paraState) {\n\t\tint[][] resultCheckerboard = new int[SIZE][SIZE];\n\t\tint tempValue = paraState;\n\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultCheckerboard[i][j] = (tempValue % SIZE);\n\t\t\t\ttempValue /= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultCheckerboard;\n\t}", "private boolean check(boolean isWhite) {\n Tile kingTile = null;\n ArrayList<Position> opponentMoves = new ArrayList<>();\n // find king's tile and populate opponent moves\n for (Tile[] t : this.board) {\n for (Tile tile : t) {\n if (tile.piece instanceof King && tile.piece.isWhite() == isWhite) {\n kingTile = tile;\n }\n if (tile.hasPiece && tile.piece.isWhite() != isWhite) {\n for(Position move : tile.piece.getLegalMoves()) opponentMoves.add(move);\n }\n }\n }\n // compare every position with king's position\n for (Position opponentMove : opponentMoves) {\n if (opponentMove.equals(kingTile.position)) {\n return true;\n }\n }\n return false;\n }", "private void checkInFront(Tile[][] chessBoard,int pawnX,int pawnY, char pawnColor) {\r\n\t\tint direction;\r\n\t\tBoolean extraStep = false;\r\n\t\tif (pawnColor =='w') {\r\n\t\t\tdirection = 1;\r\n\t\t\tif (pawnY == 1){\r\n\t\t\t\textraStep = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tdirection = -1;\r\n\t\t\tif (pawnY == 6) {\r\n\t\t\t\textraStep = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (extraStep) {\r\n\t\t\tcheckMove(chessBoard, pawnX, pawnY, direction);\r\n\t\t\tcheckMove(chessBoard, pawnX, pawnY, 2*direction);\r\n\t\t} else {\r\n\t\t\tcheckMove(chessBoard, pawnX, pawnY,direction);\r\n\t\t}\r\n\t}", "private ArrayList<Move> blackKing() {\n // obtain current co-ordinates\n int x = this.getX();\n int y = this.getY();\n\n ArrayList<Move> blackMoves = new ArrayList<Move>();\n\n // set up m to refer to a Move object\n Move theMove = null;\n\n\n // the top and bottom are opposites coordinates for the black and white kings and so are left and right\n // all Unoccupied moves\n\n // first legal move is to go from x,y to x,y-1 if x,y-1 is unoccupied (top)\n if (validNormalMove(x, y - 1)) {\n theMove = new Move(this, x, y, x, y - 1, false);\n if(takeOverCheck(x, y-1)){\n theMove.setOccupied(true);\n }\n\n blackMoves.add(theMove);\n }\n\n\n // legal move is to go from x,y to x,y+1 if x,y+1 is unoccupied (bottom)\n if (validNormalMove(x, y + 1)) {\n theMove = new Move(this, x, y, x, y + 1, false);\n if(takeOverCheck(x, y+1)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n }\n\n //left\n // legal move to go left from x,y to x+1, y if x+1,y is unoccupied (left)\n\n if (validNormalMove(x+1, y)) {\n theMove = new Move(this, x, y, x+1, y, false);\n if(takeOverCheck(x+1, y)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n\n }\n\n //right\n // legal move to go right from x,y to x-1, y if x-1,y is unoccupied (right)\n\n if (validNormalMove(x-1, y)) {\n theMove = new Move(this, x, y, x-1, y, false);\n\n if(takeOverCheck(x-1, y)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n }\n\n\n // legal move to diagonal top right for white king\n if (validNormalMove(x-1, y - 1)) {\n theMove = new Move(this, x, y, x-1, y - 1, false);\n if(takeOverCheck(x-1, y-1)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n }\n\n // legal move to diagonal bottom left\n\n if (validNormalMove(x+1, y +1)) {\n theMove = new Move(this, x, y, x+1, y + 1, false);\n\n if(takeOverCheck(x+1, y+1)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n }\n\n // legal move to diagonal bottom right\n if (validNormalMove(x-1, y +1)) {\n theMove = new Move(this, x, y, x-1, y + 1, false);\n if(takeOverCheck(x-1, y+1)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n }\n\n // legal move to diagonal top left\n if (validNormalMove(x+1, y-1)) {\n theMove = new Move(this, x, y, x+1, y - 1, false);\n if(takeOverCheck(x+1, y-1)){\n theMove.setOccupied(true);\n }\n blackMoves.add(theMove);\n }\n\n\n\n\n\n if (blackMoves.isEmpty())\n return null;\n return blackMoves;\n }", "private Coordinate firstMoveHeuristics(TicTacToeModel model, PossibleBoard possibleBoard) {\n BoardSpace[][] board = possibleBoard.board;\n\n if (possibleBoard.freeSpace == TicTacToeModel.BOARD_DIMENSION*TicTacToeModel.BOARD_DIMENSION) {\n if (board[0][0].getIcon() == Icon.EMPTY) {\n return new Coordinate(0,0);\n } else {\n return new Coordinate(0, TicTacToeModel.BOARD_DIMENSION - 1);\n }\n } else if (possibleBoard.freeSpace == TicTacToeModel.BOARD_DIMENSION*TicTacToeModel.BOARD_DIMENSION - 1) {\n if (model.cornerTaken()) {\n return new Coordinate(TicTacToeModel.BOARD_DIMENSION/2, TicTacToeModel.BOARD_DIMENSION/2);\n } else if (board[TicTacToeModel.BOARD_DIMENSION/2][TicTacToeModel.BOARD_DIMENSION/2].getIcon() != Icon.EMPTY) {\n return new Coordinate(0,0);\n } else {\n return model.getCornerNextToEdge();\n }\n }\n\n return null;\n }", "public Result determineOutcome() {\n for (int row = 0; row < TicTacToeModel.BOARD_DIMENSION; row++) {\n if (rowScore[row] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (rowScore[row] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n for (int col = 0; col < TicTacToeModel.BOARD_DIMENSION; col++) {\n if (colScore[col] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (colScore[col] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n if (leftDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (rightDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (leftDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n if (rightDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n\n if (freeSpace == 0) return Result.DRAW;\n\n return Result.INCOMPLETE;\n }", "public boolean isBlack () { return (this == PlayColour.BLACK);}", "public Board twin() {\n short[] s1;\n short[] s2;\n if (blank_r == 0 && blank_c == 0) {\n s1 = new short[]{0, 1};\n s2 = new short[]{1, 0};\n } else {\n s1 = new short[]{0, 0};\n if (blank_r == 1 && blank_c == 0) s2 = new short[]{0, 1};\n else s2 = new short[]{1, 0};\n }\n return swapTiles1d(s1, s2);\n }", "public String winner(){\n\t\tString winner =\"\";\n\t\tif(board.isWin() == \"blue\")\n\t\t\t{\n\t\t\twinner= \"blue\";\n\t\t\t}\n\t\telse if(board.isWin()==\"red\")\n\t\t\t{\n\t\t\twinner= \"red\";\n\t\t\t}\n\t\treturn winner; \n\t}", "public WumpusState wellItsDarkNow(GameTile[][] visibleMap) {\r\n\t\tQueue<WumpusState> queue = new LinkedList<WumpusState>();\r\n\t\tHashMap<String, Boolean> visitedStates = new HashMap<String, Boolean>();\t\r\n\t\tWumpusState state = new WumpusState(visibleMap, playerX, playerY);\r\n\t\tlong nodesExpanded = 0;\r\n\t\tqueue.add(state);\r\n\t\tif(state.getParent()!=null) {\t\r\n\t\t\tqueue.add(state.getParent());\r\n\t\t}\r\n\t\twhile(!queue.isEmpty()) {\r\n\t\t\tWumpusState currentState = queue.remove();\r\n\t\t\tSystem.out.println(currentState.toString());\r\n\t\t\t\r\n\t\t\tif(currentState.getGoldCollected()) {\r\n\t\t\t\tArrayList<AgentAction> actions = currentState.getAllActions();\r\n\t\t\t\tfor(int i=1;i<actions.size(); i++) {\r\n\t\t\t\t\tSystem.out.println(\"gold\");\r\n\t\t\t\t\tSystem.out.println(actions.get(i));\r\n\t\t\t\t\tnextMoves.add(actions.get(i));\r\n\t\t\t\t}\r\n\t\t\t\tgoldCollected = true;\r\n\t\t\t\treturn currentState;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(currentState.spaceNotVisited()) {\r\n\t\t\t\tArrayList<AgentAction> actions = currentState.getAllActions();\r\n\t\t\t\tfor(int i=1;i<actions.size(); i++) {\r\n\t\t\t\t\tSystem.out.println(\"null\");\r\n\t\t\t\t\tSystem.out.println(actions.get(i));\r\n\t\t\t\t\tnextMoves.add(actions.get(i));\r\n\t\t\t\t}\r\n\t\t\t\treturn currentState;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(visitedStates.containsKey(currentState.toString())) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tvisitedStates.put(currentState.toString(), true);\r\n\t\t\t\tWumpusState[] childrenOfCurrentChild = currentState.generateChildrenStates();\r\n\t\t\t\tfor(int j=0; j<childrenOfCurrentChild.length; j++) {\r\n\t\t\t\t\tif(childrenOfCurrentChild[j]!=null) {\r\n\t\t\t\t\t\tqueue.add(childrenOfCurrentChild[j]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tgoldCollected = true;\r\n\t\treturn state;\r\n\t\t\r\n\t}", "private float getStateCost(int[] board) {\r\n\t\tfloat cost = 0;\r\n\t\tfor (int i = 0; i < this.checkBoardSide; i++) {\r\n\t\t\tif (isQueenAttacked(i, board[i], board)) {\r\n\t\t\t\tcost++;\r\n\t\t\t\t// System.out.println(\"row: \" + i + \" attacked\");\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn cost;\r\n\r\n\t}", "public boolean CheckMate(Board b, Player p, boolean check) {\n int WhiteKingx = WhiteKing(b)[0];\r\n int WhiteKingy = WhiteKing(b)[1];\r\n int BlackKingx = BlackKing(b)[0];\r\n int BlackKingy = BlackKing(b)[1];\r\n\r\n if (check && p.getColor()) {\r\n //currently in check and color is white\r\n for (int horizontal = -1; horizontal < 2; horizontal++) {\r\n for (int vertical = -1; vertical < 2; vertical++) {\r\n if (b.blocks[WhiteKingx][WhiteKingy].getPiece().ValidMove(b.blocks, WhiteKingx, WhiteKingy, WhiteKingx + horizontal, WhiteKingy + vertical)) {\r\n /* Check which blocks the king can move to.\r\n * If the king can move, check if that block still puts the king on check\r\n * If all of them yield check, then see if there is a piece that can move to prevent the check\r\n */\r\n b.move(WhiteKingx, WhiteKingy, WhiteKingx + horizontal, WhiteKingy + vertical);\r\n if(!CheckChecker(b, p)) {\r\n b.move(WhiteKingx + horizontal, WhiteKingy + vertical, WhiteKingx, WhiteKingy);\r\n return false;\r\n }\r\n b.move(WhiteKingx + horizontal, WhiteKingy + vertical, WhiteKingx, WhiteKingy);\r\n }\r\n }\r\n }\r\n }\r\n if (check && !p.getColor()) {\r\n for(int horizontal = -1; horizontal < 2; horizontal++) {\r\n for(int vertical = -1; vertical < 2; vertical ++) {\r\n if(b.blocks[BlackKingx][BlackKingy].getPiece().ValidMove(b.blocks, BlackKingx, BlackKingy, BlackKingx + horizontal, BlackKingy + vertical)) {\r\n b.move(BlackKingx, BlackKingy, BlackKingx + horizontal, BlackKingy + vertical);\r\n if(!CheckChecker(b, p)) {\r\n b.move(BlackKingx + horizontal, BlackKingy + vertical, BlackKingx, BlackKingy);\r\n return false;\r\n }\r\n b.move(BlackKingx + horizontal, BlackKingy + vertical, BlackKingx, BlackKingy);\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }", "private void checkColors(){\r\n\t\tpaintCorner(RED);\r\n\t\tif(leftIsClear()){\r\n\t\t\tturnLeft();\r\n\t\t\tmove();\r\n\t\t\tif(cornerColorIs(null)){\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnLeft();\r\n\t\t\t\tpaintCorner(GREEN);\r\n\t\t\t}else{\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnLeft();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(rightIsClear()){\r\n\t\t\tturnRight();\r\n\t\t\tmove();\r\n\t\t\tif(cornerColorIs(null)){\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnRight();\r\n\t\t\t\tpaintCorner(GREEN);\r\n\t\t\t}else{\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnRight();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(frontIsClear()){\r\n\t\t\tmove();\r\n\t\t\tif(cornerColorIs(null)) {\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tpaintCorner(GREEN);\r\n\t\t\t\tturnAround();\r\n\t\t\t}else{\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnAround();\r\n\t\t\t}\r\n\t\t}\r\n\t\tmakeMove();\r\n\t}", "public int status() \n {\n \tif (stonesCount(7,12) != 0 && stonesCount(0,5) != 0)\n \t\treturn GAME_NOT_OVER;\n \telse if (stonesCount(7,13) < stonesCount(0,6))\n \t\treturn GAME_OVER_WIN;\n \telse if (stonesCount(7,13) == stonesCount(0,6))\n \t\treturn GAME_OVER_TIE;\n \telse\n \t\treturn GAME_OVER_LOSE;\n }", "public static void makeBoardChess() {\r\n \r\n white = new AllPiece(\"White\");\r\n black = new AllPiece(\"Black\");\r\n \r\n }", "public void gameOfLife(int[][] board) {\n int m = board.length;\n int n = ( m > 0 ? board[0].length : 0);\n int[] dx = {-1, -1, -1, 0, 1, 1, 1, 0};\n int[] dy = {-1, 0, 1, 1, 1, 0, -1, -1};\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n int cnt = 0;\n /**\n * Count the neighbors with live status.\n */\n for (int k = 0; k < 8; k++) {\n int x = i + dx[k];\n int y = j + dy[k];\n /**\n * Notice using board[x][y] here, not board[i][j]\n * The next state is created by applying the above rules simultaneously to every cell in the current state,\n * so we concern state==1 and state==2(both states indicate live)\n */\n if (x >= 0 && x < m && y >= 0 && y < n && (board[x][y] == 1 || board[x][y] == 2)) {\n cnt++;\n }\n }\n if (board[i][j] == 1 && (cnt < 2 || cnt > 3)) {\n /**\n * From live to dead.\n */\n board[i][j] = 2;\n }\n if (board[i][j] == 0 && cnt == 3) {\n /**\n * From dead to live\n */\n board[i][j] = 3;\n }\n }\n }\n /**\n * Restore state back to 0 and 1.\n */\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n board[i][j] %= 2;\n }\n }\n }", "public boolean isBoardSolved() {\n for (int goal : goalCells) {\n if (!((board[goal] & 15) == BOX_ON_GOAL)) {\n return false;\n }\n }\n return true;\n }", "private ArrayList<Move> whiteKing(){\n // obtain current co-ordinates\n int x = this.getX();\n int y = this.getY();\n\n // otherwise create a new vector to store legal whiteMoves\n ArrayList<Move> whiteMoves = new ArrayList<Move>();\n\n // set up m to refer to a Move object\n Move theMove = null;\n\n // first legal move is to go from x,y to x,y+1\n if (validNormalMove(x, y + 1)) {\n theMove = new Move(this, x, y, x, y + 1, false);\n if(takeOverCheck(x, y+1)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n\n // legal move is to go from x,y to x,y-1 if x,y-1 is unoccupied (bottom)\n if (validNormalMove(x, y - 1)) {\n theMove = new Move(this, x, y, x, y - 1, false);\n if(takeOverCheck(x, y-1)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n //left\n // legal move to go left from x,y to x-1, y if x-1,y is unoccupied (left)\n\n if (validNormalMove(x-1, y)) {\n theMove = new Move(this, x, y, x-1, y, false);\n if(takeOverCheck(x-1, y)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n //right\n // legal move to go right from x,y to x+1, y if x+1,y is unoccupied (right)\n\n if (validNormalMove(x+1, y)) {\n theMove = new Move(this, x, y, x+1, y, false);\n\n if(takeOverCheck(x+1, y)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n\n\n // legal move to diagonal top right for white king\n if (validNormalMove(x+1, y + 1)) {\n theMove = new Move(this, x, y, x+1, y + 1, false);\n if(takeOverCheck(x+1, y+1)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n // legal move to diagonal bottom right\n\n if (validNormalMove(x+1, y -1)) {\n theMove = new Move(this, x, y, x+1, y - 1, false);\n if(takeOverCheck(x+1, y-1)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n // legal move to diagonal bottom left\n if (validNormalMove(x-1, y -1)) {\n theMove = new Move(this, x, y, x-1, y - 1, false);\n if(takeOverCheck(x-1, y-1)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n // legal move to diagonal top left\n if (validNormalMove(x-1, y+1)) {\n theMove = new Move(this, x, y, x-1, y + 1, false);\n if(takeOverCheck(x-1, y+1)){\n theMove.setOccupied(true);\n }\n whiteMoves.add(theMove);\n }\n\n\n\n if (whiteMoves.isEmpty())\n return null;\n return whiteMoves;\n }", "public void checkBoard(){\n\n //check horizontally for a winner\n for(int i = 0; i < 3; i++) {\n if (boardStatus[i][0].equals(boardStatus[i][1]) && boardStatus[i][1].equals(boardStatus[i][2])) {\n if (boardStatus[i][0].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n break;\n } else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n break;\n\n }\n }\n\n\n }\n\n //check vertically for a winner\n for(int i = 0; i < 3; i++) {\n if (boardStatus[0][i].equals(boardStatus[1][i]) && boardStatus[1][i].equals(boardStatus[2][i])) {\n if (boardStatus[0][i].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n break;\n } else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n break;\n }\n }\n }\n\n //diagonally\n\n if((boardStatus[0][0].equals(boardStatus[1][1])) && (boardStatus[0][0].equals(boardStatus[2][2]))){\n\n if (boardStatus[0][0].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n\n }\n else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n\n }\n\n }\n\n //diagonally\n if (boardStatus[0][2].equals(boardStatus[1][1]) && (boardStatus[0][2].equals(boardStatus[2][0]))) {\n\n if (boardStatus[0][2].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n } else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n }\n }\n\n //If all the locations on the board have been played but no win conditions have been met\n //the game will end without a winner\n if(boardStatus[0][0] != \"a\" && boardStatus[0][1] != \"b\" && boardStatus[0][2] != \"c\" &&\n boardStatus[1][0] != \"d\" && boardStatus[1][1] != \"e\" && boardStatus[1][2] != \"f\" &&\n boardStatus[2][0] != \"g\" && boardStatus[2][1] != \"h\" && boardStatus[2][2] != \"i\"){\n NoWinnerDialog dialog = new NoWinnerDialog();\n dialog.show(getSupportFragmentManager(), \"NoWinner\");\n }\n\n\n\n\n }", "public boolean blackCheck() {\n\t\treturn false;\n\t}", "public void checkState() {\r\n\t\tout.println(state);\r\n\t\tif(getEnergy() < 80 && getOthers() > 5) {\r\n\t\t\tstate = 1;\r\n\t\t\tturnLeft(getHeading() % 90);\r\n\t\t\tahead(moveAmount);\r\n\t\t}\r\n\t\telse if(getEnergy() < 80 && getOthers() < 5) {\r\n\t\t\tstate = 0;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tstate = 0;\r\n\t\t}\r\n\t\t\r\n\t}", "private boolean winningBoard(char[][] board){\n for(int i = 0; i < boardHeight; i++ ){\n for(int j = 0; j < boardWidth; j++) {\n\n //if white was made it to the other side\n if(board[i][j] == 'P' && i == 0){\n return true;\n }\n\n //if black has made it to the other side\n if(board[i][j] == 'p' && i == boardHeight -1){\n return true;\n }\n }\n }\n //no winners\n return false;\n }", "@Override\r\n\tpublic void mouseClicked(MouseEvent e) {\r\n\t\tSystem.out.println(e.getX()/100 + \", \" + e.getY()/100);\r\n\t\tif (board[e.getX()/100][e.getY()/100].equals(Color.blue)) {\r\n\t\t\tif (turn%2 == 0) {\r\n\t\t\t\tboard[e.getX()/100][e.getY()/100] = Color.yellow;\r\n\t\t\t} else {\r\n\t\t\t\tboard[e.getX()/100][e.getY()/100] = Color.red;\r\n\t\t\t}\r\n\t\t\tturn++;\r\n\t\t\t\r\n\t\t\t//win condition\r\n\t\t\tif(board[0][0] == Color.yellow && board[0][1] == Color.yellow && board[0][2] == Color.yellow && board[0][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[1][0] == Color.yellow && board[1][1] == Color.yellow && board[1][2] == Color.yellow && board[1][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[2][0] == Color.yellow && board[2][1] == Color.yellow && board[2][2] == Color.yellow && board[2][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.yellow && board[1][0] == Color.yellow && board[2][0] == Color.yellow && board[3][0] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][1] == Color.yellow && board[1][1] == Color.yellow && board[2][1] == Color.yellow && board[3][1] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][2] == Color.yellow && board[1][2] == Color.yellow && board[2][2] == Color.yellow && board[3][2] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.yellow && board[1][1] == Color.yellow && board[2][2] == Color.yellow && board[3][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[3][0] == Color.yellow && board[1][2] == Color.yellow && board[2][1] == Color.yellow && board[0][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.red && board[0][1] == Color.red && board[0][2] == Color.red && board[0][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[1][0] == Color.red && board[1][1] == Color.red && board[1][2] == Color.red && board[1][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[2][0] == Color.red && board[2][1] == Color.red && board[2][2] == Color.red && board[2][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.red && board[1][0] == Color.red && board[2][0] == Color.red && board[3][0] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][1] == Color.red && board[1][1] == Color.red && board[2][1] == Color.red && board[3][1] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][2] == Color.red && board[1][2] == Color.red && board[2][2] == Color.red && board[3][2] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.red && board[1][1] == Color.red && board[2][2] == Color.red && board[3][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[3][0] == Color.red && board[1][2] == Color.red && board[2][1] == Color.red && board[0][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\trepaint();\r\n\t\t}\r\n\t}", "protected void takeTurn(int[][] boardState)\n {\n \n }", "public boolean isWinner(boolean isRed){\n\n for(int i =0; i<mCheckerBoard.size(); i++){\n if(mCheckerBoard.get(i)!=null && mCheckerBoard.get(i).isRed() != isRed){\n return false;\n }\n }\n return true;\n }", "public String computerMove() {\n\t\t// Look to win in a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win in a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Find the non-full row and col w/ least val\n\t\tint bestR = -1;\n\t\tint bestC = -1;\n\t\tint minSum = 10;\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\tint sum = rowSum[r] + colSum[c];\n\t\t\t\t\tif (sum < minSum) {\n\t\t\t\t\t\tminSum = sum;\n\t\t\t\t\t\tbestR = r;\n\t\t\t\t\t\tbestC = c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn done(bestR, bestC);\n\t}", "public static boolean testCheckMateWhite() {\n\t\t\t\tint i = 0;\n\t\t\t\tfor(Square s : BOARD_SQUARES) {\n\t\t\t\t\tPiece p = s.getPiece();\n\t\t\t\t\tif(s.hasPiece() && (p.getTeamColor()).equals(TeamColor.WHITE)) {\n\t\t\t\t\t\tif(!p.getPossibleMoves().isEmpty()) {\n\t\t\t\t\t\t\tfor(int[] potentialMove : p.getPossibleMoves()) {\n\t\t\t\t\t\t\t\tif(hasSquare(potentialMove)) {\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t// Completely move piece\n\t\t\t\t\t\t\t\t\tSquare targetSquare = getSquare(potentialMove);\n\t\t\t\t\t\t\t\t\tPiece savedPiece = targetSquare.getPiece();\n\t\t\t\t\t\t\t\t\ttargetSquare.setIcon(p);\n\t\t\t\t\t\t\t\t\ts.removePiece();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t// Update positions/square protections\n\t\t\t\t\t\t\t\t\tupdatePositions();\n\t\t\t\t\t\t\t\t\tsetProtectedSquares();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t// Test if still in check\n\t\t\t\t\t\t\t\t\tif(!testCheckWhite()) {\n\t\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t// Undo move\n\t\t\t\t\t\t\t\t\ttargetSquare.setIcon(savedPiece);\n\t\t\t\t\t\t\t\t\ts.setIcon(p);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn (i==0);\n\t}", "public boolean checkForVictory() {\n // keep track of whether we have seen any pieces of either color.\n boolean anyWhitePieces = false;\n boolean anyRedPieces = false;\n // iterate through each row\n for (Row row : this.redBoard) {\n // whether we iterate through the red or white board does not matter; they contain the same pieces, just\n // in a different layout\n // iterate through each space in a row\n for (Space space : row) {\n // if there is a piece on this space\n if (space.getPiece() != null) {\n if (space.getPiece().getColor() == Piece.COLOR.RED) {\n // and if it's red, we have now seen at least one red piece\n anyRedPieces = true;\n } else if (space.getPiece().getColor() == Piece.COLOR.WHITE) {\n // and if it's white, we have now seen at least one white piece\n anyWhitePieces = true;\n }\n }\n }\n }\n // if we haven't seen any pieces of a color, then the other player has won\n if (!anyRedPieces) {\n // white player has won\n markGameAsDone(getWhitePlayer().getName() + \" has captured all the pieces.\");\n return true;\n } else if (!anyWhitePieces) {\n // red player has won\n markGameAsDone(getRedPlayer().getName() + \" has captured all the pieces.\");\n return true;\n }\n return false;\n }", "public void changeBoard(int columnnumber, int whoseTurn, Color color1, Color color2){ //changes the colour of the circles on the board\r\n \r\n if(whoseTurn==1){ \r\n if(erase>0){ //this if statement runs if a checker needs to be erased; (because AI was checking future game states)\r\n for(int i = 0; i<=5; i++){ //going from top to bottom to change the last entered checker\r\n if(arrayCircles[i][erase-1].getColor()==color1){\r\n arrayCircles[i][erase-1].setColor(Color.white); //removing the checker that was previously placed\r\n repaint();\r\n break;\r\n }\r\n }\r\n }\r\n else{\r\n for(int i = 5; i>=0; i--){\r\n if(arrayCircles[i][columnnumber-1].getColor()==Color.white){ //starting from row 5 (the bottom one) see if any of those within the column is null\r\n arrayCircles[i][columnnumber-1].setColor(color1); //if so, set that value to the colour of the player who inputted that columnnumber\r\n repaint(); //repainting the board so that it updates and is visible to viewers\r\n break; //break once the colour has been changed and a move has been made\r\n }\r\n }\r\n }\r\n }\r\n \r\n else if(whoseTurn==2){\r\n for(int i = 5; i>=0; i--){\r\n if(arrayCircles[i][columnnumber-1].getColor()==Color.white){ //if there is an open space, set its colour to the desired colour \r\n arrayCircles[i][columnnumber-1].setColor(color2);\r\n repaint();\r\n break;\r\n }\r\n }\r\n }\r\n \r\n else if(whoseTurn==3||whoseTurn==4){ //either the easyAI or the hardAI\r\n \r\n \r\n if(erase>0){ //this if statement erases the last placed coloured checker\r\n for(int i = 0; i<=5; i++){ //going from top to bottom to change the last entered checker to white\r\n if(arrayCircles[i][erase-1].getColor()==Color.magenta){\r\n arrayCircles[i][erase-1].setColor(Color.white); //sets it back to white\r\n repaint(); //repaints and breaks\r\n break;\r\n }\r\n }\r\n }\r\n else{\r\n for(int i = 5; i>=0; i--){ //setting the colour of the column to magenta (for the AI)\r\n if(arrayCircles[i][columnnumber-1].getColor()==Color.white){\r\n arrayCircles[i][columnnumber-1].setColor(color2);\r\n repaint();\r\n break;\r\n }\r\n }\r\n } \r\n }\r\n }", "public Status getStatus() {\n return board.getStatus();\n }", "public int[] findMove(){\n int[] blackCheckerSpots = new int[12];\n int i =0;\n while(mCheckerBoard.indexOf(new Checker(1, false)) != -1){\n int startPosition = mCheckerBoard.indexOf(new Checker(1, false)); //need to override Checker equals method\n Checker current = mCheckerBoard.get(startPosition);\n int[] answer = jumpRight(startPosition, false, current);\n if(answer.length > 1)\n {\n //jumped right downwards\n return answer;\n }\n answer = jumpLeft(startPosition, false, current);\n if(answer.length > 1){\n //jumped left downwards\n return answer;\n }\n answer = moveDiagonalRight(startPosition, false, current);\n if(answer.length > 1){\n //moved diagonal right downwards\n return;\n }\n answer = moveDiagonalLeft(startPosition, false, current);\n if(answer.length > 1){\n //moved diagonal left downwards\n return;\n }\n\n //end of loop\n //these are the ones that need to be set back to black at the end\n current.setIsRed(true);\n blackCheckerSpots[i]=startPosition;\n i++;\n }\n\n for(int j =0; j<blackCheckerSpots.length; j++){\n Checker changed = mCheckerBoard.get(blackCheckerSpots[j]);\n changed.setIsRed(false);\n mCheckerBoard.set(blackCheckerSpots[j], changed);\n }\n\n }", "private void highlightLegalMoves(final Board board) {\n if (shouldHighlightLegalMoves) {\n // running calculatePieceToBeMovedLegalMoves(board) ensures\n // 1. there is a clicked piece\n // 2. clicked piece belongs to current player\n for (final Move move : calculatePieceToBeMovedLegalMoves(board)) {\n MoveTransition transition = board.currentPlayer().makeMove(move);\n if(!transition.getMoveStatus().isDone()){\n continue;\n }\n if (move.getDestinationCoordinate() == this.tileCoordinate) {\n try {\n ImageIcon greenDot = new ImageIcon(ImageIO.read(new File(\"art/misc/green_dot.png\")));\n add(new JLabel(greenDot));\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }\n }\n }", "private String getTurnMessage(){\n if (board.turn ==0)\n return \"Black's turn\";\n else\n return \"White's turn\";\n }", "private Color opponent(Color color) {\n\t\treturn (color == Color.WHITE) ? Color.BLACK : Color.WHITE;\n\t}", "public int checkForWin() \r\n {\r\n \twinner = null;\r\n \tint winrole = -1;\r\n \tif(isBoardFull()){\r\n \t\tint white = 0;\r\n \t\tint black = 0;\r\n\t\t\tfor(int i = 0; i < boardsize; ++i){\r\n\t\t\t\tfor(int j = 0; j<boardsize; ++j){\r\n\t\t\t\t\tif(board[i][j] == 0){\r\n\t\t\t\t\t\twhite++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(board[i][j] == 1){\r\n\t\t\t\t\t\tblack++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(white > black){\r\n\t\t\t\twinrole = 0;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\t\r\n\t\t\telse if(black > white){\r\n\t\t\t\twinrole = 1;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\twinrole=2;\r\n\t\t\t}\r\n\t\t\treturn winrole;\r\n \t}\r\n \treturn -1;\r\n }", "public static Move openingStrategy(PentagoBoardState boardState, int player) {\n\t Move firstMoveOne = new PentagoMove(1, 0, Quadrant.BL, Quadrant.BR, player);\r\n\t Move firstMoveTwo = new PentagoMove(1, 3, Quadrant.BL, Quadrant.BR, player);\r\n\t Move moveThree = new PentagoMove(0, 1, Quadrant.BL, Quadrant.TR, player);\r\n\t Move moveFour = new PentagoMove(0, 4, Quadrant.TL, Quadrant.BR, player);\r\n\t Move moveFive = new PentagoMove(3, 1, Quadrant.BL, Quadrant.TL, player);\r\n\t Move moveSix = new PentagoMove(3, 4, Quadrant.TL, Quadrant.TR, player);\r\n\t Move moveSeven = new PentagoMove(2, 2, Quadrant.TL, Quadrant.TR, player);\r\n\t Move moveEight = new PentagoMove(2, 5, Quadrant.TL, Quadrant.BR, player);\r\n\t Move moveNine = new PentagoMove(5, 2, Quadrant.BL, Quadrant.TL, player);\r\n\t Move moveTen = new PentagoMove(5, 5, Quadrant.TL, Quadrant.TR, player);\r\n\t \r\n\t //First turn as either Black or White\r\n\t if(boardState.getTurnNumber() == 0 || boardState.getTurnNumber() == 1) {\r\n\t if(boardState.isLegal((PentagoMove) firstMoveOne)) {\r\n\t \treturn firstMoveOne;\r\n\t }\r\n\t else if(boardState.isLegal((PentagoMove) firstMoveTwo)) {\r\n\t \treturn firstMoveTwo;\r\n\t }\r\n\t else {\r\n\t \t/* If something goes awry, play the first legal move (will place pieces in TL quadrant usually).\r\n\t \t * Same error condition for the following moves as well.\r\n\t \t **/\r\n\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t \treturn legalMoves.get(0);\r\n\t }\r\n\t }\r\n\t else if(boardState.getTurnNumber() == 2 || boardState.getTurnNumber() == 3) {\r\n\t \t//White player turn 2 & 3 set up\r\n\t \tif(player == 0) {\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveThree) && boardState.getPieceAt(1, 0).toString().equals(\"w\")) {\r\n\t\t \treturn moveThree;\r\n\t\t }\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveFour) && boardState.getPieceAt(1, 3).toString().equals(\"w\")) {\r\n\t\t \t\treturn moveFour;\r\n\t\t \t}\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveFive) && boardState.getPieceAt(4, 0).toString().equals(\"w\")) {\r\n\t\t \treturn moveFive;\r\n\t\t }\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveSix) && boardState.getPieceAt(4, 3).toString().equals(\"w\")) {\r\n\t\t \t\treturn moveSix;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(0, 1).toString().equals(\"b\") && boardState.getPieceAt(1, 0).toString().equals(\"w\")\t\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveSeven)) {\r\n\t\t \treturn moveSeven;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(0, 4).toString().equals(\"b\") && boardState.getPieceAt(1, 3).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveEight)) {\r\n\t\t \t\treturn moveEight;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(3, 1).toString().equals(\"b\") && boardState.getPieceAt(4, 0).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveNine)) {\r\n\t\t \treturn moveNine;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(3, 4).toString().equals(\"b\") && boardState.getPieceAt(4, 3).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveTen)) {\r\n\t\t \t\treturn moveTen;\r\n\t\t \t}\r\n\t\t else {\r\n\t\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t\t \treturn legalMoves.get(0);\r\n\t\t }\r\n\t \t} \r\n\t \t//Black player turn 2 & 3 set up\r\n\t \telse {\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveThree) && boardState.getPieceAt(1, 0).toString().equals(\"b\")) {\r\n\t\t \treturn moveThree;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveFour) && boardState.getPieceAt(1, 3).toString().equals(\"b\")) {\r\n\t\t \treturn moveFour;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveFive) && boardState.getPieceAt(4, 0).toString().equals(\"b\")) {\r\n\t\t \treturn moveFive;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveSix) && boardState.getPieceAt(4, 3).toString().equals(\"b\")) {\r\n\t\t \treturn moveSix;\r\n\t\t }\r\n\t \t\tif(boardState.getPieceAt(0, 1).toString().equals(\"w\") && boardState.getPieceAt(1, 0).toString().equals(\"b\")\r\n\t \t\t\t\t&& boardState.isLegal((PentagoMove) moveSeven)) {\r\n\t\t \treturn moveSeven;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(0, 4).toString().equals(\"w\") && boardState.getPieceAt(1, 3).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveEight)) {\r\n\t\t \t\treturn moveEight;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(3, 1).toString().equals(\"w\") && boardState.getPieceAt(4, 0).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveNine)) {\r\n\t\t \treturn moveNine;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(3, 4).toString().equals(\"w\") && boardState.getPieceAt(4, 3).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveTen)) {\r\n\t\t \t\treturn moveTen;\r\n\t\t \t}\r\n\t\t else {\r\n\t\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t\t \treturn legalMoves.get(0);\r\n\t\t }\r\n\t \t}\t \r\n\t }\r\n\t else {\r\n\t \t//If we are past Player's Turn 3, start using MiniMax with a-b pruning\r\n\t \tMiniMaxABPruning instc = new MiniMaxABPruning();\r\n\t \treturn instc.abPruningStrategy(boardState, boardState.getTurnPlayer());\r\n\t }\r\n\t}", "void onCheck(Chess.Color inCheckColor);", "public List<Piece> inCheck(int kingX, int kingY){ // returns list of attacking pieces.\n // Also have to look for opponent king to avoid moving into check.\n // In this case only care whether or not a check occurs, not how many so breaks still ok\n // for regular check tests, want to know if 1 or 2 checks, cannot have multiple diagonal checks.\n List<Piece> attackers = new ArrayList<>();\n // knights\n int knight = turn == WHITE ? BLACK_KNIGHT : WHITE_KNIGHT;\n knightSearch:\n for (int dx = -1; dx <= 1; dx += 2){\n for (int dy = -2; dy <= 2; dy += 4){\n if (kingX + dx >= 0 && kingX + dx < 8 && kingY + dy >= 0 && kingY + dy < 8){\n if (board[kingY+dy][kingX+dx] == knight){\n attackers.add(new Piece(knight, kingX+dx, kingY+dy));\n break knightSearch; // can only be checked by 1 knight at a time\n }\n }\n if (kingX + dy >= 0 && kingX + dy < 8 && kingY + dx >= 0 && kingY + dx < 8){\n if (board[kingY+dx][kingX+dy] == knight){\n attackers.add(new Piece(knight, kingX+dy, kingY+dx));\n break knightSearch;\n }\n }\n }\n }\n // bishop/queen/pawn/king\n int pawn = turn == WHITE ? BLACK_PAWN : WHITE_PAWN;\n int bish = turn == WHITE ? BLACK_BISHOP : WHITE_BISHOP;\n int queen = turn == WHITE ? BLACK_QUEEN : WHITE_QUEEN;\n int king = turn == WHITE ? BLACK_KING : WHITE_KING;\n diagSearch:\n for (int dx = -1; dx <= 1; dx += 2){\n for (int dy = -1; dy <= 1; dy += 2){\n int i = 1;\n while (kingX + dx*i >= 0 && kingX + dx*i < 8 && kingY + dy*i >= 0 && kingY + dy*i < 8){\n int piece = board[kingY + dy*i][kingX + dx*i];\n if (piece != 0){\n if (piece == bish || piece == queen || (piece == pawn && i == 1 && dy == turn)\n || (piece == king && i == 1)){\n attackers.add(new Piece(piece, kingX+dx*i, kingY+dy*i));\n break diagSearch;\n }\n break;\n }\n i++;\n }\n }\n }\n // rook/queen/king\n int rook = turn == WHITE ? BLACK_ROOK : WHITE_ROOK;\n straightSearch:\n for (int dx = -1; dx <= 1; dx += 2){\n int i = 1;\n while (kingX + i*dx >= 0 && kingX + i*dx < 8){\n int piece = board[kingY][kingX + dx*i];\n if (piece != 0){\n if (piece == rook || piece == queen || (piece == king && i == 1)){\n attackers.add(new Piece(piece, kingX+dx*i, kingY));\n break straightSearch;\n }\n break;\n }\n i++;\n }\n i = 1;\n while (kingY + i*dx >= 0 && kingY + i*dx < 8){\n int piece = board[kingY+dx*i][kingX];\n if (piece != 0){\n if (piece == rook || piece == queen || (piece == king && i == 1)){\n attackers.add(new Piece(piece, kingX, kingY+dx*i));\n break straightSearch;\n }\n break;\n }\n i++;\n }\n }\n return attackers;\n }", "public IGameAlgo.GameState getGameState (GameBoard.GameMove move){\n\t\t/*\n\t\t * If last move made by computer,check if computer wins.\n\t\t */\n\t\tif(this.board[lastMove.getRow()][lastMove.getColumn()]==BoardSigns.COMPUTER.getSign()) {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[0][1] == BoardSigns.COMPUTER.getSign() && board[0][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][0] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_LOST;\t\t\t\t\t\t \n\t\t}\n\t\t/*\n\t\t * If last move made by player,check if player wins.\n\t\t */\n\t\telse {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[0][1] == BoardSigns.PLAYER.getSign() && board[0][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][0] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_WON;\t\n\t\t}\n\t\t/*\n\t\t * No one wins,check if in progress or game ends with tie.\n\t\t */\n\t\t\n\t\t //check if exist empty spots. \n\t\t\tfor(int i=0;i<3;i++)\n\t\t\tfor(int j=0;j<3;j++)\n\t\t\t\tif(board[i][j]==TicTacTow.BoardSigns.BLANK.getSign()) \n\t\t\t\t return GameState.IN_PROGRESS;\n\t\t\treturn GameState.TIE;\t\t\t\n\t}", "public int CheckForClear(){\n int endState = -1;\n //check top\n for (int i = 0; i < 6; i++){\n if(this.gameBoard[i] != 0){\n endState = -1;\n break;\n }\n else{\n endState = 0;\n }\n }\n //check bottom\n if (endState == -1){\n for (int i = 7; i < 13; i++){\n if (this.gameBoard[i] != 0){\n endState = -1;\n break;\n }\n else{\n endState = 1;\n }\n }\n }\n return endState;\n }", "boolean gameOver() {\n return piecesContiguous(BLACK) || piecesContiguous(WHITE);\n }", "void analyzeBoard() {\n if (onProcessCompleteListener == null) {\n return;\n }\n\n if ((!isWin(TTTConstants.CIRCLE, true)) && (!isWin(TTTConstants.CROSS, true)) && (depth >= 9)) {\n onProcessCompleteListener.onGameDraw();\n }\n }", "@Override\r\n\tpublic void getLegalMoves() {\r\n\t\tint pawnX = this.getX();\r\n\t\tint pawnY = this.getY();\r\n\t\tchar pawnColor = getColor();\r\n\t\tTile[][] chessBoard = SimpleChess.getChessBoard();\r\n\t\tcheckInFront(chessBoard,pawnX,pawnY,pawnColor);\r\n\t\tcheckDiagonal(chessBoard,pawnX,pawnY,pawnColor);\r\n\t}", "public static String[][] getBoardState() {\n return boardState;\n }", "@Test\n public void determineWinnerNoWhiteMove()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final Agent agentRed = agents.get(0);\n final Agent agentWhite = agents.get(1);\n final CheckersEnvironment environment = new CheckersEnvironment();\n\n environment.placeToken(CheckersPosition.P26, King.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P30, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P31, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P21, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P25, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P29, King.WHITE.withAgent(agentWhite));\n // System.out.println(environment);\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(3));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(3));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n assertThat(adjudicator.determineWinner(environment), is(agentRed));\n }", "public int evalBoard(){\n if (wins('o')){\n return 3;\n }\n // Return 0 if human wins\n else if (wins('b')){\n return 0;\n }\n //Return 2 if game is draw\n else if (isDraw()){\n return 2;\n }\n // Game is not a draw and no player has won. Game is still undecided.\n else {\n return 1;\n }\n }", "public boolean move(int x, int y, CheckersBoard board) {\n if (whiteTurn == true && team == Constants.TeamId.team1Id) {\n return false;\n }\n if (whiteTurn == false && team == Constants.TeamId.team2Id) {\n return false;\n }\n /**\n * then change the x - y coords of the piece\n * update the UI to remove the highlighted squares then move the piece\n * if chess and shared square you take a piece\n * if checkers you jumped them you take the piece\n * return new x - y components\n *\n * if this is too high up in the tree you can override this implementation or update it\n * to fit specific pieces if its not working for some reason\n */\n if (possible(x, y, gameBoard)) {\n int changex = this.getX()-x;\n int changey = this.getY()-y;\n CheckersPiece temp = gameBoard.boardPositions[getX()][getY()];\n gameBoard.boardPositions[getX()][getY()] = null;\n gameBoard.boardPositions[x][y] = temp;\n if (gameBoard.boardPositions[(this.getX() + x)/2][(this.getY() + y)/2] != null) {\n System.out.println(\"Here\");\n if (gameBoard.boardPositions[(this.getX() + x)/2][(this.getY() + y)/2].team != this.team) {\n gameBoard.boardPositions[(this.getX() + x)/2][(this.getY() + y)/2].imageView.setVisibility(View.GONE);\n gameBoard.boardPositions[(this.getX() + x)/2][(this.getY() + y)/2] = null;\n }\n }\n this.setX(x);\n this.setY(y);/*\n if (Math.abs(changex) == 2) {\n gameBoard.boardPositions[x + (changex/2)][y + (changey/2)] = null;\n if (team == Constants.TeamId.team1Id) {\n board.numPieces1--;\n } else if (team == Constants.TeamId.team2Id) {\n board.numPieces0--;\n }\n }*/\n\n gameBoard.boardPositions[x][y].imageView.setX(142*x);\n gameBoard.boardPositions[x][y].imageView.setY(142*y);\n // flips after move is\n whiteTurn = !whiteTurn;\n gameBoard.startTimer();\n }\n //setUpUI(gameBoard);\n if (getY() == 7 && team == Constants.TeamId.team2Id) {\n board.crown(this);\n }\n if (getY() == 0 && team == Constants.TeamId.team1Id) {\n board.crown(this);\n }\n return possible(x, y, gameBoard);\n }", "private static String determineActiveColor(final Board gameBoard) {\n return gameBoard.getCurrentPlayer().getColor().getAbbr();\n }", "private boolean check(int l, int r, boolean checkForBlacks) {\n\t\tif (checkForBlacks) {\n\t\t\t// If black increment counter and continue\n\t\t\tif (board[l][r].isBlack()) {\n\t\t\t\tcounter++;\n\t\t\t\tpossibleFlips.add(board[l][r]);\n\t\t\t}\n\n\t\t\t// If red break out of loop\n\t\t\telse if (board[l][r].isRed())\n\t\t\t\treturn false;\n\n\t\t\t// If empty and count > 0 set square as possible move else return from function\n\t\t\telse if (board[l][r].isEmpty()) {\n\t\t\t\tif (counter > 0) {\n\t\t\t\t\tboard[l][r].setPossMove(true);\n\t\t\t\t\tboard[l][r].addToFlipSquares(possibleFlips);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\telse {\n\t\t\t// If red increment counter and continue\n\t\t\tif (board[l][r].isRed()) {\n\t\t\t\tcounter++;\n\t\t\t\tpossibleFlips.add(board[l][r]);\n\t\t\t}\n\n\t\t\t// If black break out of loop\n\t\t\telse if (board[l][r].isBlack()) \n\t\t\t\treturn false;\n\n\t\t\t// If empty and count > 0 set square as possible move else return from function\n\t\t\telse if (board[l][r].isEmpty()) {\n\t\t\t\tif (counter > 0) {\n\t\t\t\t\tboard[l][r].setPossMove(true);\n\t\t\t\t\tboard[l][r].addToFlipSquares(possibleFlips);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\t\treturn true;\n\t}", "public boolean isBlack() {\r\n\t\treturn !isRed();\r\n\t}", "public static HashSet<gameState> Actions(gameState currentState) {\n\t\t\n\t\tHashSet<gameState> possibleStates = new HashSet<gameState>();\n\t\t\n\t\t\n\t\t// Store which player goes next after this player plays\n\t\tint nextNextUp;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tnextNextUp = 1;\n\t\t} else {\n\t\t\tnextNextUp = 0;\n\t\t}\n\t\t\n\t\t// Store corresponding characters for each player\n\t\t// DARK(X) - 0, LIGHT(O) - 1\n\t\tchar myTile;\n\t\tchar opponentTile;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tmyTile = 'x';\n\t\t\topponentTile = 'o';\n\t\t} else {\n\t\t\tmyTile = 'o';\n\t\t\topponentTile = 'x';\n\t\t}\n\n\t\t\n\n\t\t// Check the entire board of the state \n\t\tfor (int i = 0; i<boardSize; i++) {\n\t\t\tfor (int j = 0; j<boardSize; j++) {\n\t\t\t\t\n\t\t\t\t// If the tile is my tile\n\t\t\t\tif (currentState.getBoard()[i][j] == '_') {\n\t\t\t\t\t\n\t\t\t\t\tchar[][] moveBoard = createNewBoard(currentState);\n\t\t\t\t\t\n\t\t\t\t\t// Up\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// If it is an opponent tile, then you keep going up until you either my tile (fail) or\n\t\t\t\t\t\t// a blank space (success/move possible)\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=i;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Down\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=i;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j-1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=j;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j+1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=j;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j-1] == opponentTile) { \n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j+1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j-1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j+1] == opponentTile) { \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\tif (!compareBoards(moveBoard, currentState.getBoard())) {\n\t\t\t\t\t\tgameState move = new gameState(moveBoard, nextNextUp);\t\t\n\t\t\t\t\t\tpossibleStates.add(move);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\n\t\treturn possibleStates;\n\t\t\n\t\t\n\t\t\n\t}", "public boolean CheckChecker(Board b, Player p) {\r\n int WhiteKingx = WhiteKing(b)[0];\r\n int WhiteKingy = WhiteKing(b)[1];\r\n int BlackKingx = BlackKing(b)[0];\r\n int BlackKingy = BlackKing(b)[1];\r\n\r\n if (p.getColor()) {\r\n //check if any Black Piece can land on the White King's position\r\n for (int r = 0; r < row; r++) {\r\n for (int c = 0; c < column; c++) {\r\n if (b.blocks[r][c].getPiece() != null && !b.blocks[r][c].getPiece().getPlayer().getColor() && b.blocks[r][c].getPiece().ValidMove(b.blocks, r, c, WhiteKingx, WhiteKingy)) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n if (!p.getColor()) {\r\n //check if any White Piece can land on the Black King's position\r\n for (int r = 0; r < row; r++) {\r\n for (int c = 0; c < column; c++) {\r\n if (b.blocks[r][c].getPiece() != null && b.blocks[r][c].getPiece().getPlayer().getColor() && b.blocks[r][c].getPiece().ValidMove(b.blocks, r, c, BlackKingx, BlackKingy)) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "public Winner whoWins(){\r\n\r\n /* transfer the matrix to an array */\r\n Sign[] flatBoard = flattenBoard();\r\n\r\n /* check if someone has won */\r\n if (CompPlayer.compWon(flatBoard))\r\n return Winner.COMPUTER;\r\n else if (CompPlayer.playerWon(flatBoard))\r\n return Winner.PLAYER;\r\n else\r\n return Winner.NON;\r\n }", "public static boolean isBlackWin(char[][] board){\r\n for (int r= 0; r < 6; r++ ){\r\n for (int c = 0; c < 7; c++){\r\n if (r < 3){\r\n if (board [r][c] =='b' && board [r + 1][c] =='b' && board [r + 2][c] =='b' && board [r + 3][c] =='b' ){\r\n return true;\r\n }\r\n }\r\n if (c < 4){\r\n if (board [r][c] =='b' && board [r][c + 1] =='b' && board [r ][c + 2] =='b' && board [r][c + 3] =='b' ){\r\n return true;\r\n }\r\n }\r\n\r\n \r\n }\r\n }\r\n \r\n for (int r = 0; r < 3; r++){\r\n for (int c = 0; c < 4; c++){\r\n if (board [r][c] =='b' && board [r + 1][c +1 ] =='b' && board [r + 2][c +2] =='b' && board [r + 3][c +3 ] =='b' ){\r\n return true; }\r\n }\r\n }\r\n\r\n for (int r = 0; r < 3 ; r++){\r\n for (int c = 6; c > 2; c--){\r\n if (board [r][c] =='b' && board [r + 1][c - 1 ] =='b' && board [r + 2][c - 2] =='b' && board [r + 3][c - 3 ] =='b' ){\r\n return true; }\r\n }\r\n }\r\n return false;\r\n }", "private String calculateColourBoard(int col, int row) {\n // ORANGE\n if (col == 0 && row == 0 ||\n col == 1 && row == 1 ||\n col == 2 && row == 2 ||\n col == 3 && row == 3 ||\n col == 4 && row == 4 ||\n col == 5 && row == 5 ||\n col == 6 && row == 6 ||\n col == 7 && row == 7) {\n return \"#FFA500\";\n }\n\n // BLUE\n if (col == 1 && row == 0 ||\n col == 4 && row == 1 ||\n col == 7 && row == 2 ||\n col == 2 && row == 3 ||\n col == 5 && row == 4 ||\n col == 0 && row == 5 ||\n col == 3 && row == 6 ||\n col == 6 && row == 7) {\n return \"#0000FF\";\n }\n\n // PURPLE\n if (col == 2 && row == 0 ||\n col == 7 && row == 1 ||\n col == 4 && row == 2 ||\n col == 1 && row == 3 ||\n col == 6 && row == 4 ||\n col == 3 && row == 5 ||\n col == 0 && row == 6 ||\n col == 5 && row == 7) {\n return \"#7D3C98\";\n }\n\n // PINK\n if (col == 3 && row == 0 ||\n col == 2 && row == 1 ||\n col == 1 && row == 2 ||\n col == 0 && row == 3 ||\n col == 7 && row == 4 ||\n col == 6 && row == 5 ||\n col == 5 && row == 6 ||\n col == 4 && row == 7) {\n return \"#FFB6C1\";\n }\n\n // YELLOW\n if (col == 4 && row == 0 ||\n col == 5 && row == 1 ||\n col == 6 && row == 2 ||\n col == 7 && row == 3 ||\n col == 0 && row == 4 ||\n col == 1 && row == 5 ||\n col == 2 && row == 6 ||\n col == 3 && row == 7) {\n return \"#FFFF00\";\n }\n\n // RED\n if (col == 5 && row == 0 ||\n col == 0 && row == 1 ||\n col == 3 && row == 2 ||\n col == 6 && row == 3 ||\n col == 1 && row == 4 ||\n col == 4 && row == 5 ||\n col == 7 && row == 6 ||\n col == 2 && row == 7) {\n return \"#FF0000\";\n }\n\n // GREEN\n if (col == 6 && row == 0 ||\n col == 3 && row == 1 ||\n col == 0 && row == 2 ||\n col == 5 && row == 3 ||\n col == 2 && row == 4 ||\n col == 7 && row == 5 ||\n col == 4 && row == 6 ||\n col == 1 && row == 7) {\n return \"#008000\";\n }\n\n // BROWN\n if (col == 7 && row == 0 ||\n col == 6 && row == 1 ||\n col == 5 && row == 2 ||\n col == 4 && row == 3 ||\n col == 3 && row == 4 ||\n col == 2 && row == 5 ||\n col == 1 && row == 6 ||\n col == 0 && row == 7) {\n return \"#641E16\";\n }\n\n\n return \"meh\";\n }", "public Piece.COLOR checkColor (int x, int y){\n\t\treturn board[x][y].getColor();\n\t}", "public static String checkEndGame(){\n\t\tif(turn.equals(\"white\") && king.whiteKingCheck == true){\n\t\t\tif(endGame.checkMate(board, \"white\")){\n\t\t\t\tincrementPoints(\"black\");\n\t\t\t\treturn \"Check Mate! Black Wins!\\n Press OK to start new game\";\n\t\t\t}\n\t\t}\n\t\tif(turn.equals(\"black\") && king.blackKingCheck == true){\n\t\t\tif(endGame.checkMate(board, \"black\")){\n\t\t\t\tincrementPoints(\"white\");\n\t\t\t\treturn \"Check Mate! White Wins!\\n Press OK to start new game\";\n\t\t\t}\n\t\t}\n\t\treturn \"noCheckMate\";\n\t}", "boolean canMove(Color player) {\n int[][] myStatusBoard;\n if (_playerOnMove == ORANGE) {\n myStatusBoard = _orangeStatusBoard;\n } else {\n myStatusBoard = _violetStatusBoard;\n }\n if (Game._totalMoves < 2) {\n return true;\n }\n int i, j;\n for (i = 0; i < 16; i++) {\n for (j = 0; j < 16; j++) {\n if (myStatusBoard[i][j] == 1) {\n if (findMove(i, j, myStatusBoard)) {\n return true;\n }\n }\n }\n }\n return false;\n }", "private void checks(){\n if (check(true)){\n changeBottomPane(\"White is in check! :(\");\n }\n else if (check(false)){\n changeBottomPane(\"Black is in check!!!!!!!!!!!\");\n }\n else{\n changeBottomPane(\"\");\n }\n }", "interface Cnst {\r\n\r\n /////////////////////////////////////////////////////////////\r\n // These constants can be changed to edit the big bang ran //\r\n /////////////////////////////////////////////////////////////\r\n\r\n //full size is eight, scales the size of the board\r\n int scale = 8;\r\n\r\n //numbers of blocks in a row and a column\r\n int blocks = 10;\r\n\r\n //number of colors the game will use, between 2-8 inclusive\r\n int numOfColors = 8;\r\n\r\n //the number of turns you have to win the game\r\n int maxTurns = 25;\r\n\r\n\r\n ////////////////////////////////////////\r\n // Please do not edit these constants //\r\n ////////////////////////////////////////\r\n\r\n //the visible board width, scales with scale\r\n int boardWidth = 70 * scale;\r\n\r\n //the visible board height, scales with scale\r\n int boardHeight = 70 * scale;\r\n\r\n //cell width scales with the board and scale\r\n int cellWidth = boardWidth / blocks;\r\n\r\n //cell height scales with board and scale\r\n int cellHeight = boardHeight / blocks;\r\n\r\n //new constant for text on the board\r\n int textHeight = boardWidth / 12;\r\n\r\n //the 8 colors that can be selected by the user\r\n ArrayList<Color> colorsToChoose =\r\n new ArrayList<Color>(Arrays.asList(\r\n Color.CYAN, Color.PINK, Color.ORANGE,\r\n Color.BLUE, Color.RED, Color.GREEN,\r\n Color.MAGENTA, Color.YELLOW));\r\n}", "public static int whoseTurn(int[][] board){\n int[] oneBoard = twoToOne(board);\n int countOne =0;\n int countTwo =0;\n for(int i=0; i<ROW*COLUMN; i++){\n if(oneBoard[i]==1){\n countOne++;\n }\n else if(oneBoard[i]==2){\n countTwo++;\n }\n }\n if(countOne>countTwo)\n return 2;\n else if(countOne<countTwo)\n return 1;\n else\n //neutral board, hardcode player=computer\n return 1;\n \n }", "public Piece flip(){\n if(this == BLACK){\n return WHITE;\n }\n else{\n return BLACK;\n }\n }", "protected boolean isBlack() {\n return this.black;\n }", "public void checkMilestones()\n {\n if(\n (beliefs.puzzle[0][0] == 1) &&\n (beliefs.puzzle[0][1] == 2) &&\n (beliefs.puzzle[0][2] == 3) &&\n (beliefs.puzzle[0][3] == 4)\n )\n {\n Blackboard.firstMilestoneAccomplished = true;\n }//end if\n\n if(\n (beliefs.puzzle[0][0] == 1) &&\n (beliefs.puzzle[0][1] == 2) &&\n (beliefs.puzzle[0][2] == 3) &&\n (beliefs.puzzle[0][3] == 4) &&\n (beliefs.puzzle[1][0] == 5) &&\n (beliefs.puzzle[1][1] == 6) &&\n (beliefs.puzzle[1][2] == 7) &&\n (beliefs.puzzle[1][3] == 8)\n )\n {\n Blackboard.secondMilestoneAccomplished = true;\n }//end if\n\n if(\n (beliefs.puzzle[0][0] == 1) &&\n (beliefs.puzzle[0][1] == 2) &&\n (beliefs.puzzle[0][2] == 3) &&\n (beliefs.puzzle[0][3] == 4) &&\n (beliefs.puzzle[1][0] == 5) &&\n (beliefs.puzzle[1][1] == 6) &&\n (beliefs.puzzle[1][2] == 7) &&\n (beliefs.puzzle[1][3] == 8) &&\n (beliefs.puzzle[2][0] == 9) &&\n (beliefs.puzzle[3][0] == 13)\n )\n {\n Blackboard.thirdMilestoneAccomplished = true;\n }//end if\n\n if(\n (beliefs.puzzle[0][0] == 1) &&\n (beliefs.puzzle[0][1] == 2) &&\n (beliefs.puzzle[0][2] == 3) &&\n (beliefs.puzzle[0][3] == 4) &&\n (beliefs.puzzle[1][0] == 5) &&\n (beliefs.puzzle[1][1] == 6) &&\n (beliefs.puzzle[1][2] == 7) &&\n (beliefs.puzzle[1][3] == 8) &&\n (beliefs.puzzle[2][0] == 9) &&\n (beliefs.puzzle[2][1] == 10) &&\n (beliefs.puzzle[2][2] == 11) &&\n (beliefs.puzzle[2][3] == 12) &&\n (beliefs.puzzle[3][0] == 13) &&\n (beliefs.puzzle[3][1] == 14) &&\n (beliefs.puzzle[3][2] == 15)\n )\n {\n Blackboard.finalMilestoneAccomplished = true;\n }//end if\n }", "public BoardView getActiveBoard() {\n if (activePlayer == Piece.COLOR.RED)\n return getRedBoard();\n else\n return getWhiteBoard();\n }" ]
[ "0.65948015", "0.640109", "0.6371557", "0.6231964", "0.6207184", "0.6022786", "0.6010222", "0.59374565", "0.5882329", "0.5868622", "0.5862792", "0.5836571", "0.5771187", "0.5767563", "0.576522", "0.57454264", "0.5721251", "0.5718965", "0.57080853", "0.5701385", "0.56761247", "0.5670159", "0.56619555", "0.56493205", "0.56182027", "0.55929786", "0.5587984", "0.5578257", "0.55436057", "0.5542415", "0.5528476", "0.5526087", "0.5500682", "0.5500227", "0.54992104", "0.5477958", "0.547679", "0.5476682", "0.5473967", "0.5469994", "0.54699296", "0.54696923", "0.5457245", "0.5454573", "0.54387015", "0.5433846", "0.54271126", "0.5422189", "0.5416404", "0.54120195", "0.54038244", "0.5402672", "0.53980845", "0.53915447", "0.53880984", "0.538582", "0.53769845", "0.53694546", "0.5360414", "0.5345438", "0.53361326", "0.5329675", "0.53227884", "0.5308375", "0.53058225", "0.52991784", "0.5295841", "0.5295093", "0.5287073", "0.5278376", "0.52769697", "0.5275547", "0.52670944", "0.52608496", "0.5257454", "0.52566254", "0.5255007", "0.52537704", "0.5246937", "0.52443504", "0.5244177", "0.52441454", "0.52440804", "0.524292", "0.52428293", "0.5239166", "0.52389044", "0.523582", "0.5235037", "0.52340835", "0.5224583", "0.5223711", "0.5222753", "0.52174306", "0.5209905", "0.5203898", "0.51984316", "0.5197043", "0.51965666", "0.5185399" ]
0.55476886
28
Of computeGameSituation Determine current game situation for white: WHITE, BLACK, TIE, or UNFINISHED. Maybe should check the validity of the state.
public int computeGameSituation(int paraState) { int[][] tempCheckerboard = stateToCheckerboard(paraState); // System.out.println("The checkerboard is: " + // Arrays.deepToString(tempCheckerboard)); return computeGameSituation(tempCheckerboard); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int computeGameSituation() {\n\t\treturn computeGameSituation(checkerboard);\n\t}", "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "private int gameState() {\n\t\t\n\t\tint gameNotOver = 0;\n\t\tint gameOverWinnerX = 1;\n\t\tint gameOverWinnerO = 2;\n\t\tint gameOverTie = 3;\n\t\t\n\t\t\n\t\t\n\t\t//Win Vertically \n\t\t// 0 3 6 , 1 4 7 , 2 5 8\n\t\t\t\t\n\t\t//Win Horizontally\n\t\t//0 1 2 , 3 4 5 , 6 7 8 \n\t\t\t\t\n\t\t//Win Diagonally\n\t\t// 0 4 8 , 2 4 6\n\t\t\t\t\n\t\t//Assuming it's an equal grid\n\t\t\t\t\n\t\tMark winningMark = null;\n\t\t\t\t\n\t\tboolean hasFoundWinner = false;\n\t\t\t\t\n\t\tint row = 0;\n\t\tint column = 0;\n\t\t\t\t\n\t\t//Horizontal Winner Test\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\tcolumn ++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tcolumn = 0;\n\t\t\trow++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// Vertical Winner Test\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\n\t\twhile (!hasFoundWinner && column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\trow = 0;\n\t\t\tcolumn++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Winner Test \"\\\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Test \"/\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = COLUMN_COUNT - 1;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn--;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If there are no moves left, and there is no winner, game ends inn a tie \n\t\t\n\t\tboolean foundNoMove = false;\n\t\tfor (int i = 0; i < movesArray.length; i++) {\n\t\t\tif (movesArray[i] == NO_MOVE) {\n\t\t\t\tfoundNoMove = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!foundNoMove && !hasFoundWinner) {\n\t\t\treturn gameOverTie;\n\t\t}\n\t\t\n\t\t// If there is no winner and there are still moves left, game is not over\n\t\t\n\t\treturn gameNotOver;\n\t\t\n\t}", "public static void getGameSituationTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17060 };\n\n\t\tint tempResult;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResult = tempEnvironment.computeGameSituation(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The game situation of \" + tempTestStates[i] + \" is: \" + tempResult);\n\t\t} // Of for i\n\t}", "private int evaluateState() {\r\n\r\n\t\t// add up score\r\n\t\t//\r\n\t\tint scoreWhite = 0;\r\n\t\tint scoreBlack = 0;\r\n\t\tfor (Piece piece : this.chessGame.getPieces()) {\r\n\t\t\tif(piece.getColor() == Piece.COLOR_BLACK){\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else if( piece.getColor() == Piece.COLOR_WHITE){\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else{\r\n\t\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\t\"unknown piece color found: \"+piece.getColor());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// return evaluation result depending on who's turn it is\r\n\t\tint gameState = this.chessGame.getGameState();\r\n\t\t\r\n\t\tif( gameState == ChessGame.GAME_STATE_BLACK){\r\n\t\t\treturn scoreBlack - scoreWhite;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_WHITE){\r\n\t\t\treturn scoreWhite - scoreBlack;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_END_WHITE_WON\r\n\t\t\t\t|| gameState == ChessGame.GAME_STATE_END_BLACK_WON){\r\n\t\t\treturn Integer.MIN_VALUE + 1;\r\n\t\t\r\n\t\t}else{\r\n\t\t\tthrow new IllegalStateException(\"unknown game state: \"+gameState);\r\n\t\t}\r\n\t}", "public int gameStatus() {\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tif((Grid[x][0] == Grid[x][1]) && (Grid[x][1] == Grid[x][2]))\n \t\t\t\tif(Grid[x][0] != 0 && Grid[x][1] != 0 && Grid[x][2] != 0)\n \t\t\t\t\treturn Grid[x][0];\n \t\t}\n \t\tfor(int y=0;y<3;y++) {\n \t\t\tif((Grid[0][y] == Grid[1][y]) && (Grid[1][y] == Grid[2][y])) \n \t\t\t\tif(Grid[0][y] != 0 && Grid[1][y] != 0 && Grid[2][y] != 0)\n \t\t\t\t\treturn Grid[0][y];\n \t\t}\n \t\tif(Grid[0][0] == Grid[1][1] && Grid[1][1] == Grid[2][2]) \n \t\t\tif(Grid[0][0] != 0 && Grid[1][1] != 0 && Grid[2][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tif(Grid[2][0] == Grid[1][1] && Grid[1][1] == Grid[0][2])\n \t\t\tif(Grid[2][0] != 0 && Grid[1][1] != 0 && Grid[0][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tfor(int y = 0;y<3;y++) {\n \t\t\t\tif(Grid[x][y] == 0)\n \t\t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t\treturn 3;\t\t\n \t}", "public GameState won() {\n if ( (board[0][0] != TileState.BLANK) && (board[0][0] == board[0][1]) && (board[0][0] == board[0][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[1][0] != TileState.BLANK) && (board[1][0] == board[1][1]) && (board[1][0] == board[1][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[2][0] != TileState.BLANK) && (board[2][0] == board[2][1]) && (board[2][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][1]) && (board[0][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ( (board[0][2] != TileState.BLANK) && (board[0][2] == board[1][1]) && (board[0][2] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][0]) && (board[0][0] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][1] != TileState.BLANK) && (board[0][1] == board[1][1]) && (board[0][1] == board[2][1])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][2] != TileState.BLANK) && (board[0][2] == board[1][2]) && (board[0][2] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if (movesPlayed == 9)\n return GameState.DRAW;\n return GameState.IN_PROGRESS;\n }", "public int status() \n {\n \tif (stonesCount(7,12) != 0 && stonesCount(0,5) != 0)\n \t\treturn GAME_NOT_OVER;\n \telse if (stonesCount(7,13) < stonesCount(0,6))\n \t\treturn GAME_OVER_WIN;\n \telse if (stonesCount(7,13) == stonesCount(0,6))\n \t\treturn GAME_OVER_TIE;\n \telse\n \t\treturn GAME_OVER_LOSE;\n }", "public int getResult() {\n whiteTotal = 0;\n blackTotal = 0;\n rest = 0;\n for (int row = 0; row < BOARD_SIZE; row++) {\n for (int column = 0; column < BOARD_SIZE; column++) {\n if (board[row][column] == BLACK) {\n blackTotal++;\n } else if (board[row][column] == WHITE) {\n whiteTotal++;\n } else {\n rest++;\n }\n }\n }\n int winner = -1;\n if (rest == 0) {\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n\n if (blackTotal == 0 || whiteTotal == 0) {\n\n if (blackTotal != 0) {\n winner = 2;\n } else if (whiteTotal != 0) {\n winner = 1;\n }\n }\n\n if (getValidateMoveList('W', 'B').isEmpty() && getValidateMoveList('B', 'W').isEmpty()) {\n\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n return winner;\n }", "public Result determineOutcome() {\n for (int row = 0; row < TicTacToeModel.BOARD_DIMENSION; row++) {\n if (rowScore[row] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (rowScore[row] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n for (int col = 0; col < TicTacToeModel.BOARD_DIMENSION; col++) {\n if (colScore[col] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (colScore[col] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n if (leftDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (rightDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (leftDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n if (rightDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n\n if (freeSpace == 0) return Result.DRAW;\n\n return Result.INCOMPLETE;\n }", "private boolean checkGameStatus() {\n int res = model.getWinner();\n if (res == Model.DRAW) {\n draw();\n return false;\n } else if (res == Model.WHITE) {\n whiteScore++;\n view.getPrompt().setText(whiteName + \" win!\");\n prepareRestart();\n return false;\n } else if (res == Model.BLACK) {\n blackScore++;\n view.getPrompt().setText(blackName + \" win!\");\n prepareRestart();\n return false;\n }\n return true;\n }", "public int evaluate(PentagoBoardState pbs) {\n PentagoBoardState.Piece[][] pieces = pbs.getBoard();\n\n\n int whitescore =0; //keep track of white's total score\n int blackscore = 0;//keep track of black's total score\n\n //Check rows\n for (int x = 0; x <6 ; x++) {\n int countWHori = 0;\n int countBHori = 0;\n\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = 0; y <5 ; y++) {\n //Count how many black and white pieces\n if (pieces[x][y].ordinal() == 0 ) {\n\n //countBHori = countBHori + countvalue;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWHori = countWHori +countvalue;\n whites++;\n }\n\n //Check for consecutive\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n\n //Check for disjoint and joint set If * B B W * * then disjoint and * B B * B * Then joint set for B * B\n if (y!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 && pieces[x][y+2].ordinal() == 1){\n countBHori = countBHori +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 && pieces[x][y+2].ordinal() == 0){\n countWHori = countWHori +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 0){\n countBHori = countBHori +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 1){\n countWHori = countWHori +jointset;\n }\n }\n }\n //check if unwinnable\n if (blacks == 4 && whites==2){\n countBHori += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWHori += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countWHori += unwinnable;\n countBHori += unwinnable;\n }\n\n\n //Run value for row in evaluation scheme and add to total score\n int valuew = consecutivevalue(countWHori);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBHori);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec hori \" + valueb + \"White consec hori \" + valuew);\n\n }\n\n //Check Verticals\n for (int y = 0; y <6 ; y++) {\n int countWvert = 0;\n int countBvert = 0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int x = 0; x <5 ; x++) {\n if (pieces[x][y].ordinal() == 0) {\n\n //countBvert = countBvert +1;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWvert = countWvert +1;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n\n if (x!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 1){\n countBvert = countBvert +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 0){\n countWvert = countWvert +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0){\n countBvert = countBvert +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1){\n countWvert = countWvert +jointset;\n }\n }\n }\n\n if (blacks == 4 && whites==2){\n countBvert += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBvert += unwinnable;\n countWvert += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWvert += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBvert + \"White consec \" + countWvert);\n int valuew = consecutivevalue(countWvert);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBvert);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec VERT \" + valueb + \"White consec hori \" + valuew);\n }\n\n //S West N EAST Top\n for (int a = 1; a <6 ; a++) { //loop through all diagonal lines\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = a; y !=0 ; y--) { //loop through one diagonal line\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +2;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n // check for joint and disjoint set at these x y coordinates by looking 2 pieces ahead\n if (x==0 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==0 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n\n x++;\n\n\n }\n if (blacks == 4 && whites==2){\n countBdiagSoNe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n //S West N EAST Bot\n for (int a = 1; a <5 ; a++) {\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int y=5;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n if (x==1 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n //System.out.println(x + \" y:\" + y +\" Black consec DIAGOMAAL \" + countBdiagSoNe + \"White consec hori \" + countWdiagSoNe);\n y--;\n\n\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n /*if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }*/\n if (a==1&& blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n\n //NorthWest S EAST Left\n for (int a = 0; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int y=0;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n //System.out.println(pbs+\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n y++;\n\n\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n if (blacks == 4 && whites==2){\n countBdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagNoSe += unwinnable;\n countWdiagNoSe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n //NorthWest S EAST Right\n for (int a = 1; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n for (int y = a; y <5 ; y++) {\n //System.out.println(\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0 ) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n x++;\n\n\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n\n\n\n\n\n //System.out.println(\"Black consec score \" + blackscore +\" \" + \"White consec scpre \" + whitescore);\n //System.out.println(\"max player is \" + maxplayer + \"My colour is \" + mycolour);\n int i = -123456789;\n if (mycolour == 0){\n //System.out.println(blackscore-whitescore +\" I am black\");\n\n\n i= blackscore-whitescore;\n return i;\n\n }\n else {\n //System.out.println(whitescore-blackscore +\" I am white\");\n i= whitescore-blackscore;\n return i;\n }\n /*\n if(i>0 && i<1000){\n return 100; //i*2;\n }\n else if(i>=1000 && i<10000){\n return 1000; //i*10;\n }\n else if(i>=10000 && i<100000){\n return 10000; //i*50;\n }\n else if(i>=100000){\n return 100000;//i*500;\n }\n else if(i<=0 && i>-100){\n return -100; //i*2;\n }\n else if(i<=-100 && i>-1000){\n return -1000; //i*10;\n }\n else if(i<=-1000 && i>-10000){\n return -10000; //i*50;\n }\n else if(i<=0 && i>-100000){\n return -100000;//i*500;\n }\n\n */\n\n\n }", "public IGameAlgo.GameState getGameState (GameBoard.GameMove move){\n\t\t/*\n\t\t * If last move made by computer,check if computer wins.\n\t\t */\n\t\tif(this.board[lastMove.getRow()][lastMove.getColumn()]==BoardSigns.COMPUTER.getSign()) {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[0][1] == BoardSigns.COMPUTER.getSign() && board[0][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][0] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_LOST;\t\t\t\t\t\t \n\t\t}\n\t\t/*\n\t\t * If last move made by player,check if player wins.\n\t\t */\n\t\telse {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[0][1] == BoardSigns.PLAYER.getSign() && board[0][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][0] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_WON;\t\n\t\t}\n\t\t/*\n\t\t * No one wins,check if in progress or game ends with tie.\n\t\t */\n\t\t\n\t\t //check if exist empty spots. \n\t\t\tfor(int i=0;i<3;i++)\n\t\t\tfor(int j=0;j<3;j++)\n\t\t\t\tif(board[i][j]==TicTacTow.BoardSigns.BLANK.getSign()) \n\t\t\t\t return GameState.IN_PROGRESS;\n\t\t\treturn GameState.TIE;\t\t\t\n\t}", "public static int computeGameSituation(int[][] paraCheckerboard) {\n\t\t// Indicate whether or not the row/column/slope is the same.\n\t\tboolean tempSame = false;\n\n\t\t// Step 1. Horizontal\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tif (paraCheckerboard[i][0] == EMPTY) {\n\t\t\t\tcontinue;\n\t\t\t} // Of if\n\n\t\t\t// A whole row is the same.\n\t\t\ttempSame = true;\n\t\t\tfor (int j = 1; j < SIZE; j++) {\n\t\t\t\tif (paraCheckerboard[i][j] != paraCheckerboard[i][0]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for j\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[i][0];\n\t\t\t} // Of if\n\t\t} // Of for i\n\n\t\t// Step 2. Vertical\n\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\tif (paraCheckerboard[0][j] == EMPTY) {\n\t\t\t\tcontinue;\n\t\t\t} // Of if\n\n\t\t\t// A whole column is the same.\n\t\t\ttempSame = true;\n\t\t\tfor (int i = 1; i < SIZE; i++) {\n\t\t\t\tif (paraCheckerboard[i][j] != paraCheckerboard[0][j]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for i\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[0][j];\n\t\t\t} // Of if\n\t\t} // Of for i\n\n\t\t// Step 3. Slope: Left-top to right-bottom.\n\t\tif (paraCheckerboard[0][0] != EMPTY) {\n\t\t\ttempSame = true;\n\t\t\tfor (int i = 1; i < SIZE; i++) {\n\t\t\t\tif (paraCheckerboard[i][i] != paraCheckerboard[0][0]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for i\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[0][0];\n\t\t\t} // Of if\n\t\t} // Of if\n\n\t\t// Step 4. Slope: Right-top to left-bottom.\n\t\tif (paraCheckerboard[0][SIZE - 1] != EMPTY) {\n\t\t\tfor (int i = 1; i < SIZE; i++) {\n\t\t\t\ttempSame = true;\n\t\t\t\tif (paraCheckerboard[i][SIZE - i\n\t\t\t\t\t\t- 1] != paraCheckerboard[0][SIZE - 1]) {\n\t\t\t\t\ttempSame = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for i\n\n\t\t\tif (tempSame) {\n\t\t\t\treturn paraCheckerboard[0][SIZE - 1];\n\t\t\t} // Of if\n\t\t} // Of if\n\n\t\t// Step 5. Checkboard full\n\t\tboolean tempHasEmpty = false;\n\t\tfor (int i = 0; i < paraCheckerboard.length; i++) {\n\t\t\tfor (int j = 0; j < paraCheckerboard.length; j++) {\n\t\t\t\tif (paraCheckerboard[i][j] == EMPTY) {\n\t\t\t\t\ttempHasEmpty = true;\n\t\t\t\t\tbreak;\n\t\t\t\t} // Of if\n\t\t\t} // Of for j\n\n\t\t\tif (tempHasEmpty) {\n\t\t\t\tbreak;\n\t\t\t} // Of if\n\t\t} // Of for i\n\t\tif (!tempHasEmpty) {\n\t\t\treturn TIE;\n\t\t} // Of if\n\n\t\treturn UNFINISHED;\n\t}", "public int getGameSituation() {\n\t\treturn gameSituation;\n\t}", "public int getBoardState(boolean whiteTeamMoving) {\n\t\tint result = 0;\n\t\tboolean moves = doMovesExist(whiteTeamMoving);\n\n\t\tresult |= moves ? 0 : 1;\n\t\tresult |= isWhiteCheck() ? 1<<1 : 0;\n\t\tresult |= isBlackCheck() ? 1<<2 : 0;\n\t\tresult |= result == 1 ? 0 : 1<<3;\n\n\t\treturn result;\n\t}", "public double heuristic(game Game){\n // int l[] = {0,1};\n // board b = Game.getBoard();\n // tic smallBoard = b.getState(l); \n \n /* if O wins the game */\n if(Game.getState() == 2){return 99;}\n \n /* X wins the game */\n if(Game.getState() == 1){return -99;}\n \n return 0;\n }", "boolean gameOver() {\n return piecesContiguous(BLACK) || piecesContiguous(WHITE);\n }", "public String win() {\r\n\t\tint blackCount = 0;\r\n\t\tint whiteCount = 0;\r\n\t\tfor (int i=0; i<piece.size(); i++) {\r\n\t\t\tif (piece.get(order[i]).chessPlayer.equals(\"black\")) {\r\n\t\t\t\tblackCount++;\r\n\t\t\t} else if (piece.get(order[i]).chessPlayer.equals(\"white\")) {\r\n\t\t\t\twhiteCount++;\r\n\t\t\t} else continue;\r\n\t\t}\r\n\t\tif (blackCount == 0) {\r\n\t\t\treturn \"white\";\r\n\t\t} else if (whiteCount == 0) {\r\n\t\t\treturn \"black\";\r\n\t\t} else return null;\r\n\t}", "private static int evalState(GameState state){\n Move m = state.getMove();\n int counter = 0;\n\n // return directly if we encouter win or loss\n if(m.isXWin()){\n return 10000;\n }\n else if(m.isOWin()){\n return -1;\n }\n\n Vector<Integer> points = new Vector<Integer>();\n points.setSize(state.BOARD_SIZE*2+2);\n int player;\n Collections.fill(points, 1);\n int scaling = 4;\n int value = 0;\n\n for(int row = 0; row < state.BOARD_SIZE; row ++){\n for(int col = 0; col < state.BOARD_SIZE; col ++){\n player = state.at(row, col);\n\n // add points to the vector, increase by a factor for every new entry\n if(player == 1){\n points.set(row, points.get(row)*scaling);\n points.add(state.BOARD_SIZE + col, points.get(state.BOARD_SIZE - 1 + col)*scaling);\n\n // if it's in the first diagonal\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, points.get(state.BOARD_SIZE*2)*scaling);\n }\n\n // checking other diagonal\n if(counter%state.BOARD_SIZE-1 == 0 && row+col != 0){\n points.add(state.BOARD_SIZE*2 + 1, points.get(state.BOARD_SIZE*2)*scaling);\n }\n }\n // if an enemy player is encoutered null the value of the row/col\n else if(player == 2){\n points.set(row, 0);\n points.set(state.BOARD_SIZE + col, 0);\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, 0);\n }\n if(counter%state.BOARD_SIZE-1 == 0){\n points.add(state.BOARD_SIZE*2 + 1, 0);\n }\n }\n counter++;\n }\n }\n\n // if we have nulled the point we don't count it for the value of the state\n for(Integer i: points){\n if(i > 1){\n value += i;\n }\n }\n //System.err.println(\"Value: \" + value);\n return value;\n }", "public void solveGame() {\n\t\tlosingStates = new HashSet<S>();\n\t\t\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tList<Set<S>> uncontrollableSuccessors = new ArrayList<Set<S>>();\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> currentUncontrollableSuccesors;\n\t\tSet<S> currentSet; \n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\tcurrentUncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\t\t\tcurrentSet = new HashSet<S>();\n\t\n\t\t\tif(!relaxAllControllables){\n\t\t\t\tfor(S s: currentUncontrollableSuccesors){\n\t\t\t\t\tif((!relaxOnAssumptions || (!assumptionsStates.contains(s) || assumptionsStates.contains(state))\n\t\t\t\t\t\t\t&& (!relaxSelfLoops || (!s.equals(state)))))\n\t\n\t\t\t\t\t\tcurrentSet.add(s);\n\t\t\t\t}\n\t\t\t}\n\t\t\t uncontrollableSuccessors.add(currentSet);\n\t\t\t isUncontrollable[indexCount] = currentSet.size() > 0;\n\t\t\t indexCount+=1;\n\t\t}\n\n\t\tlosingStates.addAll(game.getStates());\n\t\t\n\t\tSet<S> currentLosingStates;\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t\tcurrentLosingStates\t= new HashSet<S>();\n\t\t\t\n\t\t\t// Handle the pending states\n\t\t\twhile (!losing.isEmpty()) {\n\t\t\t\tS state = losing.poll();\n\n\t\t\t\t\n\t\t\t\tcurrentLosingStates.add(state);\n\n\t\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\t\tfor (S pred : predecessors) {\n\t\t\t\t\tif(losing.contains(pred) || currentLosingStates.contains(pred))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\n\t\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t\t//if(i == -1)\n\t\t\t\t\t\t//continue;\n\t\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tuncontrollableSuccessors.get(i).remove(state);\n\t\t\t\t\t\tif(uncontrollableSuccessors.get(i).isEmpty())\n\t\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tlosingStates.retainAll(currentLosingStates);\n\t\t\t\n\t\t}\n\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "public static String checkEndGame(){\n\t\tif(turn.equals(\"white\") && king.whiteKingCheck == true){\n\t\t\tif(endGame.checkMate(board, \"white\")){\n\t\t\t\tincrementPoints(\"black\");\n\t\t\t\treturn \"Check Mate! Black Wins!\\n Press OK to start new game\";\n\t\t\t}\n\t\t}\n\t\tif(turn.equals(\"black\") && king.blackKingCheck == true){\n\t\t\tif(endGame.checkMate(board, \"black\")){\n\t\t\t\tincrementPoints(\"white\");\n\t\t\t\treturn \"Check Mate! White Wins!\\n Press OK to start new game\";\n\t\t\t}\n\t\t}\n\t\treturn \"noCheckMate\";\n\t}", "private char getGameStatus() {\n int row;\n int col;\n\n Map<Character, Integer> lineCounts = new HashMap<>();\n\n for (row = 0; row < this.boardSize; row++) {\n countLine(getLineStatus(this.board[row]), lineCounts);\n }\n\n for (col = 0; col < this.boardSize; col++) {\n countLine(getLineStatus(getColumn(col)), lineCounts);\n }\n\n countLine(getLineStatus(getMajorDiag()), lineCounts);\n countLine(getLineStatus(getSubDiag()), lineCounts);\n\n boolean player1Won = lineCounts.getOrDefault(players[0].symbol, 0) > 0;\n boolean player2Won = lineCounts.getOrDefault(players[1].symbol, 0) > 0;\n boolean boardIsFull = lineCounts.getOrDefault(' ', 0) == 0;\n if (player1Won && player2Won) // both players completed lines, it is a tie\n return 'T';\n if (player1Won)\n return players[0].symbol;\n if (player2Won)\n return players[1].symbol;\n if (boardIsFull)\n return 'T';\n return '?';\n }", "public boolean checkForVictory() {\n // keep track of whether we have seen any pieces of either color.\n boolean anyWhitePieces = false;\n boolean anyRedPieces = false;\n // iterate through each row\n for (Row row : this.redBoard) {\n // whether we iterate through the red or white board does not matter; they contain the same pieces, just\n // in a different layout\n // iterate through each space in a row\n for (Space space : row) {\n // if there is a piece on this space\n if (space.getPiece() != null) {\n if (space.getPiece().getColor() == Piece.COLOR.RED) {\n // and if it's red, we have now seen at least one red piece\n anyRedPieces = true;\n } else if (space.getPiece().getColor() == Piece.COLOR.WHITE) {\n // and if it's white, we have now seen at least one white piece\n anyWhitePieces = true;\n }\n }\n }\n }\n // if we haven't seen any pieces of a color, then the other player has won\n if (!anyRedPieces) {\n // white player has won\n markGameAsDone(getWhitePlayer().getName() + \" has captured all the pieces.\");\n return true;\n } else if (!anyWhitePieces) {\n // red player has won\n markGameAsDone(getRedPlayer().getName() + \" has captured all the pieces.\");\n return true;\n }\n return false;\n }", "public int checkForWin() \r\n {\r\n \twinner = null;\r\n \tint winrole = -1;\r\n \tif(isBoardFull()){\r\n \t\tint white = 0;\r\n \t\tint black = 0;\r\n\t\t\tfor(int i = 0; i < boardsize; ++i){\r\n\t\t\t\tfor(int j = 0; j<boardsize; ++j){\r\n\t\t\t\t\tif(board[i][j] == 0){\r\n\t\t\t\t\t\twhite++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(board[i][j] == 1){\r\n\t\t\t\t\t\tblack++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(white > black){\r\n\t\t\t\twinrole = 0;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\t\r\n\t\t\telse if(black > white){\r\n\t\t\t\twinrole = 1;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\twinrole=2;\r\n\t\t\t}\r\n\t\t\treturn winrole;\r\n \t}\r\n \treturn -1;\r\n }", "@Override\n protected String checkIfGameOver() {\n if(state.isGameOver() == -1) {\n return \"Blue team wins\";\n } else if(state.isGameOver() == 1) {\n return \"Red team wins\";\n } else {\n return null;\n }\n }", "@Override\n public int getWinner() {\n /*\n * To please the test as well as the game\n * Temporarily change the turn colour\n */\n int temp;\n if (whoseTurn() == RED) {\n temp = YELLOW;\n } else {\n temp = RED;\n }\n\n //test horizontally\n //set x to 1 as the placed counter will always be correct\n int x = 1;\n int i = 1;\n //to check if zero has been found\n boolean leftZeroFound = false;\n boolean rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check to right of last placed\n if (!rightZeroFound && inBounds(0, i)\n && board[lastPlacedRow][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check to left of last placed\n if (!leftZeroFound && inBounds(0, -i)\n && board[lastPlacedRow][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check vertically\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n boolean zeroFound = false;\n while (!zeroFound) {\n //check below last placed\n if (inBounds(-i, 0) && board[lastPlacedRow - i][lastPlacedCol] == temp) {\n x++;\n } else {\n zeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top right diagonal\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top right diagonal\n if (!rightZeroFound && inBounds(i, i)\n && board[lastPlacedRow + i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check bottom left\n if (!leftZeroFound && inBounds(-i, -i)\n && board[lastPlacedRow - i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top left\n //set x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top left\n if (!leftZeroFound && inBounds(i, -i)\n && board[lastPlacedRow + i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n //check bottom right\n if (!rightZeroFound && inBounds(-i, i)\n && board[lastPlacedRow - i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //return Empty if a winner has not been found\n return EMPTY;\n }", "public void checkGameStatus() {\n everyTenthGoalCongrats();\n randomPopUpBecauseICan();\n }", "public static HashSet<gameState> Actions(gameState currentState) {\n\t\t\n\t\tHashSet<gameState> possibleStates = new HashSet<gameState>();\n\t\t\n\t\t\n\t\t// Store which player goes next after this player plays\n\t\tint nextNextUp;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tnextNextUp = 1;\n\t\t} else {\n\t\t\tnextNextUp = 0;\n\t\t}\n\t\t\n\t\t// Store corresponding characters for each player\n\t\t// DARK(X) - 0, LIGHT(O) - 1\n\t\tchar myTile;\n\t\tchar opponentTile;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tmyTile = 'x';\n\t\t\topponentTile = 'o';\n\t\t} else {\n\t\t\tmyTile = 'o';\n\t\t\topponentTile = 'x';\n\t\t}\n\n\t\t\n\n\t\t// Check the entire board of the state \n\t\tfor (int i = 0; i<boardSize; i++) {\n\t\t\tfor (int j = 0; j<boardSize; j++) {\n\t\t\t\t\n\t\t\t\t// If the tile is my tile\n\t\t\t\tif (currentState.getBoard()[i][j] == '_') {\n\t\t\t\t\t\n\t\t\t\t\tchar[][] moveBoard = createNewBoard(currentState);\n\t\t\t\t\t\n\t\t\t\t\t// Up\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// If it is an opponent tile, then you keep going up until you either my tile (fail) or\n\t\t\t\t\t\t// a blank space (success/move possible)\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=i;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Down\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=i;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j-1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=j;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j+1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=j;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j-1] == opponentTile) { \n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j+1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j-1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j+1] == opponentTile) { \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\tif (!compareBoards(moveBoard, currentState.getBoard())) {\n\t\t\t\t\t\tgameState move = new gameState(moveBoard, nextNextUp);\t\t\n\t\t\t\t\t\tpossibleStates.add(move);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\n\t\treturn possibleStates;\n\t\t\n\t\t\n\t\t\n\t}", "public boolean checkState(){\r\n\t\t//Check if we have enough users\r\n\t\tfor (Map.Entry<String, Role> entry : roleMap.entrySet()){\r\n\t\t\tString rid = entry.getKey();\r\n\t\t\tRole role = roleMap.get(rid);\r\n\t\t\tlog.info(\"Veryifying \" + rid);\t\t\t\r\n\t\t\tif(!roleCount.containsKey(rid)){\r\n\t\t\t\tlog.severe(\"Unsure of game state.\" + rid + \" not found in roleCount\");\r\n\t\t\t\tSystem.exit(-1);\r\n\t\t\t\r\n\t\t\t} else if(role.getMin() > roleCount.get(rid)) {\r\n\t\t\t\t\tlog.info(\"minimum number for roleID: \" + rid + \" not achived\");\r\n\t\t\t\t\treturn false;\r\n\t\t\t\r\n\t\t\t} else if(role.getMax() < roleCount.get(rid)) { //probably don't need this one but cycles are cheap\r\n\t\t\t\tlog.severe(\"OVER MAXIMUM number for roleID: \" + rid + \" not achived\");\r\n\t\t\t\tSystem.exit(-1);\r\n\t\t\t}\r\n\t\t}\r\n\t\t//if we do reach here we've reached a critical mass of players. But we still need them to load the screen\r\n\t\t\r\n\t\tif((this.getGameState() != GAMESTATE.RUNNING) ||(this.gameState !=GAMESTATE.READY_TO_START) ) {\r\n\t\t\tsetGameState(GAMESTATE.CRITICAL_MASS);\r\n\t\t\tlog.info(\"have enough players for game\");\r\n\t\t}\r\n\t\t//if the users are done loading their screen, let us know and then we can start\r\n\t\tif (!userReady.containsValue(false)){\r\n\t\t\tsetGameState(GAMESTATE.READY_TO_START);\r\n\t\t\tlog.info(\"Gamestate is running!!\");\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public static void checkWinCondition() {\n\t\twin = false;\n\t\tif (curPlayer == 1 && arrContains(2, 4))\n\t\t\twin = true;\n\t\telse if (curPlayer == 2 && arrContains(1, 3))\n\t\t\twin = true;\n\t\tif (curPlayer == 2 && !gameLogic.Logic.arrContains(2, 4))\n\t\t\tP2P.gameLost = true;\n\t\telse if (gameLogic.Logic.curPlayer == 1 && !gameLogic.Logic.arrContains(1, 3))\n\t\t\tP2P.gameLost = true;\n\t\tif (P2P.gameLost == true) {\n\t\t\tif (gameLogic.Logic.curPlayer == 1)\n\t\t\t\tEndScreen.infoWindow.setText(\"<html><center><b><font size=25 color=black> Black player won! </font></b></center></html>\");\n\t\t\telse\n\t\t\t\tEndScreen.infoWindow.setText(\"<html><center><b><font size=25 color=black> Red player won! </font></b></center></html>\");\n\t\t}\n\t\telse\n\t\t\twin = false;\n\t}", "public boolean isSolved() {\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(1, 1) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(2, 1) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(3, 1) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(1, 2) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(3, 2) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(1, 3) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(2, 3) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(3, 3) != RubiksColor.BLUE) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(1, 1) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(2, 1) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(3, 1) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(1, 2) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(3, 2) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(1, 3) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(2, 3) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(3, 3) != RubiksColor.YELLOW) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(1, 1) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(2, 1) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(3, 1) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(1, 2) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(3, 2) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(1, 3) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(2, 3) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(3, 3) != RubiksColor.GREEN) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(1, 1) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(2, 1) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(3, 1) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(1, 2) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(3, 2) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(1, 3) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(2, 3) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(3, 3) != RubiksColor.WHITE) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(1, 1) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(2, 1) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(3, 1) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(1, 2) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(3, 2) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(1, 3) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(2, 3) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(3, 3) != RubiksColor.ORANGE) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(1, 1) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(2, 1) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(3, 1) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(1, 2) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(3, 2) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(1, 3) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(2, 3) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(3, 3) != RubiksColor.RED) return false;\n\n return true;\n }", "private void checkVictory() {\n\t\tboolean currentWin = true;\n\t\t\n\t\t//Vertical win\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][yGuess] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Horizontal win\n\t\tcurrentWin = true;\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[xGuess][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Top left bottom right diagonal win\n\t\tcurrentWin = true;\n\t\tif (xGuess == yGuess){\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t}\n\t\t\n\t\t//Bottom left top right diagonal win\n\t\tcurrentWin = true;\n\t\tif (yGuess + xGuess == DIVISIONS - 1){\n\t\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\t\tif (gameArray[i][(DIVISIONS - 1) -i] != currentPlayer){\n\t\t\t\t\tcurrentWin = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentWin){\n\t\t\t\tgameWon = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "interface GameState {\n String WAITING_FOR_SECOND_PLAYER = \"WAITING_FOR_SECOND_PLAYER\";\n String TURN_HARE = \"TURN_HARE\";\n String TURN_HOUND = \"TURN_HOUND\";\n String WIN_HARE_BY_ESCAPE = \"WIN_HARE_BY_ESCAPE\";\n String WIN_HARE_BY_STALLING = \"WIN_HARE_BY_STALLING\";\n String WIN_HOUND = \"WIN_HOUND\";\n }", "void checkForPlayer(boolean checkForBlacks, int i, int j) {\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t//**Check vertical**\\\\\n\t\t// Check upwards\n\t\tfor (int n = j-1; n >= 0; --n) {\n\t\t\tif (!check(i, n, checkForBlacks))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check downwards\n\t\tfor (int n = j+1; n < dimensions.y; ++n) {\n\t\t\tif (!check (i, n, checkForBlacks))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t//**Check horizontal**\\\\\n\t\t// Check to left\n\t\tfor (int n = i-1; n >=0; --n) {\n\t\t\tif (!check(n, j, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check to right\n\t\tfor (int n = i+1; n < dimensions.x; ++n) {\n\t\t\tif (!check(n, j, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t//**Check diagonals**\\\\\n\t\t// Check North-East\n\t\tfor (int n = 1; i+n < dimensions.x && j-n >= 0; ++n) {\n\t\t\tif (!check(i+n, j-n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check North-West\n\t\tfor (int n = 1; i-n >= 0 && j-n >= 0; ++n) {\n\t\t\tif (!check(i-n, j-n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check South-East\n\t\tfor (int n = 1; i+n < dimensions.x && j+n < dimensions.y; ++n) {\n\t\t\tif (!check(i+n, j+n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check South-West\n\t\tfor (int n = 1; i-n >= 0 && j+n < dimensions.y; ++n) {\n\t\t\tif (!check(i-n, j+n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t}", "public void solveGame3() {\n\t\tlosingStates = new HashSet<S>();\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tint[] uncontrollableCount = new int[game.getStates().size()+1];\n\t\tint[] uncontrollableLosingCount = new int[game.getStates().size()+1];\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> uncontrollableSuccesors;\n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\t uncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\n\t\t\t uncontrollableCount[indexCount] = uncontrollableSuccesors.size();\n\t\t\t uncontrollableLosingCount[indexCount] = 0;\n\t\t\t isUncontrollable[indexCount] = game.isUncontrollable(state);\n\t\t\t indexCount+=1;\n\t\t}\n\t\t\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t}\n\n\t\t// Handle the pending states\n\t\twhile (!losing.isEmpty()) {\n\t\t\tS state = losing.poll();\n\n\t\t\t\n\t\t\tlosingStates.add(state);\n\n\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\tfor (S pred : predecessors) {\n\t\t\t\tif(losing.contains(pred) || losingStates.contains(pred))\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t//if(i == -1)\n\t\t\t\t\t//continue;\n\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}else{\n\t\t\t\t\tuncontrollableLosingCount[i]++;\n\t\t\t\t\tif (uncontrollableLosingCount[i] == uncontrollableCount[i])\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "private void winCondition(){\n if(cleared==(int)grid.clearedToWin){\n winGame();\n }\n }", "public boolean checkForEndgame() {\n\t\tCalculatePossibleMoves(true);\n\t\tint blackMoves = getNumberOfPossibleMoves();\n\t\tCalculatePossibleMoves(false);\n\t\tint redMoves = getNumberOfPossibleMoves();\n\t\t\n\t\tif (blackMoves == 0 && redMoves == 0)\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public int evalBoard(){\n if (wins('o')){\n return 3;\n }\n // Return 0 if human wins\n else if (wins('b')){\n return 0;\n }\n //Return 2 if game is draw\n else if (isDraw()){\n return 2;\n }\n // Game is not a draw and no player has won. Game is still undecided.\n else {\n return 1;\n }\n }", "public boolean isBoardSolved() {\n for (int goal : goalCells) {\n if (!((board[goal] & 15) == BOX_ON_GOAL)) {\n return false;\n }\n }\n return true;\n }", "public void finishGame() {\n boolean didWin = true;\n\n int dimension = mBoardSquaresGrid.length;\n\n for(int i = 0; i < dimension; i++) {\n for(int j = 0; j < dimension; j++) {\n TileView tileView = mTileViewsGrid[i][j];\n BoardSquare boardSquare = mBoardSquaresGrid[i][j];\n\n int state = tileView.getState();\n boolean doesContainMine = boardSquare == null ? false : boardSquare.doesContainMine();\n\n if(state == TileView.COVERED) {\n // User did not place a flag over a mine.\n if(doesContainMine) {\n didWin = false;\n }\n\n // Uncover all tiles without flags.\n tileView.setState(TileView.UNCOVERED);\n }\n else if(state == TileView.FLAGGED_AS_MINE) {\n if(!doesContainMine) {\n // Uncover flags not covering mines.\n tileView.setState(TileView.UNCOVERED);\n }\n }\n }\n }\n publishGameResult(didWin);\n }", "private boolean isGameOver() {\n // either all black or all white pieces don't have any moves left, save\n // to internal field so that a delayed status is available\n gameOver = longestAvailableMoves(1, true).isEmpty() ||\n longestAvailableMoves(1, false).isEmpty();\n return gameOver;\n }", "private void getWinner() {\r\n int nWhite = 0, nBlack = 0;\r\n if(nextPlayer.getChecks() == 0 && nextPlayer.getQueens() == 0){\r\n winner = currentPlayer;\r\n }\r\n else if(currentPlayer.getQueens() == nextPlayer.getQueens()){\r\n for (int i = 1; i<8; i++){\r\n for (int x = 0; x<8; x++) {\r\n if (checks[i][x] == 1) nBlack++;\r\n if (checks[7 - i][x] == 2) nWhite++;\r\n }\r\n if (nWhite>nBlack) winner = getPlayer(WHITE);\r\n else if(nBlack>nWhite)winner = getPlayer(BLACK);\r\n nWhite = 0;\r\n nBlack = 0;\r\n }\r\n }\r\n else if (currentPlayer.getQueens() > nextPlayer.getQueens()){ winner = currentPlayer;}\r\n else{winner = nextPlayer; }\r\n }", "private int evaluate(Board board)\n {\n if (computerWin(board))\n return 4*size;\n else if (playerWin(board))\n return -4*size;\n else if (draw(board))\n return 3*size;\n else\n return count(board, COMPUTER);\n }", "public int determineWinner() {\n\t\tif(board[1][1] != 0 && (\n\t\t\t(board[1][1] == board[0][0] && board[1][1] == board[2][2]) ||\n\t\t\t(board[1][1] == board[0][2] && board[1][1] == board[2][0]) ||\n\t\t\t(board[1][1] == board[0][1] && board[1][1] == board[2][1]) ||\n\t\t\t(board[1][1] == board[1][0] && board[1][1] == board[1][2]))){\n\t\t\treturn board[1][1];\n\t\t}\n\t\telse if (board[0][0] != 0 &&(\n\t\t\t(board[0][0] == board[0][1] && board[0][0] == board[0][2]) ||\n\t\t\t(board[0][0] == board[1][0] && board[0][0] == board[2][0]))){\n\t\t\treturn board[0][0];\n\t\t}\n\t\telse if (board [2][2] != 0 && (\n\t\t\t(board[2][2] == board[2][0] && board[2][2] == board[2][1]) ||\n\t\t\t(board[2][2] == board[0][2] && board[2][2] == board[1][2]))) {\n\t\t\treturn board[2][2];\n\t\t}\n\t\t\n\t\t//See if every square has been marked, return still in progress if not\n\t\tfor(int i = 0; i < 3; ++i) {\n\t\t\tfor(int j = 0; j < 3; ++j) {\n\t\t\t\tif (board[i][j] == 0)\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Return tie\n\t\treturn 3;\n\t}", "protected boolean checkForWin() {\r\n \t\r\n if (squaresRevealed == this.width * this.height - this.mines) {\r\n finishFlags();\r\n finish(GameStateModel.WON);\r\n return true;\r\n } \t\r\n \t\r\n return false;\r\n \t\r\n }", "public int hasBlackWon() {\n\t\tif(blackPieces == 0) {\n\t\t\treturn 1;\n\t\t} else if(whitePieces == 0) {\n\t\t\treturn 2;\n\t\t}\n\t\t\n\t\treturn 0;\n\t}", "private static String gameStatus(char[][] board){\n\t\t\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\t// check horizontal lines && vertical lines for player x\n\t\t\tif ((board[i][0] == 'X' && board[i][1] == 'X' && board[i][2] == 'X') || \n\t\t\t\t\t(board[0][i] == 'X' && board[1][i] == 'X' && board[2][i] == 'X')){\n\t\t\t\twinner = 'X';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for x\n\t\tif ((board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X') || \n\t\t\t\t(board[0][2] == 'X' && board[1][1] == 'X' && board[2][0] == 'X')){\n\t\t\twinner = 'X';\n\t\t\treturn \"true\";\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 3 ; i++) {\n\t\t\t// check horizontal and vertical lines for player o\n\t\t\tif ((board[i][0] == 'O' && board[i][1] == 'O' && board[i][2] == 'O') || \n\t\t\t\t\t(board[0][i] == 'O' && board[1][i] == 'O' && board[2][i] == 'O')){\n\t\t\t\twinner = 'O';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for o\n\t\tif ((board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O') || \n\t\t\t\t(board[0][2] == 'O' && board[1][1] == 'O' && board[2][0] == 'O')){\n\t\t\twinner = 'O';\n\t\t\treturn \"true\";\n\t\t}\n\n\t\t// check for tie\n\t\tint emptyCells = 9;\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\tfor (int j = 0; j < 3; j++){\n\t\t\t\tif (board[i][j]!='\\0') emptyCells -= 1;\t\t\n\t\t\t}\n\t\t}\n\t\t// if all cells are filled, game is over with a tie\n\t\tif (emptyCells == 0) return \"tie\";\n\n\t\t// otherwise game is not over and return false\n\t\t//printBoard(board);\n\n\t\treturn \"false\";\n\t}", "public String computerMove() {\n\t\t// Look to win in a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win in a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Find the non-full row and col w/ least val\n\t\tint bestR = -1;\n\t\tint bestC = -1;\n\t\tint minSum = 10;\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\tint sum = rowSum[r] + colSum[c];\n\t\t\t\t\tif (sum < minSum) {\n\t\t\t\t\t\tminSum = sum;\n\t\t\t\t\t\tbestR = r;\n\t\t\t\t\t\tbestC = c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn done(bestR, bestC);\n\t}", "@Override\r\n\tpublic BoardEvaluation evaluate(IBoard board, PlayerColor color) {\n\t\tBoardAnalyzer analyzer = board.getAnalyzer();\r\n\r\n\t\tBoardEvaluation e = new BoardEvaluation();\r\n\r\n\t\tint white = 0;\r\n\t\tint black = 0;\r\n\r\n\t\tList<IPiece> pieces = board.getAllPieces();\r\n\r\n\t\tint[] pawnCount = new int[2];\r\n\t\tint[] bishopCount = new int[2];\r\n\t\tint[] knightCount = new int[2];\r\n\t\tfor (IPiece piece : pieces) {\r\n\t\t\tif (piece.getColor() == PlayerColor.WHITE) {\r\n\t\t\t\twhite += piece.getPieceValue();\r\n\t\t\t} else {\r\n\t\t\t\tblack += piece.getPieceValue();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tint index = piece.getColor().ordinal();\r\n\t\t\tif (piece instanceof Pawn) {\r\n\t\t\t\tpawnCount[index]++;\r\n\t\t\t} else if (piece instanceof Bishop) {\r\n\t\t\t\tbishopCount[index]++;\r\n\t\t\t} else if (piece instanceof Knight) {\r\n\t\t\t\tknightCount[index]++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tint totalPieceValue = white + black;\r\n\t\tint blackIndex = PlayerColor.BLACK.ordinal();\r\n\t\tint whiteIndex = PlayerColor.WHITE.ordinal();\r\n\t\tblack += extraBishopValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\tblack += extraKnightValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\tblack += extraPawnValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\twhite += extraBishopValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\t\twhite += extraKnightValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\t\twhite += extraPawnValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\r\n\t\t// Stalemate\r\n\t\tif (analyzer.isStalemate()) {\r\n\t\t\te.draw = true;\r\n\t\t\tblack += 90;\r\n\t\t} else if (analyzer.canClaimDraw()) {\r\n\t\t\tif (board.getTurn() == PlayerColor.WHITE) {\r\n\t\t\t\t// White can stop black from claiming draw\r\n\t\t\t\t//black += 50;\r\n\t\t\t} else {\r\n\t\t\t\t// Black can claim draw immediately!\r\n\t\t\t\te.draw = true;\r\n\t\t\t\tblack += 4;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Checkmate ?\r\n\t\tif (analyzer.isCheckmate(PlayerColor.BLACK)) {\r\n\t\t\twhite += 100;\r\n\t\t\te.checkmate = true;\r\n\t\t}\r\n\r\n\t\tif (analyzer.isCheckmate(PlayerColor.WHITE)) {\r\n\t\t\tblack += 100;\r\n\t\t\te.checkmate = true;\r\n\t\t}\r\n\r\n\t\tif (color == null) {\r\n\t\t\te.value = white - black;\r\n\t\t} else if (color == PlayerColor.BLACK) {\r\n\t\t\te.value = Math.abs(white - FULL_BOARD_VALUE);\r\n\t\t} else {\r\n\t\t\te.value = Math.abs(black - FULL_BOARD_VALUE);\r\n\t\t}\r\n\r\n\t\treturn e;\r\n\t}", "public int getWinner() throws Exception {\n\t\tif (gameSituation == UNFINISHED) {\n\t\t\tthrow new Exception(\"Game unfinished yet, cannot get winner.\");\n\t\t} // Of if\n\n\t\treturn gameSituation;\n\t}", "public static int heuristic(PentagoBoardState boardState) {\n\t\tint value = 0;\n\t\t\n\t\tfor (int i = 0; i<size; i++) {\n\t\t\tfor (int j = 0; j<size; j++) {\n\t\t\t\tif (boardState.getPieceAt(i, j) == PentagoBoardState.Piece.BLACK) {\n\t\t\t\t\tvalue += 10;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}", "public boolean isLegalStep(MoveDirection dir){\r\n GamePosition curPos = currentGame.getCurrentPosition();\n\t\tPlayer white = currentGame.getWhitePlayer();\n\t\tint[] toCheckPos = new int[2];\n\t\tint[] existingPos = new int[2];\n\t\tif(curPos.getPlayerToMove().equals(white)) {\n\t\t\ttoCheckPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t} else {\n\t\t\ttoCheckPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t}\n\t\t//0 = column, 1 = row\n\t\tif(dir == MoveDirection.North) {\n\t\t\tif(toCheckPos[1] == 1) return false;\n\t\t\tif(toCheckPos[1] - 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), -1, 0);\n\t\t} else if(dir == MoveDirection.South) {\n\t\t\tif(toCheckPos[1] == 9) return false;\n\t\t\tif(toCheckPos[1] + 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 1, 0);\n\t\t} else if(dir == MoveDirection.East) {\n\t\t\tif(toCheckPos[0] == 9) return false;\n\t\t\tif(toCheckPos[0] + 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, 1);\n\t\t} else if(dir == MoveDirection.West) {\n\t\t\tif(toCheckPos[0] == 1) return false;\n\t\t\tif(toCheckPos[0] - 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, -1);\n\t\t}\n\t\t\n\t\treturn false;\r\n }", "public boolean computerGuess()\r\n\t{\r\n\t\tboolean isWhite;\r\n\t\tint randomBool = (int) (Math.random()*50);\r\n\t\tif(randomBool<25)\r\n\t\t\tisWhite = true;\r\n\t\telse\r\n\t\t\tisWhite = false;\r\n\t\twhile(newGame.containsColor(isWhite) == false)\r\n\t\t{\r\n\t\t\trandomBool = (int) (Math.random()*50);\r\n\t\t\tif(randomBool<25)\r\n\t\t\t\tisWhite = true;\r\n\t\t\telse\r\n\t\t\t\tisWhite = false;\r\n\t\t}\r\n\t\tint randomPanel = (int) (Math.random()*newGame.getUserHandLength());\r\n\t\t//System.out.println(randomPanel);\r\n\t\tint randomGuess = (int) (Math.random()*12);\r\n\t\tif(newGame.getCompHand().contains(new Panel(isWhite,randomGuess,false)))\r\n\t\t{\r\n\t\t\tif(newGame.getUserHand().getPanel(randomPanel).compareTo(new Panel(isWhite,randomGuess,false)) == 0)\r\n\t\t\t\treturn true;\r\n\t\t\telse \r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "boolean isWinner(GameState state, String username) throws GameStateException;", "public void solveGame4() {\n\t\tlosingStates = new HashSet<S>();\n\t\t\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tList<Set<S>> uncontrollableSuccessors = new ArrayList<Set<S>>();\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> currentUncontrollableSuccesors;\n\t\tSet<S> currentSet; \n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\tcurrentUncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\t\t\tcurrentSet = new HashSet<S>();\n\t\t\tfor(S s: currentUncontrollableSuccesors){\n\t\t\t\tif((!relaxOnAssumptions || (!assumptionsStates.contains(s) || assumptionsStates.contains(state))\n\t\t\t\t\t\t&& (!relaxSelfLoops || (!s.equals(state)))))\n\t\t\t\t\tcurrentSet.add(s);\n\t\t\t}\n\t\t\t uncontrollableSuccessors.add(currentSet);\n\t\t\t isUncontrollable[indexCount] = currentSet.size() > 0;\n\t\t\t indexCount+=1;\n\t\t}\n\t\t\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t}\n\n\t\t// Handle the pending states\n\t\twhile (!losing.isEmpty()) {\n\t\t\tS state = losing.poll();\n\n\t\t\t\n\t\t\tlosingStates.add(state);\n\n\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\tfor (S pred : predecessors) {\n\t\t\t\tif(losing.contains(pred) || losingStates.contains(pred))\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t//if(i == -1)\n\t\t\t\t\t//continue;\n\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}else{\n\t\t\t\t\tuncontrollableSuccessors.get(i).remove(state);\n\t\t\t\t\tif(uncontrollableSuccessors.get(i).isEmpty())\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "public GameState getState(){\n\t\tGameState State=new GameState(this.points, this.currentBoard.getState());\n\t\t\n\t\treturn State;\n\t}", "public int checkForWinner() {\n\n // Check horizontal wins\n for (int i = 0; i <= 6; i += 3)\t{\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+1] == HUMAN_PLAYER &&\n mBoard[i+2]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+1]== COMPUTER_PLAYER &&\n mBoard[i+2] == COMPUTER_PLAYER)\n return 3;\n }\n\n // Check vertical wins\n for (int i = 0; i <= 2; i++) {\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+3] == HUMAN_PLAYER &&\n mBoard[i+6]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+3] == COMPUTER_PLAYER &&\n mBoard[i+6]== COMPUTER_PLAYER)\n return 3;\n }\n\n // Check for diagonal wins\n if ((mBoard[0] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[8] == HUMAN_PLAYER) ||\n (mBoard[2] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[6] == HUMAN_PLAYER))\n return 2;\n if ((mBoard[0] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[8] == COMPUTER_PLAYER) ||\n (mBoard[2] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[6] == COMPUTER_PLAYER))\n return 3;\n\n // Check for tie\n for (int i = 0; i < BOARD_SIZE; i++) {\n // If we find a number, then no one has won yet\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER)\n return 0;\n }\n\n // If we make it through the previous loop, all places are taken, so it's a tie\n return 1;\n }", "void computeResult() {\n // Get the winner (null if draw).\n roundWinner = compareTopCards();\n\n\n if (roundWinner == null) {\n logger.log(\"Round winner: Draw\");\n logger.log(divider);\n // Increment statistic.\n numDraws++;\n\n } else {\n logger.log(\"Round winner: \" + roundWinner.getName());\n\t logger.log(divider);\n this.gameWinner = roundWinner;\n if (roundWinner.getIsHuman()) {\n // Increment statistic.\n humanWonRounds++;\n }\n }\n\n setGameState(GameState.ROUND_RESULT_COMPUTED);\n }", "private WinScenario getWinningScenario() {\n Diagonal primaryDiagonal = new Diagonal(this, true);\n if (primaryDiagonal.isWon()) {\n return primaryDiagonal;\n }\n\n // Check for secondary diagonal\n Diagonal secondaryDiagonal = new Diagonal(this, false);\n if (secondaryDiagonal.isWon()) {\n return secondaryDiagonal;\n }\n\n // Check for a winning row or colum\n for (int i = 0; i < 3; i++) {\n Row row = new Row(this, i);\n if (row.isWon()) {\n return row;\n }\n\n Column column = new Column(this, i);\n if (column.isWon()) {\n return column;\n }\n }\n\n return null;\n }", "private boolean testIfGameIsValid(ChesspairingGame game) {\n\t\tChesspairingPlayer playerA = game.getWhitePlayer();\n\t\tString keyA = playerA.getPlayerKey();\n\t\tChesspairingPlayer playerB = game.getBlackPlayer();\n\t\tString keyB = playerB.getPlayerKey();\n\t\tif (keyA.equals(keyB)) {\n\t\t\tthrow new IllegalStateException(\"You shuld never try to pare a players agains himself\");\n\t\t}\n\t\t/**\n\t\t * two players shall not meet more than once\n\t\t */\n\t\tList<String> partnersA = partnerHistory.get(keyA);\n\t\tif (partnersA.contains(keyB)) {\n\t\t\treturn false;\n\t\t}\n\t\tList<String> partnersB = partnerHistory.get(keyB);\n\t\tif (partnersB.contains(keyA)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * the color difference is the number of games played with white minus\n\t\t * the number of games played with black\n\t\t * \n\t\t * -2 < diff < 2\n\t\t */\n\t\tint aHistoryColor = getColorDifference(keyA);\n\t\tint bHistoryColor = getColorDifference(keyB);\n\n\t\t// if a is white\n\t\tint aWhite = aHistoryColor + 1;\n\t\tint bBlach = bHistoryColor - 1;\n\t\tboolean aPlaysWite = false;\n\t\tif ((-2 < aWhite) && (aWhite < 2) && (-2 < bBlach) && (bBlach < 2)) {\n\t\t\taPlaysWite = true;\n\t\t}\n\n\t\t// if a is black\n\t\tboolean aPlaysBlack = false;\n\t\tif (!aPlaysWite) {\n\t\t\tint aBlack = aHistoryColor - 1;\n\t\t\tint bWhite = bHistoryColor + 1;\n\t\t\tif ((-2 < aBlack) && (aBlack < 2) && (-2 < bWhite) && (bWhite < 2)) {\n\t\t\t\taPlaysBlack = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!aPlaysWite && !aPlaysBlack) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// basic tests have passed. time to return true\n\t\treturn true;\n\t}", "@Test\n public void isGameOverNoWhite()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n\n for (int y = 0; y < 3; y++)\n {\n for (int x = 0; x < 8; x++)\n {\n if ((x % 2) != (y % 2))\n {\n final CheckersPosition position = CheckersPosition.findByCoordinates(x, y);\n environment.removeToken(position);\n }\n }\n }\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(12));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(0));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n }", "int checkGameWon(){\n int sx,sy,ex,ey;\n Point size = new Point();\n //get the size of current window\n Display display = getWindowManager().getDefaultDisplay();\n display.getSize(size);\n int width = size.x;\n int height = size.y;\n\n //win first row\n if (gameBoard[0] != 0 && gameBoard[0] == gameBoard[1] && gameBoard[0] == gameBoard[2]){\n sx = 0;\n sy =(int) (height * .30);\n\n ex = width;\n ey = (int) (height * .30);\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[0];\n }\n //win second row\n else if (gameBoard[3] != 0 && gameBoard[3] == gameBoard[4] && gameBoard[3] == gameBoard[5]){\n sx = 0;\n sy = (int) (height * .54);\n ex = width;\n ey = (int) (height * .54);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[3];\n }\n //win third row\n else if (gameBoard[6] != 0 && gameBoard[6] == gameBoard[7] && gameBoard[6] == gameBoard[8]){\n sx = 0;\n sy = (int) (height * .77);\n\n ex = width;\n ey = (int) (height * .77);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[6];\n }\n //win first colum\n else if (gameBoard[0] != 0 && gameBoard[0] == gameBoard[3] && gameBoard[0] == gameBoard[6]){\n sx = (int) (width *.15);\n sy = (int) (height * .18);\n ex = (int) (width * .15);\n ey=(int) (height * .89);\n\n drawLine(sx,sy,ex,sy,imageView10);\n return gameBoard[0];\n }\n //win second colum\n else if (gameBoard[1] != 0 && gameBoard[1] == gameBoard[4] && gameBoard[1] == gameBoard[7]){\n sx = (int) (width * .50);\n sy = (int) (height * .18);\n\n ex = (int) (width * .50);\n ey = (int) (height * .89);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[1];\n }\n //win third colum\n else if (gameBoard[2] != 0 && gameBoard[2] == gameBoard[5] && gameBoard[2] == gameBoard[8]){\n sx = (int) (width * .85);\n sy = (int) (height * .18);\n\n ex = (int) (width * .85);\n ey = (int) (height * .89);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[2];\n }\n else{\n //game not won\n return 0;\n }\n }", "private boolean checkForBigGameWin(){\n boolean truth = false;\n if (checkGameWin(getLettersOfAllGames())){\n truth = true;\n }\n return truth;\n }", "private void determineState() {\n if ( .66 <= ( ( float ) currentHealth / maxHealth ) ) {\n if ( currentState != HealthState.HIGH ) {\n currentState = HealthState.HIGH;\n for ( Image i : healthMeter ) {\n i.setDrawable( new TextureRegionDrawable( healthBars.findRegion( \"highHealth\" ) ) );\n }\n }\n } else if ( .33 <= ( ( float ) currentHealth / maxHealth ) ) {\n if ( currentState != HealthState.MEDIUM ) {\n currentState = HealthState.MEDIUM;\n for ( Image i : healthMeter ) {\n i.setDrawable( new TextureRegionDrawable( healthBars.findRegion( \"mediumHealth\" ) ) );\n }\n }\n } else if ( .0 <= ( ( float ) currentHealth / maxHealth ) ) {\n if ( currentState != HealthState.LOW ) {\n currentState = HealthState.LOW;\n for ( Image i : healthMeter ) {\n i.setDrawable( new TextureRegionDrawable( healthBars.findRegion( \"lowHealth\" ) ) );\n }\n }\n }\n }", "public int eval()\n\t\t{\n\t\t\tif (p[BLACK]==0) return MAX+1;\t//black=0 then white win then return max\n\t\t\tif (p[WHITE]==0) return MIN-1;\t//white=0 then black win then return min\n\t\t\tint bl=getNumberOne(p[0]);int wh=getNumberOne(p[1]);\n\t\t\treturn wh-bl;\n\t\t}", "private boolean winningBoard(char[][] board){\n for(int i = 0; i < boardHeight; i++ ){\n for(int j = 0; j < boardWidth; j++) {\n\n //if white was made it to the other side\n if(board[i][j] == 'P' && i == 0){\n return true;\n }\n\n //if black has made it to the other side\n if(board[i][j] == 'p' && i == boardHeight -1){\n return true;\n }\n }\n }\n //no winners\n return false;\n }", "void analyzeBoard() {\n if (onProcessCompleteListener == null) {\n return;\n }\n\n if ((!isWin(TTTConstants.CIRCLE, true)) && (!isWin(TTTConstants.CROSS, true)) && (depth >= 9)) {\n onProcessCompleteListener.onGameDraw();\n }\n }", "private boolean checkOrTurn(int row,int column, ItemState itemStateCurrentPlayer, int x, int y) {\n\t\t if(column==Settings.nbrRowsColumns||column<0){\n\t\t\t return false; //Get the hell out\n\t\t }\n\t\t if(row==Settings.nbrRowsColumns||row<0){ \n\t\t\t return false; //Get the hell out\n\t\t }\n\t\t if (gameStateInt[row][column]==Helpers.getOpponentPlayerCorrespondingInt(itemStateCurrentPlayer)){ //Still another color\n\t\t\t if(checkOrTurn(row+y,column+x, itemStateCurrentPlayer, x, y)){ //continue check next\n\t\t\t\t\t changed.add(new Action(row,column));\n\t\t\t\t return true;\n\t\t\t }else{\n\t\t\t\t return false;\n\t\t\t }\n\t\t }else if (gameStateInt[row][column]==Helpers.getPlayerCorrespondingInt(itemStateCurrentPlayer)){\n\t\t\t return true; //found same color\n\t\t }else{\n\t\t\t return false; //found grass\n\t\t }\n\t }", "public int getUtility(State s) {\n int columns = s.getColumns();\n int rows = s.getRows();\n int player = s.getPlayerId();\n byte[][] board = s.getGameBoard();\n int utility = 0;\n int sign = 1;\n for (int x = 0; x < columns; x++) {\n for (int y = 0; y < rows; y++) {\n int current = board[x][y];\n if (current == 0) break;\n if (current == player) {\n sign = 1;\n } else {\n sign = -1;\n }\n {\n if (y > 0) {\n //check down\n if (board[x][y - 1] == current) {\n utility += sign;\n }\n //check diagDownLeft\n if (x > 0) {\n if (board[x - 1][y - 1] == current) {\n utility += sign;\n }\n }\n //check diagDownRight\n if (x < 0) {\n if (board[x + 1][y - 1] == current) {\n utility += sign;\n }\n }\n }\n if (x > 0) {\n //check left\n if (x > 0) {\n if (board[x - 1][y] == current) {\n utility += sign;\n }\n }\n }\n }\n }\n }\n return utility;\n }", "GameState checkState(String guid, String username) throws GameStateException;", "public SimplePoolGameState evaluateShot(SimplePoolMove shot) {\r\n\t\tapplyShot(shot);\r\n\t\tSimplePoolGameState gameState = TurnOver;\r\n\t\tif (shot.somethingPotted())\r\n\t\t\tgameState = table().isBallsLeftOnTable() ? TurnContinued : GameOver;\r\n\t\treturn shot.isFoul() ? gameState.forFoul() : gameState;\r\n\t}", "@Test\n public void determineWinnerNoWhiteMove()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final Agent agentRed = agents.get(0);\n final Agent agentWhite = agents.get(1);\n final CheckersEnvironment environment = new CheckersEnvironment();\n\n environment.placeToken(CheckersPosition.P26, King.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P30, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P31, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P21, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P25, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P29, King.WHITE.withAgent(agentWhite));\n // System.out.println(environment);\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(3));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(3));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n assertThat(adjudicator.determineWinner(environment), is(agentRed));\n }", "public CellSigns gameWinner(){\n for (int i = 0; i < size; i++) {\n var firstSign = gameField[i][0].getCurrentSign();\n int j;\n for (j = 1; j < size; j++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(j == size)\n return firstSign;\n }\n\n //Check vertical lines\n for (int j = 0; j < size; j++) {\n var firstSign = gameField[0][j].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(i == size)\n return firstSign;\n }\n\n //Check diagonal lines\n\n var mainDiagonalSign = gameField[0][0].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n if(mainDiagonalSign != gameField[i][i].getCurrentSign())\n break;\n }\n if(i == size)\n return mainDiagonalSign;\n\n var secondaryDiagonalSign = gameField[0][size-1].getCurrentSign();\n for (i = 1; i < size; i++) {\n if(secondaryDiagonalSign!= gameField[i][size-1-i].getCurrentSign())\n break;\n }\n if(i==size)\n return secondaryDiagonalSign;\n\n //No winner\n return CellSigns.EMPTY;\n }", "public boolean meWin(){\n return whitePieces.size() > blackPieces.size() && isWhitePlayer;\n }", "boolean isWinner() {\n boolean win = true;\n // first method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if ((state[i][j] == 'X' && stateGame[i][j] != '*') || (state[i][j] != 'X' && stateGame[i][j] == '*'))\n win = false;\n }\n }\n if (win)\n return true;\n\n win = true;\n // second method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if (state[i][j] == '.' && stateGame[i][j] == '.')\n win = false;\n }\n }\n return win;\n }", "public static Move openingStrategy(PentagoBoardState boardState, int player) {\n\t Move firstMoveOne = new PentagoMove(1, 0, Quadrant.BL, Quadrant.BR, player);\r\n\t Move firstMoveTwo = new PentagoMove(1, 3, Quadrant.BL, Quadrant.BR, player);\r\n\t Move moveThree = new PentagoMove(0, 1, Quadrant.BL, Quadrant.TR, player);\r\n\t Move moveFour = new PentagoMove(0, 4, Quadrant.TL, Quadrant.BR, player);\r\n\t Move moveFive = new PentagoMove(3, 1, Quadrant.BL, Quadrant.TL, player);\r\n\t Move moveSix = new PentagoMove(3, 4, Quadrant.TL, Quadrant.TR, player);\r\n\t Move moveSeven = new PentagoMove(2, 2, Quadrant.TL, Quadrant.TR, player);\r\n\t Move moveEight = new PentagoMove(2, 5, Quadrant.TL, Quadrant.BR, player);\r\n\t Move moveNine = new PentagoMove(5, 2, Quadrant.BL, Quadrant.TL, player);\r\n\t Move moveTen = new PentagoMove(5, 5, Quadrant.TL, Quadrant.TR, player);\r\n\t \r\n\t //First turn as either Black or White\r\n\t if(boardState.getTurnNumber() == 0 || boardState.getTurnNumber() == 1) {\r\n\t if(boardState.isLegal((PentagoMove) firstMoveOne)) {\r\n\t \treturn firstMoveOne;\r\n\t }\r\n\t else if(boardState.isLegal((PentagoMove) firstMoveTwo)) {\r\n\t \treturn firstMoveTwo;\r\n\t }\r\n\t else {\r\n\t \t/* If something goes awry, play the first legal move (will place pieces in TL quadrant usually).\r\n\t \t * Same error condition for the following moves as well.\r\n\t \t **/\r\n\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t \treturn legalMoves.get(0);\r\n\t }\r\n\t }\r\n\t else if(boardState.getTurnNumber() == 2 || boardState.getTurnNumber() == 3) {\r\n\t \t//White player turn 2 & 3 set up\r\n\t \tif(player == 0) {\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveThree) && boardState.getPieceAt(1, 0).toString().equals(\"w\")) {\r\n\t\t \treturn moveThree;\r\n\t\t }\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveFour) && boardState.getPieceAt(1, 3).toString().equals(\"w\")) {\r\n\t\t \t\treturn moveFour;\r\n\t\t \t}\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveFive) && boardState.getPieceAt(4, 0).toString().equals(\"w\")) {\r\n\t\t \treturn moveFive;\r\n\t\t }\r\n\t\t \tif(boardState.isLegal((PentagoMove) moveSix) && boardState.getPieceAt(4, 3).toString().equals(\"w\")) {\r\n\t\t \t\treturn moveSix;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(0, 1).toString().equals(\"b\") && boardState.getPieceAt(1, 0).toString().equals(\"w\")\t\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveSeven)) {\r\n\t\t \treturn moveSeven;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(0, 4).toString().equals(\"b\") && boardState.getPieceAt(1, 3).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveEight)) {\r\n\t\t \t\treturn moveEight;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(3, 1).toString().equals(\"b\") && boardState.getPieceAt(4, 0).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveNine)) {\r\n\t\t \treturn moveNine;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(3, 4).toString().equals(\"b\") && boardState.getPieceAt(4, 3).toString().equals(\"w\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveTen)) {\r\n\t\t \t\treturn moveTen;\r\n\t\t \t}\r\n\t\t else {\r\n\t\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t\t \treturn legalMoves.get(0);\r\n\t\t }\r\n\t \t} \r\n\t \t//Black player turn 2 & 3 set up\r\n\t \telse {\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveThree) && boardState.getPieceAt(1, 0).toString().equals(\"b\")) {\r\n\t\t \treturn moveThree;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveFour) && boardState.getPieceAt(1, 3).toString().equals(\"b\")) {\r\n\t\t \treturn moveFour;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveFive) && boardState.getPieceAt(4, 0).toString().equals(\"b\")) {\r\n\t\t \treturn moveFive;\r\n\t\t }\r\n\t \t\tif(boardState.isLegal((PentagoMove) moveSix) && boardState.getPieceAt(4, 3).toString().equals(\"b\")) {\r\n\t\t \treturn moveSix;\r\n\t\t }\r\n\t \t\tif(boardState.getPieceAt(0, 1).toString().equals(\"w\") && boardState.getPieceAt(1, 0).toString().equals(\"b\")\r\n\t \t\t\t\t&& boardState.isLegal((PentagoMove) moveSeven)) {\r\n\t\t \treturn moveSeven;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(0, 4).toString().equals(\"w\") && boardState.getPieceAt(1, 3).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveEight)) {\r\n\t\t \t\treturn moveEight;\r\n\t\t \t}\r\n\t\t \tif(boardState.getPieceAt(3, 1).toString().equals(\"w\") && boardState.getPieceAt(4, 0).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveNine)) {\r\n\t\t \treturn moveNine;\r\n\t\t }\r\n\t\t \tif(boardState.getPieceAt(3, 4).toString().equals(\"w\") && boardState.getPieceAt(4, 3).toString().equals(\"b\")\r\n\t\t \t\t\t&& boardState.isLegal((PentagoMove) moveTen)) {\r\n\t\t \t\treturn moveTen;\r\n\t\t \t}\r\n\t\t else {\r\n\t\t \tArrayList<PentagoMove> legalMoves = boardState.getAllLegalMoves();\r\n\t\t \treturn legalMoves.get(0);\r\n\t\t }\r\n\t \t}\t \r\n\t }\r\n\t else {\r\n\t \t//If we are past Player's Turn 3, start using MiniMax with a-b pruning\r\n\t \tMiniMaxABPruning instc = new MiniMaxABPruning();\r\n\t \treturn instc.abPruningStrategy(boardState, boardState.getTurnPlayer());\r\n\t }\r\n\t}", "protected int winnable(Board b){\r\n\t\t//checks if two tiles are the same (and not empty) and checks if\r\n\t\t//the third tile required to win is empty for a winning condition\r\n\t\tint condition = 0;\r\n\t\tif ((b.getTile(1) == b.getTile(2)) && (b.getTile(3) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\t\tcondition =3;\r\n\t\telse if ((b.getTile(1) == b.getTile(3)) && (b.getTile(2) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 2;\r\n\t\telse if ((b.getTile(2) == b.getTile(3)) && (b.getTile(1) == ' ')\r\n\t\t\t\t&& (b.getTile(2) != ' ') && (b.getTile(2) == this.getSymbol()))\r\n\t\t\tcondition = 1;\r\n\t\telse if ((b.getTile(4) == b.getTile(5)) && (b.getTile(6) == ' ')\r\n\t\t\t\t&& (b.getTile(4) != ' ') && (b.getTile(4) == this.getSymbol()))\r\n\t\t\tcondition = 6;\r\n\t\telse if ((b.getTile(4) == b.getTile(6)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(4) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(6)) && (b.getTile(4) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 4;\r\n\t\telse if ((b.getTile(7) == b.getTile(8)) && (b.getTile(9) == ' ')\r\n\t\t\t\t&& (b.getTile(7) != ' ') && (b.getTile(7) == this.getSymbol()))\r\n\t\t\tcondition = 9;\r\n\t\telse if ((b.getTile(7) == b.getTile(9)) && (b.getTile(8) == ' ')\r\n\t\t\t\t&& (b.getTile(7) != ' ') && (b.getTile(7) == this.getSymbol()))\r\n\t\t\tcondition = 8;\r\n\t\telse if ((b.getTile(8) == b.getTile(9)) && (b.getTile(7) == ' ')\r\n\t\t\t\t&& (b.getTile(8) != ' ') && (b.getTile(8) == this.getSymbol()))\r\n\t\t\tcondition = 7;\r\n\t\telse if ((b.getTile(1) == b.getTile(4)) && (b.getTile(7) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 7;\r\n\t\telse if ((b.getTile(1) == b.getTile(7)) && (b.getTile(4) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 4;\r\n\t\telse if ((b.getTile(4) == b.getTile(7)) && (b.getTile(1) == ' ')\r\n\t\t\t\t&& (b.getTile(4) != ' ') && (b.getTile(4) == this.getSymbol()))\r\n\t\t\tcondition = 1;\r\n\t\telse if ((b.getTile(2) == b.getTile(5)) && (b.getTile(8) == ' ')\r\n\t\t\t\t&& (b.getTile(2) != ' ') && (b.getTile(2) == this.getSymbol()))\r\n\t\t\tcondition = 8;\r\n\t\telse if ((b.getTile(2) == b.getTile(8)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(2) != ' ') && (b.getTile(2) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(8)) && (b.getTile(2) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 2;\r\n\t\telse if ((b.getTile(3) == b.getTile(6)) && (b.getTile(9) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 9;\r\n\t\telse if ((b.getTile(3) == b.getTile(9)) && (b.getTile(6) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 6;\r\n\t\telse if ((b.getTile(6) == b.getTile(9)) && (b.getTile(3) == ' ')\r\n\t\t\t\t&& (b.getTile(6) != ' ') && (b.getTile(6) == this.getSymbol()))\r\n\t\t\tcondition = 3;\r\n\t\telse if ((b.getTile(1) == b.getTile(5)) && (b.getTile(9) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 9;\r\n\t\telse if ((b.getTile(1) == b.getTile(5)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(9)) && (b.getTile(1) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 1;\r\n\t\telse if ((b.getTile(3) == b.getTile(5)) && (b.getTile(7) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 7;\r\n\t\telse if ((b.getTile(3) == b.getTile(7)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(7)) && (b.getTile(3) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 3;\r\n\t\treturn condition;\r\n\t}", "public void solveGame5() {\n\t\tlosingStates = new HashSet<S>();\n\t\t\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tList<Set<S>> uncontrollableSuccessors = new ArrayList<Set<S>>();\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> currentUncontrollableSuccesors;\n\t\tSet<S> currentSet; \n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\tcurrentUncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\t\t\tcurrentSet = new HashSet<S>();\n\t\t\tfor(S s: currentUncontrollableSuccesors){\n\t\t\t\tif((!relaxOnAssumptions || (!assumptionsStates.contains(s) || assumptionsStates.contains(state))\n\t\t\t\t\t\t&& (!relaxSelfLoops || (!s.equals(state)))))\n\t\t\t\t\tcurrentSet.add(s);\n\t\t\t}\n\t\t\t uncontrollableSuccessors.add(currentSet);\n\t\t\t isUncontrollable[indexCount] = currentSet.size() > 0;\n\t\t\t indexCount+=1;\n\t\t}\n\n\t\tlosingStates.addAll(game.getStates());\n\t\t\n\t\tSet<S> currentLosingStates;\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t\tcurrentLosingStates\t= new HashSet<S>();\n\t\t\t\n\t\t\t// Handle the pending states\n\t\t\twhile (!losing.isEmpty()) {\n\t\t\t\tS state = losing.poll();\n\n\t\t\t\t\n\t\t\t\tcurrentLosingStates.add(state);\n\n\t\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\t\tfor (S pred : predecessors) {\n\t\t\t\t\tif(losing.contains(pred) || currentLosingStates.contains(pred))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\n\t\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t\t//if(i == -1)\n\t\t\t\t\t\t//continue;\n\t\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tuncontrollableSuccessors.get(i).remove(state);\n\t\t\t\t\t\tif(uncontrollableSuccessors.get(i).isEmpty())\n\t\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tlosingStates.retainAll(currentLosingStates);\n\t\t\t\n\t\t}\n\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "private int Win_Move() {\n\t\tfinal int POSSIBLE_WIN = 8;\n\t\tint move = NO_MOVE;\n\t\tif(( gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_LEFT] == EMPTY){\n\t\t\t\tmove = TOP_LEFT;\n\t\t\t}else if (gameBoard[TOP_CENTER] == EMPTY){\n\t\t\t\tmove = TOP_CENTER;\n\t\t\t}else if (gameBoard[TOP_RIGHT] == EMPTY){\n\t\t\t\tmove = TOP_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[CTR_LEFT] == EMPTY){\n\t\t\t\tmove = CTR_LEFT;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[CTR_RIGHT] == EMPTY){\n\t\t\t\tmove = CTR_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[BTM_LEFT] == EMPTY){\n\t\t\t\tmove = BTM_LEFT;\n\t\t\t}else if (gameBoard[BTM_CENTER] == EMPTY){\n\t\t\t\tmove = BTM_CENTER;\n\t\t\t}else if (gameBoard[BTM_RIGHT] == EMPTY){\n\t\t\t\tmove = BTM_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_LEFT] + gameBoard[BTM_LEFT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_LEFT] == EMPTY){\n\t\t\t\tmove = TOP_LEFT;\n\t\t\t}else if (gameBoard[CTR_LEFT] == EMPTY){\n\t\t\t\tmove = CTR_LEFT;\n\t\t\t}else if (gameBoard[BTM_LEFT] == EMPTY){\n\t\t\t\tmove = BTM_LEFT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_CENTER] + gameBoard[CTR_CENTER] + gameBoard[BTM_CENTER]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_CENTER] == EMPTY){\n\t\t\t\tmove = TOP_CENTER;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[BTM_CENTER] == EMPTY){\n\t\t\t\tmove = BTM_CENTER;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_RIGHT] == EMPTY){\n\t\t\t\tmove = TOP_RIGHT;\n\t\t\t}else if (gameBoard[CTR_RIGHT] == EMPTY){\n\t\t\t\tmove = CTR_RIGHT;\n\t\t\t}else if (gameBoard[BTM_RIGHT] == EMPTY){\n\t\t\t\tmove = BTM_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_CENTER] + gameBoard[BTM_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_LEFT] == EMPTY){\n\t\t\t\tmove = TOP_LEFT;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[BTM_RIGHT] == EMPTY){\n\t\t\t\tmove = BTM_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_CENTER] + gameBoard[BTM_LEFT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_RIGHT] == EMPTY){\n\t\t\t\tmove = TOP_RIGHT;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[BTM_LEFT] == EMPTY){\n\t\t\t\tmove = BTM_LEFT;\n\t\t\t}\n\t\t}\n\t\treturn move;\n\t}", "public void startGameState(){\n\n ArrayList<Integer> checkeredSpaces = new ArrayList<Integer>(Arrays.asList(1, 3, 5, 7, 8, 10, 12, 14, 17, 19, 21,\n 23, 24, 26, 28, 30, 33, 35, 37, 39, 41, 42, 44, 46, 48,\n 51, 53, 55, 56, 58, 60, 62));\n\n\n\n for(int i =0; i < 63; i++){\n if(!checkeredSpaces.contains(i)){\n //set all black spaces to null on the board\n mCheckerBoard.add(null);\n }\n else if(i < 24){\n //set first three rows to red checkers\n mCheckerBoard.add(new Checker((i/2), true));\n }\n else if(i < 40){\n //set middle two rows to null\n mCheckerBoard.add(null);\n }\n else{\n //set top three row to black checkers\n mCheckerBoard.add(new Checker((i/2), false));\n }\n }\n\n }", "boolean gameOver() {\n return piecesContiguous(BP) || piecesContiguous(WP);\n }", "public int checkWin(){\n //check for horizontal and vertical wins\n for(int i=0; i<3; i++){\n if(gameBoard[i][0].equals(\"O\") && gameBoard[i][1].equals(\"O\") && gameBoard[i][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[i][0].equals(\"X\") && gameBoard[i][1].equals(\"X\") && gameBoard[i][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][i].equals(\"O\") && gameBoard[1][i].equals(\"O\") && gameBoard[2][i].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][i].equals(\"X\") && gameBoard[1][i].equals(\"X\") && gameBoard[2][i].equals(\"X\")){\n return 2;\n }\n }\n //check for both diagonal cases\n if(gameBoard[0][0].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][2].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][0].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][0].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][2].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][0].equals(\"X\")){\n return 2;\n }\n return 0;\n }", "public WumpusState wellItsDarkNow(GameTile[][] visibleMap) {\r\n\t\tQueue<WumpusState> queue = new LinkedList<WumpusState>();\r\n\t\tHashMap<String, Boolean> visitedStates = new HashMap<String, Boolean>();\t\r\n\t\tWumpusState state = new WumpusState(visibleMap, playerX, playerY);\r\n\t\tlong nodesExpanded = 0;\r\n\t\tqueue.add(state);\r\n\t\tif(state.getParent()!=null) {\t\r\n\t\t\tqueue.add(state.getParent());\r\n\t\t}\r\n\t\twhile(!queue.isEmpty()) {\r\n\t\t\tWumpusState currentState = queue.remove();\r\n\t\t\tSystem.out.println(currentState.toString());\r\n\t\t\t\r\n\t\t\tif(currentState.getGoldCollected()) {\r\n\t\t\t\tArrayList<AgentAction> actions = currentState.getAllActions();\r\n\t\t\t\tfor(int i=1;i<actions.size(); i++) {\r\n\t\t\t\t\tSystem.out.println(\"gold\");\r\n\t\t\t\t\tSystem.out.println(actions.get(i));\r\n\t\t\t\t\tnextMoves.add(actions.get(i));\r\n\t\t\t\t}\r\n\t\t\t\tgoldCollected = true;\r\n\t\t\t\treturn currentState;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(currentState.spaceNotVisited()) {\r\n\t\t\t\tArrayList<AgentAction> actions = currentState.getAllActions();\r\n\t\t\t\tfor(int i=1;i<actions.size(); i++) {\r\n\t\t\t\t\tSystem.out.println(\"null\");\r\n\t\t\t\t\tSystem.out.println(actions.get(i));\r\n\t\t\t\t\tnextMoves.add(actions.get(i));\r\n\t\t\t\t}\r\n\t\t\t\treturn currentState;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(visitedStates.containsKey(currentState.toString())) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tvisitedStates.put(currentState.toString(), true);\r\n\t\t\t\tWumpusState[] childrenOfCurrentChild = currentState.generateChildrenStates();\r\n\t\t\t\tfor(int j=0; j<childrenOfCurrentChild.length; j++) {\r\n\t\t\t\t\tif(childrenOfCurrentChild[j]!=null) {\r\n\t\t\t\t\t\tqueue.add(childrenOfCurrentChild[j]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tgoldCollected = true;\r\n\t\treturn state;\r\n\t\t\r\n\t}", "public static void checkResult() {\n\t\tint sum = PlayerBean.PLAYERONE - PlayerBean.PLAYERTWO;\n\n\t\tif (sum == 1 || sum == -2) {\n\t\t\tScoreBean.addWin();\n\t\t\tresult = \"player one wins\";\n\t\t} else {\n\t\t\tScoreBean.addLoss();\n\t\t\tresult = \"player two wins\";\n\t\t}\n\t}", "boolean isGameSpedUp();", "public Marker gameWon() {\r\n for (int s : sums) {\r\n if (s == BOARD_SIZE) {\r\n return Marker.X;\r\n }\r\n else if (s == -BOARD_SIZE) {\r\n return Marker.O;\r\n }\r\n }\r\n\r\n return Marker.EMPTY;\r\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "public boolean meTurn(){\n return (isWhite && isWhitePlayer) || (!isWhite && !isWhitePlayer);\n }", "private void checkState() {\r\n\t\tswitch (this.stepPanel.getStep()) {\r\n\t\tcase StepPanel.STEP_HOST_GRAPH:\r\n\t\t\tcheckHostGraphAndNextStep();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_STOP_GRAPH:\r\n\t\t\tcheckStopGraphAndNextStep();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_CRITICAL_PAIRS:\r\n\t\t\tcheckPairsAndNextStep();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_FINISH:\r\n\t\t\tcheckIfReadyToParse();\r\n\t\t\tquitDialog();\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "@Override\n\tpublic double stateEvaluator(GameState s)\n\t{\r\n\t\tint count = 0;\n\t\tif (s.takenList[1] == 0)\r\n\t\t{\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\telse if(s.lastMove == 1)\r\n\t\t{\r\n\t\t\tfor (int i = 1; i < s.takenList.length ; i++)\r\n\t\t\t{\r\n\t\t\t\tif (s.takenList[i] == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (count % 2 == 0)\r\n\t\t\t{\r\n\t\t\t\treturn -0.5;\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\treturn 0.5;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (isPrime(s.lastMove))\r\n\t\t{\r\n\t\t\tfor (int i = 1; i < s.takenList.length; i++)\r\n\t\t\t{\r\n\t\t\t\tif (s.takenList[i] == 0 && i % s.lastMove == 0) // i = 4, % 2\r\n\t\t\t\t{\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (count % 2 == 0)\r\n\t\t\t{\r\n\t\t\t\treturn -0.7;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn 0.7;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tint largestPrime = 2;\r\n\t\t\tfor (int i = 2; i < (s.lastMove/2); i++)\r\n\t\t\t{\r\n\t\t\t\tif (s.lastMove % i == 0 && isPrime(i))\r\n\t\t\t\t{\r\n\t\t\t\t\tlargestPrime = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (int i = largestPrime; i <= s.lastMove; i+= largestPrime)\r\n\t\t\t{\r\n\t\t\t\tif (s.takenList[i] == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (count % 2 == 0)\r\n\t\t\t{\r\n\t\t\t\treturn -0.6;\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\treturn 0.6;\r\n\t\t\t}\r\n\r\n\t\t}\n\t}", "public static String play(GuessWhoGame g) {\n if (g.hairIsColor(Color.BROWN)) {\n if (g.eyeIsColor(Color.BROWN)) {\n if (g.shirtIsColor(Color.GREEN)) {\n if (g.isWearingGlasses()) {\n return \"Bob\";\n } else {\n return \"Dave\";\n }\n } else {\n if (g.shirtIsColor(Color.RED)) {\n if (g.isWearingHat()) {\n return \"Robert\";\n } else {\n return \"Quinn\";\n }\n } else {\n return \"Zander\";\n }\n }\n } else {\n if (g.shirtIsColor(Color.RED)) {\n if (g.eyeIsColor(Color.BLUE)) {\n if (g.isWearingGlasses()) {\n if (g.isSmiling()) {\n return \"Mallie\";\n } else {\n return \"Wendy\";\n }\n } else {\n return \"Nick\";\n }\n } else {\n if (g.isWearingGlasses()) {\n return \"Emily\";\n } else {\n return \"Philip\";\n }\n }\n } else {\n if (g.shirtIsColor(Color.GREEN)) {\n if (g.eyeIsColor(Color.BLUE)) {\n return \"Alice\";\n } else {\n if (g.eyeIsColor(Color.GREEN)) {\n return \"Frank\";\n } else {\n return \"Isabelle\";\n }\n }\n } else {\n return \"Tucker\";\n }\n }\n }\n } else {\n if (g.eyeIsColor(Color.BROWN)) {\n if (g.hairIsColor(Color.BLACK)) {\n if (g.isWearingGlasses()) {\n return \"Xavier\";\n } else {\n if (g.shirtIsColor(Color.BLUE)) {\n return \"Olivia\";\n } else {\n return \"Ursula\";\n }\n }\n } else {\n if (g.hairIsColor(Color.BLOND)) {\n if (g.shirtIsColor(Color.RED)) {\n return \"Henry\";\n } else {\n return \"Jack\";\n }\n } else {\n if (g.isWearingHat()) {\n return \"Sarah\";\n } else {\n return \"Victor\";\n }\n }\n }\n } else {\n if (g.hairIsColor(Color.BLACK)) {\n if (g.eyeIsColor(Color.BLUE)) {\n if (g.isSmiling()) {\n return \"Gertrude\";\n } else {\n return \"Carol\";\n }\n } else {\n return \"Karen\";\n }\n } else {\n if (g.shirtIsColor(Color.BLUE)) {\n return \"Larry\";\n } else {\n return \"Yasmine\";\n }\n }\n } \n }\n \n //return null;\n }", "public void gameOfLife(int[][] board) {\n int m = board.length;\n int n = ( m > 0 ? board[0].length : 0);\n int[] dx = {-1, -1, -1, 0, 1, 1, 1, 0};\n int[] dy = {-1, 0, 1, 1, 1, 0, -1, -1};\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n int cnt = 0;\n /**\n * Count the neighbors with live status.\n */\n for (int k = 0; k < 8; k++) {\n int x = i + dx[k];\n int y = j + dy[k];\n /**\n * Notice using board[x][y] here, not board[i][j]\n * The next state is created by applying the above rules simultaneously to every cell in the current state,\n * so we concern state==1 and state==2(both states indicate live)\n */\n if (x >= 0 && x < m && y >= 0 && y < n && (board[x][y] == 1 || board[x][y] == 2)) {\n cnt++;\n }\n }\n if (board[i][j] == 1 && (cnt < 2 || cnt > 3)) {\n /**\n * From live to dead.\n */\n board[i][j] = 2;\n }\n if (board[i][j] == 0 && cnt == 3) {\n /**\n * From dead to live\n */\n board[i][j] = 3;\n }\n }\n }\n /**\n * Restore state back to 0 and 1.\n */\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n board[i][j] %= 2;\n }\n }\n }", "public static int gameOver(Node nd){\n\t\tint win;\n\t\tfor(int i=0; i<6; i++){\n\t\t\tfor(int j=0; j<7; j++){\n\t\t\t\tif((win = utilVert(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\n\t\t\t\tif((win = utilHori(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\n\t\t\t\tif((win = utilRDiag(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\n\t\t\t\tif((win = utilLDiag(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(fullBoard(nd))\n\t\t\treturn 1;\n\n\t\treturn 0;\n\t}", "protected String checkContradictionRaw(BoardState state)\r\n {\r\n \tString error = null;\r\n \tint height = state.getHeight();\r\n \tint width = state.getWidth();\r\n\r\n \tint[][] arrayacross = new int[height][width];\r\n \tint[][] arraydown = new int[height][width];\r\n \tint[][] cellRegions = (int[][])state.getExtraData().get(2);\r\n \tfor(int x = 0; x < width; ++x)\r\n \t{\r\n \t\tfor(int y = 0; y < height; ++y)\r\n \t\t{\r\n \t\t\tarrayacross[y][x] = arraydown[y][x] = 0;\r\n \t\t}\r\n \t}\r\n \t\r\n \tfor(int x = 0; x < width; ++x)\r\n \t{\r\n \t\tfor(int y = 0; y < height; ++y)\r\n \t\t{\r\n \t\t\tif(state.getCellContents(x,y) == 1)\r\n \t\t\t{\r\n \t\t\t\tif(x+1 < width)\r\n \t\t\t\t{\r\n \t\t\t\t\tif(state.getCellContents(x+1,y) == 1)\r\n \t\t\t\t\t{\r\n \t\t\t\t\t\tif( cellRegions[y][x] != cellRegions[y][x+1])\r\n \t\t\t\t\t\t\tarrayacross[y][x+1] = arrayacross[y][x] + 1;\r\n \t\t\t\t\t\telse\r\n \t\t\t\t\t\t\tarrayacross[y][x+1] = arrayacross[y][x];\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t\tif(y+1 < height)\r\n \t\t\t\t{\r\n \t\t\t\t\tif(state.getCellContents(x,y+1) == 1)\r\n \t\t\t\t\t{\r\n \t\t\t\t\t\tif( cellRegions[y][x] != cellRegions[y+1][x])\r\n \t\t\t\t\t\t\tarraydown[y+1][x] = arraydown[y][x] + 1;\r\n \t\t\t\t\t\telse\r\n \t\t\t\t\t\t\tarraydown[y+1][x] = arraydown[y][x];\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n \t\r\n \tfor(int x = 0; x < width; ++x)\r\n \t{\r\n \t\tfor(int y = 0; y < height; ++y)\r\n \t\t{\r\n \t\t\tif(arrayacross[y][x] > 1 || arraydown[y][x] > 1)\r\n \t\t\t\treturn error;\r\n \t\t}\r\n \t}\r\n \t\r\n \terror = \"A line of white cells does not exceed two rooms.\";\r\n\r\n\t\treturn error;\r\n }", "private final String checkIfGameOver() {\n\t\tif(state.getGameOver()){\n\t\t\tint winner = state.getWinner();\n\t\t\tif(winner == CbgState.PLAYER_1){\n\t\t\t\treturn (\"Playre 1 won with \" + state.getScore(CbgState.PLAYER_1) + \" points.\");\n\t\t\t}\n\t\t\telse if(winner == CbgState.PLAYER_2){\n\t\t\t\treturn (\"Playre 2 won with \" + state.getScore(CbgState.PLAYER_1) + \" points.\");\n\t\t\t}\n\t\t\telse return \"ERROR\";//if something horrible happens\n\t\t}\n\n\t\treturn \"FALSE\";//if game is not over\n\n\t}", "private void announceRoundResult()\n {\n // Last actions of each player, to compare\n GameAction fpAction = firstPlayer.getLastAction();\n GameAction spAction = secondPlayer.getLastAction();\n\n // Display first IA game\n if (!hasHuman)\n {\n if (fpAction instanceof RockAction)\n {\n animateSelectedButton(firstPlayerRock, true);\n }\n else if (fpAction instanceof PaperAction)\n {\n animateSelectedButton(firstPlayerPaper, true);\n }\n else if (fpAction instanceof ScissorsAction)\n {\n animateSelectedButton(firstPlayerScissors, true);\n }\n }\n // Display second IA game\n if (spAction instanceof RockAction)\n {\n animateSelectedButton(secondPlayerRock, false);\n }\n else if (spAction instanceof PaperAction)\n {\n animateSelectedButton(secondPlayerPaper, false);\n }\n else if (spAction instanceof ScissorsAction)\n {\n animateSelectedButton(secondPlayerScissors, false);\n }\n\n\n // First player has played something ==> look at result\n if (firstPlayer.hasAlreadyPlayed())\n {\n switch (fpAction.versus(spAction))\n {\n case WIN:\n updateResultIcons(true, false);\n break;\n case DRAW:\n updateResultIcons(false, true);\n break;\n case LOSE:\n updateResultIcons(false, false);\n break;\n }\n }\n // First player didn't play ==> draw or loose\n else\n {\n // Draw\n if (!secondPlayer.hasAlreadyPlayed())\n {\n updateResultIcons(false, true);\n }\n // Lose\n else\n {\n updateResultIcons(false, false);\n }\n }\n }", "public void checkGame() {\n\n\t}", "@Override\n public int status() {\n if (currentLoad <= maxLoad && currentLoad >= 0.6 * maxLoad) return GOOD;\n if (currentLoad < 0.6 * maxLoad && currentLoad >= 0.1 * maxLoad) return CHECK;\n else return BAD;\n }", "private String getTurnMessage(){\n if (board.turn ==0)\n return \"Black's turn\";\n else\n return \"White's turn\";\n }" ]
[ "0.70483464", "0.6978462", "0.6456531", "0.6341541", "0.632967", "0.6321593", "0.619317", "0.6176654", "0.61246306", "0.60626245", "0.6054882", "0.60438013", "0.60227084", "0.5950726", "0.59340876", "0.58785784", "0.5862582", "0.58062834", "0.5802472", "0.57717085", "0.5766569", "0.5678059", "0.5655925", "0.56390667", "0.5635825", "0.56274515", "0.56125844", "0.5607202", "0.5599936", "0.559747", "0.5592314", "0.55914843", "0.5567585", "0.55617005", "0.5559139", "0.55388486", "0.55368084", "0.5533811", "0.55194825", "0.5511852", "0.54949063", "0.5494382", "0.5490027", "0.5484443", "0.54599553", "0.5459085", "0.5455439", "0.5452191", "0.54493177", "0.5442383", "0.5441185", "0.54361033", "0.54357487", "0.5434945", "0.54059505", "0.5399551", "0.5392327", "0.5391521", "0.53881353", "0.53856486", "0.5382164", "0.5376523", "0.5376205", "0.5361184", "0.5347391", "0.5341401", "0.5334394", "0.53263223", "0.53250206", "0.5314865", "0.53113747", "0.5307494", "0.5306266", "0.5301361", "0.5297398", "0.52967006", "0.5293806", "0.5293342", "0.52722853", "0.52651936", "0.5262923", "0.5260287", "0.52553487", "0.5253851", "0.5248389", "0.5246862", "0.5232528", "0.5231576", "0.5230138", "0.5226174", "0.52254105", "0.5223938", "0.5220369", "0.5218693", "0.5211684", "0.52102757", "0.5209346", "0.51999706", "0.5198887", "0.51981574" ]
0.7015858
1
Of computeGameSituation Determine the given game situation for white: WHITE, BLACK, TIE, or UNFINISHED.
public static int computeGameSituation(int[][] paraCheckerboard) { // Indicate whether or not the row/column/slope is the same. boolean tempSame = false; // Step 1. Horizontal for (int i = 0; i < SIZE; i++) { if (paraCheckerboard[i][0] == EMPTY) { continue; } // Of if // A whole row is the same. tempSame = true; for (int j = 1; j < SIZE; j++) { if (paraCheckerboard[i][j] != paraCheckerboard[i][0]) { tempSame = false; break; } // Of if } // Of for j if (tempSame) { return paraCheckerboard[i][0]; } // Of if } // Of for i // Step 2. Vertical for (int j = 0; j < SIZE; j++) { if (paraCheckerboard[0][j] == EMPTY) { continue; } // Of if // A whole column is the same. tempSame = true; for (int i = 1; i < SIZE; i++) { if (paraCheckerboard[i][j] != paraCheckerboard[0][j]) { tempSame = false; break; } // Of if } // Of for i if (tempSame) { return paraCheckerboard[0][j]; } // Of if } // Of for i // Step 3. Slope: Left-top to right-bottom. if (paraCheckerboard[0][0] != EMPTY) { tempSame = true; for (int i = 1; i < SIZE; i++) { if (paraCheckerboard[i][i] != paraCheckerboard[0][0]) { tempSame = false; break; } // Of if } // Of for i if (tempSame) { return paraCheckerboard[0][0]; } // Of if } // Of if // Step 4. Slope: Right-top to left-bottom. if (paraCheckerboard[0][SIZE - 1] != EMPTY) { for (int i = 1; i < SIZE; i++) { tempSame = true; if (paraCheckerboard[i][SIZE - i - 1] != paraCheckerboard[0][SIZE - 1]) { tempSame = false; break; } // Of if } // Of for i if (tempSame) { return paraCheckerboard[0][SIZE - 1]; } // Of if } // Of if // Step 5. Checkboard full boolean tempHasEmpty = false; for (int i = 0; i < paraCheckerboard.length; i++) { for (int j = 0; j < paraCheckerboard.length; j++) { if (paraCheckerboard[i][j] == EMPTY) { tempHasEmpty = true; break; } // Of if } // Of for j if (tempHasEmpty) { break; } // Of if } // Of for i if (!tempHasEmpty) { return TIE; } // Of if return UNFINISHED; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int computeGameSituation() {\n\t\treturn computeGameSituation(checkerboard);\n\t}", "public int computeGameSituation(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\t// System.out.println(\"The checkerboard is: \" +\n\t\t// Arrays.deepToString(tempCheckerboard));\n\n\t\treturn computeGameSituation(tempCheckerboard);\n\t}", "public static void getGameSituationTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17060 };\n\n\t\tint tempResult;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResult = tempEnvironment.computeGameSituation(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The game situation of \" + tempTestStates[i] + \" is: \" + tempResult);\n\t\t} // Of for i\n\t}", "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "public int evaluate(PentagoBoardState pbs) {\n PentagoBoardState.Piece[][] pieces = pbs.getBoard();\n\n\n int whitescore =0; //keep track of white's total score\n int blackscore = 0;//keep track of black's total score\n\n //Check rows\n for (int x = 0; x <6 ; x++) {\n int countWHori = 0;\n int countBHori = 0;\n\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = 0; y <5 ; y++) {\n //Count how many black and white pieces\n if (pieces[x][y].ordinal() == 0 ) {\n\n //countBHori = countBHori + countvalue;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWHori = countWHori +countvalue;\n whites++;\n }\n\n //Check for consecutive\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n\n //Check for disjoint and joint set If * B B W * * then disjoint and * B B * B * Then joint set for B * B\n if (y!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 && pieces[x][y+2].ordinal() == 1){\n countBHori = countBHori +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 && pieces[x][y+2].ordinal() == 0){\n countWHori = countWHori +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 0){\n countBHori = countBHori +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 1){\n countWHori = countWHori +jointset;\n }\n }\n }\n //check if unwinnable\n if (blacks == 4 && whites==2){\n countBHori += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWHori += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countWHori += unwinnable;\n countBHori += unwinnable;\n }\n\n\n //Run value for row in evaluation scheme and add to total score\n int valuew = consecutivevalue(countWHori);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBHori);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec hori \" + valueb + \"White consec hori \" + valuew);\n\n }\n\n //Check Verticals\n for (int y = 0; y <6 ; y++) {\n int countWvert = 0;\n int countBvert = 0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int x = 0; x <5 ; x++) {\n if (pieces[x][y].ordinal() == 0) {\n\n //countBvert = countBvert +1;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWvert = countWvert +1;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n\n if (x!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 1){\n countBvert = countBvert +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 0){\n countWvert = countWvert +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0){\n countBvert = countBvert +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1){\n countWvert = countWvert +jointset;\n }\n }\n }\n\n if (blacks == 4 && whites==2){\n countBvert += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBvert += unwinnable;\n countWvert += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWvert += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBvert + \"White consec \" + countWvert);\n int valuew = consecutivevalue(countWvert);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBvert);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec VERT \" + valueb + \"White consec hori \" + valuew);\n }\n\n //S West N EAST Top\n for (int a = 1; a <6 ; a++) { //loop through all diagonal lines\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = a; y !=0 ; y--) { //loop through one diagonal line\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +2;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n // check for joint and disjoint set at these x y coordinates by looking 2 pieces ahead\n if (x==0 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==0 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n\n x++;\n\n\n }\n if (blacks == 4 && whites==2){\n countBdiagSoNe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n //S West N EAST Bot\n for (int a = 1; a <5 ; a++) {\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int y=5;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n if (x==1 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n //System.out.println(x + \" y:\" + y +\" Black consec DIAGOMAAL \" + countBdiagSoNe + \"White consec hori \" + countWdiagSoNe);\n y--;\n\n\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n /*if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }*/\n if (a==1&& blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n\n //NorthWest S EAST Left\n for (int a = 0; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int y=0;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n //System.out.println(pbs+\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n y++;\n\n\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n if (blacks == 4 && whites==2){\n countBdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagNoSe += unwinnable;\n countWdiagNoSe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n //NorthWest S EAST Right\n for (int a = 1; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n for (int y = a; y <5 ; y++) {\n //System.out.println(\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0 ) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n x++;\n\n\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n\n\n\n\n\n //System.out.println(\"Black consec score \" + blackscore +\" \" + \"White consec scpre \" + whitescore);\n //System.out.println(\"max player is \" + maxplayer + \"My colour is \" + mycolour);\n int i = -123456789;\n if (mycolour == 0){\n //System.out.println(blackscore-whitescore +\" I am black\");\n\n\n i= blackscore-whitescore;\n return i;\n\n }\n else {\n //System.out.println(whitescore-blackscore +\" I am white\");\n i= whitescore-blackscore;\n return i;\n }\n /*\n if(i>0 && i<1000){\n return 100; //i*2;\n }\n else if(i>=1000 && i<10000){\n return 1000; //i*10;\n }\n else if(i>=10000 && i<100000){\n return 10000; //i*50;\n }\n else if(i>=100000){\n return 100000;//i*500;\n }\n else if(i<=0 && i>-100){\n return -100; //i*2;\n }\n else if(i<=-100 && i>-1000){\n return -1000; //i*10;\n }\n else if(i<=-1000 && i>-10000){\n return -10000; //i*50;\n }\n else if(i<=0 && i>-100000){\n return -100000;//i*500;\n }\n\n */\n\n\n }", "private int gameState() {\n\t\t\n\t\tint gameNotOver = 0;\n\t\tint gameOverWinnerX = 1;\n\t\tint gameOverWinnerO = 2;\n\t\tint gameOverTie = 3;\n\t\t\n\t\t\n\t\t\n\t\t//Win Vertically \n\t\t// 0 3 6 , 1 4 7 , 2 5 8\n\t\t\t\t\n\t\t//Win Horizontally\n\t\t//0 1 2 , 3 4 5 , 6 7 8 \n\t\t\t\t\n\t\t//Win Diagonally\n\t\t// 0 4 8 , 2 4 6\n\t\t\t\t\n\t\t//Assuming it's an equal grid\n\t\t\t\t\n\t\tMark winningMark = null;\n\t\t\t\t\n\t\tboolean hasFoundWinner = false;\n\t\t\t\t\n\t\tint row = 0;\n\t\tint column = 0;\n\t\t\t\t\n\t\t//Horizontal Winner Test\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\tcolumn ++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tcolumn = 0;\n\t\t\trow++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// Vertical Winner Test\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\n\t\twhile (!hasFoundWinner && column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\trow = 0;\n\t\t\tcolumn++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Winner Test \"\\\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Test \"/\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = COLUMN_COUNT - 1;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn--;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If there are no moves left, and there is no winner, game ends inn a tie \n\t\t\n\t\tboolean foundNoMove = false;\n\t\tfor (int i = 0; i < movesArray.length; i++) {\n\t\t\tif (movesArray[i] == NO_MOVE) {\n\t\t\t\tfoundNoMove = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!foundNoMove && !hasFoundWinner) {\n\t\t\treturn gameOverTie;\n\t\t}\n\t\t\n\t\t// If there is no winner and there are still moves left, game is not over\n\t\t\n\t\treturn gameNotOver;\n\t\t\n\t}", "public int getResult() {\n whiteTotal = 0;\n blackTotal = 0;\n rest = 0;\n for (int row = 0; row < BOARD_SIZE; row++) {\n for (int column = 0; column < BOARD_SIZE; column++) {\n if (board[row][column] == BLACK) {\n blackTotal++;\n } else if (board[row][column] == WHITE) {\n whiteTotal++;\n } else {\n rest++;\n }\n }\n }\n int winner = -1;\n if (rest == 0) {\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n\n if (blackTotal == 0 || whiteTotal == 0) {\n\n if (blackTotal != 0) {\n winner = 2;\n } else if (whiteTotal != 0) {\n winner = 1;\n }\n }\n\n if (getValidateMoveList('W', 'B').isEmpty() && getValidateMoveList('B', 'W').isEmpty()) {\n\n if (blackTotal < whiteTotal) {\n winner = 1;\n } else if (blackTotal > whiteTotal) {\n winner = 2;\n } else {\n winner = 0;\n }\n }\n return winner;\n }", "void checkForPlayer(boolean checkForBlacks, int i, int j) {\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t//**Check vertical**\\\\\n\t\t// Check upwards\n\t\tfor (int n = j-1; n >= 0; --n) {\n\t\t\tif (!check(i, n, checkForBlacks))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check downwards\n\t\tfor (int n = j+1; n < dimensions.y; ++n) {\n\t\t\tif (!check (i, n, checkForBlacks))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t//**Check horizontal**\\\\\n\t\t// Check to left\n\t\tfor (int n = i-1; n >=0; --n) {\n\t\t\tif (!check(n, j, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check to right\n\t\tfor (int n = i+1; n < dimensions.x; ++n) {\n\t\t\tif (!check(n, j, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t//**Check diagonals**\\\\\n\t\t// Check North-East\n\t\tfor (int n = 1; i+n < dimensions.x && j-n >= 0; ++n) {\n\t\t\tif (!check(i+n, j-n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check North-West\n\t\tfor (int n = 1; i-n >= 0 && j-n >= 0; ++n) {\n\t\t\tif (!check(i-n, j-n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check South-East\n\t\tfor (int n = 1; i+n < dimensions.x && j+n < dimensions.y; ++n) {\n\t\t\tif (!check(i+n, j+n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcounter = 0;\n\t\tpossibleFlips.clear();\n\t\t\n\t\t// Check South-West\n\t\tfor (int n = 1; i-n >= 0 && j+n < dimensions.y; ++n) {\n\t\t\tif (!check(i-n, j+n, checkForBlacks))\n\t\t\tbreak;\n\t\t}\n\t}", "boolean gameOver() {\n return piecesContiguous(BLACK) || piecesContiguous(WHITE);\n }", "public String win() {\r\n\t\tint blackCount = 0;\r\n\t\tint whiteCount = 0;\r\n\t\tfor (int i=0; i<piece.size(); i++) {\r\n\t\t\tif (piece.get(order[i]).chessPlayer.equals(\"black\")) {\r\n\t\t\t\tblackCount++;\r\n\t\t\t} else if (piece.get(order[i]).chessPlayer.equals(\"white\")) {\r\n\t\t\t\twhiteCount++;\r\n\t\t\t} else continue;\r\n\t\t}\r\n\t\tif (blackCount == 0) {\r\n\t\t\treturn \"white\";\r\n\t\t} else if (whiteCount == 0) {\r\n\t\t\treturn \"black\";\r\n\t\t} else return null;\r\n\t}", "public int gameStatus() {\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tif((Grid[x][0] == Grid[x][1]) && (Grid[x][1] == Grid[x][2]))\n \t\t\t\tif(Grid[x][0] != 0 && Grid[x][1] != 0 && Grid[x][2] != 0)\n \t\t\t\t\treturn Grid[x][0];\n \t\t}\n \t\tfor(int y=0;y<3;y++) {\n \t\t\tif((Grid[0][y] == Grid[1][y]) && (Grid[1][y] == Grid[2][y])) \n \t\t\t\tif(Grid[0][y] != 0 && Grid[1][y] != 0 && Grid[2][y] != 0)\n \t\t\t\t\treturn Grid[0][y];\n \t\t}\n \t\tif(Grid[0][0] == Grid[1][1] && Grid[1][1] == Grid[2][2]) \n \t\t\tif(Grid[0][0] != 0 && Grid[1][1] != 0 && Grid[2][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tif(Grid[2][0] == Grid[1][1] && Grid[1][1] == Grid[0][2])\n \t\t\tif(Grid[2][0] != 0 && Grid[1][1] != 0 && Grid[0][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tfor(int y = 0;y<3;y++) {\n \t\t\t\tif(Grid[x][y] == 0)\n \t\t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t\treturn 3;\t\t\n \t}", "public Result determineOutcome() {\n for (int row = 0; row < TicTacToeModel.BOARD_DIMENSION; row++) {\n if (rowScore[row] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (rowScore[row] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n for (int col = 0; col < TicTacToeModel.BOARD_DIMENSION; col++) {\n if (colScore[col] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (colScore[col] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n if (leftDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (rightDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (leftDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n if (rightDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n\n if (freeSpace == 0) return Result.DRAW;\n\n return Result.INCOMPLETE;\n }", "public int getGameSituation() {\n\t\treturn gameSituation;\n\t}", "public GameState won() {\n if ( (board[0][0] != TileState.BLANK) && (board[0][0] == board[0][1]) && (board[0][0] == board[0][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[1][0] != TileState.BLANK) && (board[1][0] == board[1][1]) && (board[1][0] == board[1][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[2][0] != TileState.BLANK) && (board[2][0] == board[2][1]) && (board[2][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][1]) && (board[0][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ( (board[0][2] != TileState.BLANK) && (board[0][2] == board[1][1]) && (board[0][2] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][0]) && (board[0][0] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][1] != TileState.BLANK) && (board[0][1] == board[1][1]) && (board[0][1] == board[2][1])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][2] != TileState.BLANK) && (board[0][2] == board[1][2]) && (board[0][2] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if (movesPlayed == 9)\n return GameState.DRAW;\n return GameState.IN_PROGRESS;\n }", "public double heuristic(game Game){\n // int l[] = {0,1};\n // board b = Game.getBoard();\n // tic smallBoard = b.getState(l); \n \n /* if O wins the game */\n if(Game.getState() == 2){return 99;}\n \n /* X wins the game */\n if(Game.getState() == 1){return -99;}\n \n return 0;\n }", "public IGameAlgo.GameState getGameState (GameBoard.GameMove move){\n\t\t/*\n\t\t * If last move made by computer,check if computer wins.\n\t\t */\n\t\tif(this.board[lastMove.getRow()][lastMove.getColumn()]==BoardSigns.COMPUTER.getSign()) {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[0][1] == BoardSigns.COMPUTER.getSign() && board[0][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][0] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_LOST;\t\t\t\t\t\t \n\t\t}\n\t\t/*\n\t\t * If last move made by player,check if player wins.\n\t\t */\n\t\telse {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[0][1] == BoardSigns.PLAYER.getSign() && board[0][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][0] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_WON;\t\n\t\t}\n\t\t/*\n\t\t * No one wins,check if in progress or game ends with tie.\n\t\t */\n\t\t\n\t\t //check if exist empty spots. \n\t\t\tfor(int i=0;i<3;i++)\n\t\t\tfor(int j=0;j<3;j++)\n\t\t\t\tif(board[i][j]==TicTacTow.BoardSigns.BLANK.getSign()) \n\t\t\t\t return GameState.IN_PROGRESS;\n\t\t\treturn GameState.TIE;\t\t\t\n\t}", "@Test\n public void isGameOverNoWhite()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n\n for (int y = 0; y < 3; y++)\n {\n for (int x = 0; x < 8; x++)\n {\n if ((x % 2) != (y % 2))\n {\n final CheckersPosition position = CheckersPosition.findByCoordinates(x, y);\n environment.removeToken(position);\n }\n }\n }\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(12));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(0));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n }", "private boolean checkGameStatus() {\n int res = model.getWinner();\n if (res == Model.DRAW) {\n draw();\n return false;\n } else if (res == Model.WHITE) {\n whiteScore++;\n view.getPrompt().setText(whiteName + \" win!\");\n prepareRestart();\n return false;\n } else if (res == Model.BLACK) {\n blackScore++;\n view.getPrompt().setText(blackName + \" win!\");\n prepareRestart();\n return false;\n }\n return true;\n }", "public static String checkEndGame(){\n\t\tif(turn.equals(\"white\") && king.whiteKingCheck == true){\n\t\t\tif(endGame.checkMate(board, \"white\")){\n\t\t\t\tincrementPoints(\"black\");\n\t\t\t\treturn \"Check Mate! Black Wins!\\n Press OK to start new game\";\n\t\t\t}\n\t\t}\n\t\tif(turn.equals(\"black\") && king.blackKingCheck == true){\n\t\t\tif(endGame.checkMate(board, \"black\")){\n\t\t\t\tincrementPoints(\"white\");\n\t\t\t\treturn \"Check Mate! White Wins!\\n Press OK to start new game\";\n\t\t\t}\n\t\t}\n\t\treturn \"noCheckMate\";\n\t}", "public boolean checkForVictory() {\n // keep track of whether we have seen any pieces of either color.\n boolean anyWhitePieces = false;\n boolean anyRedPieces = false;\n // iterate through each row\n for (Row row : this.redBoard) {\n // whether we iterate through the red or white board does not matter; they contain the same pieces, just\n // in a different layout\n // iterate through each space in a row\n for (Space space : row) {\n // if there is a piece on this space\n if (space.getPiece() != null) {\n if (space.getPiece().getColor() == Piece.COLOR.RED) {\n // and if it's red, we have now seen at least one red piece\n anyRedPieces = true;\n } else if (space.getPiece().getColor() == Piece.COLOR.WHITE) {\n // and if it's white, we have now seen at least one white piece\n anyWhitePieces = true;\n }\n }\n }\n }\n // if we haven't seen any pieces of a color, then the other player has won\n if (!anyRedPieces) {\n // white player has won\n markGameAsDone(getWhitePlayer().getName() + \" has captured all the pieces.\");\n return true;\n } else if (!anyWhitePieces) {\n // red player has won\n markGameAsDone(getRedPlayer().getName() + \" has captured all the pieces.\");\n return true;\n }\n return false;\n }", "public int checkForWin() \r\n {\r\n \twinner = null;\r\n \tint winrole = -1;\r\n \tif(isBoardFull()){\r\n \t\tint white = 0;\r\n \t\tint black = 0;\r\n\t\t\tfor(int i = 0; i < boardsize; ++i){\r\n\t\t\t\tfor(int j = 0; j<boardsize; ++j){\r\n\t\t\t\t\tif(board[i][j] == 0){\r\n\t\t\t\t\t\twhite++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(board[i][j] == 1){\r\n\t\t\t\t\t\tblack++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(white > black){\r\n\t\t\t\twinrole = 0;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\t\r\n\t\t\telse if(black > white){\r\n\t\t\t\twinrole = 1;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\twinrole=2;\r\n\t\t\t}\r\n\t\t\treturn winrole;\r\n \t}\r\n \treturn -1;\r\n }", "private boolean testIfGameIsValid(ChesspairingGame game) {\n\t\tChesspairingPlayer playerA = game.getWhitePlayer();\n\t\tString keyA = playerA.getPlayerKey();\n\t\tChesspairingPlayer playerB = game.getBlackPlayer();\n\t\tString keyB = playerB.getPlayerKey();\n\t\tif (keyA.equals(keyB)) {\n\t\t\tthrow new IllegalStateException(\"You shuld never try to pare a players agains himself\");\n\t\t}\n\t\t/**\n\t\t * two players shall not meet more than once\n\t\t */\n\t\tList<String> partnersA = partnerHistory.get(keyA);\n\t\tif (partnersA.contains(keyB)) {\n\t\t\treturn false;\n\t\t}\n\t\tList<String> partnersB = partnerHistory.get(keyB);\n\t\tif (partnersB.contains(keyA)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * the color difference is the number of games played with white minus\n\t\t * the number of games played with black\n\t\t * \n\t\t * -2 < diff < 2\n\t\t */\n\t\tint aHistoryColor = getColorDifference(keyA);\n\t\tint bHistoryColor = getColorDifference(keyB);\n\n\t\t// if a is white\n\t\tint aWhite = aHistoryColor + 1;\n\t\tint bBlach = bHistoryColor - 1;\n\t\tboolean aPlaysWite = false;\n\t\tif ((-2 < aWhite) && (aWhite < 2) && (-2 < bBlach) && (bBlach < 2)) {\n\t\t\taPlaysWite = true;\n\t\t}\n\n\t\t// if a is black\n\t\tboolean aPlaysBlack = false;\n\t\tif (!aPlaysWite) {\n\t\t\tint aBlack = aHistoryColor - 1;\n\t\t\tint bWhite = bHistoryColor + 1;\n\t\t\tif ((-2 < aBlack) && (aBlack < 2) && (-2 < bWhite) && (bWhite < 2)) {\n\t\t\t\taPlaysBlack = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!aPlaysWite && !aPlaysBlack) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// basic tests have passed. time to return true\n\t\treturn true;\n\t}", "public int status() \n {\n \tif (stonesCount(7,12) != 0 && stonesCount(0,5) != 0)\n \t\treturn GAME_NOT_OVER;\n \telse if (stonesCount(7,13) < stonesCount(0,6))\n \t\treturn GAME_OVER_WIN;\n \telse if (stonesCount(7,13) == stonesCount(0,6))\n \t\treturn GAME_OVER_TIE;\n \telse\n \t\treturn GAME_OVER_LOSE;\n }", "public void finishGame() {\n boolean didWin = true;\n\n int dimension = mBoardSquaresGrid.length;\n\n for(int i = 0; i < dimension; i++) {\n for(int j = 0; j < dimension; j++) {\n TileView tileView = mTileViewsGrid[i][j];\n BoardSquare boardSquare = mBoardSquaresGrid[i][j];\n\n int state = tileView.getState();\n boolean doesContainMine = boardSquare == null ? false : boardSquare.doesContainMine();\n\n if(state == TileView.COVERED) {\n // User did not place a flag over a mine.\n if(doesContainMine) {\n didWin = false;\n }\n\n // Uncover all tiles without flags.\n tileView.setState(TileView.UNCOVERED);\n }\n else if(state == TileView.FLAGGED_AS_MINE) {\n if(!doesContainMine) {\n // Uncover flags not covering mines.\n tileView.setState(TileView.UNCOVERED);\n }\n }\n }\n }\n publishGameResult(didWin);\n }", "@Override\r\n\tpublic BoardEvaluation evaluate(IBoard board, PlayerColor color) {\n\t\tBoardAnalyzer analyzer = board.getAnalyzer();\r\n\r\n\t\tBoardEvaluation e = new BoardEvaluation();\r\n\r\n\t\tint white = 0;\r\n\t\tint black = 0;\r\n\r\n\t\tList<IPiece> pieces = board.getAllPieces();\r\n\r\n\t\tint[] pawnCount = new int[2];\r\n\t\tint[] bishopCount = new int[2];\r\n\t\tint[] knightCount = new int[2];\r\n\t\tfor (IPiece piece : pieces) {\r\n\t\t\tif (piece.getColor() == PlayerColor.WHITE) {\r\n\t\t\t\twhite += piece.getPieceValue();\r\n\t\t\t} else {\r\n\t\t\t\tblack += piece.getPieceValue();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tint index = piece.getColor().ordinal();\r\n\t\t\tif (piece instanceof Pawn) {\r\n\t\t\t\tpawnCount[index]++;\r\n\t\t\t} else if (piece instanceof Bishop) {\r\n\t\t\t\tbishopCount[index]++;\r\n\t\t\t} else if (piece instanceof Knight) {\r\n\t\t\t\tknightCount[index]++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tint totalPieceValue = white + black;\r\n\t\tint blackIndex = PlayerColor.BLACK.ordinal();\r\n\t\tint whiteIndex = PlayerColor.WHITE.ordinal();\r\n\t\tblack += extraBishopValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\tblack += extraKnightValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\tblack += extraPawnValue(totalPieceValue, bishopCount[blackIndex]);\r\n\t\twhite += extraBishopValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\t\twhite += extraKnightValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\t\twhite += extraPawnValue(totalPieceValue, bishopCount[whiteIndex]);\r\n\r\n\t\t// Stalemate\r\n\t\tif (analyzer.isStalemate()) {\r\n\t\t\te.draw = true;\r\n\t\t\tblack += 90;\r\n\t\t} else if (analyzer.canClaimDraw()) {\r\n\t\t\tif (board.getTurn() == PlayerColor.WHITE) {\r\n\t\t\t\t// White can stop black from claiming draw\r\n\t\t\t\t//black += 50;\r\n\t\t\t} else {\r\n\t\t\t\t// Black can claim draw immediately!\r\n\t\t\t\te.draw = true;\r\n\t\t\t\tblack += 4;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Checkmate ?\r\n\t\tif (analyzer.isCheckmate(PlayerColor.BLACK)) {\r\n\t\t\twhite += 100;\r\n\t\t\te.checkmate = true;\r\n\t\t}\r\n\r\n\t\tif (analyzer.isCheckmate(PlayerColor.WHITE)) {\r\n\t\t\tblack += 100;\r\n\t\t\te.checkmate = true;\r\n\t\t}\r\n\r\n\t\tif (color == null) {\r\n\t\t\te.value = white - black;\r\n\t\t} else if (color == PlayerColor.BLACK) {\r\n\t\t\te.value = Math.abs(white - FULL_BOARD_VALUE);\r\n\t\t} else {\r\n\t\t\te.value = Math.abs(black - FULL_BOARD_VALUE);\r\n\t\t}\r\n\r\n\t\treturn e;\r\n\t}", "public static String play(GuessWhoGame g) {\n if (g.hairIsColor(Color.BROWN)) {\n if (g.eyeIsColor(Color.BROWN)) {\n if (g.shirtIsColor(Color.GREEN)) {\n if (g.isWearingGlasses()) {\n return \"Bob\";\n } else {\n return \"Dave\";\n }\n } else {\n if (g.shirtIsColor(Color.RED)) {\n if (g.isWearingHat()) {\n return \"Robert\";\n } else {\n return \"Quinn\";\n }\n } else {\n return \"Zander\";\n }\n }\n } else {\n if (g.shirtIsColor(Color.RED)) {\n if (g.eyeIsColor(Color.BLUE)) {\n if (g.isWearingGlasses()) {\n if (g.isSmiling()) {\n return \"Mallie\";\n } else {\n return \"Wendy\";\n }\n } else {\n return \"Nick\";\n }\n } else {\n if (g.isWearingGlasses()) {\n return \"Emily\";\n } else {\n return \"Philip\";\n }\n }\n } else {\n if (g.shirtIsColor(Color.GREEN)) {\n if (g.eyeIsColor(Color.BLUE)) {\n return \"Alice\";\n } else {\n if (g.eyeIsColor(Color.GREEN)) {\n return \"Frank\";\n } else {\n return \"Isabelle\";\n }\n }\n } else {\n return \"Tucker\";\n }\n }\n }\n } else {\n if (g.eyeIsColor(Color.BROWN)) {\n if (g.hairIsColor(Color.BLACK)) {\n if (g.isWearingGlasses()) {\n return \"Xavier\";\n } else {\n if (g.shirtIsColor(Color.BLUE)) {\n return \"Olivia\";\n } else {\n return \"Ursula\";\n }\n }\n } else {\n if (g.hairIsColor(Color.BLOND)) {\n if (g.shirtIsColor(Color.RED)) {\n return \"Henry\";\n } else {\n return \"Jack\";\n }\n } else {\n if (g.isWearingHat()) {\n return \"Sarah\";\n } else {\n return \"Victor\";\n }\n }\n }\n } else {\n if (g.hairIsColor(Color.BLACK)) {\n if (g.eyeIsColor(Color.BLUE)) {\n if (g.isSmiling()) {\n return \"Gertrude\";\n } else {\n return \"Carol\";\n }\n } else {\n return \"Karen\";\n }\n } else {\n if (g.shirtIsColor(Color.BLUE)) {\n return \"Larry\";\n } else {\n return \"Yasmine\";\n }\n }\n } \n }\n \n //return null;\n }", "@Test\n public void determineWinnerNoWhiteMove()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final Agent agentRed = agents.get(0);\n final Agent agentWhite = agents.get(1);\n final CheckersEnvironment environment = new CheckersEnvironment();\n\n environment.placeToken(CheckersPosition.P26, King.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P30, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P31, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P21, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P25, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P29, King.WHITE.withAgent(agentWhite));\n // System.out.println(environment);\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(3));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(3));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n assertThat(adjudicator.determineWinner(environment), is(agentRed));\n }", "public boolean isSolved() {\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(1, 1) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(2, 1) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(3, 1) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(1, 2) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(3, 2) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(1, 3) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(2, 3) != RubiksColor.BLUE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.RIGHT).getSquare(3, 3) != RubiksColor.BLUE) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(1, 1) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(2, 1) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(3, 1) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(1, 2) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(3, 2) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(1, 3) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(2, 3) != RubiksColor.YELLOW) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.BACK).getSquare(3, 3) != RubiksColor.YELLOW) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(1, 1) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(2, 1) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(3, 1) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(1, 2) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(3, 2) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(1, 3) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(2, 3) != RubiksColor.GREEN) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.LEFT).getSquare(3, 3) != RubiksColor.GREEN) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(1, 1) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(2, 1) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(3, 1) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(1, 2) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(3, 2) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(1, 3) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(2, 3) != RubiksColor.WHITE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.FRONT).getSquare(3, 3) != RubiksColor.WHITE) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(1, 1) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(2, 1) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(3, 1) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(1, 2) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(3, 2) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(1, 3) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(2, 3) != RubiksColor.ORANGE) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.UP).getSquare(3, 3) != RubiksColor.ORANGE) return false;\n\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(1, 1) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(2, 1) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(3, 1) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(1, 2) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(3, 2) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(1, 3) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(2, 3) != RubiksColor.RED) return false;\n if (getRubiksFace(RubiksFace.RubiksFacePosition.DOWN).getSquare(3, 3) != RubiksColor.RED) return false;\n\n return true;\n }", "private int evaluateState() {\r\n\r\n\t\t// add up score\r\n\t\t//\r\n\t\tint scoreWhite = 0;\r\n\t\tint scoreBlack = 0;\r\n\t\tfor (Piece piece : this.chessGame.getPieces()) {\r\n\t\t\tif(piece.getColor() == Piece.COLOR_BLACK){\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreBlack +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else if( piece.getColor() == Piece.COLOR_WHITE){\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPieceType(piece.getType());\r\n\t\t\t\tscoreWhite +=\r\n\t\t\t\t\tgetScoreForPiecePosition(piece.getRow(),piece.getColumn());\r\n\t\t\t}else{\r\n\t\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\t\"unknown piece color found: \"+piece.getColor());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// return evaluation result depending on who's turn it is\r\n\t\tint gameState = this.chessGame.getGameState();\r\n\t\t\r\n\t\tif( gameState == ChessGame.GAME_STATE_BLACK){\r\n\t\t\treturn scoreBlack - scoreWhite;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_WHITE){\r\n\t\t\treturn scoreWhite - scoreBlack;\r\n\t\t\r\n\t\t}else if(gameState == ChessGame.GAME_STATE_END_WHITE_WON\r\n\t\t\t\t|| gameState == ChessGame.GAME_STATE_END_BLACK_WON){\r\n\t\t\treturn Integer.MIN_VALUE + 1;\r\n\t\t\r\n\t\t}else{\r\n\t\t\tthrow new IllegalStateException(\"unknown game state: \"+gameState);\r\n\t\t}\r\n\t}", "@Override\n public int getWinner() {\n /*\n * To please the test as well as the game\n * Temporarily change the turn colour\n */\n int temp;\n if (whoseTurn() == RED) {\n temp = YELLOW;\n } else {\n temp = RED;\n }\n\n //test horizontally\n //set x to 1 as the placed counter will always be correct\n int x = 1;\n int i = 1;\n //to check if zero has been found\n boolean leftZeroFound = false;\n boolean rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check to right of last placed\n if (!rightZeroFound && inBounds(0, i)\n && board[lastPlacedRow][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check to left of last placed\n if (!leftZeroFound && inBounds(0, -i)\n && board[lastPlacedRow][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check vertically\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n boolean zeroFound = false;\n while (!zeroFound) {\n //check below last placed\n if (inBounds(-i, 0) && board[lastPlacedRow - i][lastPlacedCol] == temp) {\n x++;\n } else {\n zeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top right diagonal\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top right diagonal\n if (!rightZeroFound && inBounds(i, i)\n && board[lastPlacedRow + i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check bottom left\n if (!leftZeroFound && inBounds(-i, -i)\n && board[lastPlacedRow - i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top left\n //set x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top left\n if (!leftZeroFound && inBounds(i, -i)\n && board[lastPlacedRow + i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n //check bottom right\n if (!rightZeroFound && inBounds(-i, i)\n && board[lastPlacedRow - i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //return Empty if a winner has not been found\n return EMPTY;\n }", "public int evaluate(int[][] gameBoard) {\n for (int r = 0; r < 3; r++) {\n if (gameBoard[r][0] == gameBoard[r][1] && gameBoard[r][1] == gameBoard[r][2]) {\n if (gameBoard[r][0] == ai)\n return +10;\n else if (gameBoard[r][0] == human)\n return -10;\n }\n }\n // Checking for Columns for victory.\n for (int c = 0; c < 3; c++) {\n if (gameBoard[0][c] == gameBoard[1][c] && gameBoard[1][c] == gameBoard[2][c]) {\n //gameLogic.getWinType();\n if (gameBoard[0][c] == ai)\n return +10;\n else if (gameBoard[0][c] == human)\n return -10;\n }\n }\n // Checking for Diagonals for victory.\n if (gameBoard[0][0] == gameBoard[1][1] && gameBoard[1][1] == gameBoard[2][2]) {\n if (gameBoard[0][0] == ai)\n return +10;\n else if (gameBoard[0][0] == human)\n return -10;\n }\n if (gameBoard[0][2] == gameBoard[1][1] && gameBoard[1][1] == gameBoard[2][0]) {\n if (gameBoard[0][2] == ai)\n return +10;\n else if (gameBoard[0][2] == human)\n return -10;\n }\n // Else if none of them have won then return 0\n return 0;\n }", "public int checkForWinner() {\n\n // Check horizontal wins\n for (int i = 0; i <= 6; i += 3)\t{\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+1] == HUMAN_PLAYER &&\n mBoard[i+2]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+1]== COMPUTER_PLAYER &&\n mBoard[i+2] == COMPUTER_PLAYER)\n return 3;\n }\n\n // Check vertical wins\n for (int i = 0; i <= 2; i++) {\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+3] == HUMAN_PLAYER &&\n mBoard[i+6]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+3] == COMPUTER_PLAYER &&\n mBoard[i+6]== COMPUTER_PLAYER)\n return 3;\n }\n\n // Check for diagonal wins\n if ((mBoard[0] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[8] == HUMAN_PLAYER) ||\n (mBoard[2] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[6] == HUMAN_PLAYER))\n return 2;\n if ((mBoard[0] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[8] == COMPUTER_PLAYER) ||\n (mBoard[2] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[6] == COMPUTER_PLAYER))\n return 3;\n\n // Check for tie\n for (int i = 0; i < BOARD_SIZE; i++) {\n // If we find a number, then no one has won yet\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER)\n return 0;\n }\n\n // If we make it through the previous loop, all places are taken, so it's a tie\n return 1;\n }", "private void checkVictory() {\n\t\tboolean currentWin = true;\n\t\t\n\t\t//Vertical win\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][yGuess] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Horizontal win\n\t\tcurrentWin = true;\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[xGuess][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Top left bottom right diagonal win\n\t\tcurrentWin = true;\n\t\tif (xGuess == yGuess){\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t}\n\t\t\n\t\t//Bottom left top right diagonal win\n\t\tcurrentWin = true;\n\t\tif (yGuess + xGuess == DIVISIONS - 1){\n\t\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\t\tif (gameArray[i][(DIVISIONS - 1) -i] != currentPlayer){\n\t\t\t\t\tcurrentWin = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentWin){\n\t\t\t\tgameWon = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "private int evaluate(Board board)\n {\n if (computerWin(board))\n return 4*size;\n else if (playerWin(board))\n return -4*size;\n else if (draw(board))\n return 3*size;\n else\n return count(board, COMPUTER);\n }", "public void solveGame() {\n\t\tlosingStates = new HashSet<S>();\n\t\t\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tList<Set<S>> uncontrollableSuccessors = new ArrayList<Set<S>>();\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> currentUncontrollableSuccesors;\n\t\tSet<S> currentSet; \n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\tcurrentUncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\t\t\tcurrentSet = new HashSet<S>();\n\t\n\t\t\tif(!relaxAllControllables){\n\t\t\t\tfor(S s: currentUncontrollableSuccesors){\n\t\t\t\t\tif((!relaxOnAssumptions || (!assumptionsStates.contains(s) || assumptionsStates.contains(state))\n\t\t\t\t\t\t\t&& (!relaxSelfLoops || (!s.equals(state)))))\n\t\n\t\t\t\t\t\tcurrentSet.add(s);\n\t\t\t\t}\n\t\t\t}\n\t\t\t uncontrollableSuccessors.add(currentSet);\n\t\t\t isUncontrollable[indexCount] = currentSet.size() > 0;\n\t\t\t indexCount+=1;\n\t\t}\n\n\t\tlosingStates.addAll(game.getStates());\n\t\t\n\t\tSet<S> currentLosingStates;\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t\tcurrentLosingStates\t= new HashSet<S>();\n\t\t\t\n\t\t\t// Handle the pending states\n\t\t\twhile (!losing.isEmpty()) {\n\t\t\t\tS state = losing.poll();\n\n\t\t\t\t\n\t\t\t\tcurrentLosingStates.add(state);\n\n\t\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\t\tfor (S pred : predecessors) {\n\t\t\t\t\tif(losing.contains(pred) || currentLosingStates.contains(pred))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\n\t\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t\t//if(i == -1)\n\t\t\t\t\t\t//continue;\n\t\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tuncontrollableSuccessors.get(i).remove(state);\n\t\t\t\t\t\tif(uncontrollableSuccessors.get(i).isEmpty())\n\t\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tlosingStates.retainAll(currentLosingStates);\n\t\t\t\n\t\t}\n\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "private boolean winningBoard(char[][] board){\n for(int i = 0; i < boardHeight; i++ ){\n for(int j = 0; j < boardWidth; j++) {\n\n //if white was made it to the other side\n if(board[i][j] == 'P' && i == 0){\n return true;\n }\n\n //if black has made it to the other side\n if(board[i][j] == 'p' && i == boardHeight -1){\n return true;\n }\n }\n }\n //no winners\n return false;\n }", "protected boolean processGameEnd(int gameNumber, String whiteName, String blackName, String reason, String result){return false;}", "private void getWinner() {\r\n int nWhite = 0, nBlack = 0;\r\n if(nextPlayer.getChecks() == 0 && nextPlayer.getQueens() == 0){\r\n winner = currentPlayer;\r\n }\r\n else if(currentPlayer.getQueens() == nextPlayer.getQueens()){\r\n for (int i = 1; i<8; i++){\r\n for (int x = 0; x<8; x++) {\r\n if (checks[i][x] == 1) nBlack++;\r\n if (checks[7 - i][x] == 2) nWhite++;\r\n }\r\n if (nWhite>nBlack) winner = getPlayer(WHITE);\r\n else if(nBlack>nWhite)winner = getPlayer(BLACK);\r\n nWhite = 0;\r\n nBlack = 0;\r\n }\r\n }\r\n else if (currentPlayer.getQueens() > nextPlayer.getQueens()){ winner = currentPlayer;}\r\n else{winner = nextPlayer; }\r\n }", "private boolean checkForBigGameWin(){\n boolean truth = false;\n if (checkGameWin(getLettersOfAllGames())){\n truth = true;\n }\n return truth;\n }", "public boolean checkForEndgame() {\n\t\tCalculatePossibleMoves(true);\n\t\tint blackMoves = getNumberOfPossibleMoves();\n\t\tCalculatePossibleMoves(false);\n\t\tint redMoves = getNumberOfPossibleMoves();\n\t\t\n\t\tif (blackMoves == 0 && redMoves == 0)\n\t\t\treturn true;\n\t\treturn false;\n\t}", "boolean gameOver() {\n return piecesContiguous(BP) || piecesContiguous(WP);\n }", "public static int gameOver(Node nd){\n\t\tint win;\n\t\tfor(int i=0; i<6; i++){\n\t\t\tfor(int j=0; j<7; j++){\n\t\t\t\tif((win = utilVert(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\n\t\t\t\tif((win = utilHori(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\n\t\t\t\tif((win = utilRDiag(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\n\t\t\t\tif((win = utilLDiag(nd,i,j)) != 0){\n\t\t\t\t\tif(win == -512)\n\t\t\t\t\t\treturn -512;\n\t\t\t\t\telse if(win == 512)\n\t\t\t\t\t\treturn 512;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(fullBoard(nd))\n\t\t\treturn 1;\n\n\t\treturn 0;\n\t}", "private static String gameStatus(char[][] board){\n\t\t\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\t// check horizontal lines && vertical lines for player x\n\t\t\tif ((board[i][0] == 'X' && board[i][1] == 'X' && board[i][2] == 'X') || \n\t\t\t\t\t(board[0][i] == 'X' && board[1][i] == 'X' && board[2][i] == 'X')){\n\t\t\t\twinner = 'X';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for x\n\t\tif ((board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X') || \n\t\t\t\t(board[0][2] == 'X' && board[1][1] == 'X' && board[2][0] == 'X')){\n\t\t\twinner = 'X';\n\t\t\treturn \"true\";\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 3 ; i++) {\n\t\t\t// check horizontal and vertical lines for player o\n\t\t\tif ((board[i][0] == 'O' && board[i][1] == 'O' && board[i][2] == 'O') || \n\t\t\t\t\t(board[0][i] == 'O' && board[1][i] == 'O' && board[2][i] == 'O')){\n\t\t\t\twinner = 'O';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for o\n\t\tif ((board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O') || \n\t\t\t\t(board[0][2] == 'O' && board[1][1] == 'O' && board[2][0] == 'O')){\n\t\t\twinner = 'O';\n\t\t\treturn \"true\";\n\t\t}\n\n\t\t// check for tie\n\t\tint emptyCells = 9;\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\tfor (int j = 0; j < 3; j++){\n\t\t\t\tif (board[i][j]!='\\0') emptyCells -= 1;\t\t\n\t\t\t}\n\t\t}\n\t\t// if all cells are filled, game is over with a tie\n\t\tif (emptyCells == 0) return \"tie\";\n\n\t\t// otherwise game is not over and return false\n\t\t//printBoard(board);\n\n\t\treturn \"false\";\n\t}", "public int checkWin(){\n //check for horizontal and vertical wins\n for(int i=0; i<3; i++){\n if(gameBoard[i][0].equals(\"O\") && gameBoard[i][1].equals(\"O\") && gameBoard[i][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[i][0].equals(\"X\") && gameBoard[i][1].equals(\"X\") && gameBoard[i][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][i].equals(\"O\") && gameBoard[1][i].equals(\"O\") && gameBoard[2][i].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][i].equals(\"X\") && gameBoard[1][i].equals(\"X\") && gameBoard[2][i].equals(\"X\")){\n return 2;\n }\n }\n //check for both diagonal cases\n if(gameBoard[0][0].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][2].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][0].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][0].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][2].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][0].equals(\"X\")){\n return 2;\n }\n return 0;\n }", "private void winCondition(){\n if(cleared==(int)grid.clearedToWin){\n winGame();\n }\n }", "public boolean computerGuess()\r\n\t{\r\n\t\tboolean isWhite;\r\n\t\tint randomBool = (int) (Math.random()*50);\r\n\t\tif(randomBool<25)\r\n\t\t\tisWhite = true;\r\n\t\telse\r\n\t\t\tisWhite = false;\r\n\t\twhile(newGame.containsColor(isWhite) == false)\r\n\t\t{\r\n\t\t\trandomBool = (int) (Math.random()*50);\r\n\t\t\tif(randomBool<25)\r\n\t\t\t\tisWhite = true;\r\n\t\t\telse\r\n\t\t\t\tisWhite = false;\r\n\t\t}\r\n\t\tint randomPanel = (int) (Math.random()*newGame.getUserHandLength());\r\n\t\t//System.out.println(randomPanel);\r\n\t\tint randomGuess = (int) (Math.random()*12);\r\n\t\tif(newGame.getCompHand().contains(new Panel(isWhite,randomGuess,false)))\r\n\t\t{\r\n\t\t\tif(newGame.getUserHand().getPanel(randomPanel).compareTo(new Panel(isWhite,randomGuess,false)) == 0)\r\n\t\t\t\treturn true;\r\n\t\t\telse \r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean gameOver(){\n\t\tfor(int i = 1; i < well.length-1; i++)\n\t\t\tif(well[i][1] != Color.WHITE){\n\t\t\t\twriteScoreToFile();\n\t\t\t\treturn true;\n\t\t\t}\n\t\treturn false;\n\t}", "public boolean isBoardSolved() {\n for (int goal : goalCells) {\n if (!((board[goal] & 15) == BOX_ON_GOAL)) {\n return false;\n }\n }\n return true;\n }", "public boolean meWin(){\n return whitePieces.size() > blackPieces.size() && isWhitePlayer;\n }", "public static void continueGame(boolean humanChecker,boolean computerColor) {\n\t\t\n\t\t\n\t\tStdDraw.setPenRadius(0.05);\n\t\t// Done button\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\tStdDraw.filledRectangle(500, 100, 85, 55);\n\t\tStdDraw.setPenColor(StdDraw.ORANGE);\n\t\tStdDraw.filledRectangle(500, 100, 80, 50);\n\n\t\t// Toggle Blue\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\tStdDraw.filledRectangle(700, 900, 55, 55);\n\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\tStdDraw.filledRectangle(700, 900, 50, 50);\n\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\tStdDraw.filledRectangle(900, 900, 55, 55);\n\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\tStdDraw.filledRectangle(900, 900, 50, 50);\n\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\tStdDraw.text(700, 900, \"BLUE\");\n\t\tStdDraw.text(900, 900, \"RED\");\n\t\tStdDraw.text(500, 100, \"DONE\");\n\n\t\tStdDraw.setPenColor(StdDraw.YELLOW);\n\t\tStdDraw.filledCircle(700, 980, 10);\n\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\tStdDraw.text(270, 900, \"Please click on a position to place a piece\");\n\t\tStdDraw.text(270, 870, \"Toggle the color of the piece you wish to place\");\n\t\t\n\t\t//creating objects for all the pieces that can be played\n\t\tpieceArray = new PlayerPiece[12];\n\t\tfor (int i = 0; i < 12; i++) {\n\t\t\tif (i < 6) {\n\t\t\t\tSixMensMorris.pieceArray[i] = new PlayerPiece(\"BLUE\", i + 1);\n\t\t\t} else {\n\t\t\t\tSixMensMorris.pieceArray[i] = new PlayerPiece(\"RED\", i + 1);\n\t\t\t}\n\t\t}\n\n\t\t//creating objects for each spot on the game board that a player can put a piece\n\t\tspots = new moveLocations[16];\n\t\tspots[0] = new moveLocations(185, 215, 785, 815);\n\t\tspots[1] = new moveLocations(485, 515, 785, 815);\n\t\tspots[2] = new moveLocations(785, 815, 785, 815);\n\t\tspots[3] = new moveLocations(785, 815, 485, 515);\n\t\tspots[4] = new moveLocations(785, 815, 185, 215);\n\t\tspots[5] = new moveLocations(485, 515, 185, 215);\n\t\tspots[6] = new moveLocations(185, 215, 185, 215);\n\t\tspots[7] = new moveLocations(185, 215, 485, 515);\n\t\tspots[8] = new moveLocations(335, 365, 635, 665);\n\t\tspots[9] = new moveLocations(485, 515, 635, 665);\n\t\tspots[10] = new moveLocations(635, 665, 635, 665);\n\t\tspots[11] = new moveLocations(635, 665, 485, 515);\n\t\tspots[12] = new moveLocations(635, 665, 335, 365);\n\t\tspots[13] = new moveLocations(485, 515, 335, 365);\n\t\tspots[14] = new moveLocations(335, 365, 335, 365);\n\t\tspots[15] = new moveLocations(335, 365, 485, 515);\n\n\t\t\n\t\tif(humanChecker){\n\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\n\t\t\tif(computerColor){\n\t\t\t\t\n\t\t\t\tStdDraw.text(700, 865, \"Comp\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tStdDraw.text(900, 865, \"Comp\");\n\t\t\t}\n\n\t\t}\n\t\tboolean mouseClicked3 = false;\n\t\tdouble xLocation3 = 0;\n\t\tdouble yLocation3 = 0;\n\t\tint color = 1; // Blue\n\t\tint num1 = 700;\n\t\tint num2 = 700;\n\t\tboolean mouseClicked = false;\n\t\tdouble xLocation = 0;\n\t\tdouble yLocation = 0;\n\t\t\n\t\tint bluePieces = 0;\n\t\tint redPieces = 0;\n\t\t\n\t\twhile (!mouseClicked3 || (!(mouseInRange(xLocation3, yLocation3, 415, 585, 45, 155)))) {\n\t\t\tmouseClicked3 = StdDraw.mousePressed();\n\t\t\txLocation3 = StdDraw.mouseX();\n\t\t\tyLocation3 = StdDraw.mouseY();\n\t\t\t\n\t\t\t//toggle button for which color the user wants to place onto the game board\n\t\t\tif (color == 1 && mouseClicked3 && (mouseInRange(xLocation3, yLocation3, 845, 955, 845, 955))) {\n\t\t\t\tStdDraw.setPenColor(StdDraw.YELLOW);\n\t\t\t\tStdDraw.filledCircle(900, 980, 10);\n\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\tStdDraw.filledCircle(700, 980, 10);\n\t\t\t\tcolor = 2;\n\t\t\t} else if (color == 2 && mouseClicked3 && (mouseInRange(xLocation3, yLocation3, 645, 755, 845, 955))) {\n\t\t\t\tStdDraw.setPenColor(StdDraw.YELLOW);\n\t\t\t\tStdDraw.filledCircle(700, 980, 10);\n\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\tStdDraw.filledCircle(900, 980, 10);\n\t\t\t\tcolor = 1;\n\t\t\t}\n\t\t\t\n\t\t\t//a bunch of ifs and else ifs to allow the user to place a piece on a specific spot\n\t\t\t//it alternates between movements for blue and movements for red\n\t\t\tmouseClicked = StdDraw.mousePressed();\n\t\t\txLocation = StdDraw.mouseX();\n\t\t\tyLocation = StdDraw.mouseY();\n\t\t\tif (!spots[0].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation, spots[0].getMinX(),\n\t\t\t\t\tspots[0].getMaxX(), spots[0].getMinY(), spots[0].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(200, 800, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(0);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(200, 800, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(0);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[0].changeOccupied();\n\t\t\t} else if (!spots[1].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[1].getMinX(), spots[1].getMaxX(), spots[1].getMinY(), spots[1].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(500, 800, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(1);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(500, 800, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(1);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[1].changeOccupied();\n\t\t\t} else if (!spots[2].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[2].getMinX(), spots[2].getMaxX(), spots[2].getMinY(), spots[2].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(800, 800, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(2);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(800, 800, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(2);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[2].changeOccupied();\n\t\t\t} else if (!spots[3].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[3].getMinX(), spots[3].getMaxX(), spots[3].getMinY(), spots[3].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(800, 500, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(3);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(800, 500, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(3);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[3].changeOccupied();\n\t\t\t} else if (!spots[4].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[4].getMinX(), spots[4].getMaxX(), spots[4].getMinY(), spots[4].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(800, 200, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(4);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(800, 200, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(4);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[4].changeOccupied();\n\t\t\t} else if (!spots[5].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[5].getMinX(), spots[5].getMaxX(), spots[5].getMinY(), spots[5].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(500, 200, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(5);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(500, 200, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(5);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[5].changeOccupied();\n\t\t\t} else if (!spots[6].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[6].getMinX(), spots[6].getMaxX(), spots[6].getMinY(), spots[6].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(200, 200, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(6);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(200, 200, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(6);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[6].changeOccupied();\n\t\t\t} else if (!spots[7].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[7].getMinX(), spots[7].getMaxX(), spots[7].getMinY(), spots[7].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(200, 500, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(7);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(200, 500, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(7);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[7].changeOccupied();\n\t\t\t} else if (!spots[8].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[8].getMinX(), spots[8].getMaxX(), spots[8].getMinY(), spots[8].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(350, 650, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(8);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(350, 650, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(8);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[8].changeOccupied();\n\t\t\t} else if (!spots[9].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[9].getMinX(), spots[9].getMaxX(), spots[9].getMinY(), spots[9].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(500, 650, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(9);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(500, 650, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(9);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[9].changeOccupied();\n\t\t\t} else if (!spots[10].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[10].getMinX(), spots[10].getMaxX(), spots[10].getMinY(), spots[10].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(650, 650, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(10);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(650, 650, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(10);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[10].changeOccupied();\n\t\t\t} else if (!spots[11].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[11].getMinX(), spots[11].getMaxX(), spots[11].getMinY(), spots[11].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(650, 500, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(11);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(650, 500, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(11);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[11].changeOccupied();\n\t\t\t} else if (!spots[12].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[12].getMinX(), spots[12].getMaxX(), spots[12].getMinY(), spots[12].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(650, 350, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(12);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(650, 350, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(12);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[12].changeOccupied();\n\t\t\t} else if (!spots[13].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[13].getMinX(), spots[13].getMaxX(), spots[13].getMinY(), spots[13].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(500, 350, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(13);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(500, 350, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(13);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[13].changeOccupied();\n\t\t\t} else if (!spots[14].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[14].getMinX(), spots[14].getMaxX(), spots[14].getMinY(), spots[14].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(350, 350, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(14);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(350, 350, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(14);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[14].changeOccupied();\n\t\t\t} else if (!spots[15].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\tspots[15].getMinX(), spots[15].getMaxX(), spots[15].getMinY(), spots[15].getMaxY())) {\n\t\t\t\tif (color == 1) {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\tStdDraw.filledCircle(350, 500, 35);\n\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(bluePieces<6){\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[bluePieces].changePiecePosition(15);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbluePieces++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\tStdDraw.filledCircle(350, 500, 35);\n\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\n\t\t\t\t\tif(redPieces+6<12){\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changeEnabled();\n\t\t\t\t\t\tSixMensMorris.pieceArray[redPieces+6].changePiecePosition(15);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tredPieces++;\n\t\t\t\t}\n\t\t\t\txLocation = 0;\n\t\t\t\tyLocation = 0;\n\t\t\t\tmouseClicked = false;\n\t\t\t\tspots[15].changeOccupied();\n\t\t\t}\n\t\t\txLocation = 0;\n\t\t\tyLocation = 0;\n\t\t\tmouseClicked = false;\n\n\t\t}\n\t\tmouseClicked3=false;\n\t\t//get rid of some shapes\n\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\tStdDraw.filledCircle(700, 980, 10);\n\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\tStdDraw.filledCircle(900, 980, 10);\n\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\tStdDraw.filledRectangle(500, 100, 105, 55);\n\t\tStdDraw.filledRectangle(700, 900, 705, 55);\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\n\t\t//checks if the setup they gave is valid\n\t\tif(!(redPieces < 3 || bluePieces < 3)&&!(redPieces > 6 || bluePieces > 6)){\n\t\t\tboolean w=true;\n\t\t\t\n\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\tStdDraw.text(500, 130, \"Who goes first?\");\n\t\t\t\n\t\t\tStdDraw.setPenColor(StdDraw.YELLOW);\n\t\t\tStdDraw.filledRectangle(360, 70, 40, 40);\n\t\t\tStdDraw.filledRectangle(640, 70, 40, 40);\n\n\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\tStdDraw.text(360, 70, \"BLUE\");\n\t\t\tStdDraw.text(640, 70, \"RED\");\n\t\t\t\n\t\t\tif(humanChecker){\n\t\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\t\n\t\t\t\tFont font = new Font(\"Sans Serif\", 16, 16);\n\t\t\t\tStdDraw.setFont(font);\n\t\t\t\tif(computerColor){\n\t\t\n\t\t\t\t\tStdDraw.text(361, 45, \"Comp\");\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\n\t\t\t\t\tStdDraw.text(639, 45, \"Comp\");\n\t\t\t\t}\n\t\t\t\tFont font1 = new Font(\"Sans Serif\", 20, 20);\n\t\t\t\tStdDraw.setFont(font1);\n\n\t\t\t}\n\t\t\t\n\t\t\tboolean mouseClicked4=false;\n\t\t\tdouble xLocation4 = 0;\n\t\t\tdouble yLocation4 = 0;\n\t\t\t//while loop to ask who's turn it is to go first\n\t\t\twhile(w){\n\t\t\t\tmouseClicked4 = StdDraw.mousePressed();\n\t\t\t\txLocation4 = StdDraw.mouseX();\n\t\t\t\tyLocation4 = StdDraw.mouseY();\n\t\t\t\tif(mouseClicked4&&SixMensMorris.mouseInRange(xLocation4, yLocation4, 320, 400, 30, 110)){\n\t\t\t\t\tSixMensMorris.whosFirst=true;//blue's turn first\n\t\t\t\t\tw=false;\n\t\t\t\t}\n\t\t\t\telse if(mouseClicked4&&SixMensMorris.mouseInRange(xLocation4, yLocation4, 600, 680, 30, 110)){\n\t\t\t\t\tSixMensMorris.whosFirst=false;//red's turn first\n\t\t\t\t\tw=false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmouseClicked4=false;\n\t\t\t\n\t\t\t//reset shapes\n\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\tStdDraw.filledRectangle(500, 130, 120, 25);\n\t\t\tStdDraw.filledRectangle(360, 70, 40, 40);\n\t\t\tStdDraw.filledRectangle(640, 70, 40, 40);\n\t\t\tStdDraw.filledCircle(80, 700, 35);\n\t\t\tStdDraw.filledCircle(80, 600, 35);\n\t\t\tStdDraw.filledCircle(80, 500, 35);\n\t\t\tStdDraw.filledCircle(80, 400, 35);\n\t\t\tStdDraw.filledCircle(80, 300, 35);\n\t\t\tStdDraw.filledCircle(80, 200, 35);\n\t\t\tStdDraw.filledCircle(920, 700, 35);\n\t\t\tStdDraw.filledCircle(920, 600, 35);\n\t\t\tStdDraw.filledCircle(920, 500, 35);\n\t\t\tStdDraw.filledCircle(920, 400, 35);\n\t\t\tStdDraw.filledCircle(920, 300, 35);\n\t\t\tStdDraw.filledCircle(920, 200, 35);\n\t\t\tint[][] mill={{0,1,2},{2,3,4},{4,5,6},{6,7,0},{8,9,10},{10,11,12},{12,13,14},{14,15,8}};\n\t\t\t//checks for mills in the setup so that when the game is played, it will already have record of a mill in a location\n\t\t\tint[] tempB=new int[3];\n\t\t\tfor(int P=0;P<mill.length;P++){\n\t\t\t\tint Row=0;\n\t\t\t\tfor(int T=0;T<3;T++){\n\t\t\t\t\tfor(int R=0;R<6;R++){\n\t\t\t\t\t\tif(SixMensMorris.pieceArray[R].getEnabled()&&SixMensMorris.pieceArray[R].getPiecePosition()==mill[P][T]){\n\t\t\t\t\t\t\ttempB[Row]=R;\n\t\t\t\t\t\t\tRow++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(Row==3){//blue mill\n\t\t\t\t\tgamePlay.blueArray[0]=tempB[0];\n\t\t\t\t\tgamePlay.blueArray[1]=tempB[1];\n\t\t\t\t\tgamePlay.blueArray[2]=tempB[2];\n\t\t\t\t\tgamePlay.firstMillIndex=P;\n\t\t\t\t\tgamePlay.AA=SixMensMorris.pieceArray[gamePlay.blueArray[0]].getPiecePosition();\n\t\t\t\t\tgamePlay.BB=SixMensMorris.pieceArray[gamePlay.blueArray[1]].getPiecePosition();\n\t\t\t\t\tgamePlay.CC=SixMensMorris.pieceArray[gamePlay.blueArray[2]].getPiecePosition();\n\t\t\t\t\tgamePlay.blueCountMill=2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tint[] tempR=new int[3];\n\t\t\tfor(int P=0;P<mill.length;P++){\n\t\t\t\tint Row1=0;\n\t\t\t\tfor(int T=0;T<3;T++){\n\t\t\t\t\tfor(int R=6;R<12;R++){\n\t\t\t\t\t\tif(SixMensMorris.pieceArray[R].getEnabled()&&SixMensMorris.pieceArray[R].getPiecePosition()==mill[P][T]){\n\t\t\t\t\t\t\ttempR[Row1]=R;//\n\t\t\t\t\t\t\tRow1++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(Row1==3){//red mill\n\t\t\t\t\tgamePlay.redArray[0]=tempR[0];\n\t\t\t\t\tgamePlay.redArray[1]=tempR[1];\n\t\t\t\t\tgamePlay.redArray[2]=tempR[2];\n\t\t\t\t\t\n\t\t\t\t\tgamePlay.secondMillIndex=P;\n\t\t\t\t\tgamePlay.A=SixMensMorris.pieceArray[gamePlay.redArray[0]].getPiecePosition();\n\t\t\t\t\tgamePlay.B=SixMensMorris.pieceArray[gamePlay.redArray[1]].getPiecePosition();\n\t\t\t\t\tgamePlay.C=SixMensMorris.pieceArray[gamePlay.redArray[2]].getPiecePosition();\n\t\t\t\t\tgamePlay.redCountMill=2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(humanChecker){\n\t\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\t\n\t\t\t\tif(computerColor){\n\t\t\t\t\tStdDraw.text(80, 820, \"Computer\");\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\n\t\t\t\t\tStdDraw.text(920, 820, \"Computer\");\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tboolean fixer=true;\n\t\t\tif(humanChecker){\n\t\t\t\tfixer=SixMensMorris.whosFirst;\n\t\t\t}\n\t\t\tG=new gamePlay();\n\t\t\tG.createGame(redPieces,bluePieces,humanChecker, fixer,computerColor,\"cont\");//calls on the game so that they can proceed\n\t\t}\n\t\telse{//errors in the setup that the user gave\n\t\t\tif (redPieces < 3 || bluePieces < 3){//not enough pieces\n\t\t\t\tStdDraw.text(500, 125, \"There must be a minimum of 3 pieces for each color!\");\n\t\t\t}\n\t\t\tif (redPieces > 6 || bluePieces > 6){//too many pieces\n\t\t\t\tStdDraw.text(500, 75, \"There cannot be more than 6 pieces of a color!\");\n\t\t\t}\n\t\t\tFont font = new Font(\"Sans Serif\",Font.BOLD,16);\n\t\t\tStdDraw.setFont(font);\n\t\t\tStdDraw.text(500, 905, \"Please Restart Game!\");\n\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\tStdDraw.filledRectangle(910, 60, 50, 40);\n\t\t}\n\t\t\n\t\t\n\t}", "public int evalBoard(){\n if (wins('o')){\n return 3;\n }\n // Return 0 if human wins\n else if (wins('b')){\n return 0;\n }\n //Return 2 if game is draw\n else if (isDraw()){\n return 2;\n }\n // Game is not a draw and no player has won. Game is still undecided.\n else {\n return 1;\n }\n }", "@Override\n protected String checkIfGameOver() {\n if(state.isGameOver() == -1) {\n return \"Blue team wins\";\n } else if(state.isGameOver() == 1) {\n return \"Red team wins\";\n } else {\n return null;\n }\n }", "public int hasBlackWon() {\n\t\tif(blackPieces == 0) {\n\t\t\treturn 1;\n\t\t} else if(whitePieces == 0) {\n\t\t\treturn 2;\n\t\t}\n\t\t\n\t\treturn 0;\n\t}", "public static void checkWinCondition() {\n\t\twin = false;\n\t\tif (curPlayer == 1 && arrContains(2, 4))\n\t\t\twin = true;\n\t\telse if (curPlayer == 2 && arrContains(1, 3))\n\t\t\twin = true;\n\t\tif (curPlayer == 2 && !gameLogic.Logic.arrContains(2, 4))\n\t\t\tP2P.gameLost = true;\n\t\telse if (gameLogic.Logic.curPlayer == 1 && !gameLogic.Logic.arrContains(1, 3))\n\t\t\tP2P.gameLost = true;\n\t\tif (P2P.gameLost == true) {\n\t\t\tif (gameLogic.Logic.curPlayer == 1)\n\t\t\t\tEndScreen.infoWindow.setText(\"<html><center><b><font size=25 color=black> Black player won! </font></b></center></html>\");\n\t\t\telse\n\t\t\t\tEndScreen.infoWindow.setText(\"<html><center><b><font size=25 color=black> Red player won! </font></b></center></html>\");\n\t\t}\n\t\telse\n\t\t\twin = false;\n\t}", "private void paintGame(Graphics g){\n\t\tg.setColor(Color.RED);\n\t\tg.fillRect(0, 0, DIMENSIONS_SIZE, DIMENSIONS_SIZE);\n\t\t\n\t\t//Search through for the player/AI blocks, paint them blue/black.\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tfor(int j = 0; j<DIVISIONS; j++){\n\t\t\t\tint initialXCoord = i*DIVISION_DIMENSION;\n\t\t\t\tint initialYCoord = j*DIVISION_DIMENSION;\n\t\t\t\tif (gameArray[i][j] == USER){\n\t\t\t\t\tg.setColor(Color.BLUE);\n\t\t\t\t\tg.fillRect(initialXCoord, initialYCoord, DIVISION_DIMENSION, DIVISION_DIMENSION);\n\t\t\t\t}\n\t\t\t\tif (gameArray[i][j] == AI){\n\t\t\t\t\tg.setColor(Color.BLACK);\n\t\t\t\t\tg.fillRect(initialXCoord, initialYCoord, DIVISION_DIMENSION, DIVISION_DIMENSION);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private int getHeuristic(Player player) {\n int whitePieces = 0;\n int blackPieces = 0;\n\n for (int r = 0; r < Board.MAX_ROW; r++) {\n for (int c = 0; c < Board.MAX_COLUMN; c++) {\n if (boardObject.getSlot(r, c).getColor() == Slot.WHITE) {\n whitePieces++;\n } else if (boardObject.getSlot(r, c).getColor() == Slot.BLACK) {\n blackPieces++;\n }\n }\n }\n\n if (player.equals(playerBlack)) {\n return blackPieces - whitePieces;\n } else {\n return whitePieces - blackPieces;\n }\n }", "private static int evaluateBoard(final int[][] givenBoard) {\n final int[][] board = cloneBoard(givenBoard);\n\n final int numRows = givenBoard.length;\n final int numCols = givenBoard[0].length;\n\n \n // If the game is complete\n if (!Utils.hasMove(board)) {\n // Find largest absolute move value for player and opponent\n int playerScore = 0;\n int opponentScore = 0;\n for (final int[] row : board) {\n for (final int val : row) {\n if (val > playerScore) playerScore = val;\n if (val < opponentScore) opponentScore = val;\n } \n }\n // Give a big reward + the ammount we won the game by\n return WIN_REWARD + playerScore + opponentScore;\n }\n boardsEvaluated++;\n\n \n // If the game is incomplete, return the diference between the average \n // distance that the player and opponent are from each empty square\n int[][] playerDistances = distanceGrid(board);\n int[][] opponentDistances = distanceGrid(flipBoard(board));\n \n int totalPlayerDistance = 0;\n int totalOpponentDistance = 0;\n \n int maxPlayerDistance = 0;\n int maxOpponentDistance = 0;\n \n \n int largestPlayerMove = 0;\n int smallestOpponentMove = 0;\n \n int numEmptySpaces = 0;\n \n for (int r = 0; r < numRows; r++) {\n for (int c = 0; c < numCols; c++) {\n if (playerDistances[r][c] > 0) {\n totalPlayerDistance += playerDistances[r][c];\n numEmptySpaces++;\n }\n if (opponentDistances[r][c] > 0) {\n totalOpponentDistance += opponentDistances[r][c];\n }\n \n int boardVal = board[r][c];\n if (largestPlayerMove < boardVal) largestPlayerMove = boardVal;\n if (smallestOpponentMove > boardVal) smallestOpponentMove = boardVal;\n \n } \n }\n int averageDistanceDifference = totalOpponentDistance - totalPlayerDistance;\n\n int largestMoveDifference = largestPlayerMove + smallestOpponentMove;\n\n\n return averageDistanceDifference + largestMoveDifference;\n }", "int checkGameWon(){\n int sx,sy,ex,ey;\n Point size = new Point();\n //get the size of current window\n Display display = getWindowManager().getDefaultDisplay();\n display.getSize(size);\n int width = size.x;\n int height = size.y;\n\n //win first row\n if (gameBoard[0] != 0 && gameBoard[0] == gameBoard[1] && gameBoard[0] == gameBoard[2]){\n sx = 0;\n sy =(int) (height * .30);\n\n ex = width;\n ey = (int) (height * .30);\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[0];\n }\n //win second row\n else if (gameBoard[3] != 0 && gameBoard[3] == gameBoard[4] && gameBoard[3] == gameBoard[5]){\n sx = 0;\n sy = (int) (height * .54);\n ex = width;\n ey = (int) (height * .54);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[3];\n }\n //win third row\n else if (gameBoard[6] != 0 && gameBoard[6] == gameBoard[7] && gameBoard[6] == gameBoard[8]){\n sx = 0;\n sy = (int) (height * .77);\n\n ex = width;\n ey = (int) (height * .77);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[6];\n }\n //win first colum\n else if (gameBoard[0] != 0 && gameBoard[0] == gameBoard[3] && gameBoard[0] == gameBoard[6]){\n sx = (int) (width *.15);\n sy = (int) (height * .18);\n ex = (int) (width * .15);\n ey=(int) (height * .89);\n\n drawLine(sx,sy,ex,sy,imageView10);\n return gameBoard[0];\n }\n //win second colum\n else if (gameBoard[1] != 0 && gameBoard[1] == gameBoard[4] && gameBoard[1] == gameBoard[7]){\n sx = (int) (width * .50);\n sy = (int) (height * .18);\n\n ex = (int) (width * .50);\n ey = (int) (height * .89);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[1];\n }\n //win third colum\n else if (gameBoard[2] != 0 && gameBoard[2] == gameBoard[5] && gameBoard[2] == gameBoard[8]){\n sx = (int) (width * .85);\n sy = (int) (height * .18);\n\n ex = (int) (width * .85);\n ey = (int) (height * .89);\n\n drawLine(sx,sy,ex,ey,imageView10);\n return gameBoard[2];\n }\n else{\n //game not won\n return 0;\n }\n }", "public String computerMove() {\n\t\t// Look to win in a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win in a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Find the non-full row and col w/ least val\n\t\tint bestR = -1;\n\t\tint bestC = -1;\n\t\tint minSum = 10;\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\tint sum = rowSum[r] + colSum[c];\n\t\t\t\t\tif (sum < minSum) {\n\t\t\t\t\t\tminSum = sum;\n\t\t\t\t\t\tbestR = r;\n\t\t\t\t\t\tbestC = c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn done(bestR, bestC);\n\t}", "public static void checkResult() {\n\t\tint sum = PlayerBean.PLAYERONE - PlayerBean.PLAYERTWO;\n\n\t\tif (sum == 1 || sum == -2) {\n\t\t\tScoreBean.addWin();\n\t\t\tresult = \"player one wins\";\n\t\t} else {\n\t\t\tScoreBean.addLoss();\n\t\t\tresult = \"player two wins\";\n\t\t}\n\t}", "protected int winnable(Board b){\r\n\t\t//checks if two tiles are the same (and not empty) and checks if\r\n\t\t//the third tile required to win is empty for a winning condition\r\n\t\tint condition = 0;\r\n\t\tif ((b.getTile(1) == b.getTile(2)) && (b.getTile(3) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\t\tcondition =3;\r\n\t\telse if ((b.getTile(1) == b.getTile(3)) && (b.getTile(2) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 2;\r\n\t\telse if ((b.getTile(2) == b.getTile(3)) && (b.getTile(1) == ' ')\r\n\t\t\t\t&& (b.getTile(2) != ' ') && (b.getTile(2) == this.getSymbol()))\r\n\t\t\tcondition = 1;\r\n\t\telse if ((b.getTile(4) == b.getTile(5)) && (b.getTile(6) == ' ')\r\n\t\t\t\t&& (b.getTile(4) != ' ') && (b.getTile(4) == this.getSymbol()))\r\n\t\t\tcondition = 6;\r\n\t\telse if ((b.getTile(4) == b.getTile(6)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(4) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(6)) && (b.getTile(4) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 4;\r\n\t\telse if ((b.getTile(7) == b.getTile(8)) && (b.getTile(9) == ' ')\r\n\t\t\t\t&& (b.getTile(7) != ' ') && (b.getTile(7) == this.getSymbol()))\r\n\t\t\tcondition = 9;\r\n\t\telse if ((b.getTile(7) == b.getTile(9)) && (b.getTile(8) == ' ')\r\n\t\t\t\t&& (b.getTile(7) != ' ') && (b.getTile(7) == this.getSymbol()))\r\n\t\t\tcondition = 8;\r\n\t\telse if ((b.getTile(8) == b.getTile(9)) && (b.getTile(7) == ' ')\r\n\t\t\t\t&& (b.getTile(8) != ' ') && (b.getTile(8) == this.getSymbol()))\r\n\t\t\tcondition = 7;\r\n\t\telse if ((b.getTile(1) == b.getTile(4)) && (b.getTile(7) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 7;\r\n\t\telse if ((b.getTile(1) == b.getTile(7)) && (b.getTile(4) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 4;\r\n\t\telse if ((b.getTile(4) == b.getTile(7)) && (b.getTile(1) == ' ')\r\n\t\t\t\t&& (b.getTile(4) != ' ') && (b.getTile(4) == this.getSymbol()))\r\n\t\t\tcondition = 1;\r\n\t\telse if ((b.getTile(2) == b.getTile(5)) && (b.getTile(8) == ' ')\r\n\t\t\t\t&& (b.getTile(2) != ' ') && (b.getTile(2) == this.getSymbol()))\r\n\t\t\tcondition = 8;\r\n\t\telse if ((b.getTile(2) == b.getTile(8)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(2) != ' ') && (b.getTile(2) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(8)) && (b.getTile(2) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 2;\r\n\t\telse if ((b.getTile(3) == b.getTile(6)) && (b.getTile(9) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 9;\r\n\t\telse if ((b.getTile(3) == b.getTile(9)) && (b.getTile(6) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 6;\r\n\t\telse if ((b.getTile(6) == b.getTile(9)) && (b.getTile(3) == ' ')\r\n\t\t\t\t&& (b.getTile(6) != ' ') && (b.getTile(6) == this.getSymbol()))\r\n\t\t\tcondition = 3;\r\n\t\telse if ((b.getTile(1) == b.getTile(5)) && (b.getTile(9) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 9;\r\n\t\telse if ((b.getTile(1) == b.getTile(5)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(1) != ' ') && (b.getTile(1) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(9)) && (b.getTile(1) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 1;\r\n\t\telse if ((b.getTile(3) == b.getTile(5)) && (b.getTile(7) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 7;\r\n\t\telse if ((b.getTile(3) == b.getTile(7)) && (b.getTile(5) == ' ')\r\n\t\t\t\t&& (b.getTile(3) != ' ') && (b.getTile(3) == this.getSymbol()))\r\n\t\t\tcondition = 5;\r\n\t\telse if ((b.getTile(5) == b.getTile(7)) && (b.getTile(3) == ' ')\r\n\t\t\t\t&& (b.getTile(5) != ' ') && (b.getTile(5) == this.getSymbol()))\r\n\t\t\tcondition = 3;\r\n\t\treturn condition;\r\n\t}", "public String winCondition() {\r\n\t\tif (hasOneOfEach()) {\r\n\t\t\treturn \"Congratulations! You've won the Safari Game! You caught one of each type of Pokémon!\";\r\n\t\t}\r\n\t\tif (hasFiveOfTwo()) {\r\n\t\t\treturn \"Congratulations! You've won the Safari Game! You caught two each of five types of Pokémon!\";\r\n\t\t}\r\n\t\tif (hasTwoOfFive()) {\r\n\t\t\treturn \"Congratulations! You've won the Safari Game! You caught five each of two types Pokémon!\";\r\n\t\t}\r\n\t\treturn \"You did not win yet! Keep trying!\";\r\n\t}", "public Marker gameWon() {\r\n for (int s : sums) {\r\n if (s == BOARD_SIZE) {\r\n return Marker.X;\r\n }\r\n else if (s == -BOARD_SIZE) {\r\n return Marker.O;\r\n }\r\n }\r\n\r\n return Marker.EMPTY;\r\n }", "public int getBoardState(boolean whiteTeamMoving) {\n\t\tint result = 0;\n\t\tboolean moves = doMovesExist(whiteTeamMoving);\n\n\t\tresult |= moves ? 0 : 1;\n\t\tresult |= isWhiteCheck() ? 1<<1 : 0;\n\t\tresult |= isBlackCheck() ? 1<<2 : 0;\n\t\tresult |= result == 1 ? 0 : 1<<3;\n\n\t\treturn result;\n\t}", "public void checkGameStatus() {\n everyTenthGoalCongrats();\n randomPopUpBecauseICan();\n }", "public void checkGame() {\n\n\t}", "public SimplePoolGameState evaluateShot(SimplePoolMove shot) {\r\n\t\tapplyShot(shot);\r\n\t\tSimplePoolGameState gameState = TurnOver;\r\n\t\tif (shot.somethingPotted())\r\n\t\t\tgameState = table().isBallsLeftOnTable() ? TurnContinued : GameOver;\r\n\t\treturn shot.isFoul() ? gameState.forFoul() : gameState;\r\n\t}", "private void checkForGameEnd() {\n\t\tint checkWin = controller.checkForWinner();\n\t\tif(playerType == null && checkWin == 1 || (playerType != null && playerType == checkWin)) {\n\t\t\tgameFinished = true;\n\t\t\tAlert alert = new Alert(Alert.AlertType.WARNING);\n\t\t\talert.setTitle(\"VICTORY\");\n\t\t\talert.setHeaderText(\"VICTORY\");\n\t\t\talert.setContentText(\"CONGRATULATIONS! YOU WIN!\");\n\t\t\talert.showAndWait()\n\t\t .filter(response -> response == ButtonType.OK)\n\t\t .ifPresent(response -> formatSystem());\n\t\t\t\n\t\t}else if (playerType == null && checkWin == 2 || (playerType != null && playerType%2 + 1 == checkWin)) {\n\t\t\tgameFinished = true;\n\t\t\tAlert alert = new Alert(Alert.AlertType.WARNING);\n\t\t\talert.setTitle(\"DEFEAT\");\n\t\t\talert.setHeaderText(\"DEFEAT\");\n\t\t\talert.setContentText(\"SHAME! YOU LOSE!\");\n\t\t\talert.showAndWait()\n\t\t .filter(response -> response == ButtonType.OK)\n\t\t .ifPresent(response -> formatSystem());\n\t\t\t\n\t\t}else if (controller.checkForTie()) {\n\t\t\tgameFinished = true;\n\t\t\tAlert alert = new Alert(Alert.AlertType.WARNING);\n\t\t\talert.setTitle(\"STALEMATE\");\n\t\t\talert.setHeaderText(\"STALEMATE\");\n\t\t\talert.setContentText(\"ALAS! TIE GAME!\");\n\t\t\talert.showAndWait()\n\t\t .filter(response -> response == ButtonType.OK)\n\t\t .ifPresent(response -> formatSystem());\n\t\t}\n\t\t\n\t\tif(playerType != null && gameFinished) {\n\t\t\tSystem.out.println(\"closing connection\");\n\t\t\ttry {\n\t\t\t\tconnection.close();\n\t\t\t}catch (Exception e) {\n\t\t\t\tSystem.out.println(\"ERROR CLOSING\");\n\t\t\t}\n\t\t}\n\t}", "public int determineWinner() {\n\t\tif(board[1][1] != 0 && (\n\t\t\t(board[1][1] == board[0][0] && board[1][1] == board[2][2]) ||\n\t\t\t(board[1][1] == board[0][2] && board[1][1] == board[2][0]) ||\n\t\t\t(board[1][1] == board[0][1] && board[1][1] == board[2][1]) ||\n\t\t\t(board[1][1] == board[1][0] && board[1][1] == board[1][2]))){\n\t\t\treturn board[1][1];\n\t\t}\n\t\telse if (board[0][0] != 0 &&(\n\t\t\t(board[0][0] == board[0][1] && board[0][0] == board[0][2]) ||\n\t\t\t(board[0][0] == board[1][0] && board[0][0] == board[2][0]))){\n\t\t\treturn board[0][0];\n\t\t}\n\t\telse if (board [2][2] != 0 && (\n\t\t\t(board[2][2] == board[2][0] && board[2][2] == board[2][1]) ||\n\t\t\t(board[2][2] == board[0][2] && board[2][2] == board[1][2]))) {\n\t\t\treturn board[2][2];\n\t\t}\n\t\t\n\t\t//See if every square has been marked, return still in progress if not\n\t\tfor(int i = 0; i < 3; ++i) {\n\t\t\tfor(int j = 0; j < 3; ++j) {\n\t\t\t\tif (board[i][j] == 0)\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Return tie\n\t\treturn 3;\n\t}", "private int twoInNeg (final GameStateModule game, int player) {\n int count = 0;\n if(game.getHeight() == 4){ //if height is 4, no iterations needed\n //counting bottom up\n for(int i = 0; i < 3; i++) { //since rows is always of width 5\n for(int j = 3; j > 1; j--) {\n if ((game.getAt(i, j) == player) && (game.getAt(i + 1, j - 1) == player) && (game.getAt(i + 2, j - 2) == 0))\n count++;\n }\n }\n //counting top bottom\n for(int i = 4; i > 1; i--) {\n for(int j = 0; j < 2; j++) {\n if ((game.getAt(i, j) == player) && (game.getAt(i - 1, j + 1) == player) && (game.getAt(i - 2, j + 2) == 0))\n count++;\n }\n }\n }\n else { //if height is 5, iterations needed\n for(int i = 0; i < 4; i++) {\n for (int j = 4; j > 1; j--) {\n if ((game.getAt(i, j) == player) && (game.getAt(i + 1, j - 1) == player) && (game.getAt(i + 2, j - 2) == 0))\n count++;\n }\n }\n for(int i = 5; i > 1; i--) {\n for (int j = 0; j < 3; j++) {\n if ((game.getAt(i, j) == player) && (game.getAt(i - 1, j + 1) == player) && (game.getAt(i - 2, j + 2) == 0))\n count++;\n }\n }\n }\n return count;\n }", "@Test\n public void determineWinnerNoRedMove()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final Agent agentRed = agents.get(0);\n final Agent agentWhite = agents.get(1);\n final CheckersEnvironment environment = new CheckersEnvironment();\n\n environment.placeToken(CheckersPosition.P07, King.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P03, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P02, Pawn.WHITE.withAgent(agentWhite));\n environment.placeToken(CheckersPosition.P12, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P08, Pawn.RED.withAgent(agentRed));\n environment.placeToken(CheckersPosition.P04, King.RED.withAgent(agentRed));\n // System.out.println(environment);\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(3));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(3));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n assertThat(adjudicator.determineWinner(environment), is(agentWhite));\n }", "public static HashSet<gameState> Actions(gameState currentState) {\n\t\t\n\t\tHashSet<gameState> possibleStates = new HashSet<gameState>();\n\t\t\n\t\t\n\t\t// Store which player goes next after this player plays\n\t\tint nextNextUp;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tnextNextUp = 1;\n\t\t} else {\n\t\t\tnextNextUp = 0;\n\t\t}\n\t\t\n\t\t// Store corresponding characters for each player\n\t\t// DARK(X) - 0, LIGHT(O) - 1\n\t\tchar myTile;\n\t\tchar opponentTile;\n\t\tif (currentState.getNextUp() == 0) {\n\t\t\tmyTile = 'x';\n\t\t\topponentTile = 'o';\n\t\t} else {\n\t\t\tmyTile = 'o';\n\t\t\topponentTile = 'x';\n\t\t}\n\n\t\t\n\n\t\t// Check the entire board of the state \n\t\tfor (int i = 0; i<boardSize; i++) {\n\t\t\tfor (int j = 0; j<boardSize; j++) {\n\t\t\t\t\n\t\t\t\t// If the tile is my tile\n\t\t\t\tif (currentState.getBoard()[i][j] == '_') {\n\t\t\t\t\t\n\t\t\t\t\tchar[][] moveBoard = createNewBoard(currentState);\n\t\t\t\t\t\n\t\t\t\t\t// Up\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// If it is an opponent tile, then you keep going up until you either my tile (fail) or\n\t\t\t\t\t\t// a blank space (success/move possible)\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=i;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Down\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][j] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=i;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[l][j] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][j] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j-1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k+1; l<=j;l++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i][j+1] == opponentTile) { \n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tfor (int k = j+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[i][k] == myTile) {\n\t\t\t\t\t\t\t\t\tfor (int l = k-1; l>=j;l--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[i][l] = myTile;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[i][k] == opponentTile) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j-1] == opponentTile) { \n\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Up and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i-1][j+1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i-2; k >= 0; k--) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k+1; q<=i;q++) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Left\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j-1] == opponentTile) { \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j-2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l+1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\t// Down and Right\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (currentState.getBoard()[i+1][j+1] == opponentTile) { \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Keep going up until the top is hit\n\t\t\t\t\t\t\tint l = j+2;\n\t\t\t\t\t\t\tfor (int k = i+2; k < boardSize; k++) {\n\t\t\t\t\t\t\t\tif (currentState.getBoard()[k][l] == myTile) {\n\t\t\t\t\t\t\t\t\tint p = l-1;\n\t\t\t\t\t\t\t\t\tfor (int q = k-1; q>=i;q--) {\n\t\t\t\t\t\t\t\t\t\tmoveBoard[q][p] = myTile;\n\t\t\t\t\t\t\t\t\t\tp--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (currentState.getBoard()[k][l] == opponentTile) {\n\t\t\t\t\t\t\t\t\tl++;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {}\n\t\t\t\t\t\n\t\t\t\t\tif (!compareBoards(moveBoard, currentState.getBoard())) {\n\t\t\t\t\t\tgameState move = new gameState(moveBoard, nextNextUp);\t\t\n\t\t\t\t\t\tpossibleStates.add(move);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\n\t\treturn possibleStates;\n\t\t\n\t\t\n\t\t\n\t}", "private boolean gameOver()\n {\n \t//lose case\n \tif (guess_number == 0)\n \t{\n \t\twin = false;\n \t\treturn true;\n \t}\n \t//win case\n \tif (mask.compareTo(word) == 0)\n \t{\n \t\twin = true;\n \t\treturn true;\n \t}\n \t\n \treturn false;\n }", "private void checkAndUpdateIfSmallGameWin(SmallGameBoard gameToCheckForWin){\n String[] letters = gameToCheckForWin.getLettersOfAllButtons();\n if (checkGameWin(letters)) {\n //Set buttons' properties \"partOfWonBoard = true\" so they cannot be clicked again\n for (ButtonClass b : chosenGame.getAllButtons()) {\n b.setPartOfWonBoard(true);\n }\n chosenGame.changeGameColor(activity.getColor());\n chosenGame.setLetterOfWinner(currentLetter);\n //If this win leads to a big game win, then MainActivity finishes the game\n if(checkForBigGameWin()){\n activity.finishGame();\n }\n }\n }", "public CellSigns gameWinner(){\n for (int i = 0; i < size; i++) {\n var firstSign = gameField[i][0].getCurrentSign();\n int j;\n for (j = 1; j < size; j++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(j == size)\n return firstSign;\n }\n\n //Check vertical lines\n for (int j = 0; j < size; j++) {\n var firstSign = gameField[0][j].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(i == size)\n return firstSign;\n }\n\n //Check diagonal lines\n\n var mainDiagonalSign = gameField[0][0].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n if(mainDiagonalSign != gameField[i][i].getCurrentSign())\n break;\n }\n if(i == size)\n return mainDiagonalSign;\n\n var secondaryDiagonalSign = gameField[0][size-1].getCurrentSign();\n for (i = 1; i < size; i++) {\n if(secondaryDiagonalSign!= gameField[i][size-1-i].getCurrentSign())\n break;\n }\n if(i==size)\n return secondaryDiagonalSign;\n\n //No winner\n return CellSigns.EMPTY;\n }", "public static void newGame(boolean humanChecker,boolean whoTurn, boolean computerColor) {\n\t\tG=new gamePlay();\n\t\tnumRed=0;\n\t\tnumBlue=0;\n\t\t\n\t\t\n\t\tdouble value = Math.random();\n\t\tFont font = new Font(\"Sans Serif\", 20, 20);\n\t\tStdDraw.setFont(font);\n\t\t\n\t\twhosFirst = true;\n\t\tif (value < 0.5) {\n\t\t\tStdDraw.text(500, 950, \"Blue Player goes first!\");\n\t\t\tif(computerColor){\n\t\t\t\twhoTurn=true;\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\twhoTurn=false;\n\t\t\t\t\n\t\t\t}\n\t\t} else {\n\t\t\tStdDraw.text(500, 950, \"Red Player goes first!\");\n\t\t\tif(computerColor){\n\t\t\t\twhoTurn=false;\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\twhoTurn=true;\n\t\t\t\t\n\t\t\t}\n\t\t\twhosFirst = false;\n\t\t}\n\t\t\n\t\tStdDraw.text(500, 100, \"Please click on the location that you wish to place your piece.\");\n\t\t\n\t\t//creating objects to represent each piece that you are playing with\n\t\tpieceArray = new PlayerPiece[12];\n\t\tfor (int i = 0; i < 12; i++) {\n\t\t\tif (i < 6) {\n\t\t\t\tpieceArray[i] = new PlayerPiece(\"BLUE\", i + 1);\n\t\t\t} else {\n\t\t\t\tpieceArray[i] = new PlayerPiece(\"RED\", i + 1);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//creating objects to represent each location on the game board\n\t\tspots = new moveLocations[17];\n\t\tspots[0] = new moveLocations(165, 235, 765, 835);\n\t\tspots[1] = new moveLocations(465, 535, 765, 835);\n\t\tspots[2] = new moveLocations(765, 835, 765, 835);\n\t\tspots[3] = new moveLocations(765, 835, 465, 535);\n\t\tspots[4] = new moveLocations(765, 835, 165, 235);\n\t\tspots[5] = new moveLocations(465, 535, 165, 235);\n\t\tspots[6] = new moveLocations(165, 235, 165, 235);\n\t\tspots[7] = new moveLocations(165, 235, 465, 535);\n\t\tspots[8] = new moveLocations(315, 385, 615, 685);\n\t\tspots[9] = new moveLocations(465, 535, 615, 685);\n\t\tspots[10] = new moveLocations(615, 685, 615, 685);\n\t\tspots[11] = new moveLocations(615, 685, 465, 535);\n\t\tspots[12] = new moveLocations(615, 685, 315, 385);\n\t\tspots[13] = new moveLocations(465, 535, 315, 385);\n\t\tspots[14] = new moveLocations(315, 385, 315, 385);\n\t\tspots[15] = new moveLocations(315, 385, 465, 535);\n\t\tspots[16] = new moveLocations(1000, 2000, 1000, 2000);\n\t\t\n\t\t\n\t\tif(humanChecker){\n\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\n\t\t\tif(computerColor){\n\t\t\t\t\n\t\t\t\tStdDraw.text(80, 820, \"Computer\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\n\t\t\t\tStdDraw.text(920, 820, \"Computer\");\n\t\t\t}\n\n\t\t}\n\t\t\n\t\tint j = 0;\n\t\tint num1 = 700;\n\t\tint num2 = 700;\n\t\t\n\t\tboolean mouseClicked = false;\n\t\tboolean mouseClicked1 = false;\n\t\tboolean boolVal = true;\n\t\tboolean boolVal2 = true;\n\t\tdouble xLocation = 0;\n\t\tdouble yLocation = 0;\n\t\tdouble xLocation1 = 0;\n\t\tdouble yLocation1 = 0;\n\t\tint countBlue=0;\n\t\tint countRed=6;\n\t\tboolean turn=true;\n\t\tboolean fixingTurn=false;\n\t\t//Main while loop for 12 turns\n\t\t//setting up the game board when the user clicks new game\n\t\twhile (j < 12) {\n\t\t\t\n\t\t\t//all the if's and else if's were designed in assignment 1 to represent where a player can put there piece\n\t\t\t//we realize that this is a very inefficient way of coding although it does work\n\t\t\t//This class is designed for setting up the board with the first moves\n\t\t\t//the rest of the game is in the gamePlay class\n\t\t\t//we made the gamePlay class for assignment 2 and we made sure to modularize it\n\t\t\t//we also reduced the conditional statements to make the code easier to read and improve efficiency\n\t\t\tif (j == 1) {\n\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\tStdDraw.filledRectangle(500, 950, 400, 50);\n\t\t\t}\n\t\t\tif(whoTurn&&humanChecker){\n\t\t\t\tComputerMove moving=new ComputerMove();\n\t\t\t\tif(computerColor){\n\t\t\t\t\tmoving.placeAIPiece(countBlue);\n\t\t\t\t\t\n\t\t\t\t\tcountBlue++;\n\t\t\t\t\tnumBlue++;\n\t\t\t\t\tif(fixingTurn){\n\t\t\t\t\t\tfixingTurn=false;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tfixingTurn=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tmoving.placeAIPiece(countRed);\n\t\t\t\t\t\n\t\t\t\t\tcountRed++;\n\t\t\t\t\tnumRed++;\n\t\t\t\t\tif(fixingTurn){\n\t\t\t\t\t\tfixingTurn=false;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tfixingTurn=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\tif (j % 2 == 0) {// first\n\t\t\t\tif (whosFirst) {// blue goes first\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledRectangle(900, 900, 100, 50);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\t\tStdDraw.text(100, 900, \"Blue's Turn!\");\n\t\t\t\t\tfixingTurn=true;\n\t\t\t\t\twhile (boolVal) {\n\n\t\t\t\t\t\tmouseClicked = StdDraw.mousePressed();\n\t\t\t\t\t\txLocation = StdDraw.mouseX();\n\t\t\t\t\t\tyLocation = StdDraw.mouseY();\n\t\t\t\t\t\tif (!spots[0].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[0].getMinX(), spots[0].getMaxX(), spots[0].getMinY(), spots[0].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 800, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[0].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(0);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[1].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[1].getMinX(), spots[1].getMaxX(), spots[1].getMinY(), spots[1].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 800, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[1].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(1);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[2].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[2].getMinX(), spots[2].getMaxX(), spots[2].getMinY(), spots[2].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 800, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[2].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[3].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[3].getMinX(), spots[3].getMaxX(), spots[3].getMinY(), spots[3].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[3].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(3);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[4].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[4].getMinX(), spots[4].getMaxX(), spots[4].getMinY(), spots[4].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 200, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[4].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(4);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[5].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[5].getMinX(), spots[5].getMaxX(), spots[5].getMinY(), spots[5].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 200, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[5].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(5);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[6].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[6].getMinX(), spots[6].getMaxX(), spots[6].getMinY(), spots[6].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 200, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[6].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(6);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[7].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[7].getMinX(), spots[7].getMaxX(), spots[7].getMinY(), spots[7].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[7].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(7);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[8].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[8].getMinX(), spots[8].getMaxX(), spots[8].getMinY(), spots[8].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 650, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[8].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(8);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[9].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[9].getMinX(), spots[9].getMaxX(), spots[9].getMinY(), spots[9].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 650, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[9].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(9);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[10].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[10].getMinX(), spots[10].getMaxX(), spots[10].getMinY(), spots[10].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 650, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[10].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(10);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[11].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[11].getMinX(), spots[11].getMaxX(), spots[11].getMinY(), spots[11].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[11].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(11);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[12].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[12].getMinX(), spots[12].getMaxX(), spots[12].getMinY(), spots[12].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 350, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[12].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(12);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[13].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[13].getMinX(), spots[13].getMaxX(), spots[13].getMinY(), spots[13].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 350, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[13].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(13);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[14].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[14].getMinX(), spots[14].getMaxX(), spots[14].getMinY(), spots[14].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 350, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[14].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(14);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[15].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[15].getMinX(), spots[15].getMaxX(), spots[15].getMinY(), spots[15].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[15].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(15);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t}\n\t\t\t\t\tcountBlue++;\n\t\t\t\t\tnumBlue++;\n\t\t\t\t} else {\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledRectangle(100, 900, 100, 50);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\t\tStdDraw.text(900, 900, \"Red's Turn!\");//this is for red's turn assuming blue got to go first\n\t\t\t\t\tfixingTurn=false;\n\t\t\t\t\t//all the conditions below on where red can put their piece\n\t\t\t\t\twhile (boolVal2) {\n\t\t\t\t\t\tmouseClicked = StdDraw.mousePressed();\n\t\t\t\t\t\txLocation = StdDraw.mouseX();\n\n\t\t\t\t\t\tyLocation = StdDraw.mouseY();\n\t\t\t\t\t\tif (!spots[0].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[0].getMinX(), spots[0].getMaxX(), spots[0].getMinY(), spots[0].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 800, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[0].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(0);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[1].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[1].getMinX(), spots[1].getMaxX(), spots[1].getMinY(), spots[1].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 800, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[1].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(1);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[2].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[2].getMinX(), spots[2].getMaxX(), spots[2].getMinY(), spots[2].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 800, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[2].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[3].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[3].getMinX(), spots[3].getMaxX(), spots[3].getMinY(), spots[3].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[3].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(3);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\telse if (!spots[4].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[4].getMinX(), spots[4].getMaxX(), spots[4].getMinY(), spots[4].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 200, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[4].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(4);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[5].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[5].getMinX(), spots[5].getMaxX(), spots[5].getMinY(), spots[5].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 200, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[5].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(5);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[6].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[6].getMinX(), spots[6].getMaxX(), spots[6].getMinY(), spots[6].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 200, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[6].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(6);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[7].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[7].getMinX(), spots[7].getMaxX(), spots[7].getMinY(), spots[7].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[7].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(7);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[8].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[8].getMinX(), spots[8].getMaxX(), spots[8].getMinY(), spots[8].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 650, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[8].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(8);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[9].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[9].getMinX(), spots[9].getMaxX(), spots[9].getMinY(), spots[9].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 650, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[9].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(9);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[10].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[10].getMinX(), spots[10].getMaxX(), spots[10].getMinY(), spots[10].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 650, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[10].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(10);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[11].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[11].getMinX(), spots[11].getMaxX(), spots[11].getMinY(), spots[11].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[11].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(11);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[12].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[12].getMinX(), spots[12].getMaxX(), spots[12].getMinY(), spots[12].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 350, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[12].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(12);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[13].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[13].getMinX(), spots[13].getMaxX(), spots[13].getMinY(), spots[13].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 350, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[13].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(13);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[14].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[14].getMinX(), spots[14].getMaxX(), spots[14].getMinY(), spots[14].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 350, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[14].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(14);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[15].checkOccupied() && mouseClicked && mouseInRange(xLocation, yLocation,\n\t\t\t\t\t\t\t\tspots[15].getMinX(), spots[15].getMaxX(), spots[15].getMinY(), spots[15].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation = 0;\n\t\t\t\t\t\t\tyLocation = 0;\n\t\t\t\t\t\t\tmouseClicked = false;\n\t\t\t\t\t\t\tspots[15].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(15);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcountRed++;\n\t\t\t\t\tnumRed++;\n\t\t\t\t}\n\n\t\t\t} else {// second\n\t\t\t\tif (!whosFirst) {// if blue does not get to go first, these are for blue's moves\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledRectangle(900, 900, 100, 50);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\t\tStdDraw.text(100, 900, \"Blue's Turn!\");\n\t\t\t\t\tfixingTurn=true;\n\t\t\t\t\twhile (boolVal) {\n\t\t\t\t\t\tmouseClicked1 = StdDraw.mousePressed();\n\t\t\t\t\t\txLocation1 = StdDraw.mouseX();\n\t\t\t\t\t\tyLocation1 = StdDraw.mouseY();\n\n\t\t\t\t\t\tif (!spots[0].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[0].getMinX(), spots[0].getMaxX(), spots[0].getMinY(), spots[0].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 800, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[0].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(0);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[1].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[1].getMinX(), spots[1].getMaxX(), spots[1].getMinY(), spots[1].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 800, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[1].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(1);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[2].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[2].getMinX(), spots[2].getMaxX(), spots[2].getMinY(), spots[2].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 800, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[2].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[3].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[3].getMinX(), spots[3].getMaxX(), spots[3].getMinY(), spots[3].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[3].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(3);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[4].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[4].getMinX(), spots[4].getMaxX(), spots[4].getMinY(), spots[4].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 200, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[4].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(4);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[5].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[5].getMinX(), spots[5].getMaxX(), spots[5].getMinY(), spots[5].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 200, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[5].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(5);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[6].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[6].getMinX(), spots[6].getMaxX(), spots[6].getMinY(), spots[6].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 200, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[6].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(6);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[7].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[7].getMinX(), spots[7].getMaxX(), spots[7].getMinY(), spots[7].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[7].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(7);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[8].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[8].getMinX(), spots[8].getMaxX(), spots[8].getMinY(), spots[8].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 650, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[8].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(8);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[9].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[9].getMinX(), spots[9].getMaxX(), spots[9].getMinY(), spots[9].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 650, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[9].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(9);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[10].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[10].getMinX(), spots[10].getMaxX(), spots[10].getMinY(), spots[10].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 650, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[10].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(10);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[11].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[11].getMinX(), spots[11].getMaxX(), spots[11].getMinY(), spots[11].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[11].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(11);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[12].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[12].getMinX(), spots[12].getMaxX(), spots[12].getMinY(), spots[12].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 350, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[12].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(12);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[13].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[13].getMinX(), spots[13].getMaxX(), spots[13].getMinY(), spots[13].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 350, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[13].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(13);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[14].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[14].getMinX(), spots[14].getMaxX(), spots[14].getMinY(), spots[14].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 350, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[14].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(14);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[15].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[15].getMinX(), spots[15].getMaxX(), spots[15].getMinY(), spots[15].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(80, num1, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 500, 35);\n\t\t\t\t\t\t\tnum1 -= 100;\n\t\t\t\t\t\t\tboolVal = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[15].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countBlue].changePiecePosition(15);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcountBlue++;\n\t\t\t\t\tnumBlue++;\n\t\t\t\t\t\n\t\t\t\t} else {//finally this is for if red gets to go first\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\tStdDraw.filledRectangle(100, 900, 100, 50);\n\t\t\t\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\t\t\t\tStdDraw.text(900, 900, \"Red's Turn!\");\n\t\t\t\t\tfixingTurn=false;\n\t\t\t\t\twhile (boolVal2) {\n\n\t\t\t\t\t\tmouseClicked1 = StdDraw.mousePressed();\n\n\t\t\t\t\t\txLocation1 = StdDraw.mouseX();\n\t\t\t\t\t\tyLocation1 = StdDraw.mouseY();\n\t\t\t\t\t\tif (!spots[0].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[0].getMinX(), spots[0].getMaxX(), spots[0].getMinY(), spots[0].getMaxY())) {\n\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 800, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[0].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(0);\n\t\t\t\t\t\t} else if (!spots[1].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[1].getMinX(), spots[1].getMaxX(), spots[1].getMinY(), spots[1].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 800, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[1].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(1);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[2].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[2].getMinX(), spots[2].getMaxX(), spots[2].getMinY(), spots[2].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 800, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[2].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[3].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[3].getMinX(), spots[3].getMaxX(), spots[3].getMinY(), spots[3].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[3].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(3);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\telse if (!spots[4].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[4].getMinX(), spots[4].getMaxX(), spots[4].getMinY(), spots[4].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(800, 200, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[4].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(4);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[5].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[5].getMinX(), spots[5].getMaxX(), spots[5].getMinY(), spots[5].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 200, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[5].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(5);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[6].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[6].getMinX(), spots[6].getMaxX(), spots[6].getMinY(), spots[6].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 200, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[6].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(6);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[7].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[7].getMinX(), spots[7].getMaxX(), spots[7].getMinY(), spots[7].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(200, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[7].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(7);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[8].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[8].getMinX(), spots[8].getMaxX(), spots[8].getMinY(), spots[8].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 650, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[8].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(8);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[9].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[9].getMinX(), spots[9].getMaxX(), spots[9].getMinY(), spots[9].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 650, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[9].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(9);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[10].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[10].getMinX(), spots[10].getMaxX(), spots[10].getMinY(), spots[10].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 650, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[10].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(10);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[11].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[11].getMinX(), spots[11].getMaxX(), spots[11].getMinY(), spots[11].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[11].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(11);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[12].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[12].getMinX(), spots[12].getMaxX(), spots[12].getMinY(), spots[12].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(650, 350, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[12].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(12);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[13].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[13].getMinX(), spots[13].getMaxX(), spots[13].getMinY(), spots[13].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(500, 350, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[13].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(13);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[14].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[14].getMinX(), spots[14].getMaxX(), spots[14].getMinY(), spots[14].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 350, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[14].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(14);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else if (!spots[15].checkOccupied() && mouseClicked1 && mouseInRange(xLocation1, yLocation1,\n\t\t\t\t\t\t\t\tspots[15].getMinX(), spots[15].getMaxX(), spots[15].getMinY(), spots[15].getMaxY())) {\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\t\t\t\t\t\tStdDraw.filledCircle(920, num2, 35);\n\t\t\t\t\t\t\tStdDraw.setPenColor(StdDraw.RED);\n\t\t\t\t\t\t\tStdDraw.filledCircle(350, 500, 35);\n\t\t\t\t\t\t\tnum2 -= 100;\n\t\t\t\t\t\t\tboolVal2 = false;\n\t\t\t\t\t\t\txLocation1 = 0;\n\t\t\t\t\t\t\tyLocation1 = 0;\n\t\t\t\t\t\t\tmouseClicked1 = false;\n\t\t\t\t\t\t\tspots[15].changeOccupied();\n\t\t\t\t\t\t\tpieceArray[countRed].changePiecePosition(15);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcountRed++;\n\t\t\t\t\tnumRed++;\n\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t//after each piece is placed on the game board, the piece is enabled so that it can be used later in the game\n\t\t\tif((j%2==0&&!whosFirst)||(j%2==1&&whosFirst)){\n\t\t\t\tpieceArray[countRed-1].changeEnabled();\n\t\t\t}\n\t\t\telse{\n\t\t\t\tpieceArray[countBlue-1].changeEnabled();\n\t\t\t}\n\t\t\tj++;\n\t\t\t\n\t\t\t\n\t\t\tboolVal = true;\n\t\t\tboolVal2 = true;\n\t\t\tint pieces=6;\n\t\t\tif((j%2==0&&!whosFirst)||(j%2==1&&whosFirst)){\n\t\t\t\tpieces=0;\n\t\t\t}\n\t\t\t//checking for mills in the set up of new game\n\t\t\tif(j>=0){\n\t\t\t\t\n\t\t\t\tG.millBoard(pieces,numBlue,numRed,fixingTurn,value,humanChecker,computerColor);//to deal with a mill\n\t\t\t\tG.resetMill();//to reset previous mills if they are not left in a line\n\t\t\t\t//prevents a player from getting a mill each turn for not moving their line of 3\n\t\t\t}\n\t\t\tif(humanChecker){\n\t\t\t\tif(j==1&&!whoTurn){\n\t\t\t\t\tG.turnButton();//button created in the gamePlay class to help prevent double clicking\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(humanChecker){\n\t\t\t\tif(j!=1&& !whoTurn){\n\t\t\t\t\tG.turnButton();//button created in the gamePlay class to help prevent double clicking\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!humanChecker){\t\n\t\t\t\tG.turnButton();//button created in the gamePlay class to help prevent double clicking\n\t\t\t\t\n\t\t\t}\n\t\t\tif(turn){\n\t\t\t\tturn=false;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tturn=true;\n\t\t\t}\n\t\t\t\n\t\t\tif(whoTurn){\n\t\t\t\twhoTurn=false;\n\t\t\t}\n\t\t\telse{\n\t\t\t\twhoTurn=true;\n\t\t\t}\n\t\t}\n\t\tStdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);\n\t\tStdDraw.filledRectangle(500, 100, 500, 50);\n\t\tStdDraw.setPenColor(StdDraw.BLACK);\n\t\tStdDraw.text(500, 130, \"Piece Placement Complete!\");\n\t\tmouseClicked=false;\n\t\tmouseClicked1=false;\n\t\tboolean fixer=true;\n\t\tif(humanChecker){\n\t\t\tfixer=whoTurn;\n\t\t}\n\t\tG.createGame(numRed,numBlue,humanChecker,fixer,computerColor,\"new\");//calls on the gamePlay.createGame method which allows the user to play the game until one player wins\n\t}", "public void solveGame3() {\n\t\tlosingStates = new HashSet<S>();\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tint[] uncontrollableCount = new int[game.getStates().size()+1];\n\t\tint[] uncontrollableLosingCount = new int[game.getStates().size()+1];\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> uncontrollableSuccesors;\n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\t uncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\n\t\t\t uncontrollableCount[indexCount] = uncontrollableSuccesors.size();\n\t\t\t uncontrollableLosingCount[indexCount] = 0;\n\t\t\t isUncontrollable[indexCount] = game.isUncontrollable(state);\n\t\t\t indexCount+=1;\n\t\t}\n\t\t\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t}\n\n\t\t// Handle the pending states\n\t\twhile (!losing.isEmpty()) {\n\t\t\tS state = losing.poll();\n\n\t\t\t\n\t\t\tlosingStates.add(state);\n\n\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\tfor (S pred : predecessors) {\n\t\t\t\tif(losing.contains(pred) || losingStates.contains(pred))\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t//if(i == -1)\n\t\t\t\t\t//continue;\n\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}else{\n\t\t\t\t\tuncontrollableLosingCount[i]++;\n\t\t\t\t\tif (uncontrollableLosingCount[i] == uncontrollableCount[i])\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "@Test\n public void isGameOverNoRed()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n\n for (int y = 8 - 3; y < 8; y++)\n {\n for (int x = 0; x < 8; x++)\n {\n if ((x % 2) != (y % 2))\n {\n final CheckersPosition position = CheckersPosition.findByCoordinates(x, y);\n environment.removeToken(position);\n }\n }\n }\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(0));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(12));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n }", "private void processPlayerTurns() throws DeficitException {\n\n while(!game.isGameOver())\n {\n if(humanPlayer.allDoctorOccupied())\n {\n\n game.turns ++;\n humanPlayer.processAtEndOfTurn();\n humanPlayer.processAtStartOfTurn(); //prepare for the next turn/season\n update();\n printResult.add(\"------------------------------------- Human player ends -------------------------------------\");\n\n\n printResult.add(\"------------------------------------- Computer player 1 starts-------------------------------------\");\n processComputerPlayerTurns(computerPlayer_1);\n computerPlayer_1.processAtEndOfTurn();\n computerPlayer_1.processAtStartOfTurn();\n update();\n printResult.add(\"------------------------------------- Computer player 1 ends -------------------------------------\");\n\n printResult.add(\"------------------------------------- Computer player 2 starts------------------------------------- \");\n processComputerPlayerTurns(computerPlayer_2);\n computerPlayer_2.processAtEndOfTurn();\n computerPlayer_2.processAtStartOfTurn();\n update();\n printResult.add(\"------------------------------------- Computer player 2 ends ------------------------------------- \");\n\n\n }\n }\n showGameOver();\n\n }", "public int eval()\n\t\t{\n\t\t\tif (p[BLACK]==0) return MAX+1;\t//black=0 then white win then return max\n\t\t\tif (p[WHITE]==0) return MIN-1;\t//white=0 then black win then return min\n\t\t\tint bl=getNumberOne(p[0]);int wh=getNumberOne(p[1]);\n\t\t\treturn wh-bl;\n\t\t}", "public boolean isLegalStep(MoveDirection dir){\r\n GamePosition curPos = currentGame.getCurrentPosition();\n\t\tPlayer white = currentGame.getWhitePlayer();\n\t\tint[] toCheckPos = new int[2];\n\t\tint[] existingPos = new int[2];\n\t\tif(curPos.getPlayerToMove().equals(white)) {\n\t\t\ttoCheckPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t} else {\n\t\t\ttoCheckPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t}\n\t\t//0 = column, 1 = row\n\t\tif(dir == MoveDirection.North) {\n\t\t\tif(toCheckPos[1] == 1) return false;\n\t\t\tif(toCheckPos[1] - 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), -1, 0);\n\t\t} else if(dir == MoveDirection.South) {\n\t\t\tif(toCheckPos[1] == 9) return false;\n\t\t\tif(toCheckPos[1] + 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 1, 0);\n\t\t} else if(dir == MoveDirection.East) {\n\t\t\tif(toCheckPos[0] == 9) return false;\n\t\t\tif(toCheckPos[0] + 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, 1);\n\t\t} else if(dir == MoveDirection.West) {\n\t\t\tif(toCheckPos[0] == 1) return false;\n\t\t\tif(toCheckPos[0] - 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, -1);\n\t\t}\n\t\t\n\t\treturn false;\r\n }", "public int hamming() {\n int wrong = 0;\n for (int row = 0; row < N; ++row) {\n for (int col = 0; col < N; ++col) {\n int goalValue = N * row + col + 1;\n if (tiles[row][col] != 0 && tiles[row][col] != goalValue) {\n wrong++;\n }\n }\n }\n\n return wrong;\n }", "public boolean switchPhase() {\n int cpuShipCounter = 0;\n int playerShipCounter = 0;\n do {\n cpuShipCounter = 0;\n playerShipCounter = 0;\n if (!cpuHasPlaced) {\n placeComputerShipsDumb((int) (Math.random() * 19) + 1);\n }\n for(int i = 0; i < 10; i++){\n for(int j = 0; j <10; j++){\n if(humanPlayerBoard[i][j] == board.ship.ordinal()){\n playerShipCounter++;\n }\n if (computerPlayerBoard[i][j] == board.ship.ordinal()) {\n cpuShipCounter++;\n }\n }\n }\n if (cpuShipCounter != 17) {\n cpuHasPlaced = false;\n cpuShipCounter = 0;\n playerShipCounter = 0;\n for (int i = 0; i < 10; i++) {\n for (int j = 0; j < 10; j++) {\n computerPlayerBoard[i][j] = 0;\n }\n }\n }\n\n } while (cpuShipCounter != 17);\n\n if(cpuShipCounter == 17 && playerShipCounter == 17){\n inGame = true;\n return true;\n }\n\n return false;\n }", "public BoardPiece[] evaluatePieces(BoardPiece attackingPiece, BoardPiece defendingPiece) {\n\t\tint attackingPieceType = attackingPiece.getPieceType();\n\t\tint defendingPieceType = defendingPiece.getPieceType();\n\t\t\n\t\tBoardPiece[] result = new BoardPiece[2];\n\t\t\n\t\tLog.d(TAG, \"Arbiter evaluate! Attacking: \" +attackingPieceType+ \" Defending: \" +defendingPieceType);\n\t\t\n\t\tif(attackingPieceType == defendingPieceType) {\n\t\t\tif(attackingPieceType == PieceHierarchy.FLAG && defendingPieceType == PieceHierarchy.FLAG) {\n\t\t\t\t//attacking piece wins the game\n\t\t\t\tresult[WINNING_PIECE_INDEX] = attackingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = defendingPiece;\n\n\t\t\t\tthis.eliminatePiece(defendingPiece);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//both pieces are eliminated\n\t\t\t\tthis.eliminatePiece(attackingPiece);\n\t\t\t\tthis.eliminatePiece(defendingPiece);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t//spies case\n\t\telse if(attackingPieceType == PieceHierarchy.SPY) {\n\t\t\tif(defendingPieceType == PieceHierarchy.PRIVATE) {\n\t\t\t\t//attacking piece defeated\n\t\t\t\tthis.eliminatePiece(attackingPiece);\n\t\t\t\tresult[WINNING_PIECE_INDEX] = defendingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = attackingPiece;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//defending piece is defeated\n\t\t\t\tthis.eliminatePiece(defendingPiece);\n\t\t\t\tresult[WINNING_PIECE_INDEX] = attackingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = defendingPiece;\n\t\t\t\treturn result;\n\n\t\t\t}\n\t\t}\n\t\telse if(defendingPieceType == PieceHierarchy.SPY) {\n\t\t\tif(attackingPieceType == PieceHierarchy.PRIVATE) {\n\t\t\t\t//defending piece is defeated\n\t\t\t\tthis.eliminatePiece(defendingPiece);\n\t\t\t\tresult[WINNING_PIECE_INDEX] = attackingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = defendingPiece;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//attacking piece is defeated\n\t\t\t\tthis.eliminatePiece(attackingPiece);\n\t\t\t\tresult[WINNING_PIECE_INDEX] = defendingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = attackingPiece;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\t//any other cases\n\t\telse {\n\t\t\tif(attackingPieceType > defendingPieceType) {\n\t\t\t\t//defending piece type is defeated\n\t\t\t\tthis.eliminatePiece(defendingPiece);\n\t\t\t\tresult[WINNING_PIECE_INDEX] = attackingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = defendingPiece;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//attacking piece type is defeated\n\t\t\t\tthis.eliminatePiece(attackingPiece);\n\t\t\t\tresult[WINNING_PIECE_INDEX] = defendingPiece;\n\t\t\t\tresult[DEFEATED_PIECE_INDEX] = attackingPiece;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t}", "protected boolean checkForWin() {\r\n \t\r\n if (squaresRevealed == this.width * this.height - this.mines) {\r\n finishFlags();\r\n finish(GameStateModel.WON);\r\n return true;\r\n } \t\r\n \t\r\n return false;\r\n \t\r\n }", "public void createNewGame() {\n\t\tfor(int n = 0; n < 8; n++){\n\t\t\tfor(int j = 0; j < 8; j++){\n\t\t\t\tif ( n % 2 == j % BLACK_PAWN ) {\n\t\t\t\t\tif (n < 3)\n\t\t\t\t\t\tarr[n][j] = RED_PAWN;\n\t\t\t\t\telse if (n > 4)\n\t\t\t\t\t\tarr[n][j] = BLACK_PAWN;\n\t\t\t\t\telse\n\t\t\t\t\t\tarr[n][j] = EMPTY;\n\t\t } \n\t\t\t\telse\n\t\t\t\t\tarr[n][j] = EMPTY;\n\t\t\t}\n\t\t}\n\t}", "private WinScenario getWinningScenario() {\n Diagonal primaryDiagonal = new Diagonal(this, true);\n if (primaryDiagonal.isWon()) {\n return primaryDiagonal;\n }\n\n // Check for secondary diagonal\n Diagonal secondaryDiagonal = new Diagonal(this, false);\n if (secondaryDiagonal.isWon()) {\n return secondaryDiagonal;\n }\n\n // Check for a winning row or colum\n for (int i = 0; i < 3; i++) {\n Row row = new Row(this, i);\n if (row.isWon()) {\n return row;\n }\n\n Column column = new Column(this, i);\n if (column.isWon()) {\n return column;\n }\n }\n\n return null;\n }", "private boolean isGameOver() {\n // either all black or all white pieces don't have any moves left, save\n // to internal field so that a delayed status is available\n gameOver = longestAvailableMoves(1, true).isEmpty() ||\n longestAvailableMoves(1, false).isEmpty();\n return gameOver;\n }", "private boolean check(boolean isWhite) {\n Tile kingTile = null;\n ArrayList<Position> opponentMoves = new ArrayList<>();\n // find king's tile and populate opponent moves\n for (Tile[] t : this.board) {\n for (Tile tile : t) {\n if (tile.piece instanceof King && tile.piece.isWhite() == isWhite) {\n kingTile = tile;\n }\n if (tile.hasPiece && tile.piece.isWhite() != isWhite) {\n for(Position move : tile.piece.getLegalMoves()) opponentMoves.add(move);\n }\n }\n }\n // compare every position with king's position\n for (Position opponentMove : opponentMoves) {\n if (opponentMove.equals(kingTile.position)) {\n return true;\n }\n }\n return false;\n }", "private static int evalState(GameState state){\n Move m = state.getMove();\n int counter = 0;\n\n // return directly if we encouter win or loss\n if(m.isXWin()){\n return 10000;\n }\n else if(m.isOWin()){\n return -1;\n }\n\n Vector<Integer> points = new Vector<Integer>();\n points.setSize(state.BOARD_SIZE*2+2);\n int player;\n Collections.fill(points, 1);\n int scaling = 4;\n int value = 0;\n\n for(int row = 0; row < state.BOARD_SIZE; row ++){\n for(int col = 0; col < state.BOARD_SIZE; col ++){\n player = state.at(row, col);\n\n // add points to the vector, increase by a factor for every new entry\n if(player == 1){\n points.set(row, points.get(row)*scaling);\n points.add(state.BOARD_SIZE + col, points.get(state.BOARD_SIZE - 1 + col)*scaling);\n\n // if it's in the first diagonal\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, points.get(state.BOARD_SIZE*2)*scaling);\n }\n\n // checking other diagonal\n if(counter%state.BOARD_SIZE-1 == 0 && row+col != 0){\n points.add(state.BOARD_SIZE*2 + 1, points.get(state.BOARD_SIZE*2)*scaling);\n }\n }\n // if an enemy player is encoutered null the value of the row/col\n else if(player == 2){\n points.set(row, 0);\n points.set(state.BOARD_SIZE + col, 0);\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, 0);\n }\n if(counter%state.BOARD_SIZE-1 == 0){\n points.add(state.BOARD_SIZE*2 + 1, 0);\n }\n }\n counter++;\n }\n }\n\n // if we have nulled the point we don't count it for the value of the state\n for(Integer i: points){\n if(i > 1){\n value += i;\n }\n }\n //System.err.println(\"Value: \" + value);\n return value;\n }", "boolean isGameSpedUp();", "void analyzeBoard() {\n if (onProcessCompleteListener == null) {\n return;\n }\n\n if ((!isWin(TTTConstants.CIRCLE, true)) && (!isWin(TTTConstants.CROSS, true)) && (depth >= 9)) {\n onProcessCompleteListener.onGameDraw();\n }\n }", "void computeResult() {\n // Get the winner (null if draw).\n roundWinner = compareTopCards();\n\n\n if (roundWinner == null) {\n logger.log(\"Round winner: Draw\");\n logger.log(divider);\n // Increment statistic.\n numDraws++;\n\n } else {\n logger.log(\"Round winner: \" + roundWinner.getName());\n\t logger.log(divider);\n this.gameWinner = roundWinner;\n if (roundWinner.getIsHuman()) {\n // Increment statistic.\n humanWonRounds++;\n }\n }\n\n setGameState(GameState.ROUND_RESULT_COMPUTED);\n }", "public int getWinner() throws Exception {\n\t\tif (gameSituation == UNFINISHED) {\n\t\t\tthrow new Exception(\"Game unfinished yet, cannot get winner.\");\n\t\t} // Of if\n\n\t\treturn gameSituation;\n\t}", "private char getGameStatus() {\n int row;\n int col;\n\n Map<Character, Integer> lineCounts = new HashMap<>();\n\n for (row = 0; row < this.boardSize; row++) {\n countLine(getLineStatus(this.board[row]), lineCounts);\n }\n\n for (col = 0; col < this.boardSize; col++) {\n countLine(getLineStatus(getColumn(col)), lineCounts);\n }\n\n countLine(getLineStatus(getMajorDiag()), lineCounts);\n countLine(getLineStatus(getSubDiag()), lineCounts);\n\n boolean player1Won = lineCounts.getOrDefault(players[0].symbol, 0) > 0;\n boolean player2Won = lineCounts.getOrDefault(players[1].symbol, 0) > 0;\n boolean boardIsFull = lineCounts.getOrDefault(' ', 0) == 0;\n if (player1Won && player2Won) // both players completed lines, it is a tie\n return 'T';\n if (player1Won)\n return players[0].symbol;\n if (player2Won)\n return players[1].symbol;\n if (boardIsFull)\n return 'T';\n return '?';\n }", "public void checkResult(){\n\t\tif(throwNum == 0){\n\t\t\tthis.firstThrow = this.sumOfDice;\n\t\t}\n\n\t\tif((this.sumOfDice == 7 || this.sumOfDice==11) && throwNum==0){\n\t\t\tthis.game = gameStatus.WON;\n\t\t}\n\t\telse if(this.sumOfDice ==2 || this.sumOfDice== 3 ||this.sumOfDice==12){\n\t\t\tthis.game = gameStatus.LOST;\n\t\t}\n\t\telse if((this.game == gameStatus.CONTINUE && this.sumOfDice == 7)){\n\t\t\tthis.game = gameStatus.LOST;\n\t\t}\n\t\telse if((this.sumOfDice== this.firstThrow) && throwNum!=0){\n\t\t\tthis.game = gameStatus.WON;\n\t\t}\n\t\telse{\n\t\t\tthis.game = gameStatus.CONTINUE;\n\t\t}\n\t}", "private void winConditionCheck()\r\n {\r\n boolean win;\r\n char mark;\r\n for(int row = 0; row < 3; row++)\r\n {\r\n win = true;\r\n mark = buttons[row][0].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int column = 0; column < 3; column++)\r\n {\r\n if(mark != buttons[row][column].getText().charAt(0))\r\n {\r\n win = false;\r\n break;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n }\r\n for(int column = 0; column < 3; column++)\r\n {\r\n win = true;\r\n mark = buttons[0][column].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int row = 0; row < 3; row++)\r\n {\r\n if(mark != buttons[row][column].getText().charAt(0))\r\n {\r\n win = false;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n }\r\n win = false;\r\n mark = buttons[0][0].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int i = 0; i < 3; i++)\r\n {\r\n if(buttons[i][i].getText().charAt(0) != mark)\r\n {\r\n win = false;\r\n break;\r\n }\r\n else\r\n {\r\n win = true;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n mark = buttons[1][1].getText().charAt(0);\r\n if((buttons[0][2].getText().charAt(0) == buttons[1][1].getText().charAt(0)) && (buttons[1][1].getText().charAt(0) == buttons[2][0].getText().charAt(0)) && (buttons[1][1].getText().charAt(0) != ' '))\r\n {\r\n gameEnd(mark);\r\n }\r\n }", "boolean isWinner(GameState state, String username) throws GameStateException;", "public String getWinner(){\n if(whiteWins && blackWins){\n return \"ITS A DRAW\";\n } else if(whiteWins){\n return \"WHITE WINS\";\n } else if(blackWins){\n return \"BLACK WINS\";\n } else {\n return \"NO WINNER\";\n }\n }", "public static int whoseTurn(int[][] board){\n int[] oneBoard = twoToOne(board);\n int countOne =0;\n int countTwo =0;\n for(int i=0; i<ROW*COLUMN; i++){\n if(oneBoard[i]==1){\n countOne++;\n }\n else if(oneBoard[i]==2){\n countTwo++;\n }\n }\n if(countOne>countTwo)\n return 2;\n else if(countOne<countTwo)\n return 1;\n else\n //neutral board, hardcode player=computer\n return 1;\n \n }" ]
[ "0.69464916", "0.66237825", "0.6606996", "0.63896084", "0.61679804", "0.60942477", "0.60487396", "0.603842", "0.59779507", "0.59349257", "0.5911355", "0.5899332", "0.5827792", "0.5816893", "0.57854784", "0.57294035", "0.5724706", "0.57155836", "0.56946397", "0.56776536", "0.56687295", "0.56640977", "0.5636752", "0.56272453", "0.56241405", "0.5583832", "0.55793303", "0.55608684", "0.5559249", "0.5553782", "0.55469114", "0.5532289", "0.5516395", "0.5513341", "0.55064666", "0.5492254", "0.5473084", "0.54678565", "0.5454815", "0.5453309", "0.54526085", "0.54512626", "0.54377866", "0.5437035", "0.54277307", "0.5425324", "0.54143417", "0.54105556", "0.5390096", "0.53870726", "0.538129", "0.5377803", "0.53775173", "0.53729826", "0.5372975", "0.53606576", "0.5358363", "0.5358275", "0.5349847", "0.53358936", "0.5333949", "0.5315133", "0.5310264", "0.5301871", "0.52761906", "0.5272884", "0.526349", "0.5255665", "0.525202", "0.52475727", "0.5236272", "0.52353734", "0.5230994", "0.52281976", "0.5226339", "0.52231854", "0.52187306", "0.52160287", "0.5211892", "0.51915365", "0.5180591", "0.5173816", "0.51727927", "0.51720905", "0.51666677", "0.5165841", "0.5163743", "0.51630527", "0.5157251", "0.515675", "0.51563907", "0.5154626", "0.51529306", "0.5144325", "0.5144218", "0.51398796", "0.51362056", "0.51269436", "0.5126784", "0.5123766" ]
0.6168438
4
Of computeGameSituation Test two methods.
public static void stateCheckerboardConvertionTest() { VTicTacToe tempEnvironment = new VTicTacToe(); int[] tempTestStates = { 0, 13, 39, 26, 17087 }; int tempState; int[][] tempCheckerboard; for (int i = 0; i < tempTestStates.length; i++) { tempCheckerboard = tempEnvironment.stateToCheckerboard(tempTestStates[i]); System.out.println("The checkerboard of " + tempTestStates[i] + " is: " + Arrays.deepToString(tempCheckerboard)); tempState = tempEnvironment.checkerboardToState(tempCheckerboard); System.out.println("The state ID is " + tempState); } // Of for i }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void getGameSituationTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17060 };\n\n\t\tint tempResult;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResult = tempEnvironment.computeGameSituation(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The game situation of \" + tempTestStates[i] + \" is: \" + tempResult);\n\t\t} // Of for i\n\t}", "public int computeGameSituation() {\n\t\treturn computeGameSituation(checkerboard);\n\t}", "@Test\n public void testGameProcess() {\n // set test player data\n mTournament.setPlayerCollection(getTestPlayersData());\n\n int roundNumber = mTournament.calculateRoundsNumber(mTournament.getPlayersCount());\n for (int i = 0; i < roundNumber; ++i) {\n Round round = mTournament.createNewRound();\n assertTrue(\"State of new round must be CREATED\", round.getState() == State.CREATED);\n\n // tests can't create new round because not all rounds are completed\n Round falseRound = mTournament.createNewRound();\n assertEquals(\"Instance must be null\", null, falseRound);\n\n round.startRound();\n assertTrue(\"State of starting round must be RUNNING\", round.getState() == State.RUNNING);\n\n randomiseResults(round.getMatches());\n round.endRound();\n assertTrue(\"State of ending round must be COMPLETED\", round.getState() == State.COMPLETED);\n\n // tests that ended round can't be started again\n round.startRound();\n assertTrue(\"State of ended round must be COMPLETED\", round.getState() == State.COMPLETED);\n }\n // tests can't create one more round because game is over at this point\n Round round = mTournament.createNewRound();\n assertEquals(\"Instance must be null\", null, round);\n\n }", "public void checkGame() {\n\n\t}", "@Test\n void should_first_player_win_and_finish_the_game() {\n List<Integer> setPointOrderTab = Arrays.asList(1, 1, 1, 2, 1, 1, 1); // 6-1\n\n //WHEN\n game.computePoint(setPointOrderTab, true);\n\n //THEN\n assertTrue(firstPlayer.isWinner());\n assertEquals(GameStatus.FINISHED, game.getGameStatus());\n }", "private int gameState() {\n\t\t\n\t\tint gameNotOver = 0;\n\t\tint gameOverWinnerX = 1;\n\t\tint gameOverWinnerO = 2;\n\t\tint gameOverTie = 3;\n\t\t\n\t\t\n\t\t\n\t\t//Win Vertically \n\t\t// 0 3 6 , 1 4 7 , 2 5 8\n\t\t\t\t\n\t\t//Win Horizontally\n\t\t//0 1 2 , 3 4 5 , 6 7 8 \n\t\t\t\t\n\t\t//Win Diagonally\n\t\t// 0 4 8 , 2 4 6\n\t\t\t\t\n\t\t//Assuming it's an equal grid\n\t\t\t\t\n\t\tMark winningMark = null;\n\t\t\t\t\n\t\tboolean hasFoundWinner = false;\n\t\t\t\t\n\t\tint row = 0;\n\t\tint column = 0;\n\t\t\t\t\n\t\t//Horizontal Winner Test\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\tcolumn ++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tcolumn = 0;\n\t\t\trow++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// Vertical Winner Test\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\n\t\twhile (!hasFoundWinner && column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\trow = 0;\n\t\t\tcolumn++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Winner Test \"\\\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Test \"/\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = COLUMN_COUNT - 1;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn--;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If there are no moves left, and there is no winner, game ends inn a tie \n\t\t\n\t\tboolean foundNoMove = false;\n\t\tfor (int i = 0; i < movesArray.length; i++) {\n\t\t\tif (movesArray[i] == NO_MOVE) {\n\t\t\t\tfoundNoMove = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!foundNoMove && !hasFoundWinner) {\n\t\t\treturn gameOverTie;\n\t\t}\n\t\t\n\t\t// If there is no winner and there are still moves left, game is not over\n\t\t\n\t\treturn gameNotOver;\n\t\t\n\t}", "@Test\n void should_first_player_win_and_finish_the_game_when_second_player_has_score_5() {\n List<Integer> setPointOrderTab = Arrays.asList(2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1); // 7-5\n\n //WHEN\n game.computePoint(setPointOrderTab, true);\n\n //THEN\n assertTrue(firstPlayer.isWinner());\n assertEquals(GameStatus.FINISHED, game.getGameStatus());\n }", "private boolean testIfGameIsValid(ChesspairingGame game) {\n\t\tChesspairingPlayer playerA = game.getWhitePlayer();\n\t\tString keyA = playerA.getPlayerKey();\n\t\tChesspairingPlayer playerB = game.getBlackPlayer();\n\t\tString keyB = playerB.getPlayerKey();\n\t\tif (keyA.equals(keyB)) {\n\t\t\tthrow new IllegalStateException(\"You shuld never try to pare a players agains himself\");\n\t\t}\n\t\t/**\n\t\t * two players shall not meet more than once\n\t\t */\n\t\tList<String> partnersA = partnerHistory.get(keyA);\n\t\tif (partnersA.contains(keyB)) {\n\t\t\treturn false;\n\t\t}\n\t\tList<String> partnersB = partnerHistory.get(keyB);\n\t\tif (partnersB.contains(keyA)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * the color difference is the number of games played with white minus\n\t\t * the number of games played with black\n\t\t * \n\t\t * -2 < diff < 2\n\t\t */\n\t\tint aHistoryColor = getColorDifference(keyA);\n\t\tint bHistoryColor = getColorDifference(keyB);\n\n\t\t// if a is white\n\t\tint aWhite = aHistoryColor + 1;\n\t\tint bBlach = bHistoryColor - 1;\n\t\tboolean aPlaysWite = false;\n\t\tif ((-2 < aWhite) && (aWhite < 2) && (-2 < bBlach) && (bBlach < 2)) {\n\t\t\taPlaysWite = true;\n\t\t}\n\n\t\t// if a is black\n\t\tboolean aPlaysBlack = false;\n\t\tif (!aPlaysWite) {\n\t\t\tint aBlack = aHistoryColor - 1;\n\t\t\tint bWhite = bHistoryColor + 1;\n\t\t\tif ((-2 < aBlack) && (aBlack < 2) && (-2 < bWhite) && (bWhite < 2)) {\n\t\t\t\taPlaysBlack = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!aPlaysWite && !aPlaysBlack) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// basic tests have passed. time to return true\n\t\treturn true;\n\t}", "public void testGame1EmulateIncorrectAnswers() {\n int[] indicators;\n MainPage mainPage = getMainPage();\n GameObjectImpl game1 = mainPage.gameOpen(1);\n game1.waitIndicatorsLoad();\n indicators = game1.getIndicators();\n int qtyTasksBeforeCycle = indicators[3];\n int tasksFailedBeforeCycle = indicators[1];\n for(int iter = 0; iter < qtyTasksBeforeCycle - 1; iter++) {\n game1.waitTaskBegin();\n try {\n Thread.sleep(500);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n indicators = game1.getIndicators();\n int varTasksPassedBegin = indicators[0];\n int varTasksFailedBegin = indicators[1];\n int varTasksRemainBegin = indicators[2];\n int qtyTasksInLoopBegin = indicators[3];\n\n String[] partsOfTask = game1.getPartsOfTask();\n String firstNumberVar = partsOfTask[0];\n String secondNumberVar = partsOfTask[1];\n String operationVar = partsOfTask[2];\n int actualResult = game1.getResultWithKeys(firstNumberVar, secondNumberVar, operationVar);\n // press wrong button\n String strActualResult = Integer.toString(actualResult + 1);\n for (int i = 0; i < strActualResult.length(); i++) {\n String subStr = strActualResult.substring(i, i + 1);\n game1.pressButton((subStr));\n }\n //press correct button\n strActualResult = Integer.toString(actualResult);\n for (int i = 0; i < strActualResult.length(); i++) {\n String subStr = strActualResult.substring(i, i + 1);\n game1.pressButton((subStr));\n }\n indicators = game1.getIndicators();\n int varTasksPassedEnd = indicators[0];\n int varTasksFailedEnd = indicators[1];\n int varTasksRemainEnd = indicators[2];\n int qtyTasksInLoopEnd = indicators[3];\n\n assert varTasksRemainEnd == varTasksRemainBegin : \"positiveTestCorrectAnswers: tasks remain\";//\n assert varTasksFailedEnd == (varTasksFailedBegin + 1) : \"positiveTestCorrectAnswers: tasks failed\";\n assert varTasksPassedEnd == varTasksPassedBegin : \"positiveTestCorrectAnswers: tasks passed\";\n assert qtyTasksInLoopEnd == qtyTasksInLoopBegin + 1 : \"negativeTestWrongAnswers: tasks all\";\n }\n indicators = game1.getIndicators();\n int varTasksFailedAfterCycle = indicators[1];\n int qtyTasksAfterCycle = indicators[3];\n assert varTasksFailedAfterCycle - tasksFailedBeforeCycle == qtyTasksAfterCycle - qtyTasksBeforeCycle\n : \"positiveTestCorrectAnswers: tasks summ\" ;//\n game1.clickCloseGame();\n\n }", "public void calculateResult() {\n\t\tfor (GameEngineCallback callback : callbacks) {\n\t\t\t// Roll for house\n\t\t\tthis.rollHouse(INITIAL_DELAY, FINAL_DELAY, DELAY_INCREMENT);\n\t\t\t\n\t\t\tfor (Player player : this.players.values()) {\n\t\t\t\t// Players who are playing must have a bet and a score\n\t\t\t\t// This conditional may not be required in Assignment 2\n\t\t\t\tif (player.getBet() > 0 && player.getRollResult()\n\t\t\t\t\t\t.getTotalScore() > 0) {\n\t\t\t\t\t// Compare rolls, set result and add/subtract points\n\t\t\t\t\tif (this.houseDice.getTotalScore() > player.\n\t\t\t\t\t\t\tgetRollResult().getTotalScore()) {\n\t\t\t\t\t\tGameStatus status = GameEngine.GameStatus.LOST;\t\t\t\t\t\n\t\t\t\t\t\tplayer.setGameResult(status);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Subtract bet from player points\n\t\t\t\t\t\tint points = player.getPoints() - player.getBet();\n\t\t\t\t\t\tthis.setPlayerPoints(player, points);\n\t\t\t\t\t}\n\t\t\t\t\telse if (houseDice.getTotalScore() == player.\n\t\t\t\t\t\t\tgetRollResult().getTotalScore()) {\n\t\t\t\t\t\tGameStatus status = GameEngine.GameStatus.DREW;\t\t\t\t\t\n\t\t\t\t\t\tplayer.setGameResult(status);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No change to points on a draw\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tGameStatus status = GameEngine.GameStatus.WON;\t\t\t\t\t\n\t\t\t\t\t\tplayer.setGameResult(status);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Add bet to player points\n\t\t\t\t\t\tint points = player.getPoints() + player.getBet();\n\t\t\t\t\t\tthis.setPlayerPoints(player, points);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Display result\n\t\t\t\t\tcallback.gameResult(this.getPlayer(player.getPlayerId()), \n\t\t\t\t\t\t\tthis.getPlayer(player.getPlayerId()).getGameResult(), this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) {\r\n\t\t // SET UP: user input versus a heuristic monte carlo simulator vs a random player\r\n\t\t{\r\n\t\t\tPlayer[] players = new Player[]{new Player(\"user\", DecisionType.SCANNER), new Player(\"monte carlo\", DecisionType.HEURISTIC_MONTE_CARLO_10000), new Player(\"random\", DecisionType.RANDOM)};\r\n\t\t\tScanner scanner = new Scanner(System.in);\r\n\t\t\tplayers[0].setScanner(scanner);\r\n\r\n\t\t\tGame game = new Game(players, true, false);\r\n\t\t\tint numRounds = 10;\r\n\t\t\tfor (int i = 0; i < numRounds; i++) {\r\n\t\t\t\tgame.startNewRound();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// SET UP: three players (three user input players)\r\n//\t\t{\r\n//\t\t\tPlayer[] players = new Player[]{new Player(\"1\", DecisionType.SCANNER), new Player(\"2\", DecisionType.SCANNER), new Player(\"3\", DecisionType.SCANNER)};\r\n//\t\t\tScanner scanner = new Scanner(System.in);\r\n//\t\t\tplayers[0].setScanner(scanner);\r\n//\t\t\tplayers[1].setScanner(scanner);\r\n//\t\t\tplayers[2].setScanner(scanner);\r\n//\r\n//\t\t\tGame game = new Game(players, true, false);\r\n//\t\t\tint numRounds = 10;\r\n//\t\t\tfor (int i = 0; i < numRounds; i++) {\r\n//\t\t\t\tgame.startNewRound();\r\n//\t\t\t}\r\n//\t\t}\r\n\r\n\t\t// SET UP: a heuristic monte carlo player vs a monte carlo player vs a random player\r\n//\t\t{\r\n//\t\t\tPlayer[] players = new Player[]{new Player(\"heuristic monte carlo\", DecisionType.HEURISTIC_MONTE_CARLO_10000), new Player(\"monte carlo\", DecisionType.MONTE_CARLO_10000), new Player(\"random\", DecisionType.RANDOM)};\r\n//\t\t\tGame game = new Game(players, true, false);\r\n//\t\t\tint numRounds = 10;\r\n//\t\t\tfor (int i = 0; i < numRounds; i++) {\r\n//\t\t\t\tgame.startNewRound();\r\n//\t\t\t}\r\n//\t\t}\r\n\r\n\t\t// SET UP: three random players\r\n//\t\t{\r\n//\t\t\tPlayer[] players = new Player[]{new Player(\"1\", DecisionType.RANDOM), new Player(\"2\", DecisionType.RANDOM), new Player(\"3\", DecisionType.RANDOM)};\r\n//\t\t\tGame game = new Game(players, true, false);\r\n//\t\t\tint numRounds = 10;\r\n//\t\t\tfor (int i = 0; i < numRounds; i++) {\r\n//\t\t\t\tgame.startNewRound();\r\n//\t\t\t}\r\n//\t\t}\r\n\t}", "public int computeGameSituation(int paraState) {\n\t\tint[][] tempCheckerboard = stateToCheckerboard(paraState);\n\t\t// System.out.println(\"The checkerboard is: \" +\n\t\t// Arrays.deepToString(tempCheckerboard));\n\n\t\treturn computeGameSituation(tempCheckerboard);\n\t}", "public static void main(String[] args) {\r\n int grade = 0;\r\n \r\n initializeBoard();\r\n \r\n System.out.println(game);\r\n//getValueIn is a simple getter method the returns value at given array index \r\n if (game.getValueIn(1, 1) == 5)\r\n grade += 5;\r\n else\r\n System.out.println(\"getValueIn(r,c) test failed\");\r\n//confirms that to string was done correctly \r\n if (testToString()) \r\n grade += 5;\r\n else\r\n System.out.println(\"toString() test failed\");\r\n//testAddGuess1() test tries to add a guess (value to array index) that depends on boolean flag states \r\n game.addGuess(2, 3, 5);\r\n if (testAddGuess1()) \r\n grade += 5;\r\n else\r\n System.out.println(\"addGuess(r,c,v) test 1 failed\"); \r\n//testAddGuess2() test tries to add a guess (value to array index) that depends on boolean flag states \r\n game.addGuess(2, 2, 5);\r\n if (testAddGuess2()) \r\n grade += 5;\r\n else\r\n System.out.println(\"addGuess(r,c,v) test 2 failed\"); \r\n//testAddGuess3() test tries to add a guess (value to array index) that depends on boolean flag states \r\n game.addGuess(2, 4, 1);\r\n if (testAddGuess3()) \r\n grade += 10;\r\n else\r\n System.out.println(\"addGuess(r,c,v) test 3 failed\"); \r\n //tests reset(), by re-running the first toString test above, after running game.reset() \r\n game.reset();\r\n if (testToString())\r\n grade += 10;\r\n else\r\n System.out.println(\"reset() test failed\");\r\n//tests the game.getAllowedValues method by passing the game object method call and hence it's results\r\n//to the testGetAllowedValues(), which appears to only apply to one cell/array index at a time\r\n//so if I am correct this is saying what values can be used at coordinates 8, 8.\r\n//the answer that it uses to compare is a visual/manual analysis of expected results for cell 8, 8. \r\n if (testGetAllowedValues(game.getAllowedValues(8, 8)))\r\n grade += 10;\r\n else\r\n System.out.println(\"getAllowedValues() test failed\");\r\n \r\n System.out.printf(\"Your grade is %d/50.\\n\", grade);\r\n }", "@Test\n void should_second_player_win_match_when_he_won_tie_break() {\n List<Integer> setPointOrderTab = Arrays.asList(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2); // 6-6 and 1-3 for secondPlayer\n\n //WHEN\n game.computePoint(setPointOrderTab, true);\n\n //THEN\n assertEquals(GameStatus.FINISHED, game.getGameStatus());\n assertTrue(secondPlayer.isWinner());\n }", "@Test\r\n\tpublic void test() {\r\n\t\tmodel1.getActualTurn().setHasAttacked(true);\r\n\t\tassertEquals(attack2.isPossible(model1) , false);\r\n\t\t\r\n\t\t/* verifica che se gli alieni vincono il gioco viene chiuso */\r\n\t\taliensWin2.perform(model1);\r\n\t\tassertEquals(model1.getGameState() , GameState.CLOSING);\r\n\t\tassertEquals(model1.getActualTurn().getCurrentPlayer().getAvatar().getIsWinner() , EndState.WINNER);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn2);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento del metodo isPossible dell'azione di attacco */\r\n\t\tassertEquals(attack1.isPossible(model1) , false);\r\n\t\tmodel1.getActualTurn().setHasMoved(true);\r\n\t\tmodel1.getActualTurn().setHasDraw(true);\r\n\t\tassertEquals(attack1.isPossible(model1) , false);\r\n\t\tmodel1.getActualTurn().setHasDraw(false);\r\n\t\tmodel1.setGameState(GameState.ACCEPTING);\r\n\t\tassertEquals(attack1.isPossible(model1) , false);\r\n\t\tmodel1.setGameState(GameState.RUNNING);\r\n\t\tassertEquals(attack1.isPossible(model1) , true);\r\n\t\tmodel1.getGamePlayers().get(0).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(1).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(2).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(3).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(4).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(5).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(6).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tevtAttacked1 = attack1.perform(model1);\r\n\t\tassertEquals(((EventAttacked)evtAttacked1.get(1)).getAreThereOtherHumans() , false);\r\n\t\tmodel1.getGamePlayers().get(1).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tmodel1.getGamePlayers().get(0).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tmodel1.getGamePlayers().get(2).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tmodel1.getGamePlayers().get(3).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tevtAttacked1 = attack1.perform(model1);\t\r\n\t\tassertEquals(((EventSufferAttack)evtAttacked1.get(0)).getKilled() , killedPlayer);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn3);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento del metodo isPossible dell'azione di attacco */\r\n\t\tmodel1.setGameState(GameState.ACCEPTING);\r\n\t\t((Human)model1.getActualTurn().getCurrentPlayer().getAvatar()).setCanAttack(true);\r\n\t\tassertEquals(attack3.isPossible(model1) , false);\r\n\t\tmodel1.setGameState(GameState.RUNNING);\r\n\t\t((Human)model1.getActualTurn().getCurrentPlayer().getAvatar()).setCanAttack(false);\r\n\t\tassertEquals(attack3.isPossible(model1) , false);\r\n\t\t((Human)model1.getActualTurn().getCurrentPlayer().getAvatar()).setCanAttack(true);\r\n\t\tmodel1.getActualTurn().setHasAttacked(true);\r\n\t\tassertEquals(attack3.isPossible(model1) , false);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn4);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento della perform dell'azione di attacco */\r\n\t\tsector1 = model1.getGameMap().searchSectorByName(\"Hatch\");\r\n\t\tmodel1.getActualTurn().getCurrentPlayer().getAvatar().setCurrentSector(sector1);\r\n\t\tevtAttacked2 = humanWin2.perform(model1);\r\n\t\tassertEquals(((EventNotifyHumanWin)evtAttacked2.get(0)).getGenerator() , player4);\r\n\t\tmodel1.getGamePlayers().get(3).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(2).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(0).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(1).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(4).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tassertEquals(humanWin2.perform(model1).size() , 3);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn7);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento dell'utilizzo della carta difesa */\r\n\t\tmodel1.getActualTurn().getCurrentPlayer().getAvatar().addCard(card);\r\n\t\tdefense = new Defense(evtDefense);\r\n\t\tevtAttacked2 = defense.perform(model1);\r\n\t\tassertTrue(!model1.getActualTurn().getCurrentPlayer().getAvatar().getMyCards().contains(card));\r\n\t\tassertTrue(evtAttacked2.get(0) instanceof EventRejectCardAlien);\r\n\t\tassertTrue(evtAttacked2.get(1) instanceof EventCardUsed);\r\n\t\t\r\n\t}", "public int evaluate(int[][] gameBoard) {\n for (int r = 0; r < 3; r++) {\n if (gameBoard[r][0] == gameBoard[r][1] && gameBoard[r][1] == gameBoard[r][2]) {\n if (gameBoard[r][0] == ai)\n return +10;\n else if (gameBoard[r][0] == human)\n return -10;\n }\n }\n // Checking for Columns for victory.\n for (int c = 0; c < 3; c++) {\n if (gameBoard[0][c] == gameBoard[1][c] && gameBoard[1][c] == gameBoard[2][c]) {\n //gameLogic.getWinType();\n if (gameBoard[0][c] == ai)\n return +10;\n else if (gameBoard[0][c] == human)\n return -10;\n }\n }\n // Checking for Diagonals for victory.\n if (gameBoard[0][0] == gameBoard[1][1] && gameBoard[1][1] == gameBoard[2][2]) {\n if (gameBoard[0][0] == ai)\n return +10;\n else if (gameBoard[0][0] == human)\n return -10;\n }\n if (gameBoard[0][2] == gameBoard[1][1] && gameBoard[1][1] == gameBoard[2][0]) {\n if (gameBoard[0][2] == ai)\n return +10;\n else if (gameBoard[0][2] == human)\n return -10;\n }\n // Else if none of them have won then return 0\n return 0;\n }", "@Test\n void should_activate_tie_break_when_two_players_reach_set_6() {\n List<Integer> setPointOrderTab = Arrays.asList(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2); // 6-6\n\n //WHEN\n game.computePoint(setPointOrderTab, true);\n\n //THEN\n assertEquals(GameStatus.IN_PROGRESS, game.getGameStatus());\n assertTrue(game.isTiebreakIsActivated());\n }", "@Test\n public void isGameOver()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertFalse(adjudicator.isGameOver(environment));\n }", "public void startGame(){\n\n AgentAddress coordinatorAddressPre = getAgentWithRole(\"investment_game\", \"tout_le_monde\", \"coordinator\");\n\n if (coordinatorAddressPre==null){\n Coordinator coordinator = new Coordinator();\n\n launchAgent(coordinator);\n\n pause(1000);\n }\n\n Set<Player> players = new HashSet<Player>();\n Player primaryPlayer = null;\n\n //now launch all human player avatar agents, each of them will be initialized as agent having a GUI frame\n Iterator<GameSpecification.PlayerSpecification> playerSpecs = gameSpecification.getPlayerSpecifications().iterator();\n\n int launchedHumanPlayers = 0;\n\n while (playerSpecs.hasNext()){\n GameSpecification.PlayerSpecification spec = playerSpecs.next();\n\n if (spec instanceof GameSpecification.HumanPlayerSpecification){\n\n HumanPlayerAvatar humanPlayerAvatar = new HumanPlayerAvatar(spec.getName());\n\n launchAgent(humanPlayerAvatar,true);\n\n players.add(humanPlayerAvatar);\n\n launchedHumanPlayers++;\n\n if (null == primaryPlayer){\n primaryPlayer=humanPlayerAvatar;\n }\n\n }\n }\n\n //launch computer player agents. If no human players have been launched, the first computer player will display a GUI frame.\n playerSpecs = gameSpecification.getPlayerSpecifications().iterator();\n\n boolean first = true;\n\n while (playerSpecs.hasNext()){\n GameSpecification.PlayerSpecification spec = playerSpecs.next();\n\n if (spec instanceof GameSpecification.ComputerPlayerSpecification){\n\n ChooseAmountStrategy chooseAmountStrategy = ((GameSpecification.ComputerPlayerSpecification) spec).getChooseAmountStrategy();\n\n SelectOpponentStrategy selectOpponentStrategy = ((GameSpecification.ComputerPlayerSpecification) spec).getSelectOpponentStrategy();\n \n ComputerPlayer computerPlayer = new ComputerPlayer(spec.getName(),spec.getPictureFileName(), chooseAmountStrategy, selectOpponentStrategy);\n\n chooseAmountStrategy.setPlayer(computerPlayer);\n\n selectOpponentStrategy.setPlayer(computerPlayer);\n\n launchAgent(computerPlayer, launchedHumanPlayers == 0 && first);\n\n players.add(computerPlayer);\n\n if (null == primaryPlayer){\n primaryPlayer=computerPlayer;\n }\n\n first = false;\n\n }\n }\n\n //request new game from coordinator\n AgentAddress coordinatorAddress;\n\n while((coordinatorAddress = getAgentWithRole(\"investment_game\",\"tout_le_monde\",\"coordinator\"))==null){\n pause(750);\n }\n\n String requestGameSpec = \"<new_game> <for> \"+gameSpecification.getPlayerSpecifications().size()+\" <players> <having> \"+gameSpecification.getRounds()+\" <rounds> <invite> 0 <computer_players>\";\n\n ActMessage reply = (ActMessage)sendMessageWithRoleAndWaitForReply(coordinatorAddress,new ActMessage(\"request_game\",requestGameSpec),\"jeromes_assistant\");\n\n if (reply.getAction().equals(\"game_initialized\")){\n\n final String gameId = reply.getContent();\n\n //let players join the game\n Iterator<Player> playerIterator = players.iterator();\n\n while (playerIterator.hasNext()){\n\n final Player player = playerIterator.next();\n final boolean isPrimaryPlayer = player.equals(primaryPlayer);\n\n new Thread(){\n @Override\n public void run() {\n player.joinGame(gameId,isPrimaryPlayer,player.getPicturePath());\n }\n }.start();\n\n }\n }else{\n //TODO throw Exception\n }\n\n }", "public Tournament(){\n simplePlayer = new SimpleFakeGinRummyPlayer(new ParamList(new double[]{}));\n\n knockOnGinPlayer = new EnsembleHandEvalPlayer(ParamList.getRandomParamList(1), new DeadwoodHandEvaluator());\n knockOnGinPlayer.setKnockDecider(new KnockOnGinKnockDecider() );\n knockOnGinPlayer.setDrawDecider(new MeldOnlyDrawDecider());\n\n ExperimentalRuns.fixTwoStageKnockDecider101();\n // paramOfTunedTwoStagePlayer.set(ParamList.TS_KNOCK_THRESHOLD_EARLY, 0);\n // paramOfTunedTwoStagePlayer.set(ParamList.TS_KNOCK_THRESHOLD_LATE, 0);\n // paramOfTunedTwoStagePlayer.set(ParamList.TS_KNOCK_MIDDLE, 6);\n ParamList.setFixedValue(ParamList.TS_DRAW_MIDDLE, 14);\n ParamList paramOfTunedTwoStagePlayer = ParamList.getRandomParamList(1);\n System.out.println(paramOfTunedTwoStagePlayer);\n tunedTwoStagePlayer = new IndexEnsembleHandEvalPlayer(paramOfTunedTwoStagePlayer, new DeadwoodHandEvaluator());\n tunedTwoStagePlayer.setKnockDecider(new TwoStageKnockDecider(paramOfTunedTwoStagePlayer) );\n tunedTwoStagePlayer.setDrawDecider(new MeldOnlyDrawDecider());\n tunedTwoStagePlayer.setDrawDecider(new TwoStageDrawDecider(paramOfTunedTwoStagePlayer));\n\n resultSimpleVsKnockGin = 0;\n resultKnockGinVsTwoStage = 0;\n resultTwoStageVsSimple = 0;\n\n numGamePerPair = 2000;\n\n }", "@Test\r\n void testTitForTatWithHistoryCooperate() {\r\n TitForTat testStrat = new TitForTat();\r\n AlwaysCooperate testStrat2 = new AlwaysCooperate();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n Game game = new Game(testStrat, testStrat2, 2, payoffs);\r\n game.playGame();\r\n int points = testStrat.getPoints();\r\n assertEquals(points, 6, \"tit for tat not returning correctly \"\r\n + \"against cooperating opponent\"); \r\n }", "@Test\n\tpublic void should_two_player_fight_together_and_output_result(){\n\t\tPlayer playerA = new Player(\"李四\", 20, 100);\n\t\tPlayer playerB = new Player(\"张三\", 20, 100);\n\t\tGame game = new Game(playerA, playerB, out);\n\t\tgame.start();\n\t\tinorder.verify(out).println(\"张三被打败了\");\n\t}", "@Test\n public void testFullGameDraw() throws AuthenticationException {\n Map<String, String> data = gameInitializationService.createGame();\n Integer gameId = Integer.parseInt(data.get(GAME_ID));\n final String tokenPlayerX = data.get(TOKEN);\n final String tokenPlayerO = gameInitializationService.joinGame(gameId);\n AnotherPlayersTurnException anotherPlayersTurnException = null;\n try {\n gamePlayService.playGame(gameId, \"A1\", tokenPlayerX);\n } catch (AnotherPlayersTurnException e) {\n anotherPlayersTurnException = e;\n }\n Assertions.assertNotNull(anotherPlayersTurnException, \"Another player test.\");\n Assertions.assertEquals(\"Another player has to play.\", anotherPlayersTurnException.getMessage(),\n \"Another player exception message test\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A1\", tokenPlayerO), \"Test game - O is playing A1!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A2\", tokenPlayerX), \"Test game - X is playing A2!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"B1\", tokenPlayerO), \"Test game - O is playing B1!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"B2\", tokenPlayerX), \"Test game - X is playing B2!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"C2\", tokenPlayerO), \"Test game - O is playing C2!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"C1\", tokenPlayerX), \"Test game - X is playing C1!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A3\", tokenPlayerO), \"Test game - O is playing A3!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"B3\", tokenPlayerX), \"Test game - X is playing B3!\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"C3\", tokenPlayerO), \"Test game - O is playing C3!\");\n GameOverException gameOverException = null;\n try {\n gamePlayService.playGame(gameId, \"A1\", tokenPlayerX);\n } catch (GameOverException e) {\n gameOverException = e;\n }\n Assertions.assertNotNull(gameOverException, \"Game over test.\");\n Assertions.assertEquals(\"This game is already over.\", gameOverException.getMessage(),\n \"Game over exception message test\");\n try {\n gamePlayService.playGame(gameId, \"A1\", tokenPlayerO);\n } catch (GameOverException e) {\n gameOverException = e;\n }\n Assertions.assertNotNull(gameOverException, \"Game over test.\");\n Assertions.assertEquals(\"This game is already over.\", gameOverException.getMessage(),\n \"Game over exception message test\");\n Assertions.assertEquals(\"DRAW\", gamePlayService.obtainGameStatus(gameId, tokenPlayerX));\n }", "public void runGame() {\r\n\t\ttry {\r\n\t\t\thost.startNewGame(width, height, false);\r\n\t\t\tguest.startNewGame(width, height, true);\r\n\t\t\tnotifyStartGame(width, height);\r\n\t\t} catch(Exception e) {return;}\r\n\t\twhile(!game.isGameOver()) {\r\n\t\t\tcurrentPlayer = game.getCurrentPlayer();\r\n\t\t\tMove move;\r\n\t\t\ttry {\r\n\t\t\t\tmove = currentPlayer.getNextMove();\r\n\t\t\t} catch(Exception e) { return ;}\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tif(game.isValidMove(move)) {\r\n\t\t\t\t\tgame.registerMove(move);\r\n\t\t\t\t\thost.registerMove(move);\r\n\t\t\t\t\tguest.registerMove(move);\r\n\t\t\t\t\tnotifyMove(move);\r\n\t\t\t\t}\r\n\t\t\t} catch (IllegalMove e) { }\r\n\t\t\tcatch (Exception e) { return; }\r\n\t\t}\r\n\n\t\ttry {\r\n\t\t\thost.finishGame(game.getResult(host));\r\n\t\t\tguest.finishGame(game.getResult(guest));\r\n\t\t\tnotifyFinishGame(game.getResult(host));\r\n\t\t} catch( Exception e) { return; }\n\t}", "public void checkEndGame() {\n\t\t\n\t\tboolean gameFinished = false;\n\t\t//boolean playerOne = false;\n\t\t//boolean playerTwo = false;\n\t\t\n\t\t\n\t\tif (bucket[13].getnumOfRocks() == 0 && bucket[12].getnumOfRocks() == 0 && bucket[11].getnumOfRocks() == 0\n\t\t\t\t&& bucket[10].getnumOfRocks() == 0 && bucket[9].getnumOfRocks() == 0\n\t\t\t\t&& bucket[8].getnumOfRocks() == 0) {\n\n\t\t\tint left = bucket[6].getnumOfRocks() + bucket[5].getnumOfRocks() + bucket[4].getnumOfRocks()\n\t\t\t\t\t+ bucket[3].getnumOfRocks() + bucket[2].getnumOfRocks() + bucket[1].getnumOfRocks()\n\t\t\t\t\t+ bucket[0].getnumOfRocks();\n\n\t\t\tbucket[0].setnumOfRocks(left, c);\n\t\t\tbucket[6].setnumOfRocks(0, c);\n\t\t\tbucket[5].setnumOfRocks(0, c);\n\t\t\tbucket[4].setnumOfRocks(0, c);\n\t\t\tbucket[3].setnumOfRocks(0, c);\n\t\t\tbucket[2].setnumOfRocks(0, c);\n\t\t\tbucket[1].setnumOfRocks(0, c);\n\t\t\t\n\t\t\tgameFinished = true;\n\t\t}\n\n\t\tif (bucket[1].getnumOfRocks() == 0 && bucket[2].getnumOfRocks() == 0 && bucket[3].getnumOfRocks() == 0\n\t\t\t\t&& bucket[4].getnumOfRocks() == 0 && bucket[5].getnumOfRocks() == 0 && bucket[6].getnumOfRocks() == 0) {\n\n\t\t\tint right = bucket[13].getnumOfRocks() + bucket[12].getnumOfRocks() + bucket[11].getnumOfRocks();\n\t\t\tright = right + bucket[10].getnumOfRocks() + bucket[9].getnumOfRocks() + bucket[8].getnumOfRocks()\n\t\t\t\t\t+ bucket[7].getnumOfRocks();\n\n\t\t\tbucket[7].setnumOfRocks(right, c);\n\t\t\tbucket[13].setnumOfRocks(0, c);\n\t\t\tbucket[12].setnumOfRocks(0, c);\n\t\t\tbucket[11].setnumOfRocks(0, c);\n\t\t\tbucket[10].setnumOfRocks(0, c);\n\t\t\tbucket[9].setnumOfRocks(0, c);\n\t\t\tbucket[8].setnumOfRocks(0, c);\n\n\t\t\tgameFinished = true;\n\t\t}\n\t\t\n\t\t\n\t\tif(gameFinished==true){\n\t\t\tif(bucket[7].getnumOfRocks()<bucket[0].getnumOfRocks()){\n\t\t\t\tplayerOne=true;\n\t\t\t}else{\n\t\t\t\tplayerTwo=true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t/*if(playerOne==true){\n\t\t\tSystem.out.println(\"Player A won\");\n\t\t}\n\t\tif(playerTwo == true){\n\t\t\tSystem.out.println(\"Player B won\");\n\t\t}\n\t\t */\n\t\t\n\t}", "@Test\n void testGameContext() {\n Set<Player> playersNotMatched = new HashSet<>(players);\n for(Player player : gameContext.getPlayersTurnOrder()) {\n assertTrue(playersNotMatched.contains(player));\n playersNotMatched.remove(player);\n }\n assertTrue(playersNotMatched.isEmpty());\n\n assertNotNull(gameContext.getMarket());\n assertNotNull(gameContext.getDevelopmentCardsTable());\n assertNotNull(gameContext.getFaithPath());\n assertNotNull(gameContext.getPlayersTurnOrder());\n\n for(Player player : players)\n assertNotNull(gameContext.getPlayerContext(player));\n }", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "public void testNoBeforeYesSameElapsed() throws Exception{\n \n // RunID TeamID Prob Time Result\n \n String [] runsData = {\n \"15,8,D,12,Yes\",\n \"16,8,D,12,No\",\n \n \"24,4,B,15,Yes\",\n \"25,4,B,15,No\",\n \"26,4,B,15,No\",\n \n \"28,2,C,22,Yes\",\n \"29,2,C,22,No\",\n \"30,2,C,22,Yes\",\n \"30,2,C,22,Yes\",\n };\n \n /**\n * \n * \n * \n */\n \n // Rank TeamId Solved Penalty\n \n String [] rankData = {\n \"1,team8,1,12\",\n \"2,team4,1,15\",\n \"3,team2,1,22\",\n \"4,team1,0,0\",\n \"4,team3,0,0\",\n \"4,team5,0,0\",\n \"4,team6,0,0\",\n \"4,team7,0,0\",\n };\n \n scoreboardTest (8, runsData, rankData);\n }", "protected void processMyGameResult(int gameNumber, boolean becomesExamined, String gameResultCode, String scoreString, String descriptionString) {\n Game game = tournamentService.findGame(gameNumber);\n if (game == null) {\n return;\n }\n /* Subtract USCL-Bot itself */\n int observerCount = game.observerCountMax - 1;\n boolean adjourned = (descriptionString.indexOf(\"adjourn\") >= 0);\n if (adjourned) {\n game.status = GameState.ADJOURNED;\n } else if (\"0-1\".equals(scoreString)) {\n game.status = GameState.BLACK_WINS;\n } else if (\"1-0\".equals(scoreString)) {\n game.status = GameState.WHITE_WINS;\n } else if (\"1/2-1/2\".equals(scoreString)) {\n game.status = GameState.DRAW;\n } else if (\"aborted\".equals(scoreString)) {\n game.status = GameState.NOT_STARTED;\n } else {\n game.status = GameState.UNKNOWN;\n alertManagers(\"Error: unexpected game status \\\"{0}\\\": {1}\", gameResultCode, scoreString);\n }\n tournamentService.updateGameStatus(game, game.status);\n if (game.status.isFinished()) {\n String whiteName = game.whitePlayer.getPreTitledHandle(USCL_RATING);\n String blackName = game.blackPlayer.getPreTitledHandle(USCL_RATING);\n String libraryHandle = settingsService.getLibraryHandle();\n int librarySlot = settingsService.getAndIncrementNextLibrarySlot();\n String examineCommand = String.format(\"examine %s %%%d\", libraryHandle, librarySlot);\n command.spoof(libraryHandle, \"libsave {0} -1 %{1}\", game.whitePlayer.getHandle(), librarySlot);\n QEvent.event(game.eventSlot)\n .description(\"%-4s %s - %s\", game.status, whiteName, blackName)\n .addJoinCommand(examineCommand)\n .allowGuests(true)\n .send(command);\n tellEventChannelsAndManagers(\"{0} vs {1}: \\\"{2}\\\" : {3} ({4} observers)\", game.whitePlayer,\n game.blackPlayer, examineCommand, descriptionString, observerCount);\n command.spoof(monitorRole, \"-notify {0}\", game.whitePlayer);\n command.spoof(monitorRole, \"-notify {0}\", game.blackPlayer);\n } else {\n tellEventChannels(\"{0} vs {1}: {2} ({3} observers)\", game.whitePlayer, game.blackPlayer, descriptionString, observerCount);\n }\n if (!adjourned) {\n command.sendCommand(\"qset {0} isolated 0\", game.whitePlayer);\n command.sendCommand(\"qset {0} isolated 0\", game.blackPlayer);\n command.sendAdminCommand(\"-kmuzzle {0}\", game.whitePlayer);\n command.sendAdminCommand(\"-kmuzzle {0}\", game.blackPlayer);\n }\n tournamentService.flush();\n }", "@Test\n public void endGameDetectionTrue() {\n logic.setDirection(1);\n for (int i = 0; i < 100; i++) {\n logic.eatFoodForTesting();\n logic.gameLogic();\n }\n assertFalse(logic.gameLogic());\n }", "@Test\n void doEffectrocketlauncher() {\n ArrayList<Player> pl = new ArrayList<>();\n AlphaGame g = new AlphaGame(1, pl,false, 8);\n WeaponFactory wf = new WeaponFactory(\"rocket launcher\");\n Weapon w19 = new Weapon(\"rocket launcher\", wf.getBooleans(), wf.getCosts(), wf.getRequestedNum(), wf.getApplier(), wf.getEffects(), wf.getDescriptions());\n WeaponDeck wd = new WeaponDeck();\n RealPlayer p = new RealPlayer('b', \"ciccia\");\n wd.addWeapon(w19);\n p.setPlayerPosition(Board.getSquare(6));\n p.getPh().drawWeapon(wd, w19.getName());\n RealPlayer victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n ArrayList<Player> players = new ArrayList<>();\n ArrayList<GenericSquare> s = new ArrayList<>();\n players.add(victim);\n s.add(Board.getSquare(10));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"base\", null, null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 2 && victim.getPlayerPosition() == Board.getSquare(10));\n\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(7));\n s.add(Board.getSquare(10));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"opt1\", \"base\", null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 2 && victim.getPlayerPosition() == Board.getSquare(10) && p.getPlayerPosition() == Board.getSquare(7));\n\n p.setPlayerPosition(Board.getSquare(6));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n RealPlayer victim2 = new RealPlayer('v', \"ciccia\");\n victim2.setPlayerPosition(Board.getSpawnpoint('y'));\n RealPlayer victim3 = new RealPlayer('g', \"ciccia\");\n victim3.setPlayerPosition(Board.getSpawnpoint('y'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(7));\n s.add(Board.getSquare(10));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"opt1\", \"base\", \"opt2\", p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 3 && victim.getPlayerPosition() == Board.getSquare(10) && p.getPlayerPosition() == Board.getSquare(7) && victim2.getPb().countDamages() == 1 && victim3.getPb().countDamages() == 1);\n\n p.setPlayerPosition(Board.getSquare(6));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n victim2 = new RealPlayer('v', \"ciccia\");\n victim2.setPlayerPosition(Board.getSpawnpoint('y'));\n victim3 = new RealPlayer('g', \"ciccia\");\n victim3.setPlayerPosition(Board.getSpawnpoint('y'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(10));\n s.add(Board.getSquare(7));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"base\", \"opt2\", \"opt1\", p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 3 && victim.getPlayerPosition() == Board.getSquare(10) && p.getPlayerPosition() == Board.getSquare(7) && victim2.getPb().countDamages() == 1 && victim3.getPb().countDamages() == 1);\n }", "boolean winGame();", "public void executeMove(Game game) {\n int bestScore = 0;\n int comScore = 0;\n Board board = game.getBoard();\n int col = (board.getCols());\n int row = (board.getRows());\n \n // Basic for loop to go through and grab each gem and call the score policy on it\n // it stores the best opton in best score\n for(int i = 0; i < row; i++){\n for(int ii = 0; ii < col; ii++){\n if(board.gemAt(i,ii).isEmpty() == true){\n continue;\n }\n comScore = game.getPolicy().scoreMove(i,ii,board);\n if(comScore >= bestScore){\n bestScore = comScore;\n }\n }\n }\n \n // This for loop makes a Coord with the rows and col i and ii to keep track of where the best gem was located \n for(int i = 0; i < row; i++){\n for(int ii = 0; ii < col; ii++){\n if(board.gemAt(i,ii).isEmpty() == true){\n continue;\n }\n if(game.getPolicy().scoreMove(i,ii,board) == bestScore){\n holder.add(new Coord(i,ii));\n }\n }\n }\n \n // For loop to choose the best Gem out of the holders Coords to call \"removeGemAdjustScore()\"\n for(int i = 0; i < holder.size(); i++){\n if(holder.size() == 1){\n game.removeGemAdjustScore(holder.get(i).row,holder.get(i).col);\n break;\n }\n game.removeGemAdjustScore(holder.get(i).row,holder.get(i).col);\n break;\n }\n \n // Resets the holder and best score for the next move\n holder = new ArrayList<Coord>();\n bestScore = 0;\n \n }", "public GameResults runGame() {\n\n initializeGame();\n gameLoop();\n return new GameResults(decideWinner());\n }", "@Test\n void should_first_player_win_set_and_game_still_in_progress_when_tie_break_activated() {\n List<Integer> setPointOrderTab = Arrays.asList(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1); // 6-6 and 1-0 for firstPlayer\n\n //WHEN\n game.computePoint(setPointOrderTab, true);\n\n //THEN\n assertEquals(GameStatus.IN_PROGRESS, game.getGameStatus());\n assertTrue(game.isTiebreakIsActivated());\n }", "private boolean checkForBigGameWin(){\n boolean truth = false;\n if (checkGameWin(getLettersOfAllGames())){\n truth = true;\n }\n return truth;\n }", "protected abstract int evaluate(GameState state, String playername);", "public static void checkResult() {\n\t\tint sum = PlayerBean.PLAYERONE - PlayerBean.PLAYERTWO;\n\n\t\tif (sum == 1 || sum == -2) {\n\t\t\tScoreBean.addWin();\n\t\t\tresult = \"player one wins\";\n\t\t} else {\n\t\t\tScoreBean.addLoss();\n\t\t\tresult = \"player two wins\";\n\t\t}\n\t}", "Games game();", "public IGameAlgo.GameState getGameState (GameBoard.GameMove move){\n\t\t/*\n\t\t * If last move made by computer,check if computer wins.\n\t\t */\n\t\tif(this.board[lastMove.getRow()][lastMove.getColumn()]==BoardSigns.COMPUTER.getSign()) {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[0][1] == BoardSigns.COMPUTER.getSign() && board[0][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][0] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][1] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][2] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][2] == BoardSigns.COMPUTER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.COMPUTER.getSign() && board[1][1] == BoardSigns.COMPUTER.getSign() && board[2][0] == BoardSigns.COMPUTER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_LOST;\t\t\t\t\t\t \n\t\t}\n\t\t/*\n\t\t * If last move made by player,check if player wins.\n\t\t */\n\t\telse {\n\t\t\t if(\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[0][1] == BoardSigns.PLAYER.getSign() && board[0][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[1][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[2][0] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][0] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][1] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][1] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][2] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][0] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][2] == BoardSigns.PLAYER.getSign()) ||\n\t\t (board[0][2] == BoardSigns.PLAYER.getSign() && board[1][1] == BoardSigns.PLAYER.getSign() && board[2][0] == BoardSigns.PLAYER.getSign())\n\t\t )\n\t\t\t\t return GameState.PLAYER_WON;\t\n\t\t}\n\t\t/*\n\t\t * No one wins,check if in progress or game ends with tie.\n\t\t */\n\t\t\n\t\t //check if exist empty spots. \n\t\t\tfor(int i=0;i<3;i++)\n\t\t\tfor(int j=0;j<3;j++)\n\t\t\t\tif(board[i][j]==TicTacTow.BoardSigns.BLANK.getSign()) \n\t\t\t\t return GameState.IN_PROGRESS;\n\t\t\treturn GameState.TIE;\t\t\t\n\t}", "@Test\n public void testCalculateScore() {\n System.out.println(\"calculateScore\");\n String input1 = \"8 0 3 1 6 5 -2 4 7 1 3 -2 6\";\n String input2 = \"8 0 3 1 6 5 -2 4 7 3 2 -2 6\";\n CCGeneticDrift instance = new CCGeneticDrift();\n int expResult1 = 2;\n int expResult2 = 4;\n int result1 = instance.calculateScore(input1);\n assertEquals(result1, expResult1);\n int result2 = instance.calculateScore(input2);\n assertEquals(result2, expResult2);\n }", "@Test\n public void isGameOverNoRed()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n\n for (int y = 8 - 3; y < 8; y++)\n {\n for (int x = 0; x < 8; x++)\n {\n if ((x % 2) != (y % 2))\n {\n final CheckersPosition position = CheckersPosition.findByCoordinates(x, y);\n environment.removeToken(position);\n }\n }\n }\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(0));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(12));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n }", "private static int evalState(GameState state){\n Move m = state.getMove();\n int counter = 0;\n\n // return directly if we encouter win or loss\n if(m.isXWin()){\n return 10000;\n }\n else if(m.isOWin()){\n return -1;\n }\n\n Vector<Integer> points = new Vector<Integer>();\n points.setSize(state.BOARD_SIZE*2+2);\n int player;\n Collections.fill(points, 1);\n int scaling = 4;\n int value = 0;\n\n for(int row = 0; row < state.BOARD_SIZE; row ++){\n for(int col = 0; col < state.BOARD_SIZE; col ++){\n player = state.at(row, col);\n\n // add points to the vector, increase by a factor for every new entry\n if(player == 1){\n points.set(row, points.get(row)*scaling);\n points.add(state.BOARD_SIZE + col, points.get(state.BOARD_SIZE - 1 + col)*scaling);\n\n // if it's in the first diagonal\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, points.get(state.BOARD_SIZE*2)*scaling);\n }\n\n // checking other diagonal\n if(counter%state.BOARD_SIZE-1 == 0 && row+col != 0){\n points.add(state.BOARD_SIZE*2 + 1, points.get(state.BOARD_SIZE*2)*scaling);\n }\n }\n // if an enemy player is encoutered null the value of the row/col\n else if(player == 2){\n points.set(row, 0);\n points.set(state.BOARD_SIZE + col, 0);\n if(counter%state.BOARD_SIZE+1 == 0){\n points.add(state.BOARD_SIZE*2, 0);\n }\n if(counter%state.BOARD_SIZE-1 == 0){\n points.add(state.BOARD_SIZE*2 + 1, 0);\n }\n }\n counter++;\n }\n }\n\n // if we have nulled the point we don't count it for the value of the state\n for(Integer i: points){\n if(i > 1){\n value += i;\n }\n }\n //System.err.println(\"Value: \" + value);\n return value;\n }", "void computeResult() {\n // Get the winner (null if draw).\n roundWinner = compareTopCards();\n\n\n if (roundWinner == null) {\n logger.log(\"Round winner: Draw\");\n logger.log(divider);\n // Increment statistic.\n numDraws++;\n\n } else {\n logger.log(\"Round winner: \" + roundWinner.getName());\n\t logger.log(divider);\n this.gameWinner = roundWinner;\n if (roundWinner.getIsHuman()) {\n // Increment statistic.\n humanWonRounds++;\n }\n }\n\n setGameState(GameState.ROUND_RESULT_COMPUTED);\n }", "@Test\n public void testWhoIsOnTurn() {\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(0), \"Test - 0 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(1), \"Test - 1 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(2), \"Test - 2 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(3), \"Test - 3 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(4), \"Test - 4 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(5), \"Test - 5 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(6), \"Test - 6 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(7), \"Test - 7 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(8), \"Test - 8 returns player O\");\n }", "public int play(NumberGame game){\n\n System.out.println( game.toString() );\n System.out.println();\n int min = 1;\n int max = game.getUpperBound();\n int guess = min + (max - min)/2;\n while(true){\n if(game.guess(guess)){\n break;\n }else {\n\n if(game.getMessage().contains(\"small\")){\n min = guess + 1;\n }else {\n max = guess - 1;\n }\n\n guess = min + (max - min)/2;\n\n }\n\n }\n\n return guess;\n }", "@Test\n public void runNewGameTest() {\n\tassertNotEquals(-1,score);\n }", "public void simulation(){\n GameInformation gi = this.engine.getGameInformation();\n Point ball = gi.getBallPosition();\n Player playerSelected;\n int xTemp;\n team = gi.getTeam(ball.x , ball.y);\n\n //Attack\n if(team == gi.activeActor){\n selectAttackerPlayer(gi.getPlayerTeam(gi.activeActor));\n doAttackMoove(playerOne.getPosition(), gi.cells[(int) playerOne.getPosition().getX()][(int) playerOne.getPosition().getY()].playerMoves);\n selectProtectPlayer(gi.getPlayerTeam(gi.activeActor));\n doProtectMoove(playerTwo.getPosition(), playerOne.getPosition() ,gi.cells[(int) playerTwo.getPosition().getX()][(int) playerTwo.getPosition().getY()].playerMoves);\n playerOne = null;\n playerTwo = null;\n this.engine.next();\n }\n else{//Defense\n selectCloserPlayer(gi.getPlayerTeam(gi.activeActor));\n doDefenseMoove(playerOne.getPosition(), this.engine.getGameInformation().getBallPosition() ,gi.cells[(int) playerOne.getPosition().getX()][(int) playerOne.getPosition().getY()].playerMoves);\n selectCloserPlayer(gi.getPlayerTeam(gi.activeActor));\n doDefenseMoove(playerOne.getPosition(), this.engine.getGameInformation().getBallPosition() ,gi.cells[(int) playerOne.getPosition().getX()][(int) playerOne.getPosition().getY()].playerMoves);\n TacklAction tackl = new TacklAction();\n tackl.setSource(playerOne.getPosition());\n VisualArea[] area;\n if ( area = tackl.getVisualArea(this.engine.getGameInformation() ) != null ){\n tackl.setDestination(area[0]);\n this.engine.performAction( tackl );\n }\n\n tackl.setSource(playerTwo.getPosition());\n\n if ( area = tackl.getVisualArea(this.engine.getGameInformation() ) != null ){\n tackl.setDestination(area[0]);\n this.engine.performAction( tackl );\n }\n playerOne = null;\n playerTwo = null;\n }\n }", "@Test\n public void isGameOverThree() {\n this.reset();\n this.bps.startGame(this.fullDeck, false, 7, 1);\n assertFalse(this.bps.isGameOver());\n }", "@Test\n public final void testPlayer2Win() {\n checkPlayerWin(player2);\n }", "@Test\n public void isGameOverTwo() {\n this.reset();\n this.bps.startGame(this.fullDeck, false, 1, 0);\n assertTrue(this.bps.isGameOver());\n }", "public int play(NumberGame game) {\n\t\tint max = game.getUpperBound();\n\t\tint min = 0;\n\t\tint ans;\n\t\tboolean check = false;\n\t\tdo {\n\t\t\tans = (max + min) / 2;\n\t\t\tcheck = game.guess(ans);\n\t\t\tif (game.getMessage().contains(\"small\")) min = ans;\n\t\t\telse if (game.getMessage().contains(\"large\")) max = ans;\n\t\t} while (!check);\n\t\treturn ans;\n\t}", "public static void checkPlayer()\n\t{\n\t\ttry {\n\t\t\t\n\t\t\tscenarioResults = new String[127];\n\t\t\tArrayList<Integer> differences = new ArrayList<Integer>();\n\t\t\t//set scenarioResults to current result or player's bracket when not impossible\n\t\t\tfor(int i=0; i < 127; i++)\n\t\t\t{\n\t\t\t\tif(i < nextMatch){\n\t\t\t\t\tscenarioResults[i] = results[i];\n\t\t\t\t}else{\n\t\t\t\t\t//check if a pick has been disqualified by previous results. \n\t\t\t\t\t//If it is still possible, assume it happens, else add the match number to the list to iterate through.\n\t\t\t\t\tif(isValid(allPicks.get(checkIndex)[i],i)){\n\t\t\t\t\t\tscenarioResults[i] = allPicks.get(checkIndex)[i];\n\t\t\t\t\t}else{\n\t\t\t\t\t\tscenarioResults[i] = \"\";\n\t\t\t\t\t\tdifferences.add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//if there aren't any matches to check specifically (i.e. no picked winners that lost in previous rounds)\n\t\t\t//\tjust check to see if they win if everything breaks right.\n\t\t\tif(differences.size() == 0)\n\t\t\t{\n\t\t\t\tif(outputScenarioWinner(\"any combination+\"))\n\t\t\t\t{\n\t\t\t\t\twriter.write(\"\\t\"+entrants[checkIndex]+\" is ALIVE\");\n\t\t\t\t}else{\n\t\t\t\t\tSystem.out.println(entrants[checkIndex]);\n\t\t\t\t\twriter.write(\"\\t\"+entrants[checkIndex]+\" is DEAD\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t//find later round matches to iterate through, where the player is already guaranteed to be wrong\n\t\t\t\twrongMatches = new int[differences.size()];\n\n\n\t\t\t\tfor(int i = 0; i < wrongMatches.length; i++)\n\t\t\t\t{\n\t\t\t\t\twrongMatches[i] = differences.get(i).intValue();\n\t\t\t\t}\n\n\t\t\t\t//recurse through results, checking from left-most first. When you reach the end of the list of matches, check scores\n\t\t\t\t//\tand print the winner for the given combination.\n\t\t\t\tboolean isAlive = checkPlayerHelper(0,\"\");\n\n\t\t\t\t//if player is the winner, end execution\n\t\t\t\tif(isAlive)\n\t\t\t\t{\n\t\t\t\t\twriter.write(\"\\t\"+entrants[checkIndex]+\" is ALIVE\");\n\t\t\t\t}else{\n\t\t\t\t\twriter.write(\"\\t\"+entrants[checkIndex]+\" is DEAD\");\n\t\t\t\t\tSystem.out.println(entrants[checkIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\twriter.write(\"\\n\");\n\t\t\t\n\t\t}\t\n\t\tcatch (IOException e) {\n\t\t\tSystem.out.println(\"problem with output\");\n\t\t\tSystem.exit(1);\n\t\t}\n\t}", "@Test\n void doEffectpowerglove() {\n ArrayList<Player> pl = new ArrayList<>();\n AlphaGame g = new AlphaGame(1, pl,false, 8);\n WeaponFactory wf = new WeaponFactory(\"power glove\");\n Weapon w10 = new Weapon(\"power glove\", wf.getBooleans(), wf.getCosts(), wf.getRequestedNum(), wf.getApplier(), wf.getEffects(), wf.getDescriptions());\n WeaponDeck wd = new WeaponDeck();\n RealPlayer p = new RealPlayer('b', \"ciccia\");\n wd.addWeapon(w10);\n p.setPlayerPosition(Board.getSquare(0));\n p.getPh().drawWeapon(wd, w10.getName());\n RealPlayer victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSquare(1));\n ArrayList<Player> players = new ArrayList<>();\n players.add(victim);\n ArrayList<GenericSquare> s = new ArrayList<>();\n try {\n p.getPh().getWeaponDeck().getWeapon(w10.getName()).doEffect(\"base\", null, null, p, players, null);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(p.getPlayerPosition() == Board.getSquare(1) && victim.getPb().countDamages() == 1 && victim.getPb().getMarkedDamages('b') == 2);\n\n p.setPlayerPosition(Board.getSquare(0));\n s.add(Board.getSquare(1));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSquare(1));\n players.clear();\n players.add(victim);\n s.add(Board.getSpawnpoint('b'));\n RealPlayer victim2 = new RealPlayer('v', \"ciccia\");\n victim2.setPlayerPosition(Board.getSpawnpoint('b'));\n players.add(victim2);\n try{\n p.getPh().getWeaponDeck().getWeapon(w10.getName()).doEffect(\"alt\", null, null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(p.getPlayerPosition() == Board.getSpawnpoint('b') && victim.getPb().countDamages() == 2 && victim2.getPb().countDamages() == 2);\n\n p.setPlayerPosition(Board.getSquare(0));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('b'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(1));\n s.add(Board.getSpawnpoint('b'));\n try{\n p.getPh().getWeaponDeck().getWeapon(w10.getName()).doEffect(\"alt\", null, null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { System.out.println(\"ERROR\");}\n\n assertTrue(p.getPlayerPosition() == Board.getSpawnpoint('b') && victim.getPb().countDamages() == 2);\n }", "@Test\n public void shouldCurrentGameBeZeroWhenStartingGame() {\n\n int expResult = 0 ;\n int result = scoreService.getCurrentGame() ;\n assertThat(expResult, is(result) ) ;\n }", "public void playGame () {\n int rank1 = team1.getSeed();\n int rank2 = team2.getSeed();\n double s1 = Math.random();\n System.out.println(s1);\n double s2 = Math.random();\n System.out.println(s2);\n \n if(rank1 < rank2){\n\t double one = (s1*10)+1;\n\t score1 = (int)one;//gives a slight advantage to the person with a higher seed\n\t double two = (s2*10); \n\t score2 = (int)two;\n\t if(score1 == score2){\n\t score1 = score1+1; //gives the game to the higher seed if there is a tie\n }\n else if(rank2 < rank1){\n\t double r = (s2*10)+1;\n\t score2 = (int)r;\n\t double t = (s1*10); \n\t score1 = (int)t;\n\t if(score1 == score2){\n\t score2 = score2+1;\n\t }}}}", "@Test\n public void testWinLossRatio(){\n float wins = 0;\n float losses = 0;\n\n realDie1 = new Dice();\n realDie2 = new Dice();\n realDie3 = new Dice();\n\n game = new Game(realDie1, realDie2, realDie3);\n\n when (mockPlayer.getBalance()).thenReturn(100);\n\n int currentGameWins = 0;\n\n for (int i = 0; i < 10000; i++) {\n currentGameWins = game.playRound(mockPlayer, DiceValue.ANCHOR, 10);\n\n if (currentGameWins == 0) {\n losses ++;\n } else {\n wins ++;\n }\n\n }\n System.out.println(\"Wins = \" + wins + \" Losses = \" + losses);\n float ratio = wins/(losses + wins);\n System.out.println(\"Win ratio = \" + ratio);\n }", "private static int evaluateBoard(final int[][] givenBoard) {\n final int[][] board = cloneBoard(givenBoard);\n\n final int numRows = givenBoard.length;\n final int numCols = givenBoard[0].length;\n\n \n // If the game is complete\n if (!Utils.hasMove(board)) {\n // Find largest absolute move value for player and opponent\n int playerScore = 0;\n int opponentScore = 0;\n for (final int[] row : board) {\n for (final int val : row) {\n if (val > playerScore) playerScore = val;\n if (val < opponentScore) opponentScore = val;\n } \n }\n // Give a big reward + the ammount we won the game by\n return WIN_REWARD + playerScore + opponentScore;\n }\n boardsEvaluated++;\n\n \n // If the game is incomplete, return the diference between the average \n // distance that the player and opponent are from each empty square\n int[][] playerDistances = distanceGrid(board);\n int[][] opponentDistances = distanceGrid(flipBoard(board));\n \n int totalPlayerDistance = 0;\n int totalOpponentDistance = 0;\n \n int maxPlayerDistance = 0;\n int maxOpponentDistance = 0;\n \n \n int largestPlayerMove = 0;\n int smallestOpponentMove = 0;\n \n int numEmptySpaces = 0;\n \n for (int r = 0; r < numRows; r++) {\n for (int c = 0; c < numCols; c++) {\n if (playerDistances[r][c] > 0) {\n totalPlayerDistance += playerDistances[r][c];\n numEmptySpaces++;\n }\n if (opponentDistances[r][c] > 0) {\n totalOpponentDistance += opponentDistances[r][c];\n }\n \n int boardVal = board[r][c];\n if (largestPlayerMove < boardVal) largestPlayerMove = boardVal;\n if (smallestOpponentMove > boardVal) smallestOpponentMove = boardVal;\n \n } \n }\n int averageDistanceDifference = totalOpponentDistance - totalPlayerDistance;\n\n int largestMoveDifference = largestPlayerMove + smallestOpponentMove;\n\n\n return averageDistanceDifference + largestMoveDifference;\n }", "public void playRound(){\n this.gameState = GameController.createGameState(this.game);\n \n // Verifica se o \n if(this.gameState.isEnded()){\n var winner = this.gameState.getPlayerQttCards() == 0 ? this.game.getComputer() : this.game.getPlayer();\n\n this.gameState.setWinner(winner);\n }\n else{\n \n // Mostrando o vira, as manilhas, a quantidade de cartas dos jogadores e as cartas do jogador\n this.view.displayGame(this.gameState);\n\n var playerCardChose = this.getPlayerCardChose();\n var computerCardChose = Utils.generateRandomNumber(getGameState().getComputerQttCards());\n\n try{\n var playerCard = this.game.getPlayer().playCard(playerCardChose);\n var computerCard = this.game.getComputer().playCard(computerCardChose);\n\n var winnerCard = this.verifyBiggerCard(playerCard, computerCard);\n\n // Verificando qual `Player` ganhou e se um ganhou\n\n var hasPlayerWon = winnerCard.equals(playerCard);\n var hasComputerWon = winnerCard.equals(computerCard);\n\n var turnedCard = this.getGameState().getTurnedCard();\n\n // Aqui caso o player tenha ganhado ele recebe a carta do computador e senão ele perde a carta para o computador\n if(hasPlayerWon){\n this.game.getPlayer().earnCard(computerCard);\n this.game.getComputer().loseCard(computerCard);\n }\n else if(hasComputerWon){\n this.game.getComputer().earnCard(playerCard);\n this.game.getPlayer().loseCard(playerCard);\n }\n \n // Na hora de mostrar o vencedor eu verifico se um player venceu, se sim eu mostro vitória ou derrota para o Player\n // Se não eu mostro empate\n \n if(hasComputerWon || hasPlayerWon){\n this.view.displayRoundWinner(turnedCard, playerCard, computerCard, hasPlayerWon);\n }\n else {\n this.view.displayRoundWinner(turnedCard, playerCard, computerCard);\n }\n\n }\n catch(Exception excp){\n this.view.displayMessageError(excp.getMessage());\n\n this.playRound();\n }\n }\n \n }", "@Test\n public void isCollideTest0() {\n \n boolean actual = game.isCollide(p1, p2);\n boolean expected = false;\n \n assertEquals(actual, expected);\n }", "public void ss(){\n for (int c=0; c < league.length;c++) {\r\n for (int t=c+1;t<league.length;t++) {\r\n score = league[c].scoregenerator();\r\n secondscore = league[t].scoregenerator();\r\n league[c].pointsfor(score);\r\n league[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n league[c].wins();\r\n league[t].losses();\r\n }\r\n else if (score == secondscore){\r\n league[c].ties();\r\n league[t].ties();\r\n }\r\n else {\r\n league[t].wins();\r\n league[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < AFC.length;c++) {\r\n for (int t=c+1;t<AFC.length;t++) {\r\n score = AFC[c].scoregenerator();\r\n secondscore = AFC[t].scoregenerator();\r\n AFC[c].pointsfor(score);\r\n AFC[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n AFC[c].wins();\r\n AFC[t].losses();\r\n }\r\n else if (score == secondscore){\r\n AFC[c].ties();\r\n AFC[t].ties();\r\n }\r\n else {\r\n AFC[t].wins();\r\n AFC[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < NFC.length;c++) {\r\n for (int t=c+1;t<NFC.length;t++) {\r\n score = NFC[c].scoregenerator();\r\n secondscore = NFC[t].scoregenerator();\r\n NFC[c].pointsfor(score);\r\n NFC[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n NFC[c].wins();\r\n NFC[t].losses();\r\n }\r\n else if (score == secondscore){\r\n NFC[c].ties();\r\n NFC[t].ties();\r\n }\r\n else {\r\n NFC[t].wins();\r\n NFC[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0;c<AFCeast.length;c++) {\r\n for (int t=c+1;t<AFCeast.length;t++) {\r\n score = AFCeast[c].scoregenerator();\r\n secondscore = AFCeast[t].scoregenerator();\r\n AFCeast[c].pointsfor(score);\r\n AFCeast[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n AFCeast[c].wins();\r\n AFCeast[t].losses();\r\n }\r\n else if (score == secondscore){\r\n AFCeast[c].ties();\r\n AFCeast[t].ties();\r\n }\r\n else {\r\n AFCeast[t].wins();\r\n AFCeast[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < AFCnorth.length;c++) {\r\n for (int t=c+1;t<AFCnorth.length;t++) {\r\n score = AFCnorth[c].scoregenerator();\r\n secondscore = AFCnorth[t].scoregenerator();\r\n AFCnorth[c].pointsfor(score);\r\n AFCnorth[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n AFCnorth[c].wins();\r\n AFCnorth[t].losses();\r\n }\r\n else if (score == secondscore){\r\n AFCnorth[c].ties();\r\n AFCnorth[t].ties();\r\n }\r\n else {\r\n AFCnorth[t].wins();\r\n AFCnorth[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < AFCsouth.length;c++) {\r\n for (int t=c+1;t<AFCsouth.length;t++) {\r\n score = AFCsouth[c].scoregenerator();\r\n secondscore = AFCsouth[t].scoregenerator();\r\n AFCsouth[c].pointsfor(score);\r\n AFCsouth[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n AFCsouth[c].wins();\r\n AFCsouth[t].losses();\r\n }\r\n else if (score == secondscore){\r\n AFCsouth[c].ties();\r\n AFCsouth[t].ties();\r\n }\r\n else {\r\n AFCsouth[t].wins();\r\n AFCsouth[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < AFCwest.length;c++) {\r\n for (int t=c+1;t<AFCwest.length;t++) {\r\n score = AFCwest[c].scoregenerator();\r\n secondscore = AFCwest[t].scoregenerator();\r\n AFCwest[c].pointsfor(score);\r\n AFCwest[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n AFCwest[c].wins();\r\n AFCwest[t].losses();\r\n }\r\n else if (score == secondscore){\r\n AFCwest[c].ties();\r\n AFCwest[t].ties();\r\n }\r\n else {\r\n AFCwest[t].wins();\r\n AFCwest[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < NFCeast.length;c++) {\r\n for (int t=c+1;t<NFCeast.length;t++) {\r\n score = NFCeast[c].scoregenerator();\r\n secondscore = NFCeast[t].scoregenerator();\r\n NFCeast[c].pointsfor(score);\r\n NFCeast[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n NFCeast[c].wins();\r\n NFCeast[t].losses();\r\n }\r\n else if (score == secondscore){\r\n NFCeast[c].ties();\r\n NFCeast[t].ties();\r\n }\r\n else {\r\n NFCeast[t].wins();\r\n NFCeast[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < NFCnorth.length;c++) {\r\n for (int t=c+1;t<NFCnorth.length;t++) {\r\n score = NFCnorth[c].scoregenerator();\r\n secondscore = NFCnorth[t].scoregenerator();\r\n NFCnorth[c].pointsfor(score);\r\n NFCnorth[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n NFCnorth[c].wins();\r\n NFCnorth[t].losses();\r\n }\r\n else if (score == secondscore){\r\n NFCnorth[c].ties();\r\n NFCnorth[t].ties();\r\n }\r\n else {\r\n NFCnorth[t].wins();\r\n NFCnorth[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < NFCsouth.length;c++) {\r\n for (int t=c+1;t<NFCsouth.length;t++) {\r\n score = NFCsouth[c].scoregenerator();\r\n secondscore = NFCsouth[t].scoregenerator();\r\n NFCsouth[c].pointsfor(score);\r\n NFCsouth[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n NFCsouth[c].wins();\r\n NFCsouth[t].losses();\r\n }\r\n else if (score == secondscore){\r\n NFCsouth[c].ties();\r\n NFCsouth[t].ties();\r\n }\r\n else {\r\n NFCsouth[t].wins();\r\n NFCsouth[c].losses();\r\n }\r\n } \r\n }\r\n for (int c=0; c < NFCwest.length;c++) {\r\n for (int t=c+1;t<NFCwest.length;t++) {\r\n score = NFCwest[c].scoregenerator();\r\n secondscore = NFCwest[t].scoregenerator();\r\n NFCwest[c].pointsfor(score);\r\n NFCwest[t].pointsfor(secondscore);\r\n\r\n if (score > secondscore){\r\n NFCwest[c].wins();\r\n NFCwest[t].losses();\r\n }\r\n else if (score == secondscore){\r\n NFCwest[c].ties();\r\n NFCwest[t].ties();\r\n }\r\n else {\r\n NFCwest[t].wins();\r\n NFCwest[c].losses();\r\n }\r\n } \r\n }\r\n\r\n for (int c=0;c<league.length;c++){\r\n System.out.println(league[c]);\r\n }\r\n System.out.println(\"...\");\r\n try\r\n {\r\n Thread.sleep(3000);\r\n }\r\n catch (Exception e)\r\n {}\r\n System.out.println(\"\\n\" + \"Now let the playoffs begin!\" + \"\\n\");\r\n\r\n for (int y=0;y<4;y++){ // These next groups of code are sorting each division, and each conference based on wins\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (AFCeast[a].displaywins() > AFCeast[p].displaywins()){\r\n Temp = AFCeast[p];\r\n AFCeast[p] = AFCeast[a];\r\n AFCeast[a] = Temp;\r\n }\r\n else if (AFCeast[a].displaywins() == AFCeast[p].displaywins() && AFCeast[a].displaypf() > AFCeast[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n // System.out.println(AFCeast[0]);\r\n\r\n afcplayoff[0] = AFCeast[0];\r\n // System.out.println(afcplayoff[0]);\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (AFCnorth[a].displaywins() > AFCnorth[p].displaywins()){\r\n Temp = AFCnorth[p];\r\n AFCnorth[p] = AFCnorth[a];\r\n AFCnorth[a] = Temp;\r\n }\r\n else if (AFCnorth[a].displaywins() == AFCnorth[p].displaywins() && AFCnorth[a].displaypf() > AFCnorth[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n\r\n afcplayoff[1] = AFCnorth[0];\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (AFCsouth[a].displaywins() > AFCsouth[p].displaywins()){\r\n Temp = AFCsouth[p];\r\n AFCsouth[p] = AFCsouth[a];\r\n AFCsouth[a] = Temp;\r\n }\r\n else if (AFCsouth[a].displaywins() == AFCsouth[p].displaywins() && AFCsouth[a].displaypf() > AFCsouth[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n\r\n afcplayoff[2] = AFCsouth[0];\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (AFCwest[a].displaywins() > AFCwest[p].displaywins()){\r\n Temp = AFCwest[p];\r\n AFCwest[p] = AFCwest[a];\r\n AFCwest[a] = Temp;\r\n }\r\n else if (AFCwest[a].displaywins() == AFCwest[p].displaywins() && AFCwest[a].displaypf() > AFCwest[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n\r\n afcplayoff[3] = AFCwest[0];\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (NFCeast[a].displaywins() > NFCeast[p].displaywins()){\r\n Temp = NFCeast[p];\r\n NFCeast[p] = NFCeast[a];\r\n NFCeast[a] = Temp;\r\n }\r\n else if (NFCeast[a].displaywins() == NFCeast[p].displaywins() && NFCeast[a].displaypf() > NFCeast[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n nfcplayoff[0] = NFCeast[0];\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (NFCnorth[a].displaywins() > NFCnorth[p].displaywins()){\r\n Temp = NFCnorth[p];\r\n NFCnorth[p] = NFCnorth[a];\r\n NFCnorth[a] = Temp;\r\n }\r\n else if (NFCnorth[a].displaywins() == NFCnorth[p].displaywins() && NFCnorth[a].displaypf() > NFCnorth[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n nfcplayoff[1] = NFCnorth[0];\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (NFCsouth[a].displaywins() > NFCsouth[p].displaywins()){\r\n Temp = NFCsouth[p];\r\n NFCsouth[p] = NFCsouth[a];\r\n NFCsouth[a] = Temp;\r\n }\r\n else if (NFCsouth[a].displaywins() == NFCsouth[p].displaywins() && NFCsouth[a].displaypf() > NFCsouth[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n nfcplayoff[2] = NFCsouth[0];\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (NFCwest[a].displaywins() > NFCwest[p].displaywins()){\r\n Temp = NFCwest[p];\r\n NFCwest[p] = NFCwest[a];\r\n NFCwest[a] = Temp;\r\n }\r\n else if (NFCwest[a].displaywins() == NFCwest[p].displaywins() && NFCwest[a].displaypf() > NFCwest[p].displaypf()){\r\n Temp = league[p];\r\n league[p] = league[a];\r\n league[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n nfcplayoff[3] = NFCwest[0];\r\n for (int y=0;y<16;y++){\r\n for (int p=0;p<15;p++) {\r\n int a = p+1;\r\n if (AFC[a].displaywins() > AFC[p].displaywins()){\r\n Temp = AFC[p];\r\n AFC[p] = AFC[a];\r\n AFC[a] = Temp;\r\n }\r\n else if (AFC[a].displaywins() == AFC[p].displaywins() && AFC[a].displaypf() > AFC[p].displaypf()){\r\n Temp = AFC[p];\r\n AFC[p] = AFC[a];\r\n AFC[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n for (int y=0;y<16;y++){\r\n for (int p=0;p<15;p++) {\r\n int a = p+1;\r\n if (NFC[a].displaywins() > NFC[p].displaywins()){\r\n Temp = NFC[p];\r\n NFC[p] = NFC[a];\r\n NFC[a] = Temp;\r\n }\r\n else if (NFC[a].displaywins() == NFC[p].displaywins() && NFC[a].displaypf() > NFC[p].displaypf()){\r\n Temp = NFC[p];\r\n NFC[p] = NFC[a];\r\n NFC[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n\r\n int maxw=0;\r\n\r\n for (int x=0;x<AFC.length;x++){\r\n\r\n if ((AFC[x].displaywins() > maxw) && \r\n (AFC[x].getName() != afcplayoff[0].getName()) && \r\n (AFC[x].getName() != afcplayoff[1].getName()) && \r\n (AFC[x].getName() != afcplayoff[2].getName()) && \r\n (AFC[x].getName() != afcplayoff[3].getName()) && \r\n (AFC[x].getName() != afcplayoff[4].getName()) && \r\n (AFC[x].getName() != afcplayoff[5].getName())){\r\n maxw = AFC[x].displaywins();\r\n afcplayoff[4] = AFC[x]; \r\n }\r\n\r\n }\r\n\r\n maxw=0;\r\n for (int x=0;x<AFC.length;x++){\r\n\r\n if (AFC[x].displaywins() > maxw && \r\n AFC[x].getName() != afcplayoff[0].getName() && \r\n AFC[x].getName() != afcplayoff[1].getName() && \r\n AFC[x].getName() != afcplayoff[2].getName() && \r\n AFC[x].getName() != afcplayoff[3].getName() && \r\n AFC[x].getName() != afcplayoff[4].getName() && \r\n AFC[x].getName() != afcplayoff[5].getName()){\r\n maxw = AFC[x].displaywins();\r\n afcplayoff[5] = AFC[x]; \r\n }\r\n }\r\n\r\n maxw=0;\r\n for (int x=0;x<NFC.length;x++){\r\n if (NFC[x].displaywins() > maxw && \r\n NFC[x].getName() != nfcplayoff[0].getName() && \r\n NFC[x].getName() != nfcplayoff[1].getName() && \r\n NFC[x].getName() != nfcplayoff[2].getName() && \r\n NFC[x].getName() != nfcplayoff[3].getName() && \r\n NFC[x].getName() != nfcplayoff[4].getName() && \r\n NFC[x].getName() != nfcplayoff[5].getName()){\r\n maxw = NFC[x].displaywins();\r\n nfcplayoff[4] = NFC[x]; \r\n }\r\n }\r\n maxw=0;\r\n for (int x=0;x<NFC.length;x++){\r\n\r\n if (NFC[x].displaywins() > maxw && \r\n NFC[x].getName() != nfcplayoff[0].getName() && \r\n NFC[x].getName() != nfcplayoff[1].getName() && \r\n NFC[x].getName() != nfcplayoff[2].getName() && \r\n NFC[x].getName() != nfcplayoff[3].getName() && \r\n NFC[x].getName() != nfcplayoff[4].getName() && \r\n NFC[x].getName() != nfcplayoff[5].getName()){\r\n maxw = NFC[x].displaywins();\r\n nfcplayoff[5] = NFC[x]; \r\n }\r\n }\r\n\r\n for (int y=0;y<4;y++){\r\n for (int p=0;p<3;p++) {\r\n int a = p+1;\r\n if (afcplayoff[a].displaywins() > afcplayoff[p].displaywins()){\r\n Temp = afcplayoff[p];\r\n afcplayoff[p] = afcplayoff[a];\r\n afcplayoff[a] = Temp;\r\n }\r\n else if (afcplayoff[a].displaywins() == afcplayoff[p].displaywins() && afcplayoff[a].displaypf() > afcplayoff[p].displaypf()){\r\n Temp = afcplayoff[p];\r\n afcplayoff[p] = afcplayoff[a];\r\n afcplayoff[a] = Temp;\r\n }\r\n\r\n }\r\n }\r\n for (int c=0;c<afcplayoff.length;c++){ // Testing to see if users team made the playoffs.\r\n if(YourTeam.getName().equals(afcplayoff[c].getName()))\r\n afcplayofft = true;\r\n }\r\n\r\n for (int y=0;y<4;y++){\r\n for (int r=0;r<3;r++) {\r\n int c = r+1;\r\n if (nfcplayoff[c].displaywins() > nfcplayoff[r].displaywins()){\r\n Temp = nfcplayoff[r];\r\n nfcplayoff[r] = nfcplayoff[c];\r\n nfcplayoff[c] = Temp;\r\n }\r\n else if (nfcplayoff[c].displaywins() == nfcplayoff[r].displaywins() && nfcplayoff[c].displaypf() > nfcplayoff[r].displaypf()){\r\n Temp = nfcplayoff[r];\r\n nfcplayoff[r] = nfcplayoff[c];\r\n nfcplayoff[c] = Temp;\r\n }\r\n\r\n }\r\n }\r\n for (int c=0;c<nfcplayoff.length;c++){\r\n if(YourTeam.getName().equals(nfcplayoff[c].getName()))\r\n nfcplayofft = true;\r\n }\r\n // This shows how the playoffs will look like to the user\r\n System.out.println(\"...\" + \"\\n\" + \"Based on the regular season, here is what the first round of playoffs will look like:\" + \"\\n\");\r\n try\r\n {\r\n Thread.sleep(3000);\r\n }\r\n catch (Exception e)\r\n {}\r\n System.out.println(afcplayoff[0].getName() + \" got a bye in the first round of the playoffs for placing first in the afc.\");\r\n System.out.println(afcplayoff[1].getName() + \" also got a bye in the first round of the playoffs for placing second in the afc.\" + \"\\n\");\r\n System.out.println(nfcplayoff[0].getName() + \" got a bye in the first round of the playoffs for placing first in the nfc.\");\r\n System.out.println(nfcplayoff[1].getName() + \" also got a bye in the first round of the playoffs for placing second in the nfc.\" + \"\\n\");\r\n\r\n System.out.println(afcplayoff[2].getName());\r\n System.out.println(\" \\\\-----\\\\\");\r\n System.out.println(\" ) Winner moves on to play the \" + afcplayoff[0].getName());\r\n System.out.println(\" /-----/\");\r\n System.out.println(afcplayoff[5].getName() + \"\\n\");\r\n\r\n System.out.println(afcplayoff[3].getName());\r\n System.out.println(\" \\\\-----\\\\\");\r\n System.out.println(\" ) Winner moves onto play the \"+ afcplayoff[1].getName());\r\n System.out.println(\" /-----/\");\r\n System.out.println(afcplayoff[4].getName() + \"\\n\");\r\n\r\n System.out.println(nfcplayoff[2].getName());\r\n System.out.println(\" \\\\-----\\\\\");\r\n System.out.println(\" ) Winner moves onto play the \"+ nfcplayoff[0].getName());\r\n System.out.println(\" /-----/\");\r\n System.out.println(nfcplayoff[5].getName() + \"\\n\");\r\n\r\n System.out.println(nfcplayoff[3].getName());\r\n System.out.println(\" \\\\-----\\\\\");\r\n System.out.println(\" ) Winner moves onto play the \"+ nfcplayoff[1].getName());\r\n System.out.println(\" /-----/\");\r\n System.out.println(nfcplayoff[4].getName() + \"\\n\");\r\n\r\n System.out.println(\"...\"+ \"\\n\");\r\n\r\n try\r\n {\r\n Thread.sleep(3000);\r\n }\r\n catch (Exception e)\r\n\r\n {}\r\n }", "@Test\n void doEffectfurnace() {\n ArrayList<Player> pl = new ArrayList<>();\n AlphaGame g = new AlphaGame(1, pl,false, 8);\n WeaponFactory wf = new WeaponFactory(\"furnace\");\n Weapon w3 = new Weapon(\"furnace\", wf.getBooleans(), wf.getCosts(), wf.getRequestedNum(), wf.getApplier(), wf.getEffects(), wf.getDescriptions());\n WeaponDeck wd = new WeaponDeck();\n wd.addWeapon(w3);\n RealPlayer p = new RealPlayer('b', \"ciccia\");\n p.setPlayerPosition(Board.getSquare(0));\n p.getPh().drawWeapon(wd, w3.getName());\n RealPlayer victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('r'));\n Terminator t = new Terminator('g', Board.getSquare(5));\n t.setOwnerColor(victim.getColor());\n ArrayList<GenericSquare> s = new ArrayList<>();\n s.add(victim.getPlayerPosition());\n try{\n p.getPh().getWeaponDeck().getWeapon(w3.getName()).doEffect(\"base\", null, null, p, null, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 1 && t.getPb().countDamages() == 1);\n\n p.setPlayerPosition(Board.getSquare(0));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('r'));\n t = new Terminator('g', Board.getSpawnpoint('r'));\n t.setOwnerColor(victim.getColor());\n s.clear();\n s.add(Board.getSpawnpoint('r'));\n try{\n p.getPh().getWeaponDeck().getWeapon(w3.getName()).doEffect(\"alt\", null, null, p, null, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 1 && victim.getPb().getMarkedDamages('b')==1 && t.getPb().countDamages() == 1 && t.getPb().getMarkedDamages('b')==1);\n\n }", "public static void calculateFitness(StrategyPool sp)\r\n\t{\r\n\t\tfor(int i = 0; i<sp.pool.size() ; i++)\r\n\t\t{\r\n\t\t\tfor(int j = 0; j <sp.pool.size() ; j++)\r\n\t\t\t{\r\n\t\t\t\tif(i == j)\r\n\t\t\t\t\t; //do nothing\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n//\t\t\t\t\tSystem.out.println(\"Playing Strategy \" +i +\" against \" +j );\r\n\t\t\t\t\tStrategy p1 = sp.pool.get(i);\r\n\t\t\t\t\tStrategy p2 = sp.pool.get(j);\r\n\t\t\t\t\tint winner = 0;\r\n\t\t\t\t\tfor(int k = 0; k<1000 ; k++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\twinner = new Game().play(p1,p2);\r\n\t\t\t\t\t\t\tif(winner == 0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tp1.addDrawCount();\r\n\t\t\t\t\t\t\t\tp2.addDrawCount();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(winner == 1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tp1.addWinCount();\r\n\t\t\t\t\t\t\t\tp2.addLostCount();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(winner ==2)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tp1.addLostCount();\r\n\t\t\t\t\t\t\t\tp2.addWinCount();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//switch positions\r\n\t\t\t\t\tp2 = sp.pool.get(i);\r\n\t\t\t\t\tp1 = sp.pool.get(j);\r\n\r\n//\t\t\t\t\tSystem.out.println(\"Playing Strategy \" +j +\" against \" +i );\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(int k = 0; k<1000 ; k++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\twinner = new Game().play(p1,p2);\r\n\t\t\t\t\t\tif(winner == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tp1.addDrawCount();\r\n\t\t\t\t\t\t\tp2.addDrawCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(winner == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tp1.addWinCount();\r\n\t\t\t\t\t\t\tp2.addLostCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(winner ==2)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tp1.addLostCount();\r\n\t\t\t\t\t\t\tp2.addWinCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Test\n public void isGameOverNoWhite()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n\n for (int y = 0; y < 3; y++)\n {\n for (int x = 0; x < 8; x++)\n {\n if ((x % 2) != (y % 2))\n {\n final CheckersPosition position = CheckersPosition.findByCoordinates(x, y);\n environment.removeToken(position);\n }\n }\n }\n\n assertThat(environment.getTokenCountFor(CheckersTeam.RED), is(12));\n assertThat(environment.getTokenCountFor(CheckersTeam.WHITE), is(0));\n\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertTrue(adjudicator.isGameOver(environment));\n }", "public static double sanityCheck(Match match)\n {\n Lane lane;\n Role role;\n \n int bot = 0;\n int bottom = 0;\n int jungle = 0;\n int mid = 0;\n int middle = 0;\n int top = 0;\n \n int solo = 0;\n int duo = 0;\n int duo_carry = 0;\n int duo_support = 0;\n int none = 0;\n \n\n \n for(int i = 0; i<10; i++)\n {\n lane = match.getParticipants().get(i).getTimeline().getLane();\n role = match.getParticipants().get(i).getTimeline().getRole();\n \n switch(lane)\n {\n case BOT:\n bot++;\n break;\n \n case BOTTOM:\n bottom++;\n break;\n \n case JUNGLE:\n jungle++;\n break;\n \n case MID:\n mid++;\n break;\n \n case MIDDLE:\n middle++;\n break;\n \n case TOP:\n top++;\n break;\n }\n \n switch(role)\n {\n case SOLO:\n solo++;\n break;\n \n case DUO:\n duo++;\n break;\n \n case DUO_CARRY:\n duo_carry++;\n break;\n \n case DUO_SUPPORT:\n duo_support++;\n break;\n \n case NONE:\n none++;\n break;\n }\n }\n \n double total = 0;\n \n if(top == 2)\n total++;\n if(mid+middle == 2)\n total++;\n if(jungle == 2)\n total++;\n if(bot + bottom == 4)\n total++;\n \n if(solo == 4)\n total++;\n if(duo + duo_carry + duo_support == 4);\n total++;\n if( duo_carry == 2);\n total++;\n if(duo_support == 2)\n total++;\n if(none == 2)\n total++;\n \n //it would be total =/ 9 but I figured every time one is wrong it makes another wrong, but there's really only 1 error \n total = ((total/18.0)+.5);\n \n \n //TestPrints\n //System.out.println(\"Sanity Check:\\nTop: \"+ top + \"\\nJungle: \"+ jungle + \"\\nMid: \" + (mid+middle) + \"\\nBot: \" + (bot+bottom)+ \"\\n\\nSolo: \"+solo + \"\\nDuo: \" + (duo+duo_carry+duo_support)\n //+ \"\\n\\\"Bot\\\": \"+ duo+\"\\nADC: \"+ duo_carry+ \"\\nSupport: \"+duo_support+ \"\\nNone: \" + none + \"\\nTotal Score: \" +total);\n \n \n \n return total;\n \n }", "@Test\n public void startGameSuccess() throws PersistenceException {\n InMemoryDao successDao = new InMemoryDao();\n GuessService service = new GuessService(successDao);\n \n Game newGame = service.startGame();\n Assert.assertNotNull(newGame);\n \n// int gameID = newGame.getGameKeyID();\n// List<Game> allGames = successDao.getAllGames();\n// Game matchedGame = null;\n// \n// for(Game toCheck : allGames){\n// if(toCheck.getGameKeyID() == gameID){\n// matchedGame = toCheck;\n// } \n// }\n// Assert.assertNotNull(matchedGame);\n }", "public int gameState() {\n \tboolean check = isCheck(turn);\n \t\n \t//change this code to be some sort of checkmate detection\n \tif(check) {\n \t\t//we need to check whether there is a legal move that puts the king out of check\n \t\t//we need to loop through all pieces of the same color as the turn and make all legal moves\n \t\t//then after each move, check whether the king is still in check\n \t\t\n \t\t//first generate a list of all pieces for the turn color\n \t\tArrayList<Piece> pieces = getPieces(turn);\n \t\t\n \t\tboolean freedom;\n \t\t\n \t\t//now for each piece, check whether moving that piece can get the king out of check\n \t\tfor(int i = 0; i < pieces.size(); i++) {\n \t\t\tfreedom = simulate(pieces.get(i));\n \t\t\tif(freedom) {\n \t \t\tupdateCheckMove(false);\n \t \t\tSystem.out.println(\"Check on \" + turn + \" King!\");\n \t\t\t\treturn 2; //if the king can move, then the game isn't over yet\n \t\t\t}\n \t\t}\n \t\t\n \t\t//the game is over if we reach this far, so we can assume checkmate\n \t\t//resignation logic will probably be specific to Display class\n \t\t\n \t\tupdateCheckMove(true);\n \t\t\n \t\tif(turn == PieceColor.White) return -1; //black win if white king in check and can't move\n \t\tif(turn == PieceColor.Black) return 1;\n \t}\n \t\n \t//if all of these fail, the game isn't over yet\n \treturn 2;\n }", "public void game(int set1hometeampoints, int set2hometeampoints,\n int set3hometeampoints, int set4hometeampoints, int set5hometeampoints,\n int set1awayteampoints, int set2awayteampoints, int set3awayteampoints, \n int set4awayteampoints, int set5awayteampoints)\n { \n if (set1hometeampoints == 21){\n setsWonHT ++;\n } else if(set1awayteampoints == 21){\n setsWonAT ++; \n } \n if (set2hometeampoints == 21){\n setsWonHT ++;\n } else if(set2awayteampoints == 21){\n setsWonAT ++; \n } \n if (set3hometeampoints == 21){\n setsWonHT ++;\n } else if(set3awayteampoints == 21){\n setsWonAT ++; \n }\n if (set4hometeampoints == 21){\n setsWonHT ++;\n } else if(set4awayteampoints == 21){\n setsWonAT ++; \n } \n if (set5hometeampoints == 15){\n setsWonHT ++;\n } else if(set5awayteampoints == 15){\n setsWonAT ++; \n }\n }", "@Test\r\n\tpublic void testTournamentGamesConditions() {\r\n\t\tassertTrue(cl.checkTournamentGamesConditions(Integer.parseInt(tags[6])));\r\n\t\tassertFalse(cl.checkTournamentGamesConditions(Integer.parseInt(tags2[6])));\r\n\t}", "private void gameOver() {\n\t\t\n\t}", "@Test\n public void testFullGameOwin() throws AuthenticationException {\n Map<String, String> data = gameInitializationService.createGame();\n Integer gameId = Integer.parseInt(data.get(GAME_ID));\n final String tokenPlayerX = data.get(TOKEN);\n Assertions.assertEquals(\"AWAITING_OTHER_PLAYER\", gamePlayService.obtainGameStatus(gameId, tokenPlayerX));\n final String tokenPlayerO = gameInitializationService.joinGame(gameId);\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A1\", tokenPlayerO), \"Test game - O is playing A1.\");\n Assertions.assertEquals(\"OTHER_PLAYER_TURN\", gamePlayService.obtainGameStatus(gameId, tokenPlayerO));\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"B1\", tokenPlayerX), \"Test game - X is playing B1.\");\n Assertions.assertEquals(\"YOUR_TURN\", gamePlayService.obtainGameStatus(gameId, tokenPlayerO));\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A2\", tokenPlayerO), \"Test game - O is playing A2.\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"B2\", tokenPlayerX), \"Test game - X is playing B2.\");\n Assertions.assertFalse(gamePlayService.playGame(gameId, \"B2\", tokenPlayerO), \"Test game - O is playing B2.\");\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A3\", tokenPlayerO), \"Test game - O is playing C1.\");\n }", "@Test\n public void testFinalState()\n { \n \n GameOfLife game = new GameOfLife();\n for (int gens = 0; gens < 9; gens++)\n {\n game.createNextGeneration();\n \n }\n\n for(int row = 26; row < 31; row++)\n {\n for(int col = 30; col < 35; col++)\n {\n // in this example, an alive cell has a non-null actor and a dead cell has a null actor\n Actor cell = game.getActor(row, col);\n\n // if the cell at the current row and col should be alive, assert that the actor is not null\n if( (row == 27 && col == 31) ||\n (row == 27 && col == 34) ||\n (row == 28 && col == 30) ||\n (row == 28 && col == 32) ||\n (row == 29 && col == 30) ||\n (row == 29 && col == 31) )\n \n {\n assertNotNull(\"expected alive cell at (\" + row + \", \" + col + \")\", cell);\n }\n else // else, the cell should be dead; assert that the actor is null\n {\n assertNull(\"expected dead cell at (\" + row + \", \" + col + \")\", cell);\n }\n }\n }\n \n \n }", "public static void main(String[] args) {\n\n\n while (gameStatus) {\n if(checkRowGameWin(1) || checkColumnGameWin(1) || checkRowGameWin(2) || checkColumnGameWin(2)){\n System.out.println(\"hurray!!!!! \"+ Winplayer + \" win the game\");\n gameStatus = false;\n }else{\n getinput();\n }\n\n\n }\n }", "private void checkResults() {\n\t\tif (isOver()) {\n\t\t\tfor (GameListener gameListener : gameListeners) {\n\t\t\t\tgameListener.gameOverCallback();\n\t\t\t}\n\t\t}\n\t}", "public static void other() {\n // This is how to generate test data for the grid. (Use the VisibilityGraph algorithm to generate optimal path lengths)\n// ArrayList<Point> points = ReachableNodes.computeReachable(gridGraph, 5, 5);\n// System.out.println(points.size());\n//\n// generateRandomTestDataAndPrint(gridGraph);\n\n //This is how to conduct a running time / path length test for tha algorithm:\n// TestResult test1 = testAlgorithm(gridGraph, sx, sy, ex, ey, 1, 1);\n// System.out.println(test1);\n// TestResult test2 = testAlgorithm(gridGraph, sx, sy, ex, ey, 30, 25);\n// System.out.println(test2);\n }", "private int twoInNeg (final GameStateModule game, int player) {\n int count = 0;\n if(game.getHeight() == 4){ //if height is 4, no iterations needed\n //counting bottom up\n for(int i = 0; i < 3; i++) { //since rows is always of width 5\n for(int j = 3; j > 1; j--) {\n if ((game.getAt(i, j) == player) && (game.getAt(i + 1, j - 1) == player) && (game.getAt(i + 2, j - 2) == 0))\n count++;\n }\n }\n //counting top bottom\n for(int i = 4; i > 1; i--) {\n for(int j = 0; j < 2; j++) {\n if ((game.getAt(i, j) == player) && (game.getAt(i - 1, j + 1) == player) && (game.getAt(i - 2, j + 2) == 0))\n count++;\n }\n }\n }\n else { //if height is 5, iterations needed\n for(int i = 0; i < 4; i++) {\n for (int j = 4; j > 1; j--) {\n if ((game.getAt(i, j) == player) && (game.getAt(i + 1, j - 1) == player) && (game.getAt(i + 2, j - 2) == 0))\n count++;\n }\n }\n for(int i = 5; i > 1; i--) {\n for (int j = 0; j < 3; j++) {\n if ((game.getAt(i, j) == player) && (game.getAt(i - 1, j + 1) == player) && (game.getAt(i - 2, j + 2) == 0))\n count++;\n }\n }\n }\n return count;\n }", "public static boolean processScoring() {\r\n\t\tboolean done = true;\r\n\t\tint player1Tricks = 0;\r\n\t\tint player2Tricks = 0;\r\n\t\tint player3Tricks = 0;\r\n\t\tint player4Tricks = 0;\r\n\t\t\r\n\t\t//Gets the data for three players.\r\n\t\tplayer1Tricks = FrameUtils.player1TricksTaken.getSelectedIndex();\r\n\t\tplayer2Tricks = FrameUtils.player2TricksTaken.getSelectedIndex();\r\n\t\tplayer3Tricks = FrameUtils.player3TricksTaken.getSelectedIndex();\r\n\r\n\t\t//Gets the tricks taken if playing with four players.\r\n\t\tif (!Main.isThreeHanded) {\r\n\t\t\tplayer4Tricks = FrameUtils.player4TricksTaken.getSelectedIndex();\r\n\t\t}\r\n\r\n\t\t//Check if all the choice boxes have been selected.\r\n\t\tif (player1Tricks == -1 || player1Tricks == 0) {\r\n\t\t\tdone = false;\r\n\t\t}\r\n\t\tif (player2Tricks == -1 || player2Tricks == 0) {\r\n\t\t\tdone = false;\r\n\t\t}\r\n\t\tif (player3Tricks == -1 || player3Tricks == 0) {\r\n\t\t\tdone = false;\r\n\t\t}\r\n\t\t\r\n\t\t//Don't check fourth player if playing three handed game.\r\n\t\tif (!Main.isThreeHanded) {\r\n\t\t\tif (player4Tricks == -1 || player4Tricks == 0) {\r\n\t\t\t\tdone = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Get the value of three players tricks taken.\r\n\t\tplayer1Tricks = stringToInt(FrameUtils.player1TricksTaken.getSelectedItem());\r\n\t\tplayer2Tricks = stringToInt(FrameUtils.player2TricksTaken.getSelectedItem());\r\n\t\tplayer3Tricks = stringToInt(FrameUtils.player3TricksTaken.getSelectedItem());\r\n\t\t\r\n\t\t//Get the value of the fourth player in a four handed game.\r\n\t\tif (!Main.isThreeHanded) {\r\n\t\t\tplayer4Tricks = stringToInt(FrameUtils.player4TricksTaken.getSelectedItem());\r\n\t\t}\r\n\t\t\r\n\t\t//Check if tricks taken in a three handed game equals 17.\r\n\t\tif (Main.isThreeHanded) {\r\n\t\t\tif (player1Tricks + player2Tricks + player3Tricks != 17) {\r\n\t\t\t\tdone = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//Check if tricks taken in a non-three-handed game equals 13.\r\n\t\tif (!Main.isThreeHanded) {\r\n\t\t\tif (player1Tricks + player2Tricks + player3Tricks + player4Tricks != 13) {\r\n\t\t\t\tdone = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//Show dialog box reminder.\r\n\t\tif (!done) FrameUtils.showDialogBox(\"Tricks taken was entered wrong.\");\r\n\t\t\t\r\n\t\t//Save tricks taken data.\r\n\t\tsaveTricksTakenData();\r\n\t\t\r\n\t\treturn done;\r\n\t}", "@Test\r\n\tpublic void executeReinforcement() {\r\n\r\n\t\tInteger reinforcementArmy = playerOne.getStrategyType().calculateReinforcementArmy();\r\n\r\n\t\tHashSet<String> countriesOwned = playerOne.getStrategyType().gameData.gameMap\r\n\t\t\t\t.getConqueredCountries(playerOne.getStrategyType().getPlayerID());\r\n\r\n\t\tArrayList<String> countriesOwnedList = new ArrayList<>(countriesOwned);\r\n\r\n\t\tHashMap<String, Integer> expectedArmyCountPerCountryAfterReinforcement = new HashMap<>();\r\n\r\n\t\tfor (String country : countriesOwnedList) {\r\n\t\t\texpectedArmyCountPerCountryAfterReinforcement.put(country,\r\n\t\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(country).getCountryArmyCount());\r\n\t\t}\r\n\r\n\t\twhile (reinforcementArmy > 0) {\r\n\r\n\t\t\tInteger randomReinforcementCount = 0;\r\n\t\t\tInteger randomCountryIndex = random.nextInt(countriesOwnedList.size());\r\n\r\n\t\t\tString randomCountry = countriesOwnedList.get(randomCountryIndex);\r\n\r\n\t\t\twhile (randomReinforcementCount == 0) {\r\n\t\t\t\trandomReinforcementCount = random.nextInt(reinforcementArmy + 1);\r\n\t\t\t}\r\n\r\n\t\t\tInteger randomCountryArmyCountBeforeFortification = expectedArmyCountPerCountryAfterReinforcement\r\n\t\t\t\t\t.get(randomCountry);\r\n\r\n\t\t\tInteger randomCountryArmyCountAfterFortification = randomCountryArmyCountBeforeFortification\r\n\t\t\t\t\t+ randomReinforcementCount;\r\n\r\n\t\t\texpectedArmyCountPerCountryAfterReinforcement.put(randomCountry, randomCountryArmyCountAfterFortification);\r\n\r\n\t\t\treinforcementArmy -= randomReinforcementCount;\r\n\r\n\t\t}\r\n\r\n\t\tplayerOne.getStrategyType().executeReinforcement();\r\n\r\n\t\tHashMap<String, Integer> actualArmyCountPerCountryAfterReinforcement = new HashMap<>();\r\n\r\n\t\tfor (String country : countriesOwnedList) {\r\n\t\t\tactualArmyCountPerCountryAfterReinforcement.put(country,\r\n\t\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(country).getCountryArmyCount());\r\n\t\t}\r\n\r\n\t\tassertEquals(actualArmyCountPerCountryAfterReinforcement, expectedArmyCountPerCountryAfterReinforcement);\r\n\t\t// assertTrue(strongerCountryAfterReinforcement >\r\n\t\t// strongerCountryBeforeReinforcement);\r\n\r\n\t}", "@Test\n public void testTie() {\n Assert.assertTrue(\n new Game(\n new Grid3x3(),\n new PredefinedPlayer(new int[] {0, 2, 4, 5, 7}),\n new PredefinedPlayer(new int[] {1, 3, 6, 8})\n ).play().winner().empty());\n }", "private void playGame() {\n\t\tcategoryChosenChecker = new boolean[nPlayers + 1][N_CATEGORIES];\n\t\t// next one is for upper score.\n\t\tupperScore = new int[nPlayers + 1];\n\t\t// for lower score.\n\t\tlowerScore = new int[nPlayers + 1];\n\t\t// and finally, for total score.\n\t\ttotalScore = new int[nPlayers + 1];\n\t\t// here we have for loop, because we want our game to go for\n\t\t// N_SCORING_CATEGORIES times.\n\t\tfor (int i = 0; i < N_SCORING_CATEGORIES; i++) {\n\t\t\t// and here is another for loop, because each player should roll the\n\t\t\t// dice.\n\t\t\tfor (int j = 1; j <= nPlayers; j++) {\n\t\t\t\t// first roll.\n\t\t\t\tfirstRoll(j);\n\t\t\t\t// and the last for loop, because second and third rolls are\n\t\t\t\t// similar and can be written in one method and we want this\n\t\t\t\t// method to happen 2 times.\n\t\t\t\tfor (int k = 1; k <= 2; k++) {\n\t\t\t\t\t// second and third rolls.\n\t\t\t\t\totherRolls();\n\t\t\t\t}\n\t\t\t\t// after rolls, player will choose category.\n\t\t\t\tcategory(j);\n\t\t\t}\n\t\t}\n\t\t// when the game ends program will tell who is the winner.\n\t\twhoIsTheWinner();\n\t}", "@Test\n public void shouldFinishedGameBeFalseWhenStartingGame() {\n boolean expResult = true ;\n boolean result = scoreService.isEndGame() ;\n assertEquals(expResult, result) ;\n }", "public void testScoreboardCaseTwo () throws Exception{\n \n // RunID TeamID Prob Time Result\n \n String [] runsData = {\n \"1,1,A,1,No\", // 20\n \"2,1,A,3,Yes\", // 3 (Minute points for 1st Yes count)\n \"3,1,A,5,No\", // 20 (a No on a solved problem)\n \"4,1,A,7,Yes\", // zero (only \"No's\" count)\n \"5,1,A,9,No\", // 20 (another No on the solved problem)\n \n \"6,1,B,11,No\", // zero (problem has not been solved)\n \"7,1,B,13,No\", // zero (problem has not been solved)\n \n \"8,2,A,30,Yes\", // 30 (Minute points for 1st Yes)\n \n \"9,2,B,35,No\", // zero -- not solved\n \"10,2,B,40,No\", // zero -- not solved\n \"11,2,B,45,No\", // zero -- not solved\n \"12,2,B,50,No\", // zero -- not solved\n \"13,2,B,55,No\", // zero -- not solved\n };\n \n\n // Rank TeamId Solved Penalty\n \n String [] rankData = {\n \"1,team1,1,23\",\n \"2,team2,1,30\",\n };\n \n // TODO when SA supports count all runs, replace rankData\n \n /**\n * Case 2 tests when all no runs are counted, the current SA\n * does not support this scoring method. The commented\n * rankData is the proper results\n */\n\n// Team 2 -- 30 <-- Team 2 is now winning with a lower score \n// Team 1 -- 63 (same database; different scoring method)\n \n// String [] rankData = {\n// \"1,team2,1,30\",\n// \"2,team1,1,63\",\n// };\n \n \n scoreboardTest (2, runsData, rankData);\n \n }", "public void playRound(CuarentaGame game){\n Player human = game.getHumanPlayer();\n Player computer = game.getComputerPlayer();\n Player activePlayer;\n \n for(int i=0; i<10; i++){\n // For now, human player starts always. This isn't quite intended, but not important right now\n if(i%2==0)\n activePlayer = human;\n else\n activePlayer = computer;\n // choose a card to play\n \n // choose next actions\n \n // add points accordingly\n\n // check win condition\n\n }\n\n human.addPoints(calculatePointsFromDiscardPile(game.getHumanPlayer()));\n computer.addPoints(calculatePointsFromDiscardPile(game.getComputerPlayer()));\n }", "public void compare(){\n\t\tboolean gameOver = false;\n\t\tfor (int j = 0; j < player.size(); j++){\n\t\t\t/**\n\t\t\t * gameover screen\n\t\t\t */\n\t\t\tif (player.get(j) != input.get(j)){\n\t\t\t\tif (score <= 3){JOptionPane.showMessageDialog(pane, \"Game Over!\\n\" + \"You got the rank \"\n\t\t\t\t\t\t+ \"of a Joker with a score of \" + score + '.');}\n\t\t\t\telse if (score > 3 && score <= 10){JOptionPane.showMessageDialog(pane, \"Game Over!\\n\" +\n\t\t\t\t\"You got the ranking of a Knight with a score of \" + score + '.');}\n\t\t\t\telse if (score > 10 && score <=20){JOptionPane.showMessageDialog(pane, \"Game Over!\\n\" +\n\t\t\t\t\"You got the ranking of a King with a score of \" + score + '.');}\n\t\t\t\telse if (score >20){JOptionPane.showMessageDialog(pane, \"Game Over!\\n\" +\n\t\t\t\t\"You got the ranking of a Master with a score of \" + score + '.');}\n\t\t\t\tgameOver = true;\n\t\t\t\tif (score > highScore){\n\t\t\t\t\thighScore = score;\n\t\t\t\t\tscoreBoard.setHighScore(highScore);\n\t\t\t\t}\n\t\t\t\tplayer.clear();\n\t\t\t\tinput.clear();\n\t\t\t\tlist();\n\t\t\t\t++totalGames;\n\t\t\t\tfindGames();\n\t\t\t\tfindAvg();\n\t\t\t\tscore = 0;\n\t\t\t\tscoreBoard.setScore(score);\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t * starts new round after a successful round\n\t\t */\n\t\tif (player.size() == input.size() && !gameOver){\n\t\t\tplayer.clear();\n\t\t\tscore++;\n\t\t\tscoreBoard.setScore(score);\n\t\t\tstartGame();\n\t\t\t}\n\t}", "public int evaluate(PentagoBoardState pbs) {\n PentagoBoardState.Piece[][] pieces = pbs.getBoard();\n\n\n int whitescore =0; //keep track of white's total score\n int blackscore = 0;//keep track of black's total score\n\n //Check rows\n for (int x = 0; x <6 ; x++) {\n int countWHori = 0;\n int countBHori = 0;\n\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = 0; y <5 ; y++) {\n //Count how many black and white pieces\n if (pieces[x][y].ordinal() == 0 ) {\n\n //countBHori = countBHori + countvalue;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWHori = countWHori +countvalue;\n whites++;\n }\n\n //Check for consecutive\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n\n //Check for disjoint and joint set If * B B W * * then disjoint and * B B * B * Then joint set for B * B\n if (y!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 && pieces[x][y+2].ordinal() == 1){\n countBHori = countBHori +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 && pieces[x][y+2].ordinal() == 0){\n countWHori = countWHori +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 0){\n countBHori = countBHori +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 1){\n countWHori = countWHori +jointset;\n }\n }\n }\n //check if unwinnable\n if (blacks == 4 && whites==2){\n countBHori += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWHori += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countWHori += unwinnable;\n countBHori += unwinnable;\n }\n\n\n //Run value for row in evaluation scheme and add to total score\n int valuew = consecutivevalue(countWHori);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBHori);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec hori \" + valueb + \"White consec hori \" + valuew);\n\n }\n\n //Check Verticals\n for (int y = 0; y <6 ; y++) {\n int countWvert = 0;\n int countBvert = 0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int x = 0; x <5 ; x++) {\n if (pieces[x][y].ordinal() == 0) {\n\n //countBvert = countBvert +1;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWvert = countWvert +1;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n\n if (x!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 1){\n countBvert = countBvert +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 0){\n countWvert = countWvert +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0){\n countBvert = countBvert +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1){\n countWvert = countWvert +jointset;\n }\n }\n }\n\n if (blacks == 4 && whites==2){\n countBvert += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBvert += unwinnable;\n countWvert += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWvert += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBvert + \"White consec \" + countWvert);\n int valuew = consecutivevalue(countWvert);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBvert);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec VERT \" + valueb + \"White consec hori \" + valuew);\n }\n\n //S West N EAST Top\n for (int a = 1; a <6 ; a++) { //loop through all diagonal lines\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = a; y !=0 ; y--) { //loop through one diagonal line\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +2;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n // check for joint and disjoint set at these x y coordinates by looking 2 pieces ahead\n if (x==0 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==0 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n\n x++;\n\n\n }\n if (blacks == 4 && whites==2){\n countBdiagSoNe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n //S West N EAST Bot\n for (int a = 1; a <5 ; a++) {\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int y=5;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n if (x==1 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n //System.out.println(x + \" y:\" + y +\" Black consec DIAGOMAAL \" + countBdiagSoNe + \"White consec hori \" + countWdiagSoNe);\n y--;\n\n\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n /*if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }*/\n if (a==1&& blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n\n //NorthWest S EAST Left\n for (int a = 0; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int y=0;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n //System.out.println(pbs+\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n y++;\n\n\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n if (blacks == 4 && whites==2){\n countBdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagNoSe += unwinnable;\n countWdiagNoSe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n //NorthWest S EAST Right\n for (int a = 1; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n for (int y = a; y <5 ; y++) {\n //System.out.println(\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0 ) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n x++;\n\n\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n\n\n\n\n\n //System.out.println(\"Black consec score \" + blackscore +\" \" + \"White consec scpre \" + whitescore);\n //System.out.println(\"max player is \" + maxplayer + \"My colour is \" + mycolour);\n int i = -123456789;\n if (mycolour == 0){\n //System.out.println(blackscore-whitescore +\" I am black\");\n\n\n i= blackscore-whitescore;\n return i;\n\n }\n else {\n //System.out.println(whitescore-blackscore +\" I am white\");\n i= whitescore-blackscore;\n return i;\n }\n /*\n if(i>0 && i<1000){\n return 100; //i*2;\n }\n else if(i>=1000 && i<10000){\n return 1000; //i*10;\n }\n else if(i>=10000 && i<100000){\n return 10000; //i*50;\n }\n else if(i>=100000){\n return 100000;//i*500;\n }\n else if(i<=0 && i>-100){\n return -100; //i*2;\n }\n else if(i<=-100 && i>-1000){\n return -1000; //i*10;\n }\n else if(i<=-1000 && i>-10000){\n return -10000; //i*50;\n }\n else if(i<=0 && i>-100000){\n return -100000;//i*500;\n }\n\n */\n\n\n }", "@Test\n public void testO() {\n Assert.assertSame(\n new Game(\n new Grid3x3(),\n new PredefinedPlayer(new int[] {1, 4, 2}),\n new PredefinedPlayer(new int[] {0, 3, 6})\n ).play().winner(),\n State.O);\n }", "@Test\r\n void testHardMajorityAlwaysCooperate() {\r\n AlwaysCooperate testStrat = new AlwaysCooperate();\r\n HardMajority testStrat2 = new HardMajority();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n Game game = new Game(testStrat, testStrat2, 3, payoffs);\r\n game.playGame();\r\n assertEquals(testStrat2.getPoints(), 11, \"HardMajority strategy not functioning correctly\");\r\n }", "@Override\n public List<List<ICrosser>> solveGame() {\n return null;\n }", "boolean addHardGamePlayed();", "public int trickWinner(){\n Card.NUMBER one = player1Play.getValue();\n Card.NUMBER two = player2Play.getValue();\n Card.NUMBER three = player3Play.getValue();\n Card.NUMBER four = player4Play.getValue();\n Card.SUIT oneSuit = player1Play.getSuit();\n Card.SUIT twoSuit = player2Play.getSuit();\n Card.SUIT threeSuit = player3Play.getSuit();\n Card.SUIT fourSuit = player4Play.getSuit();\n int[] value = new int[4];\n value[0] = Card.getValsVal(one, oneSuit, currentTrumpSuit);\n value[1] = Card.getValsVal(two, twoSuit, currentTrumpSuit);\n value[2] = Card.getValsVal(three, threeSuit, currentTrumpSuit);\n value[3] = Card.getValsVal(four, fourSuit, currentTrumpSuit);\n if(player1Play.getSuit() == firstPlayedSuit && firstPlayedSuit != currentTrumpSuit && value[0] != 7){\n value[0] += 10;\n }\n if(player2Play.getSuit() == firstPlayedSuit && firstPlayedSuit != currentTrumpSuit && value[0] != 7){\n value[1] += 10;\n }\n if(player3Play.getSuit() == firstPlayedSuit && firstPlayedSuit != currentTrumpSuit && value[0] != 7){\n value[2] += 10;\n }\n if(player4Play.getSuit() == firstPlayedSuit && firstPlayedSuit != currentTrumpSuit && value[0] != 7){\n value[3] += 10;\n }\n if(player1Play.getSuit() == currentTrumpSuit || value[0] == 7){\n value[0] += 20;\n }\n if(player2Play.getSuit() == currentTrumpSuit || value[1] == 7){\n value[1] += 20;\n }\n if(player3Play.getSuit() == currentTrumpSuit || value[2] == 7){\n value[2] += 20;\n }\n if(player4Play.getSuit() == currentTrumpSuit || value[3] == 7){\n value[3] += 20;\n }\n int winner = 0;\n int winVal = 0;\n for(int i = 0; i < 4; i++){\n if(value[i] > winVal){\n winVal = value[i];\n winner = i;\n }\n }\n return winner;\n }", "private int evaluate(Board board)\n {\n if (computerWin(board))\n return 4*size;\n else if (playerWin(board))\n return -4*size;\n else if (draw(board))\n return 3*size;\n else\n return count(board, COMPUTER);\n }", "@Test\n public void shouldCreateNewRoundWithStatePlayingWhenPreviousRoundIsOver()\n throws RPSException, InvalidOperationException {\n GameSession gameSession = createGameSessionForTest();\n\n Map<String, GameSession> gameSessionMap = new HashMap<>(1);\n gameSessionMap.put(gameSession.getInviteCode(), gameSession);\n when(gameSessionService.sessions()).thenReturn(gameSessionMap);\n when(playerService.changePlayerState(gameSession.getFirstPlayer().getName(), State.PLAYING))\n .thenReturn(gameSession.getFirstPlayer());\n when(playerService.changePlayerState(gameSession.getSecondPlayer().getName(), State.PLAYING))\n .thenReturn(gameSession.getSecondPlayer());\n\n PlayRequest playRequest1 = new PlayRequest(gameSession.getFirstPlayer().getName(),\n gameSession.getInviteCode(),\n \"PAPER\");\n gameplayService.play(playRequest1);\n PlayRequest playRequest2 = new PlayRequest(gameSession.getSecondPlayer().getName(),\n gameSession.getInviteCode(),\n \"SCISSORS\");\n gameplayService.play(playRequest2);\n assertThat(gameSession.rounds().size(), is(1));\n assertThat(gameSession.rounds().get(0).getState(), is(OVER));\n // When a third Turn is played on the GameSession\n PlayRequest playRequest3 = new PlayRequest(gameSession.getSecondPlayer().getName(),\n gameSession.getInviteCode(),\n \"ROCK\");\n gameplayService.play(playRequest3);\n // Then it should create new round\n assertThat(gameSession.rounds().size(), is(2));\n assertThat(gameSession.latestRound().getState(), is(PLAYING));\n // And Latest Round should contain the latest turn played\n assertThat(gameSession.latestRound().latestTurn().getPlayer(), is(gameSession.getSecondPlayer()));\n assertThat(gameSession.latestRound().latestTurn().getMove(), is(ROCK));\n }", "public int startGame() {\n\t\tint counter = 0;\n\t\twhile (true) {\n\t\t\t\n\t\t\tPlayer current = (counter % 2 == 0) ? getPlayer1() : getPlayer2();\n\t\t\tint column = current.play(getGameBoard());\n\t\t\t\n\t\t\t// Check input validity:\n\t\t\t\n\t\t\tif(column < 0) {\n\t\t\t\tSystem.out.println(current.getName()+\" tries to play a negative column number -> disqualification.\");\n\t\t\t\treturn (current == player1)? 2 : 1;\n\t\t\t}\n\t\t\t\n\t \tif(isColumnFull(column, current)) {\n\t \t\tSystem.out.println(current.getName()+\" tries to play an already full column -> disqualification.\");\n\t \t\treturn (current == player1)? 2 : 1;\n\t \t}\n\t\t\t\n\t\t\tplayColumn(column, current);\n\t\t\tcounter++;\n\t\t\t\n\t\t\tif (isGameDrawn()) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// For Player 1:\n\t\t\tif (hasWon(getPlayer1())) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\t// For Player 2:\n\t\t\tif (hasWon(getPlayer2())) {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t\n\t\t\t// continue ...\n\t\t}\n\t}", "@Test\n public final void testPlayer1Win() {\n checkPlayerWin(player1);\n }", "public PentagoMove alphabetaw(PentagoBoardState boardState){\n PentagoBoardState pbs = (PentagoBoardState) boardState.clone();\n ArrayList<PentagoMove> legalmoves = pbs.getAllLegalMoves();\n\n PentagoMove bestmove = legalmoves.get(0);\n PentagoMove bestopponentmove = new PentagoMove(0,0,0,0,0);\n int bestmovescore = -9999999;\n int bestwhitescore = 0;\n //ArrayList<Integer> scores = new ArrayList<Integer>();\n for(int i = 0;i<legalmoves.size()-1;i++){\n\n PentagoBoardState newboard = (PentagoBoardState) pbs.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove next = legalmoves.get(i);\n\n newboard.processMove(next);\n\n int score = evaluate(newboard);\n //scores.add(score);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n\n if(score > 100000){\n newboard.getWinner();\n newboard.printBoard();\n System.out.println(\"FOUND A WINNER\" + score);\n return next;\n }\n\n\n PentagoMove currentopponentmove;\n ArrayList<PentagoMove> opponentlegalmoves = newboard.getAllLegalMoves();\n if (opponentlegalmoves.size()!=0){\n currentopponentmove = opponentlegalmoves.get(0);\n }\n\n int minopponentmovescore = 999999;\n int thismovescore = -9999;\n ArrayList<PentagoMove> bestopponentmoves = new ArrayList<PentagoMove>();\n PentagoMove currentbestopponentmove = new PentagoMove(0,0,0,0,0);\n\n for(int a = 0;a<opponentlegalmoves.size()-1;a++){\n\n PentagoBoardState pbsopponent = (PentagoBoardState) newboard.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove opponentnext = opponentlegalmoves.get(a);\n\n pbsopponent.processMove(opponentnext);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n //pbs.printBoard();\n\n int opponentscore = evaluate(pbsopponent);\n\n\n\n\n\n if (minopponentmovescore>opponentscore){\n //currentopponentmove = opponentnext;\n minopponentmovescore = opponentscore;\n bestopponentmoves.add(opponentnext);\n currentbestopponentmove = opponentnext;\n }\n\n\n }\n bestopponentmove = currentbestopponentmove;\n //lvl 3\n /*\n\n int lvl3minscore =99999;\n PentagoMove currentmaxmove;\n for (int r = 0;r<bestopponentmoves.size()-1;r++) {\n PentagoBoardState pbsopponent = (PentagoBoardState) newboard.clone();\n pbsopponent.processMove(bestopponentmoves.get(r));\n\n ArrayList<PentagoMove> maxlegalmoves = pbsopponent.getAllLegalMoves();\n if (maxlegalmoves.size() != 0) {\n currentmaxmove = maxlegalmoves.get(0);\n }\n int opponentscore = evaluate(pbsopponent);\n int findminmaxmovescore = -99999;\n for (int s = 0; s < maxlegalmoves.size() - 1; s++) {\n\n PentagoBoardState maxboard = (PentagoBoardState) pbsopponent.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove maxnext = maxlegalmoves.get(s);\n\n maxboard.processMove(maxnext);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n //pbs.printBoard();\n\n int maxnextscore = evaluate(pbsopponent);\n if (findminmaxmovescore < maxnextscore) {\n currentmaxmove = maxnext;\n findminmaxmovescore = maxnextscore;\n }\n }\n if (thismovescore<findminmaxmovescore){\n //currentopponentmove = opponentnext;\n thismovescore = findminmaxmovescore;\n }\n\n //opponentscore = maxmovescore;\n }\n\n //end experiment\n\n\n\n\n if (mycolour ==1){\n lvl3minscore =minopponentmovescore;\n }\n */\n if (minopponentmovescore>bestmovescore){//minopponentmovescore\n System.out.println(\"max player move score: \"+score + \"Min : \" + minopponentmovescore);\n bestmovescore = minopponentmovescore;\n bestmove = next;\n bestwhitescore = score;\n\n }\n else if (minopponentmovescore == bestmovescore){\n if (score > bestwhitescore){\n System.out.println(\"max player move score: \"+score + \"Min : \" + minopponentmovescore);\n bestmovescore = minopponentmovescore;\n bestmove = next;\n bestwhitescore = score;\n }\n\n\n\n }\n\n\n }\n System.out.println(\"final max player move score: \"+ bestmovescore + \"\\n My best move: \"+bestmove.toPrettyString() + \"\\n My best move: \"+ bestopponentmove.toPrettyString());\n return bestmove;\n }", "@Test\n void doEffecttractorbeam() {\n ArrayList<Player> pl = new ArrayList<>();\n AlphaGame g = new AlphaGame(1, pl,false, 8);\n setPlayers(pl);\n WeaponFactory wf = new WeaponFactory(\"tractor beam\");\n Weapon w2 = new Weapon(\"tractor beam\", wf.getBooleans(), wf.getCosts(), wf.getRequestedNum(), wf.getApplier(), wf.getEffects(), wf.getDescriptions());\n WeaponDeck wd = new WeaponDeck();\n wd.getWeapons().add(w2);\n RealPlayer p = new RealPlayer('b', \"ciccia\");\n p.setPlayerPosition(Board.getSquare(0));\n p.getPh().drawWeapon(wd, w2.getName());\n RealPlayer victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSquare(6));\n ArrayList<Player> players = new ArrayList<>();\n players.add(victim);\n ArrayList<GenericSquare> s = new ArrayList<>();\n s.add(Board.getSpawnpoint('b'));\n try {\n p.getPh().getWeaponDeck().getWeapon(w2.getName()).doEffect(\"base\", null, null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n assertTrue(players.get(0).getPb().countDamages() == 1 && players.get(0).getPlayerPosition() == Board.getSpawnpoint('b'));\n\n players.get(0).setPlayerPosition(Board.getSquare(1));\n s.clear();\n\n try{\n p.getPh().getWeaponDeck().getWeapon(w2.getName()).doEffect(\"alt\", null, null, p, players, null);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(players.get(0).getPb().countDamages() == 4 && players.get(0).getPlayerPosition() == p.getPlayerPosition());\n }", "@Test\n void doEffectelectroscythe() {\n ArrayList<Player> pl = new ArrayList<>();\n AlphaGame g = new AlphaGame(1, pl,false, 8);\n setPlayers(pl);\n WeaponFactory wf = new WeaponFactory(\"electroscythe\");\n Weapon w1 = new Weapon(\"electroscythe\", wf.getBooleans(), wf.getCosts(), wf.getRequestedNum(), wf.getApplier(), wf.getEffects(), wf.getDescriptions());\n WeaponDeck wd = new WeaponDeck();\n RealPlayer p = new RealPlayer('b', \"ciccia\");\n wd.getWeapons().add(w1);\n p.setPlayerPosition(Board.getSquare(0));\n p.getPh().drawWeapon(wd, w1.getName());\n RealPlayer victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSquare(0));\n Terminator t = new Terminator('y', Board.getSquare(0));\n t.setOwnerColor(victim.getColor());\n ArrayList<Player> players = new ArrayList<>();\n players.add(victim);\n players.add(t);\n try{\n p.getPh().getWeaponDeck().getWeapon(w1.getName()).doEffect(\"alt\", null, null, p, players, null);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 2 && t.getPb().countDamages() == 2);\n\n try{\n p.getPh().getWeaponDeck().getWeapon(w1.getName()).doEffect(\"base\", null, null, p, players, null);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 3 && t.getPb().countDamages() == 3);\n }", "public void computeResult() throws InterruptedException {\n\n System.out.println(Pet.petCollection.get(Pet.getIndex()).getName() + \" is now competing against \" + opponent.getName() + \" ......\");\n System.out.println(\"\");\n System.out.println(\"Details of your pet: \" + \"\\n\" + Pet.petCollection.get(Pet.getIndex()).printPetDetails());\n System.out.println(\"\");\n System.out.println(\"Opponent's Details: \" + \"\\n\" + opponent.printPetDetails());\n System.out.println(\"\");\n Pet.petCollection.get(Pet.getIndex()).getCompetition().setCptEntered(Pet.petCollection.get(Pet.getIndex()).getCompetition().getCptEntered() + 1);\n if ((Pet.petCollection.get(Pet.getIndex()).stats.getEnergy() + Pet.petCollection.get(Pet.getIndex()).stats.getHappiness() + Pet.petCollection.get(Pet.getIndex()).stats.getHunger() + Pet.petCollection.get(Pet.getIndex()).stats.getThirst())\n > (opponent.stats.getEnergy() + opponent.stats.getHappiness() + opponent.stats.getHunger() + opponent.stats.getThirst())) {\n\n System.out.println(\"Congrats! \" + Pet.petCollection.get(Pet.getIndex()).getName() + \" wins! :)\");\n Pet.petCollection.get(Pet.getIndex()).getCompetition().setWinCount(Pet.petCollection.get(Pet.getIndex()).getCompetition().getWinCount() + 1);\n System.out.println(\"You've earned $200!\");\n System.out.println(\"\");\n Player.player.setCurrency(Player.player.getCurrency() + 200);\n } else if ((Pet.petCollection.get(Pet.getIndex()).stats.getEnergy() + Pet.petCollection.get(Pet.getIndex()).stats.getHappiness() + Pet.petCollection.get(Pet.getIndex()).stats.getHunger() + Pet.petCollection.get(Pet.getIndex()).stats.getThirst())\n == (opponent.stats.getEnergy() + opponent.stats.getHappiness() + opponent.stats.getHunger() + opponent.stats.getThirst())) {\n System.out.println(\"Draw! You get your money back!\");\n System.out.println(\"\");\n Player.player.setCurrency(Player.player.getCurrency() + 100);\n Pet.petCollection.get(Pet.getIndex()).getCompetition().setDrawCount(Pet.petCollection.get(Pet.getIndex()).getCompetition().getDrawCount() + 1);\n } else {\n Pet.petCollection.get(Pet.getIndex()).getCompetition().setLoseCount(Pet.petCollection.get(Pet.getIndex()).getCompetition().getLoseCount() + 1);\n System.out.println(\"Too bad \" + Pet.petCollection.get(Pet.getIndex()).getName() + \" loses! :(\");\n System.out.println(\"You will get $30 back!\");\n System.out.println(\"\");\n Player.player.setCurrency(Player.player.getCurrency() + 30);\n }\n\n }", "@Test\r\n void testProberSecond() {\r\n Prober testStrat = new Prober();\r\n PeriodicCD testStrat2 = new PeriodicCD();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n ArrayList<Character> expected = new ArrayList<>(Arrays.asList('d', 'c', 'c', 'c', 'd'));\r\n Game game = new Game(testStrat, testStrat2, 5, payoffs);\r\n game.playGame();\r\n assertEquals(game.historyStrategy1, expected, \"Prober strategy not functioning correctly\");\r\n }", "static public void proccessGame(){\n int nextBallLeft = settingOfTheGame.getBallX() + settingOfTheGame.getBallDeltaX();\n int nextBallRight = settingOfTheGame.getBallX() + settingOfTheGame.getDiameter() + settingOfTheGame.getBallDeltaX();\n int nextBallTop = settingOfTheGame.getBallY() + settingOfTheGame.getBallDeltaY();\n int nextBallBottom = settingOfTheGame.getBallY() + settingOfTheGame.getDiameter() + settingOfTheGame.getBallDeltaY();\n\n int playerOneRight = settingOfTheGame.getFirst().getPlayerX() + settingOfTheGame.getFirst().getPlayerX();\n int playerOneTop = settingOfTheGame.getFirst().getPlayerY();\n int playerOneBottom = settingOfTheGame.getFirst().getPlayerY() + settingOfTheGame.getFirst().getPlayerHeight();\n\n float playerTwoLeft = settingOfTheGame.getSecond().getPlayerX();\n float playerTwoTop = settingOfTheGame.getSecond().getPlayerY();\n float playerTwoBottom = settingOfTheGame.getSecond().getPlayerY() + settingOfTheGame.getSecond().getPlayerHeight();\n\n //ball bounces off top and bottom of screen\n if (nextBallTop < 0 || nextBallBottom > 600) {\n settingOfTheGame.setBallDeltaY(settingOfTheGame.getBallDeltaY()*(-1));\n }\n\n //will the ball go off the left side?\n if (nextBallLeft < playerOneRight) {\n //is it going to miss the paddle?\n if (nextBallTop > playerOneBottom || nextBallBottom < playerOneTop) {\n\n Score.second++;\n\n if (Score.second == 3) {\n settingOfTheGame.setPlaying(false);\n settingOfTheGame.setGameOver(true);\n }\n\n settingOfTheGame.setBallX(250);\n settingOfTheGame.setBallY(250);\n } else {\n settingOfTheGame.setBallDeltaX(settingOfTheGame.getBallDeltaX()*(-1));\n }\n }\n\n //will the ball go off the right side?\n if (nextBallRight > playerTwoLeft) {\n //is it going to miss the paddle?\n if (nextBallTop > playerTwoBottom || nextBallBottom < playerTwoTop) {\n\n Score.first++;\n\n if (Score.first == 3) {\n settingOfTheGame.setPlaying(false);\n settingOfTheGame.setGameOver(true);\n }\n\n settingOfTheGame.setBallX(250);\n settingOfTheGame.setBallY(250);\n } else {\n settingOfTheGame.setBallDeltaX(settingOfTheGame.getBallDeltaX()*(-1));\n }\n }\n\n //move the ball\n settingOfTheGame.setBallX(settingOfTheGame.getBallX()+settingOfTheGame.getBallDeltaX()); //ballX += ballDeltaX;\n settingOfTheGame.setBallY(settingOfTheGame.getBallY()+settingOfTheGame.getBallDeltaY());//ballY += ballDeltaY;\n }", "private Stats playSimulatorGame2() {\n IGrid grid = new Grid();\n\n Field[][] fields = new Field[][] { { Field.BOTTLE, Field.EMPTY, Field.EMPTY, Field.EMPTY },\n { Field.EMPTY, Field.EMPTY, Field.BOTTLE, Field.EMPTY },\n { Field.BOTTLE, Field.BOTTLE, Field.EMPTY, Field.EMPTY },\n { Field.EMPTY, Field.EMPTY, Field.EMPTY/* start */, Field.BOTTLE } };\n grid.setGrid(fields, 3, 2);\n\n Robot robot = mock(Robot.class);\n\n // move right\n when(robot.nextMove(Field.EMPTY, Field.EMPTY, Field.BOTTLE, Field.EMPTY, Field.WALL))\n .thenReturn(Move.RIGHT);\n\n // collect\n when(robot.nextMove(Field.BOTTLE, Field.EMPTY, Field.WALL, Field.EMPTY, Field.WALL))\n .thenReturn(Move.COLLECT);\n\n // move up\n when(robot.nextMove(Field.EMPTY, Field.EMPTY, Field.WALL, Field.EMPTY, Field.WALL))\n .thenReturn(Move.UP);\n\n // move right\n when(robot.nextMove(Field.EMPTY, Field.EMPTY, Field.WALL, Field.EMPTY, Field.EMPTY))\n .thenReturn(Move.RIGHT);\n\n AbstractSimulator simulator = simulatorConstructor.apply(5);\n return simulator.playGame(robot, grid, new Random());\n }" ]
[ "0.7408421", "0.6802326", "0.67487746", "0.6638084", "0.65547776", "0.63769877", "0.6369946", "0.6356576", "0.6300964", "0.6299816", "0.6273463", "0.62718934", "0.6251817", "0.6231276", "0.61451966", "0.6129571", "0.61186624", "0.61065686", "0.6105349", "0.60812795", "0.6068183", "0.60477287", "0.6024395", "0.6000469", "0.599843", "0.5995813", "0.59909743", "0.598349", "0.59748226", "0.596541", "0.59642977", "0.59611076", "0.5960356", "0.5959764", "0.5949792", "0.5948853", "0.5947216", "0.59465986", "0.5945372", "0.59440917", "0.59346706", "0.5933775", "0.5932487", "0.5929391", "0.5929337", "0.5923077", "0.59177303", "0.5917033", "0.5909521", "0.5907605", "0.590466", "0.5901942", "0.5899961", "0.5899862", "0.58847344", "0.58793324", "0.5879126", "0.5872659", "0.58662015", "0.58612645", "0.58596283", "0.58557767", "0.58541286", "0.58505476", "0.5849978", "0.5844125", "0.58381534", "0.5828109", "0.58273023", "0.5827259", "0.5827053", "0.58232737", "0.58152", "0.581339", "0.5811595", "0.58094925", "0.58092445", "0.5805577", "0.58053607", "0.58028936", "0.58028585", "0.5798771", "0.57977414", "0.5797682", "0.57945377", "0.579082", "0.578791", "0.5785367", "0.57832724", "0.57822084", "0.5780289", "0.57701963", "0.5769688", "0.57648236", "0.5762735", "0.5762001", "0.5761768", "0.57610124", "0.5756823", "0.5754948", "0.57543665" ]
0.0
-1
Of stateCheckerboardConvertionTest Test a method.
public static void getGameSituationTest() { VTicTacToe tempEnvironment = new VTicTacToe(); int[] tempTestStates = { 0, 13, 39, 26, 17060 }; int tempResult; for (int i = 0; i < tempTestStates.length; i++) { tempResult = tempEnvironment.computeGameSituation(tempTestStates[i]); System.out.println("The game situation of " + tempTestStates[i] + " is: " + tempResult); } // Of for i }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void stateCheckerboardConvertionTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17087 };\n\n\t\tint tempState;\n\t\tint[][] tempCheckerboard;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempCheckerboard = tempEnvironment.stateToCheckerboard(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The checkerboard of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.deepToString(tempCheckerboard));\n\t\t\ttempState = tempEnvironment.checkerboardToState(tempCheckerboard);\n\t\t\tSystem.out.println(\"The state ID is \" + tempState);\n\t\t} // Of for i\n\n\t}", "@Test\n public void shouldTestBoardStatus(){\n\n }", "protected void takeTurn(int[][] boardState)\n {\n \n }", "@Test\n public void shouldTestBoardSetMove(){\n }", "@Test\r\n\tpublic void testGetState() {\r\n\t}", "@Test\n public void testIsSolved() {\n setUpCorrect();\n assertTrue(boardManager.puzzleSolved());\n swapFirstTwoTiles();\n assertFalse(boardManager.puzzleSolved());\n }", "@Test\n public void testGetChessBoard() {\n assertEquals(chess.getChessBoard(), board);\n }", "@Test\r\n public void testIsSolved() {\r\n assertTrue(boardManager4.puzzleSolved());\r\n boardManager4.getBoard().swapTiles(0,0,0,1);\r\n assertFalse(boardManager4.puzzleSolved());\r\n }", "@Test\r\n\tpublic void testDirectCheck() {\n\t\tBoard b = new Board();\r\n\t\tb.state = new Piece[][] //set up the board in the standard way\r\n\t\t\t\t{\r\n\t\t\t\t{new Rook(\"b\"), new Knight(\"b\"),new Bishop(\"b\"),new Queen(\"b\"), new King(\"b\"), new Bishop(\"b\"),\r\n\t\t\t\t\tnew Knight(\"b\"), new Rook(\"b\")},\r\n\t\t\t\t{new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),new Pawn(\"b\"),\r\n\t\t\t\t\t\tnew Pawn(\"b\")},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,null,null,null},\r\n\t\t\t\t{null,null,null,null,null,new Knight(\"b\"),null,null},\r\n\t\t\t\t{new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),new Pawn(\"w\"),\r\n\t\t\t\t\tnew Pawn(\"w\")},\r\n\t\t\t\t{new Rook(\"w\"), new Knight(\"w\"),new Bishop(\"w\"),new Queen(\"w\"), new King(\"w\"), new Bishop(\"w\"),\r\n\t\t\t\t\tnew Knight(\"w\"), new Rook(\"w\")}\r\n\t\t\t\t};\r\n\t\tassertTrue(b.whiteCheck());\t\r\n\t}", "private int checkerboardToState(int[][] paraCheckerboard) {\n\t\tint resultState = 0;\n\t\tint tempExponential = 1;\n\t\tfor (int i = 0; i < SIZE; i++) {\n\t\t\tfor (int j = 0; j < SIZE; j++) {\n\t\t\t\tresultState += paraCheckerboard[i][j] * tempExponential;\n\t\t\t\ttempExponential *= SIZE;\n\t\t\t} // Of for j\n\t\t} // Of for i\n\n\t\treturn resultState;\n\t}", "@Test\r\n\tpublic void testPassedGo() {\r\n\t\tBoard board = new Board(validSquareLocations); // board needs to have squares for this to be tested\r\n\t\tboolean actualPassedGo;\r\n\t\tactualPassedGo = board.passedGo(validCurrentPosition, validDieValue);\r\n\t\tassertEquals(actualPassedGo, expectedPassedGo);\r\n\t}", "@Test\n public void testInversible() {\n System.out.println(\"inversible\");\n Matrix matriz = null;\n boolean expResult = false;\n boolean result = utilsHill.inversible(matriz);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Test\n\tpublic void convertTotest1() {\n\t\tMainPanel testConvertToInt = new MainPanel(9);\n\t\tint getNumNeighbors1Result = testConvertToInt.getNumNeighbors1(2,2);\n int getNumNeighbors0Result = testConvertToInt.getNumNeighbors0(2,2);\n assertEquals(getNumNeighbors1Result, getNumNeighbors0Result);\n\t}", "@Test\n public void testOneStep1() {\n board sol = new board(3);\n assertEquals(-2, sol.neighbors(1,2));\n }", "@Test\n public void testIsActionable_SecondCornerCase() {\n board.getCell(3, 3).setDome(true);\n board.getCell(4, 3).setDome(true);\n assertFalse(godPower.isActionable(board, player.getWorker1()));\n }", "@Test\n public void testIsActionable_FirstCornerCase() {\n board.getCell(3, 4).addLevel();\n board.getCell(3, 3).addLevel();\n board.getCell(4, 3).addLevel();\n assertFalse(godPower.isActionable(board, player.getWorker1()));\n }", "@Test\n public void testThatApplyWorks() {\n Solver solver = new Solver();\n PuzzleState state = new PuzzleState(Arrays.asList(CANNIBAL, MISSIONARY, CANNIBAL),\n Arrays.asList(MISSIONARY, MISSIONARY, CANNIBAL), PuzzleState.Position.LEFT_BANK);\n Move move = new Move(Move.Direction.LEFT_TO_RIGHT, Arrays.asList(CANNIBAL));\n\n // apply the move\n PuzzleState newState = solver.apply(state, move);\n\n PuzzleState expectedState = new PuzzleState(Arrays.asList(MISSIONARY, CANNIBAL),\n Arrays.asList(MISSIONARY, MISSIONARY, CANNIBAL, CANNIBAL), PuzzleState.Position.RIGHT_BANK);\n assertEquals(\"Expected state not achieved!\", expectedState, newState);\n }", "@Test\n //checks for state switching (on/off)\n void SwitchStates() {\n Assertions.assertFalse(machine.isTurnedOn());\n\n //then, switch on and check if on\n machine.setTurnedOn(true);\n Assertions.assertTrue(machine.isTurnedOn());\n\n //switch off to see if turned off correctly\n machine.setTurnedOn(false);\n Assertions.assertFalse(machine.isTurnedOn());\n\n //and now check the inversion\n machine.flipSwitch();\n\n Assertions.assertTrue(machine.isTurnedOn());\n }", "@Test\n\tpublic void testNormalPuzzleGeneration() {\n\t}", "@Test\n\tpublic void testTotalPuzzleGenerated() {\n\t}", "Test convert(TestData testData);", "public void testGetCell()\r\n {\r\n board.loadBoardState(\"OOOO\",\r\n \"OOOO\",\r\n \"O+OO\",\r\n \"OOOO\");\r\n assertEquals(MineSweeperCell.MINE, board.getCell(1, 2));\r\n board.loadBoardState(\"OOOO\",\r\n \"OOOO\",\r\n \"O+OO\",\r\n \"OOOO\");\r\n assertEquals(MineSweeperCell.INVALID_CELL, board.getCell(-1, 2));\r\n board.loadBoardState(\"OOOO\",\r\n \"OOOO\",\r\n \"O+OO\",\r\n \"OOOO\");\r\n assertEquals(MineSweeperCell.INVALID_CELL, board.getCell(4, 2));\r\n board.loadBoardState(\"OOOO\",\r\n \"OOOO\",\r\n \"O+OO\",\r\n \"OOOO\");\r\n assertEquals(MineSweeperCell.INVALID_CELL, board.getCell(2, -1));\r\n board.loadBoardState(\"OOOO\",\r\n \"OOOO\",\r\n \"O+OO\",\r\n \"OOOO\");\r\n assertEquals(MineSweeperCell.INVALID_CELL, board.getCell(2, 4));\r\n }", "@Test\n public void stateExample2() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl(7);\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \" O O O O O\\n\" +\n \" O O O O O O\\n\" +\n \"O O O O O O O\", exampleBoard.getGameState());\n }", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Test\n public void test13() { \n Board board13 = new Board();\n board13.put(1,1,1); \n board13.put(1,2,1);\n board13.put(1,3,2);\n board13.put(2,1,2);\n board13.put(2,2,2);\n board13.put(2,3,1);\n board13.put(3,1,1);\n board13.put(3,2,1);\n board13.put(3,3,2);\n assertTrue(board13.checkTie());\n }", "@Test\n public void testIsActionable_FourthCornerCase() {\n board.getCell(3, 3).setDome(true);\n board.getCell(4, 3).setDome(true);\n board.getCell(4, 4).addLevel();\n assertTrue(godPower.isActionable(board, player.getWorker1()));\n }", "@Test\n public void test12() { \n Board board12 = new Board();\n board12.put(1,3,1);\n \n assertFalse(board12.checkWin());\n }", "public void boardSetUp(){\n\t}", "@Test\n\tpublic void testIsWon() {\n\t\tGameState test = new GameState();\n\t\ttest.blankBoard();\n\t\tassertTrue(test.isWon());\n\t}", "@Test\n public void test11() { \n Board board11 = new Board();\n board11.put(1,3,1);\n board11.put(2,3,1);\n board11.put(3,3,1);\n assertTrue(board11.checkWin());\n }", "@Override\n public Boolean call() throws Exception {\n return this.state22();\n }", "@Test\n public void makeMoveTest() {\n\n //get the board of the enemy with the method getBoard() from enemyGameBoard\n board = enemyGameBoard.getBoard();\n\n //try two times to hit a field on the board that is water, and after that assert it is done succesfully\n enemyGameBoard.makeMove(2, 3, false);\n assertTrue(board[2][3].equals(EnemyGameBoard.WATER_HIT));\n enemyGameBoard.makeMove(9, 9, false);\n assertTrue(board[9][9].equals(EnemyGameBoard.WATER_HIT));\n\n //try two times to hit a field on the board that is not water, and after that assert it is done succesfully\n enemyGameBoard.makeMove(5, 4, true);\n assertTrue(board[5][4].equals(EnemyGameBoard.SHIP_HIT));\n enemyGameBoard.makeMove(8, 1, true);\n assertTrue(board[8][1].equals(EnemyGameBoard.SHIP_HIT));\n }", "@Test\n public void stateExample2() {\n MarbleSolitaireModel exampleBoard = new MarbleSolitaireModelImpl();\n assertEquals(\" O O O\\n\"\n + \" O O O\\n\"\n + \"O O O O O O O\\n\"\n + \"O O O _ O O O\\n\"\n + \"O O O O O O O\\n\"\n + \" O O O\\n\"\n + \" O O O\", exampleBoard.getGameState());\n }", "@Test\r\n public void Test008MakeLiveCell()\r\n {\r\n\r\n assertTrue(gol.makeLiveCell(3, 4));\r\n\r\n }", "@Test\n public void getAction() {\n Card dealerCard = new CardClassAdapter(RankEnum.NINE, SuitEnum.DIAMONDS);\n\n PlayerActionEnum actionEnum1 = PlayerActionEnum.STAND;\n State55 instance = State55.getInstance();\n assertEquals(\"STAND\", actionEnum1, instance.getAction(dealerCard));\n\n }", "@Test\n public void stateExample1() {\n MarbleSolitaireModel exampleBoard = new TriangleSolitaireModelImpl();\n assertEquals(\" _\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \"O O O O O\", exampleBoard.getGameState());\n }", "@Test\n public void testOnButtonPressed() throws Exception {\n test.onButtonPressed(mockEcho);\n assertSame(mockEcho.currentState(), test);\n\n }", "@Test\n\tpublic void testBoardMoveToString() {\n\t\t\tboard.initNewGame();\n\t\t\tbyte[] move = new byte[2];\n\t\t\tmove[0]=0;\n\t\t\tmove[1]=2;\n\t\t\tAssert.assertEquals(\"A1C1\",Board.moveToString(move));\n\t\t\t\n\t\t\t// reverse test\n\t\t\ttry {\n\t\t\t\tbyte[] reverse=Board.stringToMove(\"A1C1\");\n\t\t\t\t\n\t\t\t\tAssert.assertTrue(move[0]==reverse[0]);\n\t\t\t\tAssert.assertTrue(move[1]==reverse[1]);\n\t\t\t} catch (IllegalBoardException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tAssert.fail();\n\t\t\t}\n\t}", "@Test\r\n public void testAction() {\r\n System.out.println(\"action\");\r\n ImageView but = null;\r\n ChessMain instance = new ChessMain();\r\n instance.action(but);\r\n // TODO review the generated test code and remove the default call to fail.\r\n \r\n }", "@Override\n public void test() {\n \n }", "@Test\n public void testBasicScorer() {\n assertEquals(0, stateScorer.scoreState(builder().build(), TwoPlayerKey.PLAYER_1));\n\n //The other player has won if they occupy every node on the board:\n assertEquals(-1, stateScorer.scoreState(builder().allOccupiedBy(TwoPlayerKey.PLAYER_2).build(), TwoPlayerKey.PLAYER_1));\n\n //I have won if I occupy every node on the board:\n assertEquals(1, stateScorer.scoreState(builder().allOccupiedBy(TwoPlayerKey.PLAYER_1).build(), TwoPlayerKey.PLAYER_1));\n }", "public void testNewBattleCruiser() {\n\t\tGame game = new Game(5, \"\");\n\t\t\n\t\t//Method being tested\n\t\tgame.newBattleCruiser();\n\t\t\n\t\t//Check outcome; \n\t\tEnemyShip actual = game.getAllEnemys().iterator().next();\n\t\tBattleCruiser expected = new BattleCruiser(game.getTheGrid());\n\t\t\n\t\tassertTrue(actual.getClass() == expected.getClass());\n\t}", "@Test\n public void test14() { \n Board board14 = new Board();\n board14.put(1,1,1); \n board14.put(1,2,1);\n board14.put(1,3,1);\n board14.put(2,1,2);\n board14.put(2,2,2);\n board14.put(2,3,1);\n board14.put(3,1,1);\n board14.put(3,2,1);\n board14.put(3,3,2);\n assertFalse(board14.checkTie());\n }", "@Test\n public void testGetActions() {\n }", "@Test\n\tpublic void testInitStatesListGameContainer() {\n\t}", "public void testServiceStateTransitions() {\n Date currDate = Calendar.getInstance().getTime();\n SimpleDateFormat sdfStart = new SimpleDateFormat(\"MM/dd/yyyy 00:00:00\");\n String startDate = sdfStart.format(currDate);\n SimpleDateFormat sdfEnd = new SimpleDateFormat(\"MM/dd/yyyy 23:59:59\");\n String endDate = sdfEnd.format(currDate);\n List<StateTransition> transitionList = logMessageService.getServiceStateTransitions(\"nagios\",\"network_users\", startDate, endDate, false);\n assertNotNull(transitionList);\n assertEquals(\"Number of state transitions\", 0, transitionList.size());\n // Set date to yesterday 10am\n Calendar cal = Calendar.getInstance();\n cal.add(Calendar.DATE, -1);\n cal.set(Calendar.HOUR_OF_DAY, 10);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n Date firstinsertdate = cal.getTime();\n // SCENARIO : 1\n this.createTestMessage(\"exchange\", null, \"MINOR\", \"NAGIOS\", \"Unit test message 1\", \"OPEN\", \"PENDING\", firstinsertdate);\n transitionList = logMessageService.getServiceStateTransitions(\"nagios\",\"network_users\", startDate, endDate, false);\n assertEquals(\"Number of state transitions\", 1, transitionList.size());\n if (transitionList != null) {\n for (StateTransition stateTransition : transitionList) {\n assertEquals(\"From status :\", \"PENDING\", stateTransition.getFromStatus().getName());\n assertEquals(\"To status :\", \"PENDING\", stateTransition.getToStatus().getName());\n }\n } else {\n assertNotNull(transitionList);\n }\n // First state change yesterday\n cal = Calendar.getInstance();\n cal.add(Calendar.DATE, -1);\n cal.set(Calendar.HOUR_OF_DAY, 22);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n firstinsertdate = cal.getTime();\n // SCENARIO : 2\n LogMessage msg = this.createTestMessage(\"exchange\", null, \"MAJOR\", \"NAGIOS\", \"Unit test message 2\", \"OPEN\", \"UNSCHEDULED CRITICAL\", firstinsertdate);\n transitionList = logMessageService.getServiceStateTransitions(\"nagios\",\"network_users\", startDate, endDate, false);\n assertEquals(\"Number of state transitions\", 1, transitionList.size());\n if (transitionList != null) {\n\n cal = Calendar.getInstance();\n cal.set(Calendar.HOUR_OF_DAY, 00);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n long sinceMidnight = System.currentTimeMillis() - cal.getTime().getTime();\n // TODO: Enable this test after availability refactoring for 7.1.0.\n //assertEquals(\"Duration in state : \",sinceMidnight, transitionList.get(0).getDurationInState().longValue());\n\n } else {\n assertNotNull(transitionList);\n }\n // SCENARIO : 3\n // First state change today at 3am\n cal = Calendar.getInstance();\n cal.set(Calendar.HOUR_OF_DAY, 3);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n firstinsertdate = cal.getTime();\n msg.setFirstInsertDate(firstinsertdate);\n logMessageService.saveLogMessage(msg);\n transitionList = logMessageService.getServiceStateTransitions(\"nagios\",\"network_users\", startDate, endDate, false);\n if (transitionList != null) {\n // TODO: Enable this test after availability refactoring for 7.1.0.\n //assertEquals(\"Duration in state : \",sincelaststatechange, transitionList.get(0).getDurationInState().longValue());\n\n } else {\n assertNotNull(transitionList);\n }\n\n // SCENARIO : 4\n // First state change today at 3am\n cal = Calendar.getInstance();\n cal.add(Calendar.DATE, -1);\n cal.set(Calendar.HOUR_OF_DAY, 22);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n firstinsertdate = cal.getTime();\n msg = this.createTestMessage(\"exchange\", null, \"MAJOR\", \"NAGIOS\", \"Unit test message 3\", \"OPEN\", \"UP\", firstinsertdate);\n transitionList = logMessageService.getServiceStateTransitions(\"nagios\",\"network_users\", startDate, endDate, false);\n if (transitionList != null) {\n long sincefirststatechange = System.currentTimeMillis() - cal.getTime().getTime();\n // TODO: Enable this test after availability refactoring for 7.1.0.\n //assertEquals(\"Duration in state : \",5 * 3600 * 1000, transitionList.get(0).getDurationInState().longValue());\n //assertEquals(\"Duration in state : \",sincefirststatechange, transitionList.get(1).getDurationInState().longValue());\n\n } else {\n assertNotNull(transitionList);\n }\n }", "public void testRevealBoard()\r\n {\r\n board.loadBoardState(\"OOOO\",\r\n \"OOOO\",\r\n \"OOOO\",\r\n \"OOO+\");\r\n board.revealBoard();\r\n assertBoard(board, \" \",\r\n \" \",\r\n \" 11\",\r\n \" 1*\");\r\n }", "@Test\n public void stateExample1() {\n MarbleSolitaireModel exampleBoard = new MarbleSolitaireModelImpl(5);\n assertEquals(\" O O O O O\\n\"\n + \" O O O O O\\n\"\n + \" O O O O O\\n\"\n + \" O O O O O\\n\"\n + \"O O O O O O O O O O O O O\\n\"\n + \"O O O O O O O O O O O O O\\n\"\n + \"O O O O O O _ O O O O O O\\n\"\n + \"O O O O O O O O O O O O O\\n\"\n + \"O O O O O O O O O O O O O\\n\"\n + \" O O O O O\\n\"\n + \" O O O O O\\n\"\n + \" O O O O O\\n\"\n + \" O O O O O\", exampleBoard.getGameState());\n }", "@Test\n public void transferCheckingtoSavingsTest(){\n assertTrue(userC.transfer(150.00, userS));\n }", "@Test\n public void testGameStateStack_OnPlayState(){\n\n System.out.println(gsm.getCurrentState());\n }", "@Test\n\tpublic void testHardPuzzleGeneration() {\n\t}", "@Test\n public void test10() { \n Board board10 = new Board();\n board10.put(1,1,2);\n board10.put(2,2,2);\n board10.put(3,3,2);\n assertTrue(board10.checkWin());\n }", "@Test\n public void isValidMoveTest() {\n\n //get the board of the enemy with the method getBoard() from enemyGameBoard\n board = enemyGameBoard.getBoard();\n\n //Try two times for a existing point on the board\n assertTrue(enemyGameBoard.isValidMove(1,1));\n assertTrue(enemyGameBoard.isValidMove(2,4));\n\n //Try two times for a non-existing point on the board\n assertFalse(enemyGameBoard.isValidMove(15,5)); // x-value outside the board range\n assertFalse(enemyGameBoard.isValidMove(5,11)); // y-value outside the board range\n\n //hit a water field\n enemyGameBoard.makeMove(2, 3, false);\n assertTrue(board[2][3].equals(EnemyGameBoard.WATER_HIT));\n\n //try isValidMove() on the already hit water field\n assertFalse(enemyGameBoard.isValidMove(2,3));\n\n //hit a ship field\n enemyGameBoard.makeMove(5, 4, true);\n assertTrue(board[5][4].equals(EnemyGameBoard.SHIP_HIT));\n\n //try isValidMove() on the already hit water field\n assertFalse(enemyGameBoard.isValidMove(5,4));\n }", "@Test\n public void testGameStateStack_OnMenu(){\n\n System.out.println(gsm.getCurrentState());\n }", "@Test\n public void testCloseMenuPlan() {\n System.out.println(\"closeMenuPlan\");\n MenuPlan instance = new MenuPlan();\n instance.closeMenuPlan();\n boolean expResult = true;\n boolean result = false;\n if(instance.getState() == State.CLOSED){\n result = true;\n } \n assertEquals(result, expResult);\n \n }", "@Test\n\tpublic void upDownBlackCapture()\n\t{\n\t\tData d=new Data();\n\t\td.set(21,48);\n\t\td.set(27,70);\n\t\tArrayList<Coordinate> test_arr=d.pieceLost(70);\n\t\tassertTrue(3==test_arr.get(0).getX() && 5==test_arr.get(0).getY());\n\n\t}", "@Test\n\tpublic void testblankBoard() {\n\t\tGameState test = new GameState();\n\t\ttest.blankBoard();\n\t\tfor (int x = 0; x < 25; x++) {\n\t\t\tassertTrue(!test.state()[x]);\n\t\t}\n\t}", "@Test\n public void Test_Maintain_State() {\n Map<String, Integer> inMap = new HashMap<>();\n calc = new StomaStateCalculator(3, 800);\n\n inMap.put(\"UrineColour\", 2);\n inMap.put(\"UrineFrequency\", 3);\n inMap.put(\"Volume\", 600);\n inMap.put(\"Consistency\", 2);\n inMap.put(\"PhysicalCharacteristics\", 6);\n\n assertEquals(\"Green\", calc.getState());\n assertEquals(3.0, calc.getStateVal(), 0.0);\n\n calc.Calculate_New_State(inMap);\n\n assertEquals(\"Green\", calc.getState());\n assertEquals(3.0, calc.getStateVal(), 0.0);\n }", "@Test\n public void testGetInversions5by5() {\n int inversions = board5by5.getInversions();\n assertEquals(62, inversions);\n }", "@Test\n public void testGetSquare() {\n \n }", "@Test\n public void reopenClosedTeamUnavalableOption() {\n\n }", "@Test\n\tpublic void testCtoF(){\n\t}", "@Test\n public void testBoardInit(){\n Assert.assertTrue(!board.isBoatInitDone());\n\n // check board dimensions\n Assert.assertTrue(BOARD_SIZE == board.getBoardSize());\n }", "@Test\r\n\tpublic void testRunTournamentMode() {\r\n\t\tString result=cl.runTournamentMode();\r\n\t\tassertEquals(\"Success\", result);\r\n\t}", "@Test\n public void testIsActionable_ThirdCornerCase() {\n board.getCell(3, 4).addLevel();\n board.getCell(3, 3).addLevel();\n assertTrue(godPower.isActionable(board, player.getWorker1()));\n }", "@Test\n public void testTakeTurn() {\n// System.out.println(\"takeTurn\");\n// GameSession instance = null;\n// instance.takeTurn();\n// // TODO review the generated test code and remove the default call to fail.\n// fail(\"The test case is a prototype.\");\n }", "@Override\n\t\tpublic void onTestSuccess(ITestResult result) {\n\t\t\tSystem.out.println((result.getMethod().getMethodName() + \" passed!\"));\n\t test.get().pass(\"Test passed\");\n\t\t\t\n\t\t}", "@Test\n public void testWinCenter() {\n\n\n System.out.println(\"checkMoveIsWin\");\n\n int expResult = 1;\n int result = instance.checkMoveIsWin(new Move(9, 9, player1));\n assertEquals(expResult, result);\n }", "@Test\n\tpublic void testFtoC(){\n\t}", "@Test\r\n public void getBoardTest() {\r\n assertEquals(board4, boardManager4.getBoard());\r\n }", "@Test\r\n public void testLandOn() {\r\n SnakeSquare instance = new SnakeSquare(33, 21);\r\n assertEquals(21, instance.landOn());\r\n }", "public void testActionPerformed() \n {\n System.out.println(\"actionPerformed\");\n ActionEvent e = new ActionEvent(\"\", 0, \"New Game\");\n instance.actionPerformed(e);\n verify(tableModel).newGame();\n e = new ActionEvent(\"\", 0, \"Board Size-Small\");\n instance.actionPerformed(e);\n verify(tableModel).setSize(5);\n e = new ActionEvent(\"\", 0, \"Board Size-Medium\");\n instance.actionPerformed(e);\n verify(tableModel).setSize(9);\n e = new ActionEvent(\"\", 0, \"Board Size-Large\");\n instance.actionPerformed(e);\n verify(tableModel).setSize(11);\n e = new ActionEvent(\"\", 0, \"Skin-Default\");\n instance.actionPerformed(e);\n verify(model).changeTheme(\"Default\");\n e = new ActionEvent(\"\", 0, \"Skin-Classic\");\n instance.actionPerformed(e);\n verify(model).changeTheme(\"Classic\");\n e = new ActionEvent(\"\", 0, \"Skin-Night\");\n instance.actionPerformed(e);\n verify(model).changeTheme(\"Night\");\n when(model.getTableModel()).thenReturn(hurkleModel);\n e = new ActionEvent(\"\", 0, \"Cheat-Cheat\");\n instance.actionPerformed(e);\n assertEquals(\"\", hurkleModel.validateMove(1, 1, true));\n }", "@Test\n public void testWhoIsOnTurn() {\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(0), \"Test - 0 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(1), \"Test - 1 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(2), \"Test - 2 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(3), \"Test - 3 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(4), \"Test - 4 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(5), \"Test - 5 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(6), \"Test - 6 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(7), \"Test - 7 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(8), \"Test - 8 returns player O\");\n }", "@Test\n public void test9() { \n Board board9 = new Board();\n board9.put(1,1,2);\n board9.put(1,2,2);\n board9.put(1,3,2);\n assertTrue(board9.checkWin());\n }", "@Test\n\tvoid testLectureChoixInt() {\n\t\t\n\t}", "Testcase createTestcase();", "public void testOperation();", "@Test\n public void solve1() {\n }", "@Test\n public void clientStateTest() {\n // TODO: test clientState\n }", "@Test\n\tpublic abstract void testTransform4();", "public void testGetTaskActorE(){\n }", "private void test() {\n\n\t}", "@Test\n @Ignore\n public void testConvert() {\n System.out.println(\"convert\");\n Object object = null;\n SntParser instance = new SntParser();\n byte[] expResult = null;\n byte[] result = instance.convert(object);\n assertArrayEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Override\n\tpublic void test() {\n\t\t\n\t}", "public void takeAction(BoardGameController.BoardBugAction action)\n {\n\n }", "@Test\n public void TestGameStatus(){\n int gameTime = b.Game_Status();\n assertEquals(35, gameTime);\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Test\n public void stateExample4() {\n MarbleSolitaireModel exampleBoard =\n new TriangleSolitaireModelImpl(7, 6, 6);\n assertEquals(\" O\\n\" +\n \" O O\\n\" +\n \" O O O\\n\" +\n \" O O O O\\n\" +\n \" O O O O O\\n\" +\n \" O O O O O O\\n\" +\n \"O O O O O O _\", exampleBoard.getGameState());\n }", "@Test\n\tpublic void test() {\n\t\t// CHECKSTYPE:OFF\n\n\t\t// Test the addPlayer(Player player) method\n\t\tPlayer player1 = new Player(\"Iris\");\n\t\tPlayer player2 = new Player(\"Emily\");\n\t\tPlayer player3 = new Player(\"Jason\");\n\t\tPlayer player4 = new Player(\"Rain\");\n\t\tPlayer player5 = new Player(\"Mandy\");\n\t\tscrabbleSystem.addPlayer(player1);\n\t\tscrabbleSystem.addPlayer(player2);\n\t\tscrabbleSystem.addPlayer(player3);\n\t\tscrabbleSystem.addPlayer(player4);\n\t\tscrabbleSystem.addPlayer(player5);\n\t\tList<Player> playersList = scrabbleSystem.getPlayers();\n\t\tassertEquals(4, playersList.size());\n\n\t\t// Test the startNewGame() method\n\t\t/**\n\t\t * The first Turn -- place some tiles on the board\n\t\t */\n\t\tscrabbleSystem.startNewGame();\n\t\tPlayer currentPlayer1 = scrabbleSystem.getCurrentPlayer();\n\t\tSystem.out.println(currentPlayer1.getName());\n\t\tassertEquals(7, currentPlayer1.getTileList().size());\n\t\tList<SpecialTile> specialStore = scrabbleSystem.getSpecialStore();\n\t\tassertEquals(5, specialStore.size());\n\t\tassertEquals(\"Boom\", specialStore.get(0).getName());\n\t\tassertEquals(\"NegativePoint\", specialStore.get(1).getName());\n\t\tassertEquals(\"RetrieveOrder\", specialStore.get(2).getName());\n\t\tassertEquals(\"ReverseOrder\", specialStore.get(3).getName());\n\t\tassertEquals(70, scrabbleSystem.getLetterBag().getNumber());\n\n\t\t// Test the playMove(Move move) method\n\t\tSquare square1 = scrabbleSystem.getBoard().getSquare(7, 7);\n\t\tSquare square2 = scrabbleSystem.getBoard().getSquare(8, 7);\n\t\tSquare square3 = scrabbleSystem.getBoard().getSquare(9, 7);\n\n\t\tTile tile1 = currentPlayer1.getTileList().get(0);\n\t\tTile tile2 = currentPlayer1.getTileList().get(1);\n\t\tTile tile3 = currentPlayer1.getTileList().get(2);\n\n\t\tint scoreSum1 = tile1.getValue() + tile2.getValue() + tile3.getValue();\n\t\t// The first Player\n\t\tMove move = scrabbleSystem.getMove();\n\t\tmove.addTile(square2, tile2);\n\t\tmove.addTile(square3, tile3);\n\n\t\tscrabbleSystem.playMove(move);\n\t\tassertEquals(7, currentPlayer1.getTileList().size());\n\t\tassertEquals(70, scrabbleSystem.getLetterBag().getNumber());\n\n\t\tmove.addTile(square1, tile1);\n\t\tscrabbleSystem.playMove(move);\n\t\tassertEquals(7, currentPlayer1.getTileList().size());\n\t\tassertEquals(67, scrabbleSystem.getLetterBag().getNumber());\n\n\t\tassertTrue(scrabbleSystem.getBoard().getSquare(7, 7).isOccuppied());\n\t\tassertTrue(scrabbleSystem.getBoard().getSquare(8, 7).isOccuppied());\n\t\tassertTrue(scrabbleSystem.getBoard().getSquare(9, 7).isOccuppied());\n\t\tassertFalse(scrabbleSystem.getBoard().getSquare(10, 7).isOccuppied());\n\t\tassertFalse(scrabbleSystem.isGameOver());\n\t\t// check player's score\n\t\tassertEquals(scoreSum1, currentPlayer1.getScore());\n\n\t\tPlayer challengePlayer1 = playersList.get(0);\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tPlayer playerTmp = playersList.get(i);\n\t\t\tif (playerTmp != currentPlayer1) {\n\t\t\t\tchallengePlayer1 = playerTmp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// if there is no player invoke a challenge\n\t\tscrabbleSystem.updateOrder();\n\n\t\t/**\n\t\t * The secord turn -- place some tiles on the board and challenges by\n\t\t * another player\n\t\t */\n\t\tPlayer currentPlayer2 = scrabbleSystem.getCurrentPlayer();\n\t\tassertNotEquals(currentPlayer1, currentPlayer2);\n\t\tSystem.out.println(currentPlayer1.getName());\n\t\tSystem.out.println(currentPlayer2.getName());\n\n\t\tSquare square4 = scrabbleSystem.getBoard().getSquare(8, 6);\n\t\tSquare square5 = scrabbleSystem.getBoard().getSquare(8, 8);\n\t\tSquare square6 = scrabbleSystem.getBoard().getSquare(8, 9);\n\t\tSquare square7 = scrabbleSystem.getBoard().getSquare(7, 8);\n\n\t\tTile tile4 = currentPlayer2.getTileList().get(0);\n\t\tTile tile5 = currentPlayer2.getTileList().get(1);\n\t\tTile tile6 = currentPlayer2.getTileList().get(2);\n\n\t\tMove move2 = scrabbleSystem.getMove();\n\t\tassertEquals(0, move2.getTileMap().size());\n\t\tmove2.addTile(square4, tile4);\n\t\tmove2.addTile(square5, tile5);\n\t\tmove2.addTile(square7, tile6);\n\t\t// check invalid move\n\t\tscrabbleSystem.playMove(move2);\n\n\t\t// check invalid move\n\t\tmove2.clearMove();\n\t\tmove2.addTile(square4, tile4);\n\t\tmove2.addTile(square6, tile6);\n\t\tscrabbleSystem.playMove(move2);\n\n\t\t// make valid move\n\t\tmove2.clearMove();\n\t\tmove2.addTile(square4, tile4);\n\t\tmove2.addTile(square5, tile5);\n\t\tmove2.addTile(square6, tile6);\n\t\tscrabbleSystem.playMove(move2);\n\n\t\tint scoreSum2 = tile2.getValue() + tile4.getValue() * 2 + tile5.getValue() * 2 + tile6.getValue();\n\t\tassertEquals(scoreSum2, currentPlayer2.getScore());\n\n\t\t// get the challenge player\n\t\tPlayer challengePlayer2 = playersList.get(0);\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tPlayer playerTmp = playersList.get(i);\n\t\t\tif (playerTmp != currentPlayer1) {\n\t\t\t\tchallengePlayer2 = playerTmp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tassertEquals(64, scrabbleSystem.getLetterBag().getNumber());\n\n\t\tscrabbleSystem.challenge(challengePlayer2);\n\t\tscrabbleSystem.updateOrder();\n\t\tassertEquals(67, scrabbleSystem.getLetterBag().getNumber());\n\t\tassertFalse(square4.isOccuppied());\n\t\tassertFalse(square5.isOccuppied());\n\t\tassertFalse(square6.isOccuppied());\n\n\t\t/**\n\t\t * The third turn -- buy a Boom special tile and pass this turn\n\t\t */\n\n\t\tPlayer currentPlayer3 = scrabbleSystem.getCurrentPlayer();\n\t\tMove move3 = scrabbleSystem.getMove();\n\t\tcurrentPlayer3.addScore(100);\n\t\tscrabbleSystem.buySpecialTile(\"Boom\");\n\t\tassertEquals(80, currentPlayer3.getScore());\n\n\t\tSquare square8 = scrabbleSystem.getBoard().getSquare(8, 8);\n\t\tSquare square9 = scrabbleSystem.getBoard().getSquare(9, 8);\n\t\tSquare square10 = scrabbleSystem.getBoard().getSquare(10, 8);\n\t\tSquare square11 = scrabbleSystem.getBoard().getSquare(10, 7);\n\n\t\tTile tile8 = currentPlayer3.getTileList().get(0);\n\t\tTile tile9 = currentPlayer3.getTileList().get(1);\n\t\tTile tile10 = currentPlayer3.getTileList().get(2);\n\t\tSpecialTile specialTile = currentPlayer3.getSpecialTiles().get(\"Boom\").get(0);\n\t\tmove3.addTile(square8, tile8);\n\t\tmove3.addTile(square9, tile9);\n\t\tmove3.addTile(square10, tile10);\n\t\tmove3.addSpecialTile(specialTile, square11);\n\n\t\tint scoreSum3 = 2 * tile8.getValue() + tile9.getValue() + tile10.getValue() + 2 * tile8.getValue()\n\t\t\t\t+ tile2.getValue() + tile3.getValue() + tile9.getValue() + 80;\n\t\tscrabbleSystem.playMove(move3);\n\t\tassertEquals(scoreSum3, currentPlayer3.getScore());\n\t\tscrabbleSystem.challenge(currentPlayer2);\n\t\tassertEquals(67, scrabbleSystem.getLetterBag().getNumber());\n\t\tassertTrue(square11.hasSpecialTile());\n\n\t\t/**\n\t\t * The fourth turn -- buy a NegativePoint special tile and place it on\n\t\t * the board\n\t\t */\n\t\tPlayer currentPlayer4 = scrabbleSystem.getCurrentPlayer();\n\t\tcurrentPlayer4.addScore(10);\n\t\tscrabbleSystem.buySpecialTile(\"NegativePoint\");\n\t\tassertEquals(1, currentPlayer4.getSpecialTiles().get(\"NegativePoint\").size());\n\n\t\tcurrentPlayer4.addScore(50);\n\t\tSystem.out.println(currentPlayer4.getScore());\n\t\tscrabbleSystem.buySpecialTile(\"NegativePoint\");\n\t\tint scoreSum4 = currentPlayer4.getScore();\n\n\t\tMove move4 = scrabbleSystem.getMove();\n\t\tSpecialTile specialTile2 = currentPlayer4.getSpecialTiles().get(\"NegativePoint\").get(0);\n\n\t\tSquare square12 = scrabbleSystem.getBoard().getSquare(11, 7);\n\t\tmove4.addSpecialTile(specialTile2, square12);\n\n\t\tscrabbleSystem.pass(move4);\n\t\tassertEquals(scoreSum4, currentPlayer4.getScore());\n\t\tassertTrue(square12.hasSpecialTile());\n\t\tassertEquals(1, currentPlayer4.getSpecialTiles().get(\"NegativePoint\").size());\n\n\t\t/**\n\t\t * The fifth turn -- invork the Boom and NegativePoint special tiles at\n\t\t * the same time\n\t\t */\n\t\tPlayer currentPlayer5 = scrabbleSystem.getCurrentPlayer();\n\t\tMove move5 = scrabbleSystem.getMove();\n\t\tSquare square13 = scrabbleSystem.getBoard().getSquare(10, 7);\n\t\tSquare square14 = scrabbleSystem.getBoard().getSquare(11, 7);\n\t\tSquare square15 = scrabbleSystem.getBoard().getSquare(12, 7);\n\t\tSquare square16 = scrabbleSystem.getBoard().getSquare(13, 7);\n\t\tSquare square17 = scrabbleSystem.getBoard().getSquare(14, 7);\n\n\t\tTile tile13 = currentPlayer5.getTileList().get(0);\n\t\tTile tile14 = currentPlayer5.getTileList().get(1);\n\t\tTile tile15 = currentPlayer5.getTileList().get(2);\n\t\tTile tile16 = currentPlayer5.getTileList().get(3);\n\t\tTile tile17 = currentPlayer5.getTileList().get(4);\n\n\t\tmove5.addTile(square13, tile13);\n\t\tmove5.addTile(square14, tile14);\n\t\tmove5.addTile(square15, tile15);\n\t\tmove5.addTile(square16, tile16);\n\t\tmove5.addTile(square17, tile17);\n\t\tscrabbleSystem.playMove(move5);\n\t\tassertFalse(square13.isOccuppied());\n\t\tassertFalse(square14.isOccuppied());\n\t\tassertFalse(square15.isOccuppied());\n\t\tassertFalse(square2.isOccuppied());\n\t\tassertFalse(square3.isOccuppied());\n\t\tassertTrue(square1.isOccuppied());\n\t\tscrabbleSystem.updateOrder();\n\n\t\tint scoreSum5 = scoreSum1 - 3 * (tile13.getValue() + tile14.getValue() + tile1.getValue());\n\t\tSystem.out.println(scoreSum5);\n\n\t\t/**\n\t\t * The sixth turn -- The player exchanges some tiles\n\t\t */\n\t\tPlayer currentPlayer6 = scrabbleSystem.getCurrentPlayer();\n\t\tList<Tile> tiles = new ArrayList<>();\n\t\tTile tile18 = currentPlayer6.getTileList().get(0);\n\t\tTile tile19 = currentPlayer6.getTileList().get(1);\n\t\tTile tile20 = currentPlayer6.getTileList().get(2);\n\t\ttiles.add(tile18);\n\t\ttiles.add(tile19);\n\t\ttiles.add(tile20);\n\t\tscrabbleSystem.exchangeTile(tiles);\n\t\tassertEquals(7, currentPlayer6.getTileList().size());\n\n\t\t/**\n\t\t * Get winner\n\t\t */\n\n\t\tList<Player> playersWinner = scrabbleSystem.getWinner();\n\t\tassertEquals(currentPlayer3.getName(), playersWinner.get(0).getName());\n\t}", "@Test\n\tpublic void forWinnerchecker() {\n\t\tString stringOfTestingWord = (\"aword\");\n\t\tboolean ExpectedResult;\n\t\tExpectedResult = true;\n\t\tboolean MethodResult = object1.Winnerchecker(stringOfTestingWord);\n\t\tassertEquals(ExpectedResult, MethodResult);\n\t}", "@Test\n public void testInterfaceState() throws Exception {\n isisNeighbor.setNeighborState(IsisInterfaceState.DOWN);\n isisInterfaceState = isisNeighbor.neighborState();\n assertThat(isisInterfaceState, is(IsisInterfaceState.DOWN));\n }", "@Test\n public void testMoveToPlayer(){\n \n }", "@Test\n public void testIsTransitionMatrix()\n {\n IDoubleArray T = null;\n MarkovModelUtilities instance = new MarkovModelUtilities();\n boolean expResult = false;\n boolean result = instance.isTransitionMatrix(T);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "public void testHostStateTransitions() {\n Date currDate = Calendar.getInstance().getTime();\n SimpleDateFormat sdfStart = new SimpleDateFormat(\"MM/dd/yyyy 00:00:00\");\n String startDate = sdfStart.format(currDate);\n SimpleDateFormat sdfEnd = new SimpleDateFormat(\"MM/dd/yyyy 23:59:59\");\n String endDate = sdfEnd.format(currDate);\n List<StateTransition> transitionList = logMessageService.getHostStateTransitions(\"nagios\", startDate, endDate, false);\n assertNotNull(transitionList);\n assertEquals(\"Number of state transitions\", 0, transitionList.size());\n // Set date to yesterday 10am\n Calendar cal = Calendar.getInstance();\n cal.add(Calendar.DATE, -1);\n cal.set(Calendar.HOUR_OF_DAY, 10);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n Date firstinsertdate = cal.getTime();\n // SCENARIO : 1\n this.createTestMessage(\"exchange\", null, \"MINOR\", \"NAGIOS\", \"Unit test message 1\", \"OPEN\", \"PENDING\", firstinsertdate);\n transitionList = logMessageService.getHostStateTransitions(\"exchange\", startDate, endDate, false);\n assertEquals(\"Number of state transitions\", 1, transitionList.size());\n if (transitionList != null) {\n for (StateTransition stateTransition : transitionList) {\n assertNull(\"From status :\", stateTransition.getFromStatus());\n assertEquals(\"To status :\", \"PENDING\", stateTransition.getToStatus().getName());\n }\n } else {\n assertNotNull(transitionList);\n }\n // First state change yesterday\n cal = Calendar.getInstance();\n cal.add(Calendar.DATE, -1);\n cal.set(Calendar.HOUR_OF_DAY, 22);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n firstinsertdate = cal.getTime();\n // SCENARIO : 2\n LogMessage msg = this.createTestMessage(\"exchange\", null, \"MAJOR\", \"NAGIOS\", \"Unit test message 2\", \"OPEN\", \"UNSCHEDULED CRITICAL\", firstinsertdate);\n transitionList = logMessageService.getHostStateTransitions(\"exchange\", startDate, endDate, false);\n assertEquals(\"Number of state transitions\", 1, transitionList.size());\n if (transitionList != null) {\n\n cal = Calendar.getInstance();\n cal.set(Calendar.HOUR_OF_DAY, 00);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n long sinceMidnight = System.currentTimeMillis() - cal.getTime().getTime();\n // TODO: Enable this test after availability refactoring for 7.1.0.\n //assertEquals(\"Duration in state : \",sinceMidnight, transitionList.get(0).getDurationInState().longValue());\n\n } else {\n assertNotNull(transitionList);\n }\n // SCENARIO : 3\n // First state change today at 3am\n cal = Calendar.getInstance();\n cal.set(Calendar.HOUR_OF_DAY, 3);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n firstinsertdate = cal.getTime();\n msg.setFirstInsertDate(firstinsertdate);\n logMessageService.saveLogMessage(msg);\n transitionList = logMessageService.getHostStateTransitions(\"exchange\", startDate, endDate, false);\n if (transitionList != null) {\n // TODO: Enable this test after availability refactoring for 7.1.0.\n //assertEquals(\"Duration in state : \",sincelaststatechange, transitionList.get(0).getDurationInState().longValue());\n\n } else {\n assertNotNull(transitionList);\n }\n\n // SCENARIO : 4\n // First state change today at 3am\n cal = Calendar.getInstance();\n cal.add(Calendar.DATE, -1);\n cal.set(Calendar.HOUR_OF_DAY, 22);\n cal.set(Calendar.MINUTE, 00);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n firstinsertdate = cal.getTime();\n msg = this.createTestMessage(\"exchange\", null, \"MAJOR\", \"NAGIOS\", \"Unit test message 3\", \"OPEN\", \"UP\", firstinsertdate);\n transitionList = logMessageService.getHostStateTransitions(\"exchange\", startDate, endDate, false);\n if (transitionList != null) {\n long sincefirststatechange = System.currentTimeMillis() - cal.getTime().getTime();\n // TODO: Enable this test after availability refactoring for 7.1.0.\n //assertEquals(\"Duration in state : \",5 * 3600 * 1000, transitionList.get(0).getDurationInState().longValue());\n //assertEquals(\"Duration in state : \",sincefirststatechange, transitionList.get(1).getDurationInState().longValue());\n\n } else {\n assertNotNull(transitionList);\n }\n\n\n }", "@Test\n public void buttonOne_initiates_game_matching_shapes() {\n\n }", "void issueBoardingPass();", "public Result(BoardState board) {\n this.board = board;\n time = 0;\n }", "@Test\n public void updateAccept() throws Exception {\n\n }", "@Test\n\tpublic void testNumberOnBoardOfPassengerCar() throws TrainException\n\t{\n\t\tInteger grossWeight = 1;\n\t\tInteger numberOfSeats = 10;\n\t\tInteger newPassengers = 5;\n\t\t\n\t\tasgn2RollingStock.RollingStock passengerCarUnderTest = \n\t\t\tnew asgn2RollingStock.PassengerCar((Integer)grossWeight, (Integer)numberOfSeats);\n\t\t\n\t\t((asgn2RollingStock.PassengerCar)passengerCarUnderTest).board((Integer) newPassengers);\n\t\t\n\t\tInteger numOnBoard = ((asgn2RollingStock.PassengerCar)passengerCarUnderTest).numberOnBoard();\n\t\t\n\t\tassertEquals(newPassengers, numOnBoard);\n\t\t\n\t}", "@Test\n\tpublic void testBoard() {\n\t\tUserModel exampleUser = new UserModel();\n\t\texampleUser.setUserId(\"@tester_5\");\n\t\texampleUser.setUserPseudo(\"Test_pseudo\");\n\t\texampleUser.setUserEmail(\"[email protected]\");\n\t\texampleUser.setUserPassword(\"0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123\");\n\t\texampleUser.setUserDate(new Date(new java.util.Date().getTime()));\n\t\texampleUser.setUserAdmin(true);\n\t\ttry {\n\t\t\tUserDatabaseManager.insertUser(exampleUser);\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tfail(\"Cannot insert a new user for board testing !\");\n\t\t}\n\n\t\t// Test insertion\n\t\tBoardModel newBoard = new BoardModel();\n\t\tnewBoard.setBoardName(\"test_board\");\n\t\tnewBoard.setBoardCreatorId(\"@tester_5\");\n\t\tnewBoard.setBoardDescription(\"This is the test board of the test user\");\n\t\tnewBoard.addMessageId(\"1\");\n\t\tnewBoard.addMessageId(\"3\");\n\t\ttry {\n\t\t\tBoardDatabaseManager.insertBoard(newBoard);\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tfail(\"Cannot insert a new board !\");\n\t\t}\n\n\t\t// Test updating\n\t\tnewBoard.setBoardDescription(\"LOL\");\n\t\ttry {\n\t\t\tBoardDatabaseManager.updateBoard(newBoard);\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tfail(\"Cannot update the board !\");\n\t\t}\n\n\t\t// Test the board get for one\n\t\tBoardFilter filter = new BoardFilter();\n\t\tfilter.addBoardName(\"test_board\");\n\t\tfilter.addBoardCreatorId(\"@tester_5\");\n\t\ttry {\n\t\t\tList<BoardModel> res = BoardDatabaseManager.getBoards(filter, false);\n\t\t\tassertEquals(1, res.size());\n\t\t\tassertEquals(\"LOL\", res.get(0).getBoardDescription());\n\t\t\tassertEquals(2, res.get(0).getBoardMessagesId().size());\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tfail(\"Cannot get one board !\");\n\t\t}\n\n\t\t// Test the board deletion\n\t\ttry {\n\t\t\tBoardDatabaseManager.deleteBoard(newBoard);\n\t\t\tList<BoardModel> noBoard = BoardDatabaseManager.getBoards(filter, false);\n\t\t\tassertEquals(0, noBoard.size());\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tfail(\"Cannot delete the board !\");\n\t\t}\n\t}", "@Test\n public void moveExample5() {\n MarbleSolitaireModel exampleBoard = new MarbleSolitaireModelImpl();\n exampleBoard.move(1, 3, 3, 3);\n exampleBoard.move(2, 1, 2, 3);\n exampleBoard.move(2, 4, 2, 2);\n exampleBoard.move(2, 6, 2, 4);\n exampleBoard.move(4, 6, 2, 6);\n exampleBoard.move(3, 4, 3, 6);\n exampleBoard.move(4, 4, 4, 6);\n exampleBoard.move(3, 2, 3, 4);\n exampleBoard.move(2, 4, 4, 4);\n exampleBoard.move(4, 3, 4, 5);\n exampleBoard.move(4, 6, 4, 4);\n exampleBoard.move(4, 1, 4, 3);\n exampleBoard.move(5, 3, 3, 3);\n exampleBoard.move(3, 0, 3, 2);\n exampleBoard.move(2, 2, 4, 2);\n exampleBoard.move(0, 2, 2, 2);\n exampleBoard.move(0, 4, 2, 4);\n exampleBoard.move(5, 2, 3, 2);\n exampleBoard.move(5, 4, 3, 4);\n exampleBoard.move(3, 2, 1, 2);\n exampleBoard.move(3, 4, 1, 4);\n exampleBoard.move(2, 6, 4, 6);\n\n assertEquals(true, exampleBoard.isGameOver());\n assertEquals(\" _ O _\\n\"\n + \" O _ O\\n\"\n + \"O _ _ _ _ _ _\\n\"\n + \"_ _ _ O _ _ _\\n\"\n + \"O _ _ _ _ _ O\\n\"\n + \" _ _ _\\n\"\n + \" O O O\", exampleBoard.getGameState());\n }" ]
[ "0.72463745", "0.63745046", "0.62059647", "0.6081054", "0.5977221", "0.5969412", "0.5946859", "0.59076047", "0.58769876", "0.58542085", "0.58454037", "0.58391595", "0.5794593", "0.5753106", "0.5726499", "0.57112783", "0.56910485", "0.5649129", "0.5618005", "0.56007725", "0.5600425", "0.55805725", "0.55711395", "0.55640554", "0.55592597", "0.55560774", "0.5545803", "0.5528761", "0.55255485", "0.55151314", "0.551142", "0.55091214", "0.5508352", "0.5506593", "0.55030704", "0.54895645", "0.54782027", "0.547176", "0.5464398", "0.54618734", "0.5448584", "0.5425396", "0.5419358", "0.54119724", "0.541088", "0.54065144", "0.5405552", "0.54020035", "0.53889775", "0.5380209", "0.5373578", "0.53682417", "0.53585225", "0.5354351", "0.5351503", "0.53490317", "0.5337761", "0.5335854", "0.5332092", "0.53310835", "0.5329648", "0.5329409", "0.5327534", "0.53232294", "0.53206086", "0.53187704", "0.5318709", "0.5318104", "0.5314944", "0.53077084", "0.5302515", "0.52979535", "0.52952653", "0.52947533", "0.5288416", "0.5287643", "0.5285922", "0.5283122", "0.5278789", "0.52754235", "0.52753264", "0.52700573", "0.52692044", "0.5268237", "0.5266961", "0.5265651", "0.5262424", "0.52619374", "0.5255141", "0.52527356", "0.52493674", "0.52476496", "0.5240329", "0.5238507", "0.5235935", "0.52340597", "0.5231749", "0.5227936", "0.5227815", "0.5223548", "0.522091" ]
0.0
-1
Of getGameSituationTest Test a method.
public static void getValidActionsTest() { VTicTacToe tempEnvironment = new VTicTacToe(); int[] tempTestStates = { 0, 13, 39, 26, 6643 }; int[] tempResultArray; for (int i = 0; i < tempTestStates.length; i++) { tempResultArray = tempEnvironment.getValidActions(tempTestStates[i]); System.out.println("The valid actions of " + tempTestStates[i] + " is: " + Arrays.toString(tempResultArray)); } // Of for i }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void winGame() {\n }", "@Test\n public void testTakeTurn() {\n// System.out.println(\"takeTurn\");\n// GameSession instance = null;\n// instance.takeTurn();\n// // TODO review the generated test code and remove the default call to fail.\n// fail(\"The test case is a prototype.\");\n }", "public static void getGameSituationTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 17060 };\n\n\t\tint tempResult;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResult = tempEnvironment.computeGameSituation(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The game situation of \" + tempTestStates[i] + \" is: \" + tempResult);\n\t\t} // Of for i\n\t}", "@Test\r\n public void ss(){\r\n playGame.play();\r\n }", "@Test\n public void testGetRoundsByGameID() {\n \n \n }", "@Test\n public void testAttack() {\n enemy.attack(1, enemy);\n assertEquals(enemy.getHealth(), 90);\n \n hero.attack(2, hero);\n assertEquals(hero.getHealth(), 85);\n \n \n System.out.println(testName.getMethodName() + \" PASSED.\");\n }", "public void load_game() {\n testing();\n}", "@Test\n public void fightShredderTest() {\n }", "@Test\n public void temporaryTeamClosingUnavalableOption() {\n\n }", "@Test\n public void testTakeBet(){\n }", "public Game getTestGame(){\n return m_testGame;\n }", "@Test\n public void TestGameStatus(){\n int gameTime = b.Game_Status();\n assertEquals(35, gameTime);\n }", "@Test\r\n void testTitForTatWithHistoryCooperate() {\r\n TitForTat testStrat = new TitForTat();\r\n AlwaysCooperate testStrat2 = new AlwaysCooperate();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n Game game = new Game(testStrat, testStrat2, 2, payoffs);\r\n game.playGame();\r\n int points = testStrat.getPoints();\r\n assertEquals(points, 6, \"tit for tat not returning correctly \"\r\n + \"against cooperating opponent\"); \r\n }", "@Test\r\n public void testRent() {\r\n }", "@Test\r\n void testTitForTatWithHistoryDefect() {\r\n TitForTat testStrat = new TitForTat();\r\n AlwaysDefect testStrat2 = new AlwaysDefect();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n Game game = new Game(testStrat, testStrat2, 2, payoffs);\r\n game.playGame();\r\n int points = testStrat.getPoints();\r\n assertEquals(points, 1, \"tit for tat not returning \"\r\n + \"correctly against defecting opponent\"); \r\n }", "@Test\n public void testWhoIsOnTurn() {\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(0), \"Test - 0 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(1), \"Test - 1 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(2), \"Test - 2 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(3), \"Test - 3 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(4), \"Test - 4 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(5), \"Test - 5 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(6), \"Test - 6 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(7), \"Test - 7 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(8), \"Test - 8 returns player O\");\n }", "@Test\n public void shouldTestWinner(){\n }", "@Test\n public void testMoveToPlayer(){\n \n }", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "public void testGo() {\n\t\tGame game = new Game(5, \"\");\n\t\tMovement move = Movement.SE;\n\t\tSquare playerStart = game.getPlayer().getPosition();\n\t\t\t\t\n\t\t//Method being tested\n\t\tgame.go(move);\n\t\t\n\t\t//Check outcome; this method carries out many actions, the outcomes of which will be tested below\n\t\t//We will check one outcome here\n\t\tSquare actual = game.getPlayer().getPosition();\n\t\t\n\t\tassertFalse(actual.equals(playerStart));\n\t}", "@Override\n\tpublic void test() {\n\t\t\n\t}", "@Test\n public void fightEnemyTest() {\n }", "@Test\n public void testGetLastAttackTitle() {\n \n assertEquals(hero.getLastAttackTitle(), \"The starting battle specs are:\");\n System.out.println(testName.getMethodName() + \" PASSED.\");\n }", "public void testLizard(){\n }", "@Test\n public void fightEnemyBossTest() {\n\n }", "@Override\n public void test() {\n \n }", "@Test\r\n\tpublic void testRunTournamentMode() {\r\n\t\tString result=cl.runTournamentMode();\r\n\t\tassertEquals(\"Success\", result);\r\n\t}", "@Test\r\n public void testRentOut() {\r\n }", "public void testAltaVehiculo(){\r\n\t}", "@Test\n public void startGameSuccess() throws PersistenceException {\n InMemoryDao successDao = new InMemoryDao();\n GuessService service = new GuessService(successDao);\n \n Game newGame = service.startGame();\n Assert.assertNotNull(newGame);\n \n// int gameID = newGame.getGameKeyID();\n// List<Game> allGames = successDao.getAllGames();\n// Game matchedGame = null;\n// \n// for(Game toCheck : allGames){\n// if(toCheck.getGameKeyID() == gameID){\n// matchedGame = toCheck;\n// } \n// }\n// Assert.assertNotNull(matchedGame);\n }", "@Test\n\tvoid testLectureChoixInt() {\n\t\t\n\t}", "public void test() {\n\t}", "@Test\r\n void testTitForTatNoHistory() {\r\n TitForTat testStrat = new TitForTat();\r\n AlwaysDefect testStrat2 = new AlwaysDefect();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n Game game = new Game(testStrat, testStrat2, 1, payoffs);\r\n game.playGame();\r\n int points = testStrat.getPoints();\r\n assertEquals(points, 0, \"tit for tat not returning c when no history\");\r\n }", "@Test\n public void reopenClosedTeamUnavalableOption() {\n\n }", "@Test\n public void abandonFight() {\n }", "public void testSpock(){\n }", "@Test\n public void testSaveGame(){\n assertEquals(d_gameEngine.saveGame(d_gameData, \"testGame\"), true);\n }", "private void test() {\n\n\t}", "@Test\n public void testGetPower() {\n assertEquals(hero.getPower(), 100);\n System.out.println(testName.getMethodName() + \" PASSED.\");\n \n }", "@Test\n public void getGameStateTest1() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n assertEquals(g.getGameState(), \"Number of players: 0\");\n }", "public void test() {\n }", "public void test() {\n }", "@Test\n public void testGameProcess() {\n // set test player data\n mTournament.setPlayerCollection(getTestPlayersData());\n\n int roundNumber = mTournament.calculateRoundsNumber(mTournament.getPlayersCount());\n for (int i = 0; i < roundNumber; ++i) {\n Round round = mTournament.createNewRound();\n assertTrue(\"State of new round must be CREATED\", round.getState() == State.CREATED);\n\n // tests can't create new round because not all rounds are completed\n Round falseRound = mTournament.createNewRound();\n assertEquals(\"Instance must be null\", null, falseRound);\n\n round.startRound();\n assertTrue(\"State of starting round must be RUNNING\", round.getState() == State.RUNNING);\n\n randomiseResults(round.getMatches());\n round.endRound();\n assertTrue(\"State of ending round must be COMPLETED\", round.getState() == State.COMPLETED);\n\n // tests that ended round can't be started again\n round.startRound();\n assertTrue(\"State of ended round must be COMPLETED\", round.getState() == State.COMPLETED);\n }\n // tests can't create one more round because game is over at this point\n Round round = mTournament.createNewRound();\n assertEquals(\"Instance must be null\", null, round);\n\n }", "@Test\n public void testGetSex() {\n System.out.println(\"getSex\");\n Manager instance = new Manager();\n int expResult = 0;\n int result = instance.getSex();\n assertEquals(expResult, result);\n \n fail(\"The test case is a prototype.\");\n }", "@Test\n void test() {\n Game g = init(\"gen_2p_02\");\n List<Player> players = g.getData().getPlayers();\n wrappedIllegalCommand(g, players.get(0), \"tool 6\");\n wrappedLegalCommand(g, players.get(0), \"pick 1\");\n assertTrue(g.isUndoAvailable());\n wrappedLegalCommand(g, players.get(0), \"tool 6\");\n assertFalse(g.isUndoAvailable());\n lightestShade(g, players);\n notLightestShade(g, players);\n }", "@Test\n public void testGetHealth() {\n \n assertEquals(hero.getHealth(), 100);\n System.out.println(testName.getMethodName() + \" PASSED.\");\n }", "@Test\r\n\tpublic void test() {\r\n\t\tmodel1.getActualTurn().setHasAttacked(true);\r\n\t\tassertEquals(attack2.isPossible(model1) , false);\r\n\t\t\r\n\t\t/* verifica che se gli alieni vincono il gioco viene chiuso */\r\n\t\taliensWin2.perform(model1);\r\n\t\tassertEquals(model1.getGameState() , GameState.CLOSING);\r\n\t\tassertEquals(model1.getActualTurn().getCurrentPlayer().getAvatar().getIsWinner() , EndState.WINNER);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn2);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento del metodo isPossible dell'azione di attacco */\r\n\t\tassertEquals(attack1.isPossible(model1) , false);\r\n\t\tmodel1.getActualTurn().setHasMoved(true);\r\n\t\tmodel1.getActualTurn().setHasDraw(true);\r\n\t\tassertEquals(attack1.isPossible(model1) , false);\r\n\t\tmodel1.getActualTurn().setHasDraw(false);\r\n\t\tmodel1.setGameState(GameState.ACCEPTING);\r\n\t\tassertEquals(attack1.isPossible(model1) , false);\r\n\t\tmodel1.setGameState(GameState.RUNNING);\r\n\t\tassertEquals(attack1.isPossible(model1) , true);\r\n\t\tmodel1.getGamePlayers().get(0).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(1).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(2).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(3).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(4).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(5).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tmodel1.getGamePlayers().get(6).getAvatar().setIsAlive(LifeState.DEAD);\r\n\t\tevtAttacked1 = attack1.perform(model1);\r\n\t\tassertEquals(((EventAttacked)evtAttacked1.get(1)).getAreThereOtherHumans() , false);\r\n\t\tmodel1.getGamePlayers().get(1).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tmodel1.getGamePlayers().get(0).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tmodel1.getGamePlayers().get(2).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tmodel1.getGamePlayers().get(3).getAvatar().setIsAlive(LifeState.ALIVE);\r\n\t\tevtAttacked1 = attack1.perform(model1);\t\r\n\t\tassertEquals(((EventSufferAttack)evtAttacked1.get(0)).getKilled() , killedPlayer);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn3);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento del metodo isPossible dell'azione di attacco */\r\n\t\tmodel1.setGameState(GameState.ACCEPTING);\r\n\t\t((Human)model1.getActualTurn().getCurrentPlayer().getAvatar()).setCanAttack(true);\r\n\t\tassertEquals(attack3.isPossible(model1) , false);\r\n\t\tmodel1.setGameState(GameState.RUNNING);\r\n\t\t((Human)model1.getActualTurn().getCurrentPlayer().getAvatar()).setCanAttack(false);\r\n\t\tassertEquals(attack3.isPossible(model1) , false);\r\n\t\t((Human)model1.getActualTurn().getCurrentPlayer().getAvatar()).setCanAttack(true);\r\n\t\tmodel1.getActualTurn().setHasAttacked(true);\r\n\t\tassertEquals(attack3.isPossible(model1) , false);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn4);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento della perform dell'azione di attacco */\r\n\t\tsector1 = model1.getGameMap().searchSectorByName(\"Hatch\");\r\n\t\tmodel1.getActualTurn().getCurrentPlayer().getAvatar().setCurrentSector(sector1);\r\n\t\tevtAttacked2 = humanWin2.perform(model1);\r\n\t\tassertEquals(((EventNotifyHumanWin)evtAttacked2.get(0)).getGenerator() , player4);\r\n\t\tmodel1.getGamePlayers().get(3).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(2).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(0).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(1).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tmodel1.getGamePlayers().get(4).getAvatar().setIsWinner(EndState.LOOSER);\r\n\t\tassertEquals(humanWin2.perform(model1).size() , 3);\r\n\t\t\r\n\t\tmodel1.setActualTurn(turn7);\r\n\t\t\r\n\t\t/* verifica il corrretto funzionamento dell'utilizzo della carta difesa */\r\n\t\tmodel1.getActualTurn().getCurrentPlayer().getAvatar().addCard(card);\r\n\t\tdefense = new Defense(evtDefense);\r\n\t\tevtAttacked2 = defense.perform(model1);\r\n\t\tassertTrue(!model1.getActualTurn().getCurrentPlayer().getAvatar().getMyCards().contains(card));\r\n\t\tassertTrue(evtAttacked2.get(0) instanceof EventRejectCardAlien);\r\n\t\tassertTrue(evtAttacked2.get(1) instanceof EventCardUsed);\r\n\t\t\r\n\t}", "@Override\n public void runTest() {\n }", "@Test\n public void enemySustainMassiveDamage() {\n }", "public void test() {\n\n }", "public void test(){\n }", "public void test();", "public void test();", "@Test\n public void runNewGameTest() {\n\tassertNotEquals(-1,score);\n }", "@Test\n public void testIsGamePlayable() throws AuthenticationException {\n Map<String, String> data = gameInitializationService.createGame();\n Integer gameId = Integer.parseInt(data.get(GAME_ID));\n String tokenPlayerO = gameInitializationService.joinGame(gameId);\n Assertions.assertTrue(gamePlayService.playGame(gameId, \"A1\", tokenPlayerO), \"Test game is playable.\");\n }", "@Test\r\n void testHardTitForTat() {\r\n HardTitForTat testStrat = new HardTitForTat();\r\n PeriodicCD testStrat2 = new PeriodicCD();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n ArrayList<Character> expected = new ArrayList<>(Arrays.asList('c', 'c', 'd'));\r\n Game game = new Game(testStrat, testStrat2, 3, payoffs);\r\n game.playGame();\r\n assertEquals(game.historyStrategy1, expected, \r\n \"HardTitForTat strategy not functioning correctly\");\r\n }", "public abstract void test();", "public abstract void test();", "@Test\n\tpublic void getTest() {\n\t}", "@Test\n public void buttonOne_initiates_game_matching_shapes() {\n\n }", "public void testOperation();", "void gameTie();", "@Test\n\tvoid testLectureChaineCaracteres() {\n\t}", "@Test\n public void testGetMagic() {\n assertEquals(hero.getMagic(), 100);\n System.out.println(testName.getMethodName() + \" PASSED.\");\n \n \n }", "@Test\n void questionAnswered() {\n }", "@Test\n public void getAction() {\n Card dealerCard = new CardClassAdapter(RankEnum.NINE, SuitEnum.DIAMONDS);\n\n PlayerActionEnum actionEnum1 = PlayerActionEnum.STAND;\n State55 instance = State55.getInstance();\n assertEquals(\"STAND\", actionEnum1, instance.getAction(dealerCard));\n\n }", "@Test\n public void testSetLastAttackTitle() {\n hero.setLastAttackTitle(\"Your end stats are:\");\n assertEquals(hero.getLastAttackTitle(), \"Your end stats are:\");\n System.out.println(testName.getMethodName() + \" PASSED.\");\n \n }", "@Test\n\tvoid test() {\n\t\t\n\t}", "@Test\n public void testGetSquare() {\n \n }", "public String getTestGoal() {\n return \"test\";\n }", "protected abstract void askTest(int currentLap);", "@Test\n public void testSetHealth() {\n assertEquals(hero.getHealth(), 100);\n System.out.println(testName.getMethodName() + \" PASSED.\");\n\n }", "@Test\r\n void testTitForTwoTats() {\r\n TitForTwoTats testStrat = new TitForTwoTats();\r\n AlwaysDefect testStrat2 = new AlwaysDefect();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n ArrayList<Character> expected = new ArrayList<>(Arrays.asList('c', 'c', 'd', 'd'));\r\n Game game = new Game(testStrat, testStrat2, 4, payoffs);\r\n game.playGame();\r\n assertEquals(game.historyStrategy1, expected, \r\n \"TitForTwoTats strategy not functioning correctly\");\r\n }", "public void testNewBattleShooter() {\n\t\tGame game = new Game(5, \"\");\n\t\t\n\t\t//Method being tested\n\t\tgame.newBattleShooter();\n\t\t\n\t\t//Check outcome; \n\t\tEnemyShip actual = game.getAllEnemys().iterator().next();\n\t\tBattleShooter expected = new BattleShooter(game.getTheGrid());\n\t\t\n\t\tassertTrue(actual.getClass() == expected.getClass());\n\t}", "@Test\n public void testFitnessProportionateSelection()\n {\n }", "@Test\n public void proximaSequencia(){\n\n }", "@Test\r\n\tpublic void test() {\r\n\t}", "@Test\n\tpublic void getGameTestGameFound() {\n\t\tGame expectedGame = new Game();\n\t\tGame game = gameRepository.createGame(expectedGame);\n\n\t\texpectedGame.setGameId(game.getGameId());\n\n\t\tassertEquals(expectedGame, game);\n\n\t\t// Double check it is persisted by getting the game\n\t\tGame retrievedGame = gameRepository.getGame(game.getGameId());\n\t\tassertEquals(retrievedGame, game);\n\n\t}", "@Test\n void doEffectrocketlauncher() {\n ArrayList<Player> pl = new ArrayList<>();\n AlphaGame g = new AlphaGame(1, pl,false, 8);\n WeaponFactory wf = new WeaponFactory(\"rocket launcher\");\n Weapon w19 = new Weapon(\"rocket launcher\", wf.getBooleans(), wf.getCosts(), wf.getRequestedNum(), wf.getApplier(), wf.getEffects(), wf.getDescriptions());\n WeaponDeck wd = new WeaponDeck();\n RealPlayer p = new RealPlayer('b', \"ciccia\");\n wd.addWeapon(w19);\n p.setPlayerPosition(Board.getSquare(6));\n p.getPh().drawWeapon(wd, w19.getName());\n RealPlayer victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n ArrayList<Player> players = new ArrayList<>();\n ArrayList<GenericSquare> s = new ArrayList<>();\n players.add(victim);\n s.add(Board.getSquare(10));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"base\", null, null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 2 && victim.getPlayerPosition() == Board.getSquare(10));\n\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(7));\n s.add(Board.getSquare(10));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"opt1\", \"base\", null, p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 2 && victim.getPlayerPosition() == Board.getSquare(10) && p.getPlayerPosition() == Board.getSquare(7));\n\n p.setPlayerPosition(Board.getSquare(6));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n RealPlayer victim2 = new RealPlayer('v', \"ciccia\");\n victim2.setPlayerPosition(Board.getSpawnpoint('y'));\n RealPlayer victim3 = new RealPlayer('g', \"ciccia\");\n victim3.setPlayerPosition(Board.getSpawnpoint('y'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(7));\n s.add(Board.getSquare(10));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"opt1\", \"base\", \"opt2\", p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 3 && victim.getPlayerPosition() == Board.getSquare(10) && p.getPlayerPosition() == Board.getSquare(7) && victim2.getPb().countDamages() == 1 && victim3.getPb().countDamages() == 1);\n\n p.setPlayerPosition(Board.getSquare(6));\n victim = new RealPlayer('y', \"ciccia\");\n victim.setPlayerPosition(Board.getSpawnpoint('y'));\n victim2 = new RealPlayer('v', \"ciccia\");\n victim2.setPlayerPosition(Board.getSpawnpoint('y'));\n victim3 = new RealPlayer('g', \"ciccia\");\n victim3.setPlayerPosition(Board.getSpawnpoint('y'));\n players.clear();\n players.add(victim);\n s.clear();\n s.add(Board.getSquare(10));\n s.add(Board.getSquare(7));\n try {\n p.getPh().getWeaponDeck().getWeapon(w19.getName()).doEffect(\"base\", \"opt2\", \"opt1\", p, players, s);\n }catch (WrongValueException | WrongPlayerException | WrongSquareException e) { }\n\n assertTrue(victim.getPb().countDamages() == 3 && victim.getPlayerPosition() == Board.getSquare(10) && p.getPlayerPosition() == Board.getSquare(7) && victim2.getPb().countDamages() == 1 && victim3.getPb().countDamages() == 1);\n }", "@Test\n public void testGameStateStack_OnPlayState(){\n\n System.out.println(gsm.getCurrentState());\n }", "@Test\r\n public void testNowPlaying() {\r\n System.out.println(\"nowPlaying\");\r\n String parJudul = \"\";\r\n String parGenre = \"\";\r\n double parRating = 0.0;\r\n int parDuration = 0;\r\n Film instance = new Film();\r\n instance.nowPlaying(parJudul, parGenre, parRating, parDuration);\r\n // TODO review the generated test code and remove the default call to fail.\r\n fail(\"The test case is a prototype.\");\r\n }", "@Test\n public void shouldTestBoardStatus(){\n\n }", "@Test\n void testHumanActionMakeSpeak(){\n Humans human = new Humans();\n human.setName(\"tuandung\");\n\n human.setCalm(100);\n assertEquals(human.getName() + \" \"+ \"wanna stop that war\", human.makeSpeakVote(),\"stop the war when calm\");\n human.setCalm(0);\n assertEquals(human.getName() + \" \"+ \"said what ever\", human.makeSpeakVote(),\"human make speak when calm < 0\");\n }", "Testcase createTestcase();", "@Test\r\n void testProberSecond() {\r\n Prober testStrat = new Prober();\r\n PeriodicCD testStrat2 = new PeriodicCD();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n ArrayList<Character> expected = new ArrayList<>(Arrays.asList('d', 'c', 'c', 'c', 'd'));\r\n Game game = new Game(testStrat, testStrat2, 5, payoffs);\r\n game.playGame();\r\n assertEquals(game.historyStrategy1, expected, \"Prober strategy not functioning correctly\");\r\n }", "public void method_52(Game var1) {\n }", "@Override\n protected void executeTest() {\n ClientConnection<Event> harry = register(0, \"Harry\", this.monstertype, \"Active\", 1, 0);\n ClientConnection<Event> statist23 = register(1, \"Statist23\", CreatureType.KOBOLD, \"Passive\", 0, 0);\n\n assertRegisterEvent(harry.nextEvent(), 1, \"Statist23\", CreatureType.KOBOLD, \"Passive\", 0, 0);\n assertRegisterEvent(statist23.nextEvent(), 0, \"Harry\", this.monstertype, \"Active\", 1, 0);\n\n // round 1 begins\n assertRoundBegin(assertAndMerge(harry, statist23), 1);\n\n for (int i = 0; i < this.stepsBeforeTurn; i++) {\n assertActNow(assertAndMerge(harry, statist23), 0);\n harry.sendMove(Direction.EAST);\n assertMoved(assertAndMerge(harry, statist23), 0, Direction.EAST);\n }\n assertActNow(assertAndMerge(harry, statist23), 0);\n harry.sendMove(this.lastDirection);\n assertKicked(assertAndMerge(harry, statist23), 0);\n\n assertActNow(assertAndMerge(harry, statist23), 1);\n statist23.sendDoneActing();\n assertDoneActing(assertAndMerge(harry, statist23), 1);\n\n assertRoundEnd(assertAndMerge(harry, statist23), 1, 0);\n assertWinner(assertAndMerge(harry, statist23), \"Passive\");\n }", "public abstract void onSolvedGame();", "@Test\n public void testNextPlayer() {\n\n assertEquals(Color.BLACK, game.getPlayerInTurn());\n game.nextTurn();\n assertEquals(Color.RED, game.getPlayerInTurn());\n game.nextTurn();\n assertEquals(Color.BLACK, game.getPlayerInTurn());\n }", "@Test\n\tpublic void test() {\n\t}", "@Test\n\tpublic void test() {\n\t}", "@Test\n\tpublic void test() {\n\t\t// CHECKSTYPE:OFF\n\n\t\t// Test the addPlayer(Player player) method\n\t\tPlayer player1 = new Player(\"Iris\");\n\t\tPlayer player2 = new Player(\"Emily\");\n\t\tPlayer player3 = new Player(\"Jason\");\n\t\tPlayer player4 = new Player(\"Rain\");\n\t\tPlayer player5 = new Player(\"Mandy\");\n\t\tscrabbleSystem.addPlayer(player1);\n\t\tscrabbleSystem.addPlayer(player2);\n\t\tscrabbleSystem.addPlayer(player3);\n\t\tscrabbleSystem.addPlayer(player4);\n\t\tscrabbleSystem.addPlayer(player5);\n\t\tList<Player> playersList = scrabbleSystem.getPlayers();\n\t\tassertEquals(4, playersList.size());\n\n\t\t// Test the startNewGame() method\n\t\t/**\n\t\t * The first Turn -- place some tiles on the board\n\t\t */\n\t\tscrabbleSystem.startNewGame();\n\t\tPlayer currentPlayer1 = scrabbleSystem.getCurrentPlayer();\n\t\tSystem.out.println(currentPlayer1.getName());\n\t\tassertEquals(7, currentPlayer1.getTileList().size());\n\t\tList<SpecialTile> specialStore = scrabbleSystem.getSpecialStore();\n\t\tassertEquals(5, specialStore.size());\n\t\tassertEquals(\"Boom\", specialStore.get(0).getName());\n\t\tassertEquals(\"NegativePoint\", specialStore.get(1).getName());\n\t\tassertEquals(\"RetrieveOrder\", specialStore.get(2).getName());\n\t\tassertEquals(\"ReverseOrder\", specialStore.get(3).getName());\n\t\tassertEquals(70, scrabbleSystem.getLetterBag().getNumber());\n\n\t\t// Test the playMove(Move move) method\n\t\tSquare square1 = scrabbleSystem.getBoard().getSquare(7, 7);\n\t\tSquare square2 = scrabbleSystem.getBoard().getSquare(8, 7);\n\t\tSquare square3 = scrabbleSystem.getBoard().getSquare(9, 7);\n\n\t\tTile tile1 = currentPlayer1.getTileList().get(0);\n\t\tTile tile2 = currentPlayer1.getTileList().get(1);\n\t\tTile tile3 = currentPlayer1.getTileList().get(2);\n\n\t\tint scoreSum1 = tile1.getValue() + tile2.getValue() + tile3.getValue();\n\t\t// The first Player\n\t\tMove move = scrabbleSystem.getMove();\n\t\tmove.addTile(square2, tile2);\n\t\tmove.addTile(square3, tile3);\n\n\t\tscrabbleSystem.playMove(move);\n\t\tassertEquals(7, currentPlayer1.getTileList().size());\n\t\tassertEquals(70, scrabbleSystem.getLetterBag().getNumber());\n\n\t\tmove.addTile(square1, tile1);\n\t\tscrabbleSystem.playMove(move);\n\t\tassertEquals(7, currentPlayer1.getTileList().size());\n\t\tassertEquals(67, scrabbleSystem.getLetterBag().getNumber());\n\n\t\tassertTrue(scrabbleSystem.getBoard().getSquare(7, 7).isOccuppied());\n\t\tassertTrue(scrabbleSystem.getBoard().getSquare(8, 7).isOccuppied());\n\t\tassertTrue(scrabbleSystem.getBoard().getSquare(9, 7).isOccuppied());\n\t\tassertFalse(scrabbleSystem.getBoard().getSquare(10, 7).isOccuppied());\n\t\tassertFalse(scrabbleSystem.isGameOver());\n\t\t// check player's score\n\t\tassertEquals(scoreSum1, currentPlayer1.getScore());\n\n\t\tPlayer challengePlayer1 = playersList.get(0);\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tPlayer playerTmp = playersList.get(i);\n\t\t\tif (playerTmp != currentPlayer1) {\n\t\t\t\tchallengePlayer1 = playerTmp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// if there is no player invoke a challenge\n\t\tscrabbleSystem.updateOrder();\n\n\t\t/**\n\t\t * The secord turn -- place some tiles on the board and challenges by\n\t\t * another player\n\t\t */\n\t\tPlayer currentPlayer2 = scrabbleSystem.getCurrentPlayer();\n\t\tassertNotEquals(currentPlayer1, currentPlayer2);\n\t\tSystem.out.println(currentPlayer1.getName());\n\t\tSystem.out.println(currentPlayer2.getName());\n\n\t\tSquare square4 = scrabbleSystem.getBoard().getSquare(8, 6);\n\t\tSquare square5 = scrabbleSystem.getBoard().getSquare(8, 8);\n\t\tSquare square6 = scrabbleSystem.getBoard().getSquare(8, 9);\n\t\tSquare square7 = scrabbleSystem.getBoard().getSquare(7, 8);\n\n\t\tTile tile4 = currentPlayer2.getTileList().get(0);\n\t\tTile tile5 = currentPlayer2.getTileList().get(1);\n\t\tTile tile6 = currentPlayer2.getTileList().get(2);\n\n\t\tMove move2 = scrabbleSystem.getMove();\n\t\tassertEquals(0, move2.getTileMap().size());\n\t\tmove2.addTile(square4, tile4);\n\t\tmove2.addTile(square5, tile5);\n\t\tmove2.addTile(square7, tile6);\n\t\t// check invalid move\n\t\tscrabbleSystem.playMove(move2);\n\n\t\t// check invalid move\n\t\tmove2.clearMove();\n\t\tmove2.addTile(square4, tile4);\n\t\tmove2.addTile(square6, tile6);\n\t\tscrabbleSystem.playMove(move2);\n\n\t\t// make valid move\n\t\tmove2.clearMove();\n\t\tmove2.addTile(square4, tile4);\n\t\tmove2.addTile(square5, tile5);\n\t\tmove2.addTile(square6, tile6);\n\t\tscrabbleSystem.playMove(move2);\n\n\t\tint scoreSum2 = tile2.getValue() + tile4.getValue() * 2 + tile5.getValue() * 2 + tile6.getValue();\n\t\tassertEquals(scoreSum2, currentPlayer2.getScore());\n\n\t\t// get the challenge player\n\t\tPlayer challengePlayer2 = playersList.get(0);\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tPlayer playerTmp = playersList.get(i);\n\t\t\tif (playerTmp != currentPlayer1) {\n\t\t\t\tchallengePlayer2 = playerTmp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tassertEquals(64, scrabbleSystem.getLetterBag().getNumber());\n\n\t\tscrabbleSystem.challenge(challengePlayer2);\n\t\tscrabbleSystem.updateOrder();\n\t\tassertEquals(67, scrabbleSystem.getLetterBag().getNumber());\n\t\tassertFalse(square4.isOccuppied());\n\t\tassertFalse(square5.isOccuppied());\n\t\tassertFalse(square6.isOccuppied());\n\n\t\t/**\n\t\t * The third turn -- buy a Boom special tile and pass this turn\n\t\t */\n\n\t\tPlayer currentPlayer3 = scrabbleSystem.getCurrentPlayer();\n\t\tMove move3 = scrabbleSystem.getMove();\n\t\tcurrentPlayer3.addScore(100);\n\t\tscrabbleSystem.buySpecialTile(\"Boom\");\n\t\tassertEquals(80, currentPlayer3.getScore());\n\n\t\tSquare square8 = scrabbleSystem.getBoard().getSquare(8, 8);\n\t\tSquare square9 = scrabbleSystem.getBoard().getSquare(9, 8);\n\t\tSquare square10 = scrabbleSystem.getBoard().getSquare(10, 8);\n\t\tSquare square11 = scrabbleSystem.getBoard().getSquare(10, 7);\n\n\t\tTile tile8 = currentPlayer3.getTileList().get(0);\n\t\tTile tile9 = currentPlayer3.getTileList().get(1);\n\t\tTile tile10 = currentPlayer3.getTileList().get(2);\n\t\tSpecialTile specialTile = currentPlayer3.getSpecialTiles().get(\"Boom\").get(0);\n\t\tmove3.addTile(square8, tile8);\n\t\tmove3.addTile(square9, tile9);\n\t\tmove3.addTile(square10, tile10);\n\t\tmove3.addSpecialTile(specialTile, square11);\n\n\t\tint scoreSum3 = 2 * tile8.getValue() + tile9.getValue() + tile10.getValue() + 2 * tile8.getValue()\n\t\t\t\t+ tile2.getValue() + tile3.getValue() + tile9.getValue() + 80;\n\t\tscrabbleSystem.playMove(move3);\n\t\tassertEquals(scoreSum3, currentPlayer3.getScore());\n\t\tscrabbleSystem.challenge(currentPlayer2);\n\t\tassertEquals(67, scrabbleSystem.getLetterBag().getNumber());\n\t\tassertTrue(square11.hasSpecialTile());\n\n\t\t/**\n\t\t * The fourth turn -- buy a NegativePoint special tile and place it on\n\t\t * the board\n\t\t */\n\t\tPlayer currentPlayer4 = scrabbleSystem.getCurrentPlayer();\n\t\tcurrentPlayer4.addScore(10);\n\t\tscrabbleSystem.buySpecialTile(\"NegativePoint\");\n\t\tassertEquals(1, currentPlayer4.getSpecialTiles().get(\"NegativePoint\").size());\n\n\t\tcurrentPlayer4.addScore(50);\n\t\tSystem.out.println(currentPlayer4.getScore());\n\t\tscrabbleSystem.buySpecialTile(\"NegativePoint\");\n\t\tint scoreSum4 = currentPlayer4.getScore();\n\n\t\tMove move4 = scrabbleSystem.getMove();\n\t\tSpecialTile specialTile2 = currentPlayer4.getSpecialTiles().get(\"NegativePoint\").get(0);\n\n\t\tSquare square12 = scrabbleSystem.getBoard().getSquare(11, 7);\n\t\tmove4.addSpecialTile(specialTile2, square12);\n\n\t\tscrabbleSystem.pass(move4);\n\t\tassertEquals(scoreSum4, currentPlayer4.getScore());\n\t\tassertTrue(square12.hasSpecialTile());\n\t\tassertEquals(1, currentPlayer4.getSpecialTiles().get(\"NegativePoint\").size());\n\n\t\t/**\n\t\t * The fifth turn -- invork the Boom and NegativePoint special tiles at\n\t\t * the same time\n\t\t */\n\t\tPlayer currentPlayer5 = scrabbleSystem.getCurrentPlayer();\n\t\tMove move5 = scrabbleSystem.getMove();\n\t\tSquare square13 = scrabbleSystem.getBoard().getSquare(10, 7);\n\t\tSquare square14 = scrabbleSystem.getBoard().getSquare(11, 7);\n\t\tSquare square15 = scrabbleSystem.getBoard().getSquare(12, 7);\n\t\tSquare square16 = scrabbleSystem.getBoard().getSquare(13, 7);\n\t\tSquare square17 = scrabbleSystem.getBoard().getSquare(14, 7);\n\n\t\tTile tile13 = currentPlayer5.getTileList().get(0);\n\t\tTile tile14 = currentPlayer5.getTileList().get(1);\n\t\tTile tile15 = currentPlayer5.getTileList().get(2);\n\t\tTile tile16 = currentPlayer5.getTileList().get(3);\n\t\tTile tile17 = currentPlayer5.getTileList().get(4);\n\n\t\tmove5.addTile(square13, tile13);\n\t\tmove5.addTile(square14, tile14);\n\t\tmove5.addTile(square15, tile15);\n\t\tmove5.addTile(square16, tile16);\n\t\tmove5.addTile(square17, tile17);\n\t\tscrabbleSystem.playMove(move5);\n\t\tassertFalse(square13.isOccuppied());\n\t\tassertFalse(square14.isOccuppied());\n\t\tassertFalse(square15.isOccuppied());\n\t\tassertFalse(square2.isOccuppied());\n\t\tassertFalse(square3.isOccuppied());\n\t\tassertTrue(square1.isOccuppied());\n\t\tscrabbleSystem.updateOrder();\n\n\t\tint scoreSum5 = scoreSum1 - 3 * (tile13.getValue() + tile14.getValue() + tile1.getValue());\n\t\tSystem.out.println(scoreSum5);\n\n\t\t/**\n\t\t * The sixth turn -- The player exchanges some tiles\n\t\t */\n\t\tPlayer currentPlayer6 = scrabbleSystem.getCurrentPlayer();\n\t\tList<Tile> tiles = new ArrayList<>();\n\t\tTile tile18 = currentPlayer6.getTileList().get(0);\n\t\tTile tile19 = currentPlayer6.getTileList().get(1);\n\t\tTile tile20 = currentPlayer6.getTileList().get(2);\n\t\ttiles.add(tile18);\n\t\ttiles.add(tile19);\n\t\ttiles.add(tile20);\n\t\tscrabbleSystem.exchangeTile(tiles);\n\t\tassertEquals(7, currentPlayer6.getTileList().size());\n\n\t\t/**\n\t\t * Get winner\n\t\t */\n\n\t\tList<Player> playersWinner = scrabbleSystem.getWinner();\n\t\tassertEquals(currentPlayer3.getName(), playersWinner.get(0).getName());\n\t}", "@Test\n\tpublic void testNormalPuzzleGeneration() {\n\t}", "@Test\n\tpublic void test(){\n\t}", "@Test\n\tpublic void testHardPuzzleGeneration() {\n\t}", "@Test\n public void testHasSugarmanLost() {\n System.out.println(\"hasSugarmanLost\");\n Sugarman instance = new Sugarman();\n instance.changeSugarLevel(-100);\n boolean expResult = true;\n boolean result = instance.hasSugarmanLost();\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n //fail(\"The test case is a prototype.\");\n }", "@Test\n public void shouldCurrentGameBeZeroWhenStartingGame() {\n\n int expResult = 0 ;\n int result = scoreService.getCurrentGame() ;\n assertThat(expResult, is(result) ) ;\n }", "@Test\r\n void testScoreBased() {\r\n ScoreBased testStrat = new ScoreBased();\r\n AlwaysCooperate testStrat2 = new AlwaysCooperate();\r\n ArrayList<Integer> payoffs = new ArrayList<>(Arrays.asList(3, 5, 0, 1));\r\n ArrayList<Character> expected = new ArrayList<>(Arrays.asList('d', 'd', 'c'));\r\n Game game = new Game(testStrat, testStrat2, 3, payoffs);\r\n game.playGame();\r\n assertEquals(game.historyStrategy1, expected, \"ScoreBased strategy not functioning correctly\");\r\n }", "@Test(dependsOnMethods = {\"testAddTeam\"})\n\tpublic void testUpdateTeam() {\n\t}", "public void click(ToddEthottGame game);", "@Test\r\n public void Test008MakeLiveCell()\r\n {\r\n\r\n assertTrue(gol.makeLiveCell(3, 4));\r\n\r\n }" ]
[ "0.7122754", "0.69624233", "0.6790132", "0.67679095", "0.65314895", "0.65215087", "0.6510334", "0.6505019", "0.6414975", "0.63856715", "0.6373562", "0.63710177", "0.63428277", "0.63149905", "0.63031745", "0.62844676", "0.62739563", "0.6266311", "0.626447", "0.6260655", "0.62162924", "0.61966646", "0.6190855", "0.61883676", "0.6178621", "0.6169608", "0.61535674", "0.60267544", "0.60023755", "0.5962013", "0.59562224", "0.59399223", "0.5938436", "0.59312797", "0.59237915", "0.59235585", "0.5922537", "0.5921924", "0.5913774", "0.5908829", "0.5899007", "0.5899007", "0.5862213", "0.58620185", "0.5841739", "0.5837699", "0.5836285", "0.5829946", "0.58254343", "0.58240795", "0.5808612", "0.5800238", "0.5800238", "0.5799887", "0.5798764", "0.5796151", "0.57741266", "0.57741266", "0.5770996", "0.57647324", "0.57603943", "0.5758126", "0.5756566", "0.5756078", "0.57514983", "0.57506204", "0.57331765", "0.5730737", "0.57248", "0.5712492", "0.5705281", "0.5705273", "0.56974286", "0.5688613", "0.56879437", "0.5687746", "0.5685231", "0.56825817", "0.5681506", "0.5679603", "0.5676268", "0.5671172", "0.56634283", "0.5660094", "0.5659205", "0.5656925", "0.56550753", "0.56541246", "0.56528145", "0.56519055", "0.56519055", "0.5639727", "0.5638847", "0.56338334", "0.56288314", "0.5628012", "0.56243825", "0.5623784", "0.5622095", "0.5616917", "0.56150717" ]
0.0
-1
Of getValidActionsTest For display.
public String toString() { String resultString = "\r\n"; //resultString += "Checkerboard state: \r\n"; for (int i = 0; i < checkerboard.length; i++) { for (int j = 0; j < checkerboard.length; j++) { if (checkerboard[i][j] == WHITE) { resultString += "o "; } else if (checkerboard[i][j] == BLACK) { resultString += "x "; } else { resultString += "- "; }//Of if }//Of for j resultString += "\r\n"; }//Of for i resultString += currentState; //resultString += "\r\nThe current situation is: " + gameSituation; return resultString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void getValidActionsTest() {\n\t\tVTicTacToe tempEnvironment = new VTicTacToe();\n\t\tint[] tempTestStates = { 0, 13, 39, 26, 6643 };\n\n\t\tint[] tempResultArray;\n\t\tfor (int i = 0; i < tempTestStates.length; i++) {\n\t\t\ttempResultArray = tempEnvironment.getValidActions(tempTestStates[i]);\n\t\t\tSystem.out.println(\"The valid actions of \" + tempTestStates[i] + \" is: \"\n\t\t\t\t\t+ Arrays.toString(tempResultArray));\n\t\t} // Of for i\n\t}", "public static List<String> getValidActions() {\n return VALID_ACTIONS;\n }", "public int[] getValidActions() {\n\t\treturn getValidActions(currentState);\n\t}", "public List<boolean[]> getValidActions()\n\t{\n\t\tList<boolean[]> validActions = new ArrayList<boolean[]>(allActions);\n\t\t//TODO remove actions that contain jump if environment.mayMarioJump() is false\n\t\treturn validActions;\n\t}", "@Test\n public void testGetActions() {\n }", "@Override\r\n protected boolean validateAction() {\n Set inputNames = getInputNames();\r\n Iterator inputNamesIterator = inputNames.iterator();\r\n String inputName;\r\n IActionParameter actionParameter;\r\n while (inputNamesIterator.hasNext()) {\r\n inputName = (String) inputNamesIterator.next();\r\n actionParameter = getInputParameter(inputName);\r\n message(Messages.getString(\"TestComponent.DEBUG_INPUT_DESCRIPTION\", inputName, actionParameter.getType())); //$NON-NLS-1$\r\n }\r\n\r\n Set outputNames = getOutputNames();\r\n Iterator outputNamesIterator = outputNames.iterator();\r\n String outputName;\r\n while (outputNamesIterator.hasNext()) {\r\n outputName = (String) outputNamesIterator.next();\r\n actionParameter = getOutputItem(outputName);\r\n message(Messages.getString(\"TestComponent.DEBUG_OUTPUT_DESCRIPTION\", outputName, actionParameter.getType())); //$NON-NLS-1$\r\n }\r\n\r\n Set resourceNames = getResourceNames();\r\n Iterator resourceNamesIterator = resourceNames.iterator();\r\n String resourceName;\r\n IActionSequenceResource actionResource;\r\n while (resourceNamesIterator.hasNext()) {\r\n resourceName = (String) resourceNamesIterator.next();\r\n actionResource = getResource(resourceName);\r\n message(Messages\r\n .getString(\r\n \"TestComponent.DEBUG_RESOURCE_DESCRIPTION\", resourceName, actionResource.getMimeType(), PentahoSystem.getApplicationContext().getSolutionPath(actionResource.getAddress()))); //$NON-NLS-1$\r\n try {\r\n String content = getResourceAsString(actionResource);\r\n message(Messages.getString(\r\n \"TestComponent.DEBUG_RESOURCE_CONTENTS\", ((content == null) ? \"null\" : content.substring(0, 100)))); //$NON-NLS-1$ //$NON-NLS-2$\r\n } catch (Exception e) {\r\n message(Messages.getString(\"TestComponent.ERROR_0005_RESOURCE_NOT_LOADED\", e.getMessage())); //$NON-NLS-1$\r\n }\r\n }\r\n\r\n return true;\r\n }", "@Override\n\tpublic String displayActions() {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint i = 0;\n\t\tfor(Action action: this.getTakeableActions()) {\n\t\t\tif(action.isDisplay())\n\t\t\t\tsb.append(\"\\n\"+i++ +\". \"+ action.getDescription());\n\t\t}\n\t\treturn sb.toString();\n\t}", "public ActionList getActions();", "@Test\r\n\tpublic void validEditTest() {\n\t\tadminUserEdit.clickAdminLink();\r\n\t\tadminUserEdit.clickUserListLink();\r\n\t\tadminUserEdit.clickEditUserLink();\r\n\t\t\r\n\t\t// Assertion\r\n\t\tString Actual = adminUserEdit.Assertion();\r\n\t\tString Expected = \"Hari\";\r\n\t\tassertEquals(Actual, Expected);\r\n\t\tscreenShot.captureScreenShot(\"TC019\");\r\n\t}", "public String actionsToString() {\n String res = \"\";\n for (UserCheck userCheck: checks) {\n res += userCheck.toString() + \" \\n\";\n }\n return res;\n }", "@Override\n public String getActions() {\n\treturn \"\";\n }", "@Test(groups ={Slingshot,Regression})\n\tpublic void VerifyfiftyAcctsviewValidatation() {\n\t\tReport.createTestLogHeader(\"MuMv\", \"Verify whether proper error message is diplayed when accounts added more than 50 on clicking the confirm button\");\n\n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"MuMvManageView\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.ClickManageUserLink()\n\t\t.ManageViews()\n\t\t.FiftyAcctsViewnameErrorValidation(userProfile); \t \t\t\t\t\t\t \t \t\t\t \t \t \t\t\t\t\t\t \t \t\t\n\t}", "@Test(priority=3)\r\n\tpublic void displaySalesOptions() {\r\n\t\t\r\n\t\tboolean expected=true;\r\n\t\tboolean actual=filterReturnsList.displaySalesList();\r\n\t\tassertEquals(actual, expected);\r\n\t}", "@Test\n\tpublic void testValidRemainingActions() {\n\t\tassertFalse(Player.isValidRemainingActions(Player.MAX_ALLOWED_ACTIONS + 1));\n\t}", "public ActionsValidator() {\n super();\n }", "private ArrayList<String> getPossibleActions() {\n\t\t\n\t\tRandom r = new Random();\n\t\tArrayList<String> possibleActions = new ArrayList<String>();\n\t\tfor (String actionTitle : getAllActions()) {\n\t\t\tif (r.nextDouble() < 0.3) {\n\t\t\t\tpossibleActions.add(actionTitle);\n\t\t\t}\n\t\t}\n\t\treturn possibleActions;\n\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tTester tester = new Tester();\n\t\t\t\tTestEditor testEditor = new TestEditor(tester) {\n\n\t\t\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Class<?>[] getTestActionClasses() {\n\t\t\t\t\t\tList<Class<?>> result = new ArrayList<Class<?>>(Arrays.asList(super.getTestActionClasses()));\n\t\t\t\t\t\tresult.add(CustomComponentAssertion.class);\n\t\t\t\t\t\treturn result.toArray(new Class<?>[result.size()]);\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t\t/*\n\t\t\t\t * Customize and open the test editor.\n\t\t\t\t */\n\t\t\t\ttestEditor.setDecorationsBackgroundColor(new Color(68, 61, 205));\n\t\t\t\ttestEditor.setDecorationsForegroundColor(new Color(216, 214, 245));\n\t\t\t\ttestEditor.open();\n\t\t\t}", "String[] getActions();", "public List<RequiredAction> getActions() {\n return this.actions;\n }", "@Test(groups ={Slingshot,Regression})\n\tpublic void EditViewLessthan15AcctsErrorValidation() {\n\t\tReport.createTestLogHeader(\"MuMv\", \"Verify whether proper error message is displayed in view when continuing with out enabling the accounts check box\");\n\n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"MuMvManageView\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t\t.clicktestacct();\n\t\t/*.ClickManageUserLink()\n\t\t.ManageViews()\n\t\t.VerifyEditviewname(userProfile)\n\t\t.EditViewNameErrorValidation(userProfile); \t \t\t\t\t\t\t \t \t\t\n\t}*/\n\t}", "@Test\n public void getActionTest(){\n assertEquals(BUY_CARD, card.getActionType());\n }", "@Test\n public void checkDiscountDisplays() {\n }", "@Test\n public void testAdditionalActionVisible() {\n JXTable table = new JXTable(10, 4);\n ColumnControlButton button = new ColumnControlButton(table);\n assertEquals(true, button.getAdditionalActionsVisible());\n DefaultColumnControlPopup popup = (DefaultColumnControlPopup) button.getColumnControlPopup();\n assertEquals(\"additional actions visible, component count expected \", \n table.getColumnCount() + 1 /* separator */ + 3 /* actions with column. prefix*/, \n popup.getPopupMenu().getComponentCount());\n PropertyChangeReport report = new PropertyChangeReport(button);\n button.setAdditionalActionsVisible(false);\n TestUtils.assertPropertyChangeEvent(report, \"additionalActionsVisible\", true, false);\n assertEquals(false, button.getAdditionalActionsVisible());\n assertEquals(\"additional actions hidden, component count expected \", \n table.getColumnCount(),\n popup.getPopupMenu().getComponentCount());\n \n }", "public int getActions() {\n return actions;\n }", "public void testGetPresentationName() {\n assertEquals(\"Incorrect name!\", \"Cut Comment Action\", this.action.getPresentationName());\n }", "public List<Action> getActions(){return actions;}", "private void makeValidActionsDiscretized() {\n validActionsDiscretized = new ArrayList<>();\n\n List<ActionType> actionTypes = problemSpec.getLevel().getAvailableActions();\n\n // Valid tire pressures\n List<TirePressure> tirePressures = Arrays.asList(\n TirePressure.FIFTY_PERCENT,\n TirePressure.SEVENTY_FIVE_PERCENT,\n TirePressure.ONE_HUNDRED_PERCENT\n );\n\n // Valid fuel levels (note that this is an arbitrary discretization)\n List<Integer> fuelLevels = new ArrayList<>();\n int fuelInterval = ProblemSpec.FUEL_MAX / FUEL_DISCRETE_INTERVALS;\n\n for (int i = 0; i < FUEL_DISCRETE_INTERVALS; i++) {\n fuelLevels.add(fuelInterval * i);\n }\n\n // Go through A1-A8 and add all possible combinations of the parameters\n for (ActionType actionType : actionTypes) {\n switch (actionType.getActionNo()) {\n case 1:\n validActionsDiscretized.add(new Action(actionType));\n break;\n\n case 2:\n for (String car : problemSpec.getCarOrder()) {\n validActionsDiscretized.add(new Action(actionType, car));\n }\n\n break;\n\n case 3:\n for (String driver : problemSpec.getDriverOrder()) {\n validActionsDiscretized.add(new Action(actionType, driver));\n }\n\n break;\n\n case 4:\n for (Tire tire : problemSpec.getTireOrder()) {\n validActionsDiscretized.add(new Action(actionType, tire));\n }\n\n break;\n\n case 5:\n for (int fuel : fuelLevels) {\n validActionsDiscretized.add(new Action(actionType, fuel));\n }\n\n break;\n\n case 6:\n for (TirePressure pressure : tirePressures) {\n validActionsDiscretized.add(new Action(actionType, pressure));\n }\n\n break;\n case 7:\n for (String car : problemSpec.getCarOrder()) {\n for (String driver : problemSpec.getDriverOrder()) {\n validActionsDiscretized.add(new Action(actionType, car, driver));\n }\n }\n\n break;\n\n case 8:\n for (TirePressure pressure : tirePressures) {\n for (int fuel : fuelLevels) {\n for (Tire tire : problemSpec.getTireOrder()) {\n validActionsDiscretized.add(new Action(actionType, tire, fuel,\n pressure));\n }\n }\n }\n\n break;\n }\n }\n }", "public String[] getActions() {\n return impl.getActions();\n }", "@Updatable\n public Set<String> getOkActions() {\n if (okActions == null) {\n okActions = new HashSet<>();\n }\n\n return okActions;\n }", "@Test(groups ={Slingshot,Regression})\n\tpublic void EditViewLessthan15Accts() {\n\t\tReport.createTestLogHeader(\"MuMv\",\"Verify whether user is able to edit the existing view successfully and it gets reflected in the list\");\n\n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"MuMvTestdataforFAA\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.ClickManageUserLink()\n\t\t.ManageViews()\n\t\t.VerifyEditviewname(userProfile) \t\t\t\t\t\t \t \t\t\n\t\t.EditViewNameforLessthan15Accts(userProfile)\n\t\t.ClickAddUserRHNLink()\n\t\t.StandardUser_Creation()\t\t\t\t\t\t \t \t\t\n\t\t.verifyEditedview(userProfile)\n\t\t.enterValidData_StandardUserforEditview(userProfile);\n\t\tnew BgbRegistrationAction()\n\t\t.AddNewStdUserdata(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.verifyAuditTable(userProfile);\t\n\t}", "public List<List<Action>> getPlannedActions() {\r\n\t\treturn plannedActions;\r\n\t}", "public void testAddAction() {\n AccuracyMockAddAction addAction = new AccuracyMockAddAction(\n modelElement, classToolUtil, manager, namespace);\n\n assertEquals(\"Should return ModelElement instance.\", modelElement,\n addAction.getModelElement());\n assertEquals(\"Should return ClassToolUtil instance.\", classToolUtil,\n addAction.getClassToolUtil());\n }", "@Test\n public void testExecutdAsPlanned() {\n assertFalse(action.executedAsPlanned());\n // TODO add assertTrue after execute\n }", "@Test\n\tpublic void testShow() {\n\t}", "@Override\r\n\tpublic List<ActionInput> getActions()\r\n\t{\n\t\treturn null;\r\n\t}", "@Test\n public void getSorteerAction() throws Exception {\n }", "@Test\r\n\t//\r\n\tpublic void validateEditLinkTest(){\n\t\tString text=\"Success: Your account has been successfully updated.\";\r\n\t\tassertEquals(editPOM.validateEditTest(),text);\r\n\t\tSystem.out.println(\"5th test case working as expected\");\r\n\t\tscreenShot.captureScreenShot(\"Captured updated details text\");\r\n\t\t\r\n\t}", "@Test\n public void displaying(){\n //set up\n CurrencyRates test = new CurrencyRates();\n boolean retValue = test.initialDisplay();\n assertTrue(retValue);\n retValue = test.secondDisplay();\n assertTrue(retValue);\n return;\n }", "public List<Action> getActions()\r\n {\r\n return Collections.unmodifiableList(actions);\r\n }", "protected boolean validateActions(PDPage page, DocumentHandler handler,\n List<ValidationError> result) throws ValidationException {\n // ---- get AA (additional actions) entry if it is present\n List<AbstractActionManager> lActions = this.actionFact.getActions(page\n .getCOSDictionary(), handler.getDocument().getDocument());\n for (AbstractActionManager action : lActions) {\n if (!action.valid(true, result)) {\n return false;\n }\n }\n\n return true;\n }", "public java.lang.Integer getActions() {\r\n return actions;\r\n }", "public Map<BigInteger, OnlineTest> showTests() throws UserException {\n\t\treturn null;\r\n\t}", "public void checkActions() {\n\t\tfor (BaseAction ba : this.actions) {\n\t\t\tba.checkAction();\n\t\t}\n\t}", "@Test(priority=32)\n\tpublic void campaign_user_with_invalid_filter_operetor_for_camp_created() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operetor_for_camp_created\", \"To validate whether user is able to get campaign through campaign/user api with invalid filter operator for campaign_created\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\tString camp_created = campaign_created;\n\t\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\t\tString encoded_operator = \"\";\n\t\t\tfor(String operator:operators){\n\t\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_created\"+encoded_operator+camp_created));\n\t\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_created\");\n\t\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_created\");\n\t\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\t\tString line = \"\";\n\t\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\t // Convert response to JSON object\t\n\t\t\t\t JSONParser parser = new JSONParser();\n\t\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_created\"+operator+camp_created);\n\t\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_created\");\n\t\t\t\t}\t \n\t\t\t}\t\n\t}", "@Test\n public void getAction() {\n Card dealerCard = new CardClassAdapter(RankEnum.NINE, SuitEnum.DIAMONDS);\n\n PlayerActionEnum actionEnum1 = PlayerActionEnum.STAND;\n State55 instance = State55.getInstance();\n assertEquals(\"STAND\", actionEnum1, instance.getAction(dealerCard));\n\n }", "@Test\n\tpublic void testShowCommand1() {\n\t\tString label1 = \"TEST1\";\n\t\tString label2 = \"TEST2\";\n\t\ttestData.getTaskMap().put(label1, new ArrayList<Task>());\n\t\ttestData.getTaskMap().put(label2, new ArrayList<Task>());\n\t\t\n\t\tShowCommand comd = new ShowCommand(label1 + \" \" + label2);\n\t\tassertEquals(ShowCommand.MESSAGE_SHOW_FEEDBACK, comd.execute(testData));\n\t\t\n\t\tassertFalse(testData.getHideList().contains(label1));\n\t\tassertFalse(testData.getHideList().contains(label2));\n\t\tassertTrue(testData.getHideList().contains(testData.getCurrLabel()));\n\t}", "protected Actions exec() {\n return actions;\n }", "@Test(priority=64)\n\tpublic void campaign_user_with_invalid_filter_operator_for_user_title() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operator_for_user_title\", \"To validate whether user is able to get campaign and its users through campaign/user api with invalid filter operator for user_title\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\tString user_title = \"\";\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"user_title\"+encoded_operator+user_title));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for user_title\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for user_title\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : user_title\"+operator+user_title);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for user_title\");\n\t\t\t}\t \n\t\t}\t\n\t}", "public Collection<Action> getActions() {\n\t\treturn Collections.unmodifiableCollection(actionList);\n\t}", "@Test(groups ={Slingshot,Regression})\n\tpublic void EditViewgreaterthan15Accts() {\n\t\tReport.createTestLogHeader(\"MuMv\", \"Verify whether the user is able to add the view edited in the list\");\n\n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"AddnewViewMorethan15Acctsmanage\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.ClickManageUserLink()\n\t\t.ManageViews()\n\t\t.ValidateRemoveviewname(userProfile)\n\t\t.ClickAddNewUserLink()\n\t\t.StandardUser_Creation()\n\t\t.EditViewAdduserValidation(userProfile)\n\t\t.VerifyenterValidData_StandardUsers(userProfile);\n\t\tnew BgbRegistrationAction()\n\t\t.AddNewStdUserdata(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.verifyAuditTable(userProfile);\t\t\n\t}", "@Test\r\n\tpublic void testShowStandings2() {\n\t\tassertTrue(\"Error displaying standings\", false);\r\n\t}", "@Test\r\n\tpublic void testShowStandings1() {\n\t\tassertTrue(\"Error displaying standings\", false);\r\n\t}", "public void VerifyMainMenuItems() {\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_Dashboard);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_Initiatives);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_LiveMediaPlans);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_MediaPlans);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_Audiences);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_Offers);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_CreativeAssets);\n\t\t UserActions.VerifyElementIsDisplayed(Lnk_Reports);\n\t}", "@Test(priority=3)\n\tpublic void validatePredictNiftyInContestPage2()\n\t{\n\t\tAssert.assertTrue(c.todaysNiftyValue.isDisplayed());\n\t}", "@Test\n public void subsetActionsHasUnmatchedEnabledListEntry() {\n DroolsRulesServiceFactoryFromFile reader = buildDefaultReader();\n\n List<String> enabledActionServices = new ArrayList<>();\n enabledActionServices.add(\"MISSING_ACTION\");\n\n EngineConfigDTO engine = new EngineConfigDTO();\n engine.setEnabledActionServices(enabledActionServices);\n Map<String, IActionService> services = reader.configureActions(engine);\n\n assertEquals(0, services.size());\n }", "ActionsSet getActions();", "public List<AccessibilityAction> getActionList() {\n/* 264 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public List<Action> actions() {\r\n\t\treturn this.actions;\r\n\t}", "@Test(groups ={Slingshot,Regression})\n\tpublic void ManageViewDeleteViewStandardUserValidatation() {\n\t\tReport.createTestLogHeader(\"MuMv\", \"Verify whether standard user does not have access to delete the view\");\n\n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"MuMvManageView\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.StandardUserValidation();\t \t\t\n\n\t}", "@Test(priority=51)\n\tpublic void campaign_user_with_invalid_filter_operator_for_ct_user_id() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operator_for_ct_user_id\", \"To validate whether user is able to get campaign and its users through campaign/user api with invalid filter operator for ct_user_id\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\ttest_data = HelperClass.readTestData(class_name, \"campaign_user_with_invalid_filter_operator_for_ct_user_id\");\n\t\tString ct_user_id = test_data.get(4);\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"ct_user_id\"+encoded_operator+ct_user_id));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for ct_user_id\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for ct_user_id\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : ct_user_id\"+operator+ct_user_id);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for ct_user_id\");\n\t\t\t}\t \n\t\t}\t\n\t}", "public java.util.List<com.rpg.framework.database.Protocol.CharacterAction> getActionsList() {\n if (actionsBuilder_ == null) {\n return java.util.Collections.unmodifiableList(actions_);\n } else {\n return actionsBuilder_.getMessageList();\n }\n }", "public java.util.List<com.rpg.framework.database.Protocol.CharacterAction> getActionsList() {\n if (actionsBuilder_ == null) {\n return java.util.Collections.unmodifiableList(actions_);\n } else {\n return actionsBuilder_.getMessageList();\n }\n }", "@Test(priority=67)\n\tpublic void campaign_user_with_invalid_filter_operator_for_user_status() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operator_for_user_status\", \"To validate whether user is able to get campaign and its users through campaign/user api with invalid filter operator for user_status\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\ttest_data = HelperClass.readTestData(class_name, \"campaign_user_with_invalid_filter_operator_for_user_status\");\n\t\tString user_status = this.user_status;\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"user_status\"+encoded_operator+user_status));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for user_status\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for user_status\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : user_status\"+operator+user_status);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for user_status\");\n\t\t\t}\t \n\t\t}\t\n\t}", "public void testGetCancelButtonEnabled() {\n System.out.println(\"getCancelButtonEnabled\");\n Wizard instance = new Wizard();\n boolean expResult = false;\n boolean result = instance.getCancelButtonEnabled();\n assertEquals(expResult, result);\n }", "@Test\n public void testViewAppointmentSchedule() {\n for (int i = 0; i < 10; i++) {\n presenter.onViewAppointmentSchedule();\n }\n Assert.assertEquals(10, view.getManageViewAppointmentScheduleClicks());\n }", "@Override\n\t\tpublic ActionTestFacade getAction(String caption) {\n\t\t\treturn null;\n\t\t}", "@Test(priority=28)\n\tpublic void campaign_user_with_invalid_filter_operetor_for_camp_status() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operetor_for_camp_status\", \"To validate whether user is able to get campaign and its users through campaign/user api with invalid filter operator for campaign_status\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\ttest_data = HelperClass.readTestData(class_name, \"campaign_user_with_invalid_filter_operetor_for_camp_status\");\n\t\tString campaign_status = test_data.get(4);\n\t\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\t\tString encoded_operator = \"\";\n\t\t\tfor(String operator:operators){\n\t\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_status\"+encoded_operator+campaign_status));\n\t\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_status\");\n\t\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_status\");\n\t\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\t\tString line = \"\";\n\t\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\t // Convert response to JSON object\t\n\t\t\t\t JSONParser parser = new JSONParser();\n\t\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_status\"+operator+campaign_status);\n\t\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_status\");\n\t\t\t\t}\t \n\t\t\t}\t\n\t}", "boolean hasHas_action();", "@Test(priority=38)\n\tpublic void campaign_user_with_invalid_filter_operetor_for_camp_start_date() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_list_with_invalid_filter_operetor_for_camp_start_date\", \"To validate whether user is able to get campaign and its users through campaign/user api with invalid filter operator for campaign_start_date\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\tString campaign_start_date = camp_start_date;\n\t\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\t\tString encoded_operator = \"\";\n\t\t\tfor(String operator:operators){\n\t\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_start_date\"+encoded_operator+campaign_start_date));\n\t\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_start_date\");\n\t\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_start_date\");\n\t\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\t\tString line = \"\";\n\t\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\t // Convert response to JSON object\t\n\t\t\t\t JSONParser parser = new JSONParser();\n\t\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_start_date\"+operator+campaign_start_date);\n\t\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_start_date\");\n\t\t\t\t}\t \n\t\t\t}\t\n\t}", "public int getActionsCount() {\n return actions_.size();\n }", "public List<Action> getActions() {\n return this.data.getActions();\n }", "public int getActionsCount() {\n return actions_.size();\n }", "public int showPossibleActions(String[] string);", "default List<ItemAction<T>> actions() {\n return new ArrayList<>();\n }", "@Test\n public void testRedButton4Vissible() {\n window.textBox(\"usernameText\").setText(\"karona\"); \n window.textBox(\"StoresNameTxt\").setText(\"store1\"); \n window.textBox(\"openHoursTxt\").setText(\"18:00-20:00\");\n window.textBox(\"CustomerNameTxt\").setText(\"ilias\");\n window.textBox(\"NumberOfSeatsTxt\").enterText(\"1\"); \n window.comboBox(\"HoursAvailable\").selectItem(1);\n window.button(\"makeReservation\").click();\n window.optionPane().okButton().click();\n window.button(\"redButton4\").requireVisible();\n }", "private ArrayList<String> getAllActions() {\n\t\t\n\t\tArrayList<String> allActions = new ArrayList<String>();\n\t\tallActions.add(\"Job fisher\");\n\t\tallActions.add(\"Job captain\");\n\t\tallActions.add(\"Job teacher\");\n\t\tallActions.add(\"Job factory worker\");\n\t\tallActions.add(\"Job factory boss\");\n\t\tallActions.add(\"Job elderly caretaker\");\n\t\tallActions.add(\"Job work outside village\");\n\t\tallActions.add(\"Job unemployed\");\n\t\treturn allActions;\n\t}", "public Actions getActions() {\n if (actions == null) {\n actions = new Actions();\n }\n return actions;\n }", "private static void printTest(boolean isValid, String description, String recieved, String expected) {\r\n\t\tSystem.out.println(String.format(\"Is Valid: %s%nDescription: %s%nRecieved: %s%nExpected: %s%n\", isValid, description, recieved, expected));\r\n\t}", "@Test\n public void testGetLoadWindows() {\n\tLoadCategoriesForm instance = new LoadCategoriesForm();\n\tList<LoadWindow> expResult = new ArrayList();\n\tinstance.setLoadWindows(expResult);\n\tList<LoadWindow> result = instance.getLoadWindows();\n\tassertEquals(expResult, result);\n }", "boolean isTestEligible();", "@Test(priority=35)\n\tpublic void campaign_user_with_invalid_filter_operetor_for_camp_modified() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operetor_for_camp_modified\", \"To validate whether user is able to get campaign and its users through campaign/user api with invalid filter operator for campaign_created\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\ttest_data = HelperClass.readTestData(class_name, \"campaign_user_with_invalid_filter_operetor_for_camp_modified\");\n\t\tString campaign_modified = test_data.get(4);\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_modified\"+encoded_operator+campaign_modified));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_modified\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_modified\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_modified\"+operator+campaign_modified);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_modified\");\n\t\t\t}\t \n\t\t}\t\n\t}", "@Test(priority=19)\n\tpublic void campaign_user_with_invalid_filter_operator_for_campaign_id() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operator_for_campaign_id\", \"To validate whether user is able to get campaign through campaign/user api with invalid filter operator for campaign_id\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\tString camp_id = campaign_id;\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_id\"+encoded_operator+camp_id));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_id\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_id\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_id\"+operator+camp_id);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_id\");\n\t\t\t}\t \n\t\t}\t\n\t}", "public boolean hasPlainAction() {\n return actionCase_ == 1;\n }", "public CachetActionList getActions() {\n throw new RuntimeException(\"Method not implemented.\");\n }", "public boolean hasPlainAction() {\n return actionCase_ == 1;\n }", "public ResultatTest() {\n\t\tthis.nbTests = 0;\n\t\tthis.echecs = new ArrayList<TestExecute>();\n\t\tthis.erreurs = new ArrayList<TestExecute>();\n\t}", "@Test\n\tpublic void testPrixAction() {\n\t\tassertEquals(200, TypeChaine.prixAction(TypeChaine.SACKSON, 2));\n\t\tassertEquals(300, TypeChaine.prixAction(TypeChaine.SACKSON, 3));\n\t\tassertEquals(400, TypeChaine.prixAction(TypeChaine.SACKSON, 4));\n\t\tassertEquals(500, TypeChaine.prixAction(TypeChaine.SACKSON, 5));\n\t\tassertEquals(600, TypeChaine.prixAction(TypeChaine.SACKSON, 6));\n\t\tassertEquals(600, TypeChaine.prixAction(TypeChaine.SACKSON, 8));\n\t\tassertEquals(600, TypeChaine.prixAction(TypeChaine.SACKSON, 10));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.SACKSON, 11));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.SACKSON, 15));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.SACKSON, 20));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.SACKSON, 21));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.SACKSON, 22));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.SACKSON, 30));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.SACKSON, 31));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.SACKSON, 33));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.SACKSON, 40));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.SACKSON, 41));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.SACKSON, 42));\n\n\t\t// cas categorie hotel = 2\n\t\tassertEquals(300, TypeChaine.prixAction(TypeChaine.HYDRA, 2));\n\t\tassertEquals(400, TypeChaine.prixAction(TypeChaine.HYDRA, 3));\n\t\tassertEquals(500, TypeChaine.prixAction(TypeChaine.HYDRA, 4));\n\t\tassertEquals(600, TypeChaine.prixAction(TypeChaine.HYDRA, 5));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.HYDRA, 6));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.HYDRA, 8));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.HYDRA, 10));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.HYDRA, 11));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.HYDRA, 15));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.HYDRA, 20));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.HYDRA, 21));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.HYDRA, 22));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.HYDRA, 30));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.HYDRA, 31));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.HYDRA, 33));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.HYDRA, 40));\n\t\tassertEquals(1100, TypeChaine.prixAction(TypeChaine.HYDRA, 41));\n\t\tassertEquals(1100, TypeChaine.prixAction(TypeChaine.HYDRA, 42));\n\n\t\t// cas categorie hotel = 3\n\t\tassertEquals(400, TypeChaine.prixAction(TypeChaine.PHOENIX, 2));\n\t\tassertEquals(500, TypeChaine.prixAction(TypeChaine.PHOENIX, 3));\n\t\tassertEquals(600, TypeChaine.prixAction(TypeChaine.PHOENIX, 4));\n\t\tassertEquals(700, TypeChaine.prixAction(TypeChaine.PHOENIX, 5));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.PHOENIX, 6));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.PHOENIX, 8));\n\t\tassertEquals(800, TypeChaine.prixAction(TypeChaine.PHOENIX, 10));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.PHOENIX, 11));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.PHOENIX, 15));\n\t\tassertEquals(900, TypeChaine.prixAction(TypeChaine.PHOENIX, 20));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.PHOENIX, 21));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.PHOENIX, 22));\n\t\tassertEquals(1000, TypeChaine.prixAction(TypeChaine.PHOENIX, 30));\n\t\tassertEquals(1100, TypeChaine.prixAction(TypeChaine.PHOENIX, 31));\n\t\tassertEquals(1100, TypeChaine.prixAction(TypeChaine.PHOENIX, 33));\n\t\tassertEquals(1100, TypeChaine.prixAction(TypeChaine.PHOENIX, 40));\n\t\tassertEquals(1200, TypeChaine.prixAction(TypeChaine.PHOENIX, 41));\n\t\tassertEquals(1200, TypeChaine.prixAction(TypeChaine.PHOENIX, 42));\n\t}", "@Test\n void displayAllTasks() {\n }", "@UiThreadTest\r\n public void testValidationRequired() {\n View addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n View addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be gone\", View.GONE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be gone\", View.GONE, addProjectValidateUnique.getVisibility());\r\n\r\n // Try to add with empty values\r\n ActionBar.clickMenuItem(R.id.menu_add_project_activity_save, solo.getCurrentActivity());\r\n solo.assertCurrentActivity(\"The add/edit project activity is expected\", AddEditProjectActivity.class);\r\n addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be visible\", View.VISIBLE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be gone\", View.GONE, addProjectValidateUnique.getVisibility());\r\n }", "@Test(priority=25)\n\tpublic void campaign_user_with_invalid_filter_operetor_for_camp_name() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operetor_for_camp_name\", \"To validate whether user is able to get campaign through campaign/user api with invalid filter operator for campaign_name\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\tString camp_name = campaign_name;\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_name\"+encoded_operator+camp_name));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_name\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_name\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_name\"+operator+camp_name);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_name\");\n\t\t\t}\t \n\t\t}\n\t}", "@Test\n void displayCompletedTasks() {\n }", "@Test(groups ={Slingshot,Regression})\n\tpublic void verifyUsertable() {\n\t\tReport.createTestLogHeader(\"MuMv\", \"Verify AddnewView Button Overlay\"); \t \t \t \n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"MuMVTestDatas\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.ClickManageUserLink()\n\t\t.Verifyuserlistindb(userProfile);\n\t}", "@Test(groups ={Slingshot,Regression})\n\tpublic void ManageViewDeleteViewErroValidation() {\n\t\tReport.createTestLogHeader(\"MuMv\", \"Verify the proper error message is displayed on clicking the delete view link when the View is already assigned for a user\");\n\n\t\tUserProfile userProfile = new TestDataHelper().getUserProfile(\"MuMvTestdataforFAA\");\n\t\tnew LoginAction()\n\t\t.BgbnavigateToLogin()\n\t\t.BgbloginDetails(userProfile);\n\t\tnew MultiUserMultiViewAction()\n\t\t.ClickManageUserLink() \t \t \t\t\t\t\t\t \t \t\t\n\t\t.DeleteViewOverlay(userProfile); \t \t \t\t\t\t\t\t \t \t\t\n\t}", "public int[] getCountActions() {\r\n return countActions;\r\n }", "public void showFailure(TestFailure failure);", "@Override\n public void executeAction() throws Exception {\n ContestServiceFacade contestServiceFacade = getContestServiceFacade();\n TCSubject currentUser = DirectStrutsActionsHelper.getTCSubjectFromSession();\n\n // get contest data and phases\n long contestId = getProjectId();\n SoftwareCompetition softwareCompetition \n = contestServiceFacade.getSoftwareContestByProjectId(currentUser, contestId);\n\n // set dashboard data etc. for the data above the final-fix tab\n DirectUtils.setDashboardData(currentUser, getProjectId(), viewData,\n getContestServiceFacade(), !DirectUtils.isStudio(softwareCompetition));\n ContestStatsDTO contestStats = DirectUtils.getContestStats(currentUser, getProjectId(), softwareCompetition);\n this.viewData.setContestStats(contestStats);\n\n this.viewData.setContestId(getProjectId());\n\n // Prepare the data for final fixes\n Phase[] phases = softwareCompetition.getProjectPhases().getAllPhases();\n Phase lastPhase = phases[phases.length - 1];\n\n // get final fix status\n boolean isApproval = lastPhase.getPhaseType().getId() == PhaseType.APPROVAL_PHASE.getId();\n boolean isFinalReview = lastPhase.getPhaseType().getId() == PhaseType.FINAL_REVIEW_PHASE.getId();\n \n // Get the winning submission\n Submission winningSubmission = null;\n List<Submission> submissions = DirectUtils.getStudioContestSubmissions(contestId,\n ContestRoundType.FINAL, currentUser, getContestServiceFacade());\n for (Submission submission : submissions) {\n if (submission.getPlacement() != null && submission.getPlacement() == 1) {\n winningSubmission = submission;\n }\n }\n\n if (isApproval) {\n boolean isApprovalRejected = false;\n Review[] reviewsByPhase =\n getProjectServices().getReviewsByPhase(contestId, lastPhase.getId());\n if (reviewsByPhase.length == 0) {\n this.viewData.setDataUnavailable(true);\n return;\n }\n Review approvalReview = reviewsByPhase[0];\n Comment approvalComment = DirectUtils\n .getReviewCommentByTypeId(CommentType.COMMENT_TYPE_APPROVAL_REVIEW.getId(), approvalReview);\n if (approvalComment != null) {\n isApprovalRejected = \"Rejected\".equalsIgnoreCase(String.valueOf(approvalComment.getExtraInfo()));\n }\n if (isApprovalRejected) {\n if (approvalReview.isCommitted()) {\n this.viewData.setFinalFixStatus(FinalFixStatus.IN_PROGRESS);\n } else {\n this.viewData.setFinalFixStatus(FinalFixStatus.NOT_STARTED);\n \n // Bind the Final Fix details based on approval review to view\n StudioFinalFix finalFix = new StudioFinalFix();\n Item[] approvalReviewItems = approvalReview.getAllItems();\n List<com.topcoder.direct.services.view.dto.contest.studio.Comment> finalFixComments \n = new ArrayList<com.topcoder.direct.services.view.dto.contest.studio.Comment>();\n for (Item item : approvalReviewItems) {\n Comment[] itemComments = item.getAllComments();\n for (Comment itemComment : itemComments) {\n com.topcoder.direct.services.view.dto.contest.studio.Comment com\n = new com.topcoder.direct.services.view.dto.contest.studio.Comment();\n com.setComment(itemComment.getComment());\n finalFixComments.add(com);\n }\n }\n finalFix.setComments(finalFixComments);\n finalFix.setSubmission(winningSubmission);\n this.viewData.setFinalFixes(Arrays.asList(finalFix));\n \n // Get the details for winning submitter\n if (winningSubmission != null) {\n Resource[] resources = softwareCompetition.getResources();\n for (int i = 0; i < resources.length; i++) {\n Resource resource = resources[i];\n if (resource.getId() == winningSubmission.getUpload().getOwner()) {\n this.viewData.setWinnerResource(resource);\n }\n }\n }\n }\n } else {\n throw new DirectException(\"The submission is already approved\");\n }\n } else if (isFinalReview) {\n Phase precedingPhase = phases[phases.length - 2];\n boolean isFinalFixPreceding = precedingPhase.getPhaseType().getId() == PhaseType.FINAL_FIX_PHASE.getId();\n boolean isPrecedingPhaseOpen = (precedingPhase.getPhaseStatus().getId() == PhaseStatus.OPEN.getId());\n boolean isPrecedingPhaseClosed = (precedingPhase.getPhaseStatus().getId() == PhaseStatus.CLOSED.getId());\n \n if (isFinalFixPreceding) {\n if (isPrecedingPhaseOpen) {\n this.viewData.setFinalFixStatus(FinalFixStatus.IN_PROGRESS);\n } else if (isPrecedingPhaseClosed) {\n Review[] reviewsByPhase =\n getProjectServices().getReviewsByPhase(contestId, lastPhase.getId());\n if (reviewsByPhase.length == 0) {\n this.viewData.setDataUnavailable(true);\n return;\n }\n Review finalReview = reviewsByPhase[0];\n \n Comment finalReviewComment = DirectUtils.getReviewCommentByTypeId(\n CommentType.COMMENT_TYPE_FINAL_REVIEW.getId(), finalReview);\n if (finalReviewComment == null) {\n this.viewData.setFinalFixStatus(FinalFixStatus.REVIEW);\n } else if (\"Rejected\".equalsIgnoreCase(String.valueOf(finalReviewComment.getExtraInfo()))) {\n if (finalReview.isCommitted()) {\n this.viewData.setFinalFixStatus(FinalFixStatus.IN_PROGRESS);\n } else {\n this.viewData.setFinalFixStatus(FinalFixStatus.REVIEW);\n }\n } else if (\"Approved\".equalsIgnoreCase(String.valueOf(finalReviewComment.getExtraInfo()))) {\n this.viewData.setFinalFixStatus(FinalFixStatus.COMPLETED);\n }\n }\n }\n\n // Bind data for all existing final fixes to view \n if (this.viewData.getFinalFixStatus() != FinalFixStatus.NOT_STARTED) {\n // Get the Final Fix submissions and convert them into map per project phase for faster lookup\n List<Submission> finalFixSubmissions = DirectUtils.getStudioContestSubmissions(contestId,\n ContestRoundType.STUDIO_FINAL_FIX_SUBMISSION, currentUser, getContestServiceFacade());\n Map<Long, Submission> finalFixSubmissionsMap = new HashMap<Long, Submission>();\n for (Submission finalFixSubmission : finalFixSubmissions) {\n finalFixSubmissionsMap.put(finalFixSubmission.getUpload().getProjectPhase(), finalFixSubmission);\n }\n\n List<StudioFinalFix> finalFixes = new ArrayList<StudioFinalFix>();\n for (int i = 0; i < phases.length; i++) {\n Phase phase = phases[i];\n if (phase.getPhaseType().getId() == PhaseType.FINAL_FIX_PHASE.getId()) {\n Review[] reviewsByPhase =\n getProjectServices().getReviewsByPhase(contestId, phases[i + 1].getId());\n if (reviewsByPhase.length == 0) {\n this.viewData.setDataUnavailable(true);\n return;\n }\n Review finalReview = reviewsByPhase[0];\n StudioFinalFix finalFix = new StudioFinalFix();\n Item[] finalReviewItems = finalReview.getAllItems();\n List<com.topcoder.direct.services.view.dto.contest.studio.Comment> finalFixComments\n = new ArrayList<com.topcoder.direct.services.view.dto.contest.studio.Comment>();\n Comment finalReviewAdditionalComment = null;\n for (Item item : finalReviewItems) {\n Comment[] itemComments = item.getAllComments();\n for (Comment itemComment : itemComments) {\n if (itemComment.getCommentType().getId() == CommentType.COMMENT_TYPE_REQUIRED.getId()) {\n com.topcoder.direct.services.view.dto.contest.studio.Comment com\n = new com.topcoder.direct.services.view.dto.contest.studio.Comment();\n com.setComment(itemComment.getComment());\n if (itemComment.getExtraInfo() != null) {\n com.setFixed(\"Fixed\".equalsIgnoreCase(String.valueOf(itemComment.getExtraInfo())));\n }\n finalFixComments.add(com);\n } else if (itemComment.getCommentType().getId() ==\n CommentType.COMMENT_TYPE_FINAL_REVIEW.getId()) {\n finalReviewAdditionalComment = itemComment;\n }\n }\n }\n finalFix.setComments(finalFixComments);\n if (finalReviewAdditionalComment != null) {\n finalFix.setAdditionalComment(finalReviewAdditionalComment.getComment());\n }\n finalFix.setSubmission(finalFixSubmissionsMap.get(phase.getId()));\n finalFix.setCommitted(finalReview.isCommitted());\n finalFixes.add(finalFix);\n }\n }\n this.viewData.setFinalFixes(finalFixes);\n }\n }\n }", "@Test(priority=47)\n\tpublic void campaign_user_with_invalid_filter_operator_for_camp_owner_id() throws URISyntaxException, ClientProtocolException, IOException, ParseException{\n\t\ttest = extent.startTest(\"campaign_user_with_invalid_filter_operator_for_camp_owner_id\", \"To validate whether user is able to get campaign through campaign/user api with invalid filter operator for campaign_owner_user_id\");\n\t\ttest.assignCategory(\"CFA GET /campaign/user API\");\n\t\tString camp_owner_user_id = campaign_owner_user_id;\n\t\tString[] operators = {\"+\",\"!\",\"~\",\"#\",\"@\",\"$\",\"%\",\"^\",\"&\",\"*\",\"-\",\"/\",\":\"};\n\t\tString encoded_operator = \"\";\n\t\tfor(String operator:operators){\n\t\t\tencoded_operator = java.net.URLEncoder.encode(operator, \"UTF-8\");\n\t\t\tList<NameValuePair> list = new ArrayList<NameValuePair>();\n\t\t\tlist.add(new BasicNameValuePair(\"filter\", \"campaign_owner_user_id\"+encoded_operator+camp_owner_user_id));\n\t\t\tCloseableHttpResponse response = HelperClass.make_get_request(\"/v2/campaign/user\", access_token, list);\n\t\t\tAssert.assertTrue(!(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 401), \"Invalid status code is displayed. \"+ \"Returned Status: \"+response.getStatusLine().getStatusCode()+\" \"+response.getStatusLine().getReasonPhrase());\n\t\t\ttest.log(LogStatus.INFO, \"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_owner_user_id\");\n\t\t\tSystem.out.println(\"Execute campaign/user api method with \"+ operator +\" filter operator for campaign_owner_user_id\");\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t // Convert response to JSON object\t\n\t\t\t JSONParser parser = new JSONParser();\n\t\t\t JSONObject json = (JSONObject) parser.parse(line);\n\t\t\t String result_data = json.get(\"result\").toString(); \n\t\t\t Assert.assertEquals(result_data, \"error\", \"Invalid result value is in resonse\");\n\t\t\t String err_data = json.get(\"err\").toString();\n\t\t\t Assert.assertEquals(err_data, \"Unsupported comparator used in filter on rule 1 : campaign_owner_user_id\"+operator+camp_owner_user_id);\n\t\t\t test.log(LogStatus.PASS, \"Check whether proper validation message is displayed when \"+ operator +\" filter operator is used for campaign_owner_user_id\");\n\t\t\t}\t \n\t\t}\t\n\t}", "public List<Action> getActions() {\n\n if (actions != null)\n return new ArrayList<>(actions.values());\n else\n return new ArrayList<>();\n\n }", "@Test\n\tpublic void testListFormWithTableAction() {\n\t\tElementServiceImpl service = new ElementServiceImpl() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void save(Element entity) throws UncheckedException {\n\t\t\t\tsuper.save(entity);\n\n\t\t\t\ttry {\n\t\t\t\t\tThread.sleep(200);\n\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void delete(Element entity) throws UncheckedException {\n\t\t\t\tsuper.delete(entity);\n\n\t\t\t\ttry {\n\t\t\t\t\tThread.sleep(500);\n\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tservice.save(new Element(\"ELEMENTO 1\"));\n\t\tservice.save(new Element(\"ELEMENTO 2\"));\n\t\tservice.save(new Element(\"ELEMENTO 3\"));\n\t\tservice.save(new Element(\"ELEMENTO 4\"));\n\t\tservice.save(new Element(\"ELEMENTO 5\"));\n\t\tservice.save(new Element(\"ELEMENTO 6\"));\n\t\tservice.save(new Element(\"ELEMENTO 7\"));\n\t\tservice.save(new Element(\"ELEMENTO 8\"));\n\t\tservice.save(new Element(\"ELEMENTO 9\"));\n\t\tservice.save(new Element(\"ELEMENTO 0\"));\n\n\t\tthis.panel.setEntities(service.findByFilter(new ElementFilter()));\n\t\tthis.panel.setService(service);\n\n\t\tfinal DialogContainer dialog = new DialogContainer();\n\t\tdialog.getContentPane().removeAll();\n\t\tdialog.getContentPane().add(this.panel, BorderLayout.CENTER);\n\t\tdialog.pack();\n\t\tdialog.setModal(true);\n\t\tdialog.setAlwaysOnTop(Constants.alwaysTop);\n\t\tdialog.setLocationRelativeTo(null);\n\t\tdialog.setVisible(Constants.visible);\n\t}", "@Test\n\tpublic void getDisplayValueShouldReturnNullWhenValueIsNull(){\n\t\tVitalsResult l = new VitalsResult();\n\t\tassertNull(l.getDisplayValue());\n\t}", "@Test\r\n\tpublic void displayCandidatesScheduled1() throws Exception {\r\n\r\n\t\tList<ShowCandidateDTO> candidateList = new ArrayList<>();\r\n\t\tcandidateList.add(getShowCandidateDTO());\r\n\r\n\t\twhen(interviewerService.scheduledList(anyLong())).thenReturn(candidateList);\r\n\t\tmockMvc.perform(MockMvcRequestBuilders.get(\"/scheduledInterviewListforInterview/1\"))\r\n\t\t\t\t.andExpect(MockMvcResultMatchers.status().isOk());\r\n\r\n\t}" ]
[ "0.70230556", "0.6720012", "0.60558987", "0.59635437", "0.5866841", "0.58107924", "0.5749508", "0.5721234", "0.5670061", "0.5597969", "0.55434203", "0.5527135", "0.5496798", "0.54900825", "0.5450978", "0.5414652", "0.5402238", "0.5393708", "0.5357089", "0.5304142", "0.52880836", "0.52811486", "0.52727413", "0.52536577", "0.52523243", "0.52446204", "0.5238186", "0.5237034", "0.5213043", "0.519863", "0.5197547", "0.5190421", "0.5188985", "0.5182431", "0.5173292", "0.5160355", "0.5153332", "0.5145085", "0.51373214", "0.5136416", "0.51359963", "0.51289725", "0.5125469", "0.51177216", "0.5113008", "0.5105448", "0.51042086", "0.50921696", "0.50835615", "0.50735235", "0.50694156", "0.5045933", "0.50457174", "0.5042015", "0.50383675", "0.5031452", "0.50280046", "0.5019828", "0.50195897", "0.50134957", "0.50133", "0.5011437", "0.5010817", "0.50030124", "0.49953863", "0.49943885", "0.49894202", "0.49801043", "0.49671787", "0.49667525", "0.49665475", "0.4966133", "0.49645516", "0.49567798", "0.4952341", "0.49521315", "0.49508333", "0.4949122", "0.49489778", "0.49476692", "0.49458322", "0.4943151", "0.49427843", "0.4940719", "0.49367303", "0.49322844", "0.49292508", "0.49210796", "0.49177378", "0.49153727", "0.49142933", "0.49068224", "0.49066275", "0.48953882", "0.4888512", "0.48878178", "0.48823982", "0.48758772", "0.48660618", "0.48659876", "0.48646703" ]
0.0
-1
Of toString For unit test.
public static void main(String args[]) { System.out.println("\r\ngetGameSituationTest()"); getGameSituationTest(); System.out.println("\r\nstateCheckerboardConvertionTest()"); stateCheckerboardConvertionTest(); System.out.println("\r\ngetValidActionsTest()"); getValidActionsTest(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testToString() {\n }", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "String toString();", "@Test\n\tpublic void testToString() {\n\t\tString result = email + \" \" + amount;\n\t\tassertEquals(\"Test : toString()\", bid.toString(), result);\n\t}", "@Test\r\n public void testToString() {\r\n // TODO \r\n assertTrue(true); \r\n }", "@Test\n public void toString_shouldReturnInCorrectFormat() {\n Task task = new Task(\"Test\");\n String expected = \"[N] Test\";\n Assertions.assertEquals(expected, task.toString());\n }", "@Test\n\tpublic void testToString() {\n\t\tSystem.out.println(\"toString\");\n\t\tDeleteTask task = new DeleteTask(1);\n\t\tassertEquals(task.toString(), \"DeleteTask -- [filePath=1]\");\n\t}", "@Test\r\n public void testToString() {\r\n System.out.println(\"toString\");\r\n Simulacao instance = new Simulacao(TipoDPolarizacao.ABSORCAO);\r\n String expResult = \"Simulacao{\" + \"tipoDPolarizacao=\" + instance.getTipoDPolarizacao() + '}';\r\n String result = instance.toString();\r\n assertEquals(expResult, result);\r\n }", "@Test\n\tpublic void testaToString() {\n\t\tcontato = new Contato(\"Jardely\", \"Maris\", \"984653722\");\n\t\tassertEquals(contato.toString(), \"Jardely Maris - 984653722\");\n\t}", "@Test\n\tpublic void testToString() {\n\t\tassertEquals(\"Proper string format\", basic.toString(), \"5, 5\");\n\t}", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "public abstract String toString();", "@Test\r\n\tpublic void testToString() {\r\n\t\tPerson p1 = new Person(1, \"JavaLord\", \"hunter2\", \"The Lord of Java\");\r\n\t\tString s = p1.toString();\r\n\t\tassertTrue(s.equals(\"JavaLord:hunter2:The Lord of Java\"));\r\n\t}", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n String expResult = \"Name: Gates, Bill\" + \"\\n\"\n + \"Date of Birth: 09/05/1993\";\n String result = customer.toString();\n assertEquals(expResult, result);\n }", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n Library instance = new Library();\n instance.setName(\"Test\");\n instance.setSize(5);\n String expResult = \"Library{\" + \"name=\" + instance.getName() + \", size=\" + instance.getSize() + \"}\";\n String result = instance.toString();\n assertEquals(expResult, result);\n \n }", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n Account instance = new Account(\"Piper\", 10.0);\n String expResult = \"Piper has a total of $10.0 in their account.\";\n String result = instance.toString();\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n //fail(\"The test case is a prototype.\");\n }", "@Test\n\tpublic void test_toString() {\n\tTennisPlayer c1 = new TennisPlayer(5,\"David Ferrer\");\n\tassertEquals(\"[5,David Ferrer]\",c1.toString());\n }", "@Test\n\tpublic void test_TCM__String_toString() {\n\t\t//expected value\n\t\tfinal Namespace ns = Namespace.getNamespace(\"prefx\", \"http://some.other.place\");\n\t\tfinal Attribute attr = new Attribute(\"test\", \"value\", ns);\n\t\tString str= attr.toString();\n\t\tassertTrue(\"incorrect toString form\", str.equals(\"[Attribute: prefx:test=\\\"value\\\"]\"));\n\n\t}", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "public String toString();", "@Test\r\n public void testToString() {\r\n }", "@Test\r\n public void testToString() {\r\n System.out.println(\"*****************\");\r\n System.out.println(\"Test : toString\");\r\n Cours_Reservation instance = new Cours_Reservation();\r\n instance.setFormation(\"Miage\");\r\n instance.setModule(\"programmation\");\r\n String expResult = instance.getFormation() + \"\\n\" + instance.getModule() ;\r\n String result = instance.toString();\r\n assertEquals(expResult, result);\r\n }", "@Test\n public void testToString() {\n System.out.println(\"Animal.toString\");\n assertEquals(\"Abstract Axe (17 yo Aardvark) resides in cage #202\", animal1.toString());\n assertEquals(\"Brave Beard (3 yo Beaver) resides in cage #112\", animal2.toString());\n }", "public String toString()\n/* 67: */ {\n/* 68:72 */ return this.mStringValue;\n/* 69: */ }", "@Test\r\n\tvoid testToString() {\r\n\t\tSimpleList test = new SimpleList();\r\n\t\tString output = test.toString();\r\n\t\tassertEquals(\"\", output);\r\n\t}", "public String toString() ;", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n List<Exposicao> listaExposicoes = new ArrayList<>();\n listaExposicoes.add(new Exposicao());\n RegistoExposicoes instance = new RegistoExposicoes(listaExposicoes);\n StringBuilder expResult = new StringBuilder();\n expResult.append(\"RegistoExposicoes{\");\n for (Exposicao exposicao : instance.getListaExposicoes()) {\n expResult.append(String.format(\"%s%n\", exposicao));\n }\n expResult.append(\"}\");\n String result = instance.toString();\n assertEquals(expResult.toString(), result);\n }", "@Test\n public void toStringTest() {\n String expected = \"Pepper Potts has an hourly salary of 16.00 and has worked 152 this month\";\n\n assertEquals(\"The expected string output does not match the actual\",\n expected, e1.toString());\n\n }", "abstract public String toString();", "@Test\r\n\tvoid testToString2() {\r\n\t\tSimpleList test = new SimpleList();\r\n\t\ttest.add(2);\r\n\t\tString output = test.toString();\r\n\t\tassertNotEquals(\"2 \", output);\r\n\t}", "@Test\n public void testToString() {\n LOGGER.info(\"testToString\");\n final String actual = new AtomString(\"Hello\").toString();\n final String expected = \"Hello\";\n assertEquals(expected, actual);\n }", "@Override String toString();", "@Test \n\tpublic void testToString() {\n\t\t\n\t\tString saida = \"decio neto - 56554522\";\n\t\tassertEquals(contato1.toString(), saida);\n\t}", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n Category instance = new Category();\n instance.setCategoryDescription(\"desc\");\n instance.setCategoryName(\"name\");\n instance.setCategoryParentId(0);\n \n String expResult = \"name\";\n String result = instance.toString();\n assertEquals(expResult, result);\n }", "@Test\n public void testToString() {\n Pair instance = Pair.of(\"left\", \"right\");\n String result = instance.toString();\n assertTrue(result.contains(\"left\"));\n assertTrue(result.contains(\"right\"));\n assertTrue(result.contains(\"Pair\"));\n }", "@Test\r\n public void testToString() {\r\n System.out.println(\"toString\");\r\n OpeningTicketPurpose instance = new OpeningTicketPurpose();\r\n String expResult = \"\";\r\n String result = instance.toString();\r\n assertEquals(expResult, result);\r\n // TODO review the generated test code and remove the default call to fail.\r\n fail(\"The test case is a prototype.\");\r\n }", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n Alumno instance = null;\n String expResult = \"\";\n String result = instance.toString();\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Test\n public void testToString() {\n System.out.println(\"toString\");\n Reserva instance = new Reserva();\n String expResult = \"\";\n String result = instance.toString();\n assertEquals(expResult, result);\n \n }", "@Test\n\tpublic final void testToString() {\n\t\tanimal.moveTo(testForest);\n\t\t\n\t\tassertEquals(animal.toString(), \n\t\t\t\t\"[Animal: Possum, Type: Mammal, Gender: male, Legs: 4\"\n\t\t\t\t+ \" is in \" + testForest.toString() + \"]\");\n\t}", "@Test\r\n public void testToString() {\r\n System.out.println(\"toString\");\r\n RevisorParentesis instance = null;\r\n String expResult = \"\";\r\n String result = instance.toString();\r\n assertEquals(expResult, result);\r\n // TODO review the generated test code and remove the default call to fail.\r\n fail(\"The test case is a prototype.\");\r\n }", "public void testToString()\n {\n // An empty board\n assertEquals(b1.toString(), \"EEEEEEEEE\");\n\n // A more complex case\n b1.fromString(\"RRRBEEBBE\");\n assertEquals(b1.toString(), \"RRRBEEBBE\");\n }" ]
[ "0.78094923", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7702449", "0.7609683", "0.75880045", "0.75627786", "0.75250345", "0.75012445", "0.74632084", "0.7450381", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7442228", "0.7410078", "0.7406219", "0.73846465", "0.73676467", "0.73620194", "0.7350327", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.733051", "0.7325803", "0.7320448", "0.7316805", "0.72905654", "0.72663766", "0.72618765", "0.72608995", "0.7255124", "0.72495854", "0.72394764", "0.7230708", "0.7226366", "0.722189", "0.72044045", "0.72009224", "0.717691", "0.71707803", "0.71696717", "0.71389496", "0.7131177", "0.7124824" ]
0.0
-1
/set the save up files directory
public static void setDefaultPath(String path) { PATH = path; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void makeDirectory() {\n String userHome = System.getProperty(\"user.home\");\n wnwData = new File(userHome + \"/.wnwdata\");\n wnwData.mkdirs();\n\n makeCampaignChallengesFile();\n makeCustomChallengesFile();\n makeProgressFile();\n makeSettingsFile();\n }", "public void setupDrive(){\n // Place Dove/ into base of drive\n new File(drv.toString() + File.separator + folderName).mkdir();\n //upload preset content if required\n isSetup = true;\n }", "public void init(){\n\t\ttry{\n\t\t\tFile file=new File(\"c:/EasyShare/setting/dir.es\");\n\t\t\tif(!file.exists()){\n\t\t\t\tfile.getParentFile().mkdirs();\n\t\t\t\tfile.createNewFile();\n\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}catch (Exception e) {\n\t\t\t}\n\t}", "public void init( ){\n\t filepath = getServletContext().getContextPath();\r\n\tappPath = getServletContext().getRealPath(SAVE_DIR);\r\n\t \r\n\t }", "private static void createSaveDirIfNotExisting() {\n\t\tFile dir = new File(\"save\");\n\t\tif (!dir.exists()) {\n\t\t\t// directory does not exist => create!\n\t\t\tdir.mkdir();\n\t\t}\n\t}", "private void setUpDirectories() {\r\n\t\tFile creation = new File(\"Creations\");\r\n\t\tFile audio = new File(\"Audio\");\r\n\t\tFile quiz = new File(\"Quiz\");\r\n\t\tFile temp = new File(\"Temp\");\r\n\r\n\t\tif (!creation.isDirectory()) {\r\n\t\t\tcreation.mkdir();\r\n\t\t}\r\n\t\tif (!audio.isDirectory()) {\r\n\t\t\taudio.mkdir();\r\n\t\t}\r\n\t\tif (!quiz.isDirectory()) {\r\n\t\t\tquiz.mkdir();\r\n\t\t}\r\n\t\tif (!temp.isDirectory()) {\r\n\t\t\ttemp.mkdir();\r\n\t\t}\r\n\r\n\t}", "public String pathToSave() {\n String path;\n File folder;\n do {\n System.out.print(\"Introduce la ruta en la que quieres guardar el fichero(separando directorios por guiones: directorio1-directorio2-directorio3): \");\n path = Utils.getString();\n path = String.valueOf(System.getProperty(\"user.dir\")).substring(0, 2) + \"\\\\\" + path.replace('-', '\\\\');\n folder = new File(path);\n if (!folder.exists()) {\n System.out.println(\"El directorio introducido no existe intentalo de nuevo...\");\n } else {\n if (!folder.isDirectory()) {\n System.out.println(\"Eso no es un directorio intentalo de nuevo...\");\n }\n }\n } while (!folder.exists() && !folder.isDirectory());\n return path;\n }", "public void setSaveDirectory(String dir) {\r\n\t\tEmailServiceEJB.saveDirectory = dir;\r\n\t}", "public static void createSaveFile( )\n {\n try\n {\n new File( \"data\" ).mkdirs( );\n PrintWriter writer = new PrintWriter( \"data/\" + Game.instance.getCurrentSaveFile( ).SAVEFILENAME + \".txt\", \"UTF-8\" );\n writer.println( \"dkeys: \" + Game.START_DIAMOND_KEY_COUNT );\n writer.close( );\n }\n catch ( IOException e )\n {\n e.printStackTrace( );\n System.exit( 1 );\n }\n }", "File getSaveLocation();", "public static void save() {\n\t\t// Save each user \n\t\t// and list of directories \n\t\t// and files in each directory\n\t\tArrayList<String> usernames = getRegisteredUserNames();\n\t\tUtils.FileUtils.write(\n\t\t\t\tusernames, \n\t\t\t\tGlobal.Constants.LIST_OF_USERS\n\t\t\t\t);\t\n\t\tfor (User user:Global.Variables.registeredUsers) {\n\t\t\tUtils.FileUtils.write(\n\t\t\t\tuser.getDirectoryNames(), \n\t\t\t\tGlobal.Constants.DIRECTORY_LOCATION + user.getName()\n\t\t\t\t);\n\t\t\tsave(user);\n\t\t}\n\t}", "private void saveConfiguration() {\r\n\tnew File(PROPERTIES_FILE).getParentFile().mkdirs();\r\n\tProperties props = new Properties();\r\n\ttry {\r\n\t props.setProperty(KEY_LAST_SOURCE_DIR, lastSourceDir);\r\n\t props.setProperty(KEY_LAST_TARGET_DIR, lastTargetDir);\r\n\t logger.debug(\"Speichere \" + props + \" nach \" + PROPERTIES_FILE);\r\n\t FileOutputStream stream = new FileOutputStream(PROPERTIES_FILE);\r\n\r\n\t props.store(stream, \"Do not change!\");\r\n\t stream.close();\r\n\t} catch (IOException e) {\r\n\t logger.error(\"Konfiguration konnte nicht gespeichert werden!\", e);\r\n\t}\r\n }", "public String getSaveOutputDir() {\n return saveOutputDir;\n }", "public void setup() {\n\t\tif (!new File(plugin.getDataFolder() + path).exists())\r\n\t\t\tnew File(plugin.getDataFolder() + path).mkdir();\r\n\r\n\t\tif (!new File(plugin.getDataFolder() + path, name + \".yml\").exists())\r\n\t\t\ttry {\r\n\t\t\t\tnew File(plugin.getDataFolder() + path, name + \".yml\").createNewFile();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tplugin.getLogger().log(Level.SEVERE, \"Could not generate \" + name + \".yml\");\r\n\t\t\t}\r\n\t}", "public void setPersistance() throws IOException {\n createDir(BLOBS);\n createDir(REMOVAL);\n createDir(INDEX);\n createDir(Main.ALL_BRANCHES);\n createDir(Main.ALL_COMMITS);\n createFile(MASTERBRANCH);\n createFile(HEADFILE);\n createFile(HEADNAME);\n }", "private static File setYdfDirectory()\r\n/* 27: */ throws IOException\r\n/* 28: */ {\r\n/* 29: 32 */ log.finest(\"OSHandler.setYdfDirectory\");\r\n/* 30: 33 */ ydfDirectory = new File(USER_HOME + \"/\" + \".yourdigitalfile\");\r\n/* 31: 34 */ ydfDirectory.mkdir();\r\n/* 32: 35 */ return ydfDirectory;\r\n/* 33: */ }", "public static void save() {\n Game.save(UI.askNgetString(\"Filename for this save file?\")+\".xml\");\n }", "public void autoSave(){\n\t\ttry {\n\t\t\t//read in file\n\t\t\tFile file = new File(System.getProperty(\"user.dir\")+\"/Default.scalcsave\");\n\t\t\tObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(file));\n\t\t\toutput.writeObject(SaveFile.getSaveFile());\n\t\t\toutput.close();\n\t\t\tSystem.out.println(\"Save Success\");\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void createDirectory() {\r\n\t\tpath = env.getProperty(\"resources\") + \"/\" + Year.now().getValue() + \"/\";\r\n\t\tFile file = new File(path);\r\n\t\tif (!file.exists())\r\n\t\t\tfile.mkdirs();\r\n\t}", "void save_to_file() {\n\t\tthis.setAlwaysOnTop(false);\n\t\t\n\t\t/**\n\t\t * chose file with file selector \n\t\t */\n\t\t\n\t\tFileDialog fd = new FileDialog(this, \"Choose a save directory\", FileDialog.SAVE);\n\t\t\n\t\t//default path is current directory\n\t\tfd.setDirectory(System.getProperty(\"user.dir\"));\n\t\tfd.setFile(\"*.cmakro\");\n\t\tfd.setVisible(true);\n\t\t\n\t\t\n\t\tString filename = fd.getFile();\n\t\tString path = fd.getDirectory();\n\t\tString file_withpath = path + filename;\n\t\t\n\t\tif (filename != null) {\n\t\t\t System.out.println(\"save path: \" + file_withpath);\n\t\t\t \n\t\ttry {\n\t\t\tObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file_withpath));\n\n\t\t\tout.writeObject(Key_Lists);\n\t\t\t\n\t\t\tout.close();\n\t\t\t\n\t\t\tinfo_label.setForeground(green);\n\t\t\tinfo_label.setText(\"file saved :D\");\n\t\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tthis.setAlwaysOnTop(true);\n\t\t\n\t}", "public static void initializeOutputFolder() {\n\t\tString default_folder = PropertiesFile.getInstance().getProperty(\"default_folder\");\n\t\t\n\t\t// The file has to exist and is a directory (Not just a child file)\n\t\tString fullQualifiedFolderName = getFullyQualifiedFileName(default_folder);\n\t\tFile defaultDir = new File(fullQualifiedFolderName);\n\t\tif (!checkFolder(fullQualifiedFolderName)) {\n\t\t\tboolean dirCreated = defaultDir.mkdir();\n\t\t\tif(dirCreated == false) {\n\t\t\t\tlog.error(\"Could not create generation folder\");\n\t\t\t}\n\t\t} else\n\t\t\tdeleteFolderRecursively(defaultDir);\n\t}", "void setDirectory(File dir);", "private void SetupStoryLocation() {\n\n //Delete previous project directories\n deleteDirectories();\n //ensure that newStoryReady is set to false\n newStoryReady = false;\n //Give story name a unique identifier\n String name = UUID.randomUUID().toString();\n //Set the value of the tag data to be the unique identifier of the story\n tag_data = name;\n //Create new story folder based on the name of the new story - this will be home to the new stories as well as any additional stories recorded\n story_directory = new File (getFilesDir() + File.separator + \"Stories\" + File.separator + name);\n //Create new tag folder based on the name of the new story - this will be home to the stories recorded which are saved to the tags.\n //Currently only a single audio file and picture are associated with one story folder.\n tag_directory = new File (getFilesDir() + File.separator + \"Tag\" + File.separator + name);\n //Create new cover image folder based on the name of the story - this stores the image representing the object.\n cover_directory = new File (getFilesDir() + File.separator + \"Covers\" + File.separator + name);\n //A temporary storage directory for files which are being sent and downloaded from the cloud.\n cloud_directory = new File (getFilesDir() + File.separator + \"Cloud\" + File.separator + name);\n //Make the described directory folders\n story_directory.mkdir();\n tag_directory.mkdir();\n cover_directory.mkdir();\n cloud_directory.mkdir();\n\n /* Example of saving stories to external directories\n\n// String newDirectory = LocalStoryFolder + \"/\" + name;\n// String newDirectory2 = TagFolder + \"/\" + name;\n// String newDirectory3 = CoverFolder + \"/\" + name;\n// story_directory = getExternalFilesDir(newDirectory);\n// tag_directory = getExternalFilesDir(newDirectory2);\n// cover_directory = getExternalFilesDir(newDirectory3);\n\n */\n }", "private void calcSaveDirName() {\n this.saveDirName = this.worldNameField.getText().trim();\n if (this.saveDirName.isEmpty()) {\n this.saveDirName = \"World\";\n }\n\n try {\n this.saveDirName = FileUtil.findAvailableName(this.minecraft.getSaveLoader().getSavesDir(), this.saveDirName, \"\");\n } catch (Exception var4) {\n this.saveDirName = \"World\";\n\n try {\n this.saveDirName = FileUtil.findAvailableName(this.minecraft.getSaveLoader().getSavesDir(), this.saveDirName, \"\");\n } catch (Exception exception) {\n throw new RuntimeException(\"Could not create save folder\", exception);\n }\n }\n\n }", "public void createTestDir() {\n\t\tworkDir = new File(System.getProperty(\"test.dir\", \"target\"));\n\t}", "public void save() {\n // Convert the settings to a string\n String output = readSettings();\n \n try {\n // Make sure the file exists\n if (!settingsFile.exists()) {\n File parent = settingsFile.getParentFile();\n parent.mkdirs();\n settingsFile.createNewFile(); \n }\n \n // Write the data into the file\n BufferedWriter writer = new BufferedWriter(new FileWriter(settingsFile));\n writer.write(output);\n writer.close(); \n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private void setupFiles(){\n\t\t// Copies the default configuration files to the workspace \n\t\ttry{\n\t\t\tBundle bundle = Platform.getBundle(Activator.PLUGIN_ID);\n\t\t\tIPath destBasePath = Platform.getStateLocation(bundle);\n\t\t\tpropertiesFile = destBasePath.append(PreferencesConstants.PROP_BUNDLE_STATE_PATH).toFile();\n\t\t\tif(!propertiesFile.exists()){\n\n\t\t\t\tURI sourceBaseURI = bundle.getEntry(PreferencesConstants.DEFAULT_CONFIG_BUNDLE_PATH).toURI();\n\t\t\t\t//TODO: fix the item below?\n\t\t\t\tEnumeration<URL> entries = bundle.findEntries(PreferencesConstants.DEFAULT_CONFIG_BUNDLE_PATH, null, true);\n\t\t\t\tfor(; entries != null && entries.hasMoreElements();){\n\t\t\t\t\tURL url = entries.nextElement();\n\t\t\t\t\tURI uri = url.toURI();\n\t\t\t\t\tURI relativeURI = sourceBaseURI.relativize(uri);\n\t\t\t\t\tIPath destPath = destBasePath.append(relativeURI.toString());\n\n\t\t\t\t\tif(destPath.hasTrailingSeparator()){\n\t\t\t\t\t\t// it's a folder\n\t\t\t\t\t\tdestPath.toFile().mkdirs();\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t// it's a file\n\t\t\t\t\t\tURL contentURL = FileLocator.resolve(url);\n\t\t\t\t\t\tSystemUtils.blt(contentURL.openStream(), new FileOutputStream(destPath.toFile()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//now save the destination paths to the System properties\n\t\t\t//save the report paths\n\t\t\tString reportTemplatePath = destBasePath.append(PreferencesConstants.DEFAULT_REPORT_PATH\n\t\t\t\t\t+ PreferencesConstants.DEFAULT_REPORT_TEMPLATE_URL).toPortableString();\n\t\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_REPORT_TEMPLATE, \n\t\t\t\t\treportTemplatePath);\n\t\t\tSystem.out.println(\"report template file: \" + reportTemplatePath);\t\t\n\t\t\t\n\t\t\tString reportPath = destBasePath.append(PreferencesConstants.DEFAULT_REPORT_PATH\n\t\t\t\t\t+ PreferencesConstants.DEFAULT_REPORT_URL).toPortableString();\n\t\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_REPORT, \n\t\t\t\t\treportPath);\t\t\t\n\t\t\tSystem.out.println(\"report file: \" + reportPath);\t\t\t\n\t\t\t\n\t\t\t//save the rule paths\n\t\t\tString ruleSessionPath = destBasePath.append(PreferencesConstants.DEFAULT_RULE_PATH\n\t\t\t\t\t+ PreferencesConstants.DEFAULT_RULE_SESSION_URL).toPortableString();\n\t\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_RULE_SESSION, \n\t\t\t\t\truleSessionPath);\t\t\t\n\t\t\tSystem.out.println(\"rule session file: \" + ruleSessionPath);\t\t\t\t\t\n\t\t\t\n\t\t\tString ruleSessionOutPath = destBasePath.append(PreferencesConstants.DEFAULT_RULE_PATH\n\t\t\t\t\t+ PreferencesConstants.DEFAULT_RULE_SESSION_OUT_URL).toPortableString();\n\t\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_RULE_SESSION_OUT, \n\t\t\t\t\truleSessionOutPath);\t\t\t\n\t\t\tSystem.out.println(\"rule session out file: \" + ruleSessionOutPath);\t\t\t\t\t\n\t\t\t\n\t\t}\n\t\tcatch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t\n\t\t\n\t\t/*\n\t\tString pluginName = Activator.PLUGIN_ID;\n\t\tBundle bundle = Platform.getBundle(pluginName);\n\n\t\tString propFileStr = getFixedPath(bundle, PreferencesConstants.PROP_BASE_URL + PreferencesConstants.PROP_URL);\n\t\tFile sourcePropFile = new File(propFileStr);\n\n\t\t//propertiesFile = new File(fixedPath);\n\t\tIWorkspace workspace = ResourcesPlugin.getWorkspace();\n\t\tIWorkspaceRoot root = workspace.getRoot();\n\t\tIPath location = root.getLocation();\n\t\t//location.toString()\n\t\t//String path = location.toString() + location.SEPARATOR + \".metadata\" \n\t\t//\t+ location.SEPARATOR + PreferencesConstants.PROP_BASE_URL;\n\t\tString path = location.toString() + location.SEPARATOR + PreferencesConstants.PROP_BASE_URL;\n\t\t//URL entry = Platform.getInstallLocation().getURL();\n\t\t//String path = entry.toString() + location.SEPARATOR + PreferencesConstants.PROP_BASE_URL;\n\n\t\tFile usersResourceDir = new File(path);\n\t\tpropertiesFile = new File(path + PreferencesConstants.PROP_URL);\n\t\tSystem.out.println(\"properties file \" + propertiesFile.getAbsolutePath());\n\t\tFile reportDir;\n\t\tFile ruleDir;\n\t\tif(!usersResourceDir.exists()){\n\t\t\ttry{\n\t\t\t\tSystemUtils.createDirectory(usersResourceDir);\n\t\t\t}\n\t\t\tcatch(IOException e){\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t\t//copy the properties file\n\n\t\t\ttry{\n\t\t\t\tSystemUtils.copyFile(sourcePropFile, propertiesFile);\n\t\t\t}\n\t\t\tcatch(IOException e1){\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\n\t\t\t//copy report directory\n\t\t\tString fixedReportPath = getFixedPath(bundle, PreferencesConstants.PROP_BASE_URL + PreferencesConstants.DEFAULT_REPORT_PATH);\n\t\t\treportDir = new File(fixedReportPath);\n\t\t\ttry{\n\t\t\t\tSystemUtils.copyDirectory(reportDir, usersResourceDir);\n\t\t\t}\n\t\t\tcatch(IOException e){\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t\t//copy rule directory\n\t\t\tString fixedRulePath = getFixedPath(bundle, PreferencesConstants.PROP_BASE_URL + PreferencesConstants.DEFAULT_RULE_PATH);\n\t\t\truleDir = new File(fixedRulePath);\n\t\t\ttry{\n\t\t\t\tSystemUtils.copyDirectory(ruleDir, usersResourceDir);\n\t\t\t}\n\t\t\tcatch(IOException e){\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t\tSystem.out.println(\"success\");\n\t\t}\n\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_REPORT_TEMPLATE, usersResourceDir.toString() + usersResourceDir.separator + PreferencesConstants.DEFAULT_REPORT_PATH.substring(1) + usersResourceDir.separator + PreferencesConstants.DEFAULT_REPORT_TEMPLATE_URL);\n\t\tSystem.out.println(\"report template file: \" + System.getProperty(PreferencesConstants.DEFAULT_PROP_REPORT_TEMPLATE));\n\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_REPORT, usersResourceDir.toString() + usersResourceDir.separator + PreferencesConstants.DEFAULT_REPORT_PATH.substring(1) + usersResourceDir.separator + PreferencesConstants.DEFAULT_REPORT_URL.substring(1));\n\t\tSystem.out.println(\"report file: \" + System.getProperty(PreferencesConstants.DEFAULT_PROP_REPORT));\n\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_RULE_SESSION, usersResourceDir.toString() + usersResourceDir.separator + PreferencesConstants.DEFAULT_RULE_PATH.substring(1) + usersResourceDir.separator + PreferencesConstants.DEFAULT_RULE_SESSION_URL.substring(1));\n\t\tSystem.out.println(\"rule session file: \" + System.getProperty(PreferencesConstants.DEFAULT_PROP_RULE_SESSION));\n\n\t\tSystem.setProperty(PreferencesConstants.DEFAULT_PROP_RULE_SESSION_OUT, usersResourceDir.toString() + usersResourceDir.separator + PreferencesConstants.DEFAULT_RULE_PATH.substring(1) + usersResourceDir.separator + PreferencesConstants.DEFAULT_RULE_SESSION_OUT_URL.substring(1));\n\t\tSystem.out.println(\"rule session file: \" + System.getProperty(PreferencesConstants.DEFAULT_PROP_RULE_SESSION_OUT));\n\t\t*/\n\t}", "private String setFileDestinationPath(){\n String filePathEnvironment = Environment.getExternalStorageDirectory().getAbsolutePath();\n Log.d(TAG, \"Full path edited \" + filePathEnvironment + \"/earwormfix/\" + generatedFilename + EXTENSION_JPG);\n return filePathEnvironment+ \"/earwormfix/\" + generatedFilename + EXTENSION_JPG;\n }", "private void setWorkDiretory() {\n\t\tthis.workDiretory = System.getProperty(\"user.dir\");\n\t}", "private final void directory() {\n\t\tif (!this.plugin.getDataFolder().isDirectory()) {\n\t\t\tif (!this.plugin.getDataFolder().mkdirs()) {\n\t\t\t\tMain.SEVERE(\"Failed to create directory\");\n\t\t\t} else {\n\t\t\t\tMain.INFO(\"Created directory sucessfully!\");\n\t\t\t}\n\t\t}\n\t}", "public void setDir() throws FileNotFoundException, IOException{\r\n final JFileChooser jfc = new JFileChooser();\r\n jfc.setDialogTitle(\"Choose Workplace Dirtory\");\r\n FileSystemView fsv = FileSystemView.getFileSystemView();\r\n //wppath stores workplace location\r\n wppath = fsv.getDefaultDirectory();\r\n File rd = new File(wppath.getAbsolutePath() + \"/USQ_Reporter.txt\");\r\n int ext = 0;\r\n if(rd.exists())ext=1;\r\n if(!rd.exists())ext=2;\r\n FileReader fr; \r\n if(rd.exists()){\r\n fr= new FileReader(rd);\r\n if(fr.read()==-1)\r\n ext=2;\r\n }\r\n //System.out.println(ext);\r\n //workplace path\r\n if(ext==1) {\r\n BufferedReader br = new BufferedReader(new FileReader(rd));\r\n workplace = br.readLine();\r\n }else if (ext==2) {\r\n jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r\n int returnVal = jfc.showOpenDialog(this);\r\n \r\n if(returnVal == JFileChooser.APPROVE_OPTION) {\r\n File file = jfc.getSelectedFile();\r\n if(!file.exists()) {\r\n JOptionPane.showMessageDialog(null, \"file doesn't exist.\", \"System Message\", JOptionPane.ERROR_MESSAGE);\r\n } else if(file.isDirectory()) {\r\n workplace = file.getAbsolutePath();\r\n }\r\n }\r\n BufferedWriter bw = new BufferedWriter(new FileWriter(rd));\r\n bw.write(workplace);\r\n bw.flush();\r\n bw.close();\r\n }\r\n }", "private void createDirectories()\r\n\t{\r\n\t\t// TODO: Do some checks here\r\n\t\tFile toCreate = new File(Lunar.OUT_DIR + Lunar.PIXEL_DIR\r\n\t\t\t\t\t\t\t\t\t+ Lunar.PROCESSED_DIR);\r\n\t\ttoCreate.mkdirs();\r\n\t\ttoCreate = null;\r\n\t\ttoCreate = new File(Lunar.OUT_DIR + Lunar.ROW_DIR + Lunar.PROCESSED_DIR);\r\n\t\ttoCreate.mkdirs();\r\n\t\ttoCreate = null;\r\n\t}", "public void saveIn (String directory) {\n\t\tthis.directory = directory;\n\t\tsave();\n\t}", "public void writeToDir() {\n\t\ttry{\n\t\t\tString dirPath = Paths.get(\".\").toAbsolutePath().normalize().toString()+\"/\";\n\t\t\tString path = dirPath + filename; //get server dir path\n\t\t\tSystem.out.println(\"output file path is: \" + path);\n\t\t\tFileOutputStream out = new FileOutputStream(path);\n out.write(img);\n out.close();\n PL.fsync();\n\t\t}catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void setUp() {\n new File(TEST_FILE).getParentFile().mkdirs();\n }", "private void createDir(){\n\t\tPath path = Path.of(this.dir);\n\t\ttry {\n\t\t\tFiles.createDirectories(path);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void setToDir(File dir) {\n _destDir = dir;\n }", "public FileSaver(Path directory) {\n this.directory = directory;\n }", "private String initialFileSetup(String file_path, String user_id) {\n\n String[] path_components = file_path.split(\"/\");\n String desired_filename = path_components[path_components.length - 1];\n String absolute_path = new File(\"\").getAbsolutePath();\n absolute_path = absolute_path.concat(\"/Final\");\n new File(absolute_path).mkdirs();\n absolute_path = absolute_path.concat(\"/Pause\");\n new File(absolute_path).mkdirs();\n\n absolute_path = absolute_path.concat(\"/\".concat(user_id));\n new File(absolute_path).mkdirs();\n\n absolute_path = absolute_path.concat(\"/Pause_\".concat(desired_filename));\n\n return absolute_path;\n }", "private void setupWorkingDir(Execute exe) {\r\n if (dir == null) {\r\n dir = getProject().getBaseDir();\r\n }\r\n else if (!dir.exists() || !dir.isDirectory()) {\r\n throw new BuildException(dir.getAbsolutePath() + \" is not a valid directory\", getLocation());\r\n }\r\n exe.setWorkingDirectory(dir);\r\n }", "private void saveSettings() {\n SettingsModel settingsModel = new SettingsModel();\n settingsModel.saveState(NJNPStartActivity.this);\n\n File NJNPSettingsDirectory = new File(NJNPConstants.DIRECTORY_PATH + NJNPConstants.SETTINGS_FOLDER);\n NJNPSettingsDirectory.mkdirs();\n\n File file = new File(NJNPSettingsDirectory.getPath(), NJNPConstants.SETTINGS_FILE_NAME);\n\n FileOutputStream fos = null;\n ObjectOutputStream os = null;\n try {\n fos = new FileOutputStream(file);\n os = new ObjectOutputStream(fos);\n os.writeObject(settingsModel);\n os.close();\n fos.close();\n } catch (FileNotFoundException e) {\n Log.e(NJNP_ACTIVITY_TAG, \"File not found exception when saving settings: \" + e.getMessage());\n } catch (IOException e) {\n Log.e(NJNP_ACTIVITY_TAG, \"IO Exception when saving settings: \" + e.getMessage());\n }\n\n }", "public void makeSettingsFile() {\n settingsData = new File (wnwData,\"settings.dat\");\n try {\n if (!settingsData.exists()) {\n settingsData.createNewFile();\n BufferedWriter bufferedWriter = new BufferedWriter(\n new FileWriter(settingsData));\n bufferedWriter.write(\"1 0\");\n bufferedWriter.close();\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n settingsData.setWritable(true);\n }", "void saveAs() {\n writeFile.Export();\n }", "@FXML\n private void writeFiles(){\n setProfileUNr();\n PonsFileFactory ponsFileFactory = new PonsFileFactory();\n ponsFileFactory.setKykgat(isKykgat.isSelected());\n for (Profile profile : profiles) {\n createFile(ponsFileFactory,profile);\n }\n moveXBy.setText(\"0\");\n }", "public void setup() {\n\t\tif(!plugin.getDataFolder().exists()) {\n\t\t\tplugin.getDataFolder().mkdir();\n\t\t}\n\n\t\t// Create main file\n\t\tString FileLocation = plugin.getDataFolder().toString() + File.separator + \"Storage\" + \".yml\";\n\t\tFile tmp = new File(FileLocation);\n\t\tstoragefile = tmp;\n\t\t// Check if file exists\n\t\tif (!storagefile.exists()) {\n\t\t\ttry {\n\t\t\t\tstoragefile.createNewFile();\n\t\t\t}catch(IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tBukkit.getServer().getConsoleSender().sendMessage(net.md_5.bungee.api.ChatColor.RED + \"Storage file unable to be created!\");\n\t\t\t}\n\t\t}\n\t\tstoragecfg = YamlConfiguration.loadConfiguration(storagefile);\n\t\tcreateStorageValues();\n\t}", "private static void prepareSaveFile(String filename) {\n\t\tFile f = new File(filename);\n\t\tif(!f.exists()) {\n\t\t\ttry {\n\t\t\t\tf.createNewFile();\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "private static void initDirectories() {\n String storeName = System.getProperty(USER_DIR)\n + File.separator\n + QVCSConstants.QVCS_META_DATA_DIRECTORY\n + File.separator\n + QVCSConstants.QVCS_FILEID_STORE_NAME\n + \".dat\";\n File storeFile = new File(storeName);\n if (storeFile.exists()) {\n storeFile.delete();\n }\n deleteAuthenticationStore();\n initAuthenticationStore();\n\n deleteRoleProjectViewStore();\n initRoleProjectViewStore();\n\n initProjectProperties();\n }", "public void save() {\n\t\tlog.log(\"Attempting to save...\");\n\t\tPath spath = Paths.get(getFullSavePath());\n\t\tPath cpath = Paths.get(getFullSavePath() + \"units/\");\n\t\ttry {\n\t\t\tif(!Files.exists(spath))\n\t\t\t\tFiles.createDirectory(spath);\n\t\t\tif(!Files.exists(cpath))\n\t\t\t\tFiles.createDirectory(cpath);\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tlog.log(\"Save failed.\");\n\t\t\treturn;\n\t\t}\n\n\t\tFile[] files = new File(cpath.toString()).listFiles();\n\t\tfor(File f : files) {\n\t\t\tf.delete();\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tBufferedWriter mfestWriter = new BufferedWriter(new FileWriter(getFullSavePath() + \"progress.txt\"));\n\t\t\tmfestWriter.write(name);\n\t\t\tmfestWriter.close();\n\t\t\tfor(MapCharacter mc : getFriendlies()) {\n\t\t\t\tBufferedWriter charWriter = new BufferedWriter(new FileWriter(getFullSavePath() + \"units/\"\n\t\t\t\t\t\t+ mc.getEnclosed().getDirName()));\n\t\t\t\tcharWriter.write(mc.getEnclosed().save());\n\t\t\t\tcharWriter.close();\n\t\t\t}\n\t\t}\n\t\tcatch(IOException e) {\n\t\t\tlog.log(\"Save failed.\");\n\t\t\treturn;\n\t\t}\n\t\tlog.log(\"Game saved.\");\n\t}", "public static Path getUserSaveDir() {\n\t\treturn Paths.get(prefs.get(Constants.PREF_USERSAVE_DIR, null));\n\t}", "static Path createBackupDirectory(Path savegame) {\r\n\t\tPath backupDirectory = Paths.get(savegame.getParent() + \"\\\\Backups\");\r\n\t\tif (!Files.isDirectory(backupDirectory)) {\r\n\t\t\ttry {\r\n\t\t\t\tFiles.createDirectory(backupDirectory);\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tSystem.out.println(\"Error: couldn't create Backup directory\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\tif (Files.isDirectory(backupDirectory)) {\r\n\t\t\tSystem.out.println(\"Created Backup Directory..\");\r\n\t\t}\r\n\t\treturn backupDirectory;\r\n\t}", "public String get_save_path() {\n\t\treturn _save_path;\n\t}", "private void updateFile() {\n try {\n this.taskStorage.save(this.taskList);\n this.aliasStorage.save(this.parser);\n } catch (IOException e) {\n System.out.println(\"Master i am unable to save the file!\");\n }\n }", "@Override\n public void onClick(View v) {\n\n writeFile();\n\n File INTERNAL = getFilesDir();\n File EXT_DIR = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File dataDir = Environment.getExternalStorageDirectory();\n\n Log.d(\"FILE\", \"INTERNAL: \" + INTERNAL.getAbsolutePath());\n Log.d(\"FILE\", \"EXTERNAL: \" + EXT_DIR.getAbsolutePath());\n Log.d(\"FILE\", \"DATA: \" + dataDir.getAbsolutePath());\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n JFileChooser j = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());\n\n // set the selection mode to directories only\n j.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\n\n // invoke the showsSaveDialog function to show the save dialog\n int r = j.showSaveDialog(null);\n\n if (r == JFileChooser.APPROVE_OPTION) {\n // set the label to the path of the selected directory\n directory.setText(j.getSelectedFile().getAbsolutePath());\n }\n // if the user cancelled the operation\n else\n directory.setText(\"the user cancelled the operation\");\n }", "public void createSubDirData() {\n\t\tFile f = new File(getPFDataPath());\n\t\tf.mkdirs();\n\t}", "public void saveAll() {\n try {\n writeObject(IMAGE_DATA_PATH, imageFiles);\n writeObject(EXISTING_TAGS_PATH, existingTags);\n } catch (IOException e) {\n // e.printStackTrace();\n }\n }", "public void save() {\r\n File distDataFile = new File(path);\r\n\r\n //String basePath = path;\r\n String endOfPath = path.substring(path.lastIndexOf(\"/\"));\r\n\r\n File rootDataFile;\r\n if (!path.contains(\"artists\")) {\r\n rootDataFile = new File(BASEDIR + \"/resources/data\" + endOfPath);\r\n } else {\r\n rootDataFile = new File(BASEDIR + \"/resources/data/artists\" + endOfPath);\r\n }\r\n\r\n File distTempFile = new File(path.substring(0, path.lastIndexOf(\"/\")) + \"/myTempFile.txt\");\r\n\r\n File rootTempFile;\r\n if (!path.contains(\"artists\")) {\r\n rootTempFile = new File(BASEDIR + \"/resources/data/myTempFile.txt\");\r\n } else {\r\n rootTempFile = new File(BASEDIR + \"/resources/data/artists/myTempFile.txt\");\r\n }\r\n \r\n try {\r\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(\r\n new FileOutputStream(distTempFile), \"UTF-8\"));\r\n\r\n for (String line : data) {\r\n bw.write(line);\r\n bw.newLine();\r\n }\r\n\r\n bw.close();\r\n distDataFile.delete();\r\n distTempFile.renameTo(distDataFile);\r\n\r\n BufferedWriter bw2 = new BufferedWriter(new OutputStreamWriter(\r\n new FileOutputStream(rootTempFile), \"UTF-8\"));\r\n\r\n for (String line : data) {\r\n bw2.write(line);\r\n bw2.newLine();\r\n }\r\n\r\n bw2.close();\r\n rootDataFile.delete();\r\n rootTempFile.renameTo(rootDataFile);\r\n } catch (IOException ex) {\r\n System.out.println(\"IOExceptoin in save1 : FileData\");\r\n }\r\n }", "private void setAndWriteFiles()\n\t{\n\t\tSensorConfiguration config = new SensorConfiguration();\n\t\tString versionMajor = ConfigurationInterface_v1_0.VERSION.substring(0,\n\t\t\t\tConfigurationInterface_v1_0.VERSION.indexOf('.'));\n\t\tString versionMinor = ConfigurationInterface_v1_0.VERSION\n\t\t\t\t.substring(ConfigurationInterface_v1_0.VERSION.indexOf('.') + 1);\n\t\tconfig.setConfigurationInterfaceVersion(versionMajor, versionMinor);\n\n\t\tStartModes startModes = new StartModes();\n\t\t// set startMode for sensorConfiguration\n\t\tfor (StartMode element : startModes.getStartModeList())\n\t\t{\n\t\t\tif (element.getName().equals(\"DEFINED_TIME\"))\n\t\t\t{\n\t\t\t\tconfig.setStartMode(element);\n\t\t\t}\n\t\t}\n\n\t\tConfigurationSets configSets = new ConfigurationSets();\n\t\t// set configurationSet for sensorConfiguration\n\t\tfor (ConfigurationSet element : configSets.getConfigSetList())\n\t\t{\n\t\t\tif (element.getName().equals(\"mesana\"))\n\t\t\t{\n\n\t\t\t\tconfig.setConfigurationSet(element);\n\t\t\t}\n\t\t}\n\n\t\tif (config.getStartMode().getName().equals(\"DEFINED_TIME\"))\n\t\t{\n\n\t\t\tCalendar calendar = Calendar.getInstance();\n\t\t\tcalendar.set(Calendar.DAY_OF_MONTH, 10);\n\t\t\tcalendar.set(Calendar.HOUR_OF_DAY, 5);\n\t\t\tcalendar.set(Calendar.MINUTE, 11);\n\t\t\tDate date = calendar.getTime();\n\t\t\tconfig.setRecordingStartTime(date);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tconfig.setRecordingStartTime(null);\n\t\t}\n\t\t\n\t\tconfig.setRecordingDuration(12000);\n\t\t\n\t\ttry\n\t\t{\n\t\t\tConnectionManager.getInstance().currentSensor(0).setSensorConfiguration(config);\n\t\t\t\n\t\t\tConnectionManager.getInstance().currentSensor(0).writeConfigFile();\n\t\t\t\n\t\t\t// write Encrypted data to sensor\n\t\t\tConnectionManager.getInstance().currentSensor(0).writeEncryptedParameters(\"123456789abcd12\");\n\t\t\t\n\t\t\tint index = customerList.getSelectionIndex();\n\t\t\tif (index >= 0 && index <= mCollect.getList().size())\n\t\t\t{\n\t\t\t\tString linkId = mCollect.getList().get(index).getLinkId();\n\t\t\t\tconfig.addParameter(\"LinkId\", linkId);\n\t\t\t}\n\t\t\t// write custom data to additional file in sensor\n\t\t\tConnectionManager.getInstance().currentSensor(0).writeCustomFile();\n\t\t}\n\t\tcatch (SensorNotFoundException e)\n\t\t{\n\t\t\tstatusBar.setText(e.getMessage());\n\t\t}\n\t}", "File getSaveFile();", "private void setupDirectoryChooser(DirectoryChooser directoryChooser) \n {\n directoryChooser.setTitle(\"Select Directory to save Report\");\n\n // Set Initial Directory\n directoryChooser.setInitialDirectory(new File(System.getProperty(\"user.home\")));\n }", "public void saveConfigXml() {\n // Save the xml object to disk\n IPathManager pm = PathManagerFactory.getPathManager();\n LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,\n LocalizationLevel.SITE);\n\n LocalizationFile newXmlFile = pm.getLocalizationFile(lc,\n CONFIG_FILE_NAME);\n\n if (newXmlFile.getFile().getParentFile().exists() == false) {\n // System.out.println(\"Creating new directory\");\n\n if (newXmlFile.getFile().getParentFile().mkdirs() == false) {\n // System.out.println(\"Could not create new directory...\");\n }\n }\n\n try {\n // System.out.println(\"Saving -- \"\n // + newXmlFile.getFile().getAbsolutePath());\n jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()\n .getAbsolutePath());\n newXmlFile.save();\n\n lf = newXmlFile;\n } catch (Exception e) {\n statusHandler.handle(Priority.ERROR, \"Couldn't save config file.\",\n e);\n }\n }", "public void setDir(File dir) {\n this.dir = dir;\n }", "@Override\n public void Init() {\n strRemoteDownloadPath = strBasePath + (\"serialize/to/\");\n strRemoteUploadPath = strBasePath + (\"serialize/from/\");\n new File(strRemoteDownloadPath).mkdirs();\n new File(strRemoteUploadPath).mkdirs();\n }", "private void initFiles() {\r\n\t\ttry {\r\n\t\t\tFile file = getConfigFile();\r\n\t\t\tif (!file.exists()) {\r\n\t\t\t\tXmlFile.write(file, new SystemSettings());\r\n\t\t\t}\r\n\t\t} catch (Exception ex) {\r\n\t\t\tlogger.error(\"Failed to initialize settings file\", ex);\r\n\t\t}\r\n\t}", "public File getFolderNameToSave() {\n\t\tFile destDir = ctxt.getExternalFilesDir(Tattle_Config_Constants.SD_FOLDER_NAME + File.separator);\n\t\tif (!destDir.exists()) {\n\t\t\tdestDir.mkdir();\n\t\t}\n\t\treturn destDir;\n\t}", "@Override\n\tpublic void generateDirectories() {\n\t\tFile file = new File(\"Data/My Contacts/\");\n\n\t\tif (!file.exists()) {\n\t\t\tfile.mkdirs();\n\t\t}\n\t}", "public void createModuleBackupPath() {\n\t\tString[] onlyFolderNames = new String[] {\n\t\t\tmInstance.getModuleBackupRepositoryPath(),\n\t\t\tmModuleName\n\t\t};\n\t\t\n\t\tmModuleBackupPath = StringUtils.makeFilePath (onlyFolderNames, false);\n\t}", "public void saveFacultyDirectory(String filename) {\r\n\t\ttry {\r\n\t\t\tFacultyRecordIO.writeFacultyRecords(filename, facultyDirectory);\r\n\t\t} catch (IOException e) {\r\n\t\t\tthrow new IllegalArgumentException(\"Unable to write to file \" + filename);\r\n\t\t}\r\n\t}", "private void exportSettings() {\n\t\t\tfinal JFileChooser chooser = new JFileChooser(System.getProperty(\"user.home\"));\n\t\t\tint returnVal = chooser.showSaveDialog(null);\n\t\t\tif(returnVal == JFileChooser.APPROVE_OPTION) {\n\t\t\t\tFile saved = chooser.getSelectedFile();\n\t\t\t\ttry {\n\t\t\t\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(saved));\n\t\t\t\t\twriter.write(mySettings);\n\t\t\t\t\twriter.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t }\n\t}", "@Override\n\tpublic void afterPropertiesSet() throws Exception { Make sure the directory exists.\n\t\t//\n\t\tFileUtils.forceMkdir(inboxDirectory);\n\t}", "public void setAndCreateDirPath(String dirname) {\r\n\t File newPath = new File(dirname); \r\n\t \r\n\t if(!newPath.isDirectory()) {\r\n\t\t newPath.mkdirs();\r\n\t }\r\n\t \r\n\t directory = newPath;\r\n }", "@Override\n public void finish() {\n storeProperties();\n // retrieve the full list of files according to the selected mode\n List<org.jajuk.base.File> files = getFiles();\n if (files == null) {\n return;\n }\n // define the target directory\n final Date curDate = new Date();\n // Do not use ':' character in destination directory, it's\n // forbidden under Windows\n final SimpleDateFormat stamp = new SimpleDateFormat(\"yyyyMMdd-HHmm\", Locale.getDefault());\n final String dirName = \"Party-\" + stamp.format(curDate);\n final java.io.File destDir = new java.io.File(((String) data.get(Variable.DEST_PATH)), dirName);\n if (!destDir.mkdir()) {\n Log.warn(\"Could not create destination directory \" + destDir);\n }\n Log.debug(\"Going to copy \" + files.size() + \" files to directory {{\"\n + destDir.getAbsolutePath() + \"}}\");\n // perform the actual copying\n UtilPrepareParty.copyFiles(files, destDir, isTrue(Variable.NORMALIZE_FILENAME),\n isTrue(Variable.ONE_MEDIA_ENABLED) && isTrue(Variable.CONVERT_MEDIA),\n (String) data.get(Variable.ONE_MEDIA), (String) data.get(Variable.CONVERT_COMMAND));\n }", "@Override\r\n\tprotected void setSavedDirectoriesIntoControls() {\n\r\n\t}", "public void save() {\n Path root = Paths.get(storagePath);\n try {\n Files.copy(file.getInputStream(), root.resolve(file.getOriginalFilename()),\n StandardCopyOption.REPLACE_EXISTING);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void setUpSaving() throws IOException {\r\n\t\tthis.testingXML = new File(\"testing_01.xml\");\r\n\t\tthis.savingMain = new SavingMain(boardData, testingXML);\r\n\t\ttestingXML = savingMain.getXMLFile();\r\n\t\tthis.savingMasterObj = savingMain.getSavingMasterObj();\r\n\t\tthis.savingHelper = savingMain.getHelper();\r\n\t}", "@Override\n public void onClick(View view) {\n File direct = new File(Environment.getExternalStorageDirectory() + \"/Scrittor_Backup\");\n\n if (!direct.exists()) {\n if (direct.mkdir()) {\n exportDB();\n } else {\n direct.mkdir();\n exportDB();\n }\n }\n exportDB();\n }", "public static void LoadIntoConfigFiles()\n {\n \tProperties prop = new Properties();\n ///*\n \ttry {\n \t\t//set the properties value\n \n prop.setProperty(\"comp_name\", \"Teledom International Ltd\");\n prop.setProperty(\"com_city\", \"Lagos\");\n \t\tprop.setProperty(\"State\", \"Lagos\");\n \t\tprop.setProperty(\"logo_con\", \"logo.png\");\n \t\tprop.setProperty(\"front_frame\", \"front.png\");\n prop.setProperty(\"back_frame\", \"back.png\");\n \n \n \n \n \t\t//save properties to project root folder\n \t\tprop.store(new FileOutputStream(setupFileName), null);\n \n \t} catch (IOException ex) {\n \t\tex.printStackTrace();\n }\n // */\n \n \n \n }", "Saver() throws IOException\n\t\t{\n\t\t\tthis(new File(file.getParentFile(),\n\t\t\t\t\"#\" + file.getName() + \"#save#\"));\n\t\t}", "public void saveNewRollManager()\n\t{\n\t JFileChooser chooser = new JFileChooser(); //allows the user to choose a file\n\t chooser.setCurrentDirectory(new File(\"/home/me/Documents\"));\t//sets the directory of where to find the file\n\t int retrival = chooser.showSaveDialog(null);\n\t if (retrival == JFileChooser.APPROVE_OPTION) {\n\t try \n\t {\n\t FileWriter fw = new FileWriter(chooser.getSelectedFile()+\".txt\");\n\t fw.write (getCourseToFileString ( ));\n\t for(Student b : getStudents ( ))\t \t\n\t \tfw.write(b.toFileString ( ));\n\t \tfw.close ( );\n\t \t;\n\t } \n\t catch (Exception ex) \n\t {\n\t ex.printStackTrace();\n\t }\n\t\t\tthis.saveNeed = false;\n\n\t }\n\t \n\t}", "@Override\n public void setSaveFile(File file)\n {\n \n }", "public void setupRIBFiles() {\n mRTS.mTimeMan.findAndSetEmptyDayNo();\n mRTS.mEventHandler.writeEventHeaderFile();\n mRTS.mDataLogHandler.writeDayHeaderFile();\n\n }", "private void createOutputFiles(){\n\t\tFile folder = new File(C.appFolderPath + C.DEBUG_FOLDER);\n\t\tboolean success = true;\n\t\tif(folder.exists()){\n\t\t\t// erase the folder\n\t\t\tDeleteRecursive(folder);\n\t\t}\n\t\t\n\t\t// create necessary folders\n\t\tif (!folder.exists()) {\n\t\t success = folder.mkdir();\n\t\t Log.d(C.LOG_TAG, \"folder is not existed, create one\");\n\t\t} else {\n\t\t\tLog.e(C.LOG_TAG, \"ERROR: folder has not been deleted\");\n\t\t}\n\t\tFile monitorFolder = new File(C.appFolderPath + C.DEBUG_FOLDER + logFolder);\n\t\tmonitorFolder.mkdir();\n\n\t\ttry {\n\t\t\tmMatlabOutFile = new PrintWriter(new FileOutputStream(new File(C.appFolderPath+ C.DEBUG_FOLDER +\"matlab.txt\"),true));\n\t\t\tmMatlabOutFile.println(inputPrefix+audioSettingName);\n\t\t\tmMatlabOutFile.println(RECODER_CHANNEL_CNT);\n\t\t\tmMatlabOutFile.println(C.DEFAULT_VOL);\n\t\t\tmMatlabOutFile.close();\n\t\t\tmMatlabOutFile = null;\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tLog.e(C.LOG_TAG, \"ERROR: can't open sensor file to write\");\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void set_save_path(String _save_path) {\n\t\tthis._save_path = _save_path;\n\t}", "public static void saveGameConfiguration() {\n exportJsonFile(new File(FileUtils.getRootFile(), Constant.CONFIG_FILE_NAME));\n }", "public void createSubDirCameraTaken() {\n\t\tFile f = new File(getPFCameraTakenPath());\n\t\tf.mkdirs();\n\t}", "private void savePressed(){\n\t\t\n\t\tJFileChooser fileChooser = new JFileChooser(System.getProperty(\"user.dir\"));\n\t\tFileNameExtensionFilter extentions = new FileNameExtensionFilter(\"SuperCalcSave\", \"scalcsave\");\n\t\tfileChooser.setFileFilter(extentions);\n\t\tint retunedVal = fileChooser.showSaveDialog(this);\n\t\tFile file = null;\n\t\tif(retunedVal == JFileChooser.APPROVE_OPTION){\n\t\t\tfile = fileChooser.getSelectedFile();\n\t\t\t//make sure file has the right extention\n\t\t\tif(file.getAbsolutePath().contains(\".scalcsave\"))\n\t\t\t\tfile = new File(file.getAbsolutePath());\n\t\t\telse\n\t\t\t\tfile = new File(file.getAbsolutePath()+\".scalcsave\");\n\t\t}\n\t\t//only continue if a file is selected\n\t\tif(file != null){\t\n\t\t\ttry {\n\t\t\t\t//read in file\n\t\t\t\tObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(file));\n\t\t\t\toutput.writeObject(SaveFile.getSaveFile());\n\t\t\t\toutput.close();\n\t\t\t\tSystem.out.println(\"Save Success\");\n\t\t\t\t\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "public void setDir(File dir)\n {\n this.dir = dir;\n }", "public File getStoreDir();", "public static void createDirectories() \r\n\t{\r\n\t\tif(!fCertificatesDir().exists()) \r\n\t\t{\r\n\t\t\tfCertificatesDir().mkdir();\r\n\t\t}\r\n\t\t\r\n\t\tif(!fDbDir().exists()) \r\n\t\t{\r\n\t\t\tfDbDir().mkdir();\r\n\t\t}\r\n\t\t\r\n\t\tif(!fMibsDir().exists())\r\n\t\t{\r\n\t\t\tfMibsDir().mkdir();\r\n\t\t}\r\n\t\t\r\n\t\tif(!fMibsBinaryDir().exists()) \r\n\t\t{\r\n\t\t\tfMibsBinaryDir().mkdir();\r\n\t\t}\r\n\t\t\r\n\t\tif(!fMibsTextDir().exists()) \r\n\t\t{\r\n\t\t\tfMibsTextDir().mkdir();\r\n\t\t}\r\n\t}", "@Override\n public void onChosenDir(String chosenDir) {\n ((EditTextPreference)preference).setText(chosenDir);\n try {\n SettingsActivity.createWorkingDir(getActivity(), new File(chosenDir));\n } catch (Exception ex) {\n Toast.makeText(getActivity(), ex.getMessage(), Toast.LENGTH_SHORT).show();\n }\n AvnLog.i(Constants.LOGPRFX, \"select work directory \" + chosenDir);\n }", "private void createFile(PonsFileFactory ponsFileFactory, Profile profile){\n moveX(profile);\n ponsFileFactory.setProfile(profile);\n String text = ponsFileFactory.createPonsFile();\n String profileName = profile.getName();\n WriteFile.write(text,pathTextField.getText() + \"/\" + profileName.substring(0,profileName.indexOf(\".\")));\n }", "@Override\n public void modelStarted(ModelEvent me)\n {\n save(me.getSource(), _startDirectory);\n }", "private void saveBeforeRun() {\n if ( _helper != null && _settings.getSaveBeforeRun() )\n _helper.saveBeforeRun();\n }", "public PoseurFileManager()\r\n {\r\n // NOTHING YET\r\n currentFile = null;\r\n currentFileName = null;\r\n saved = true;\r\n poseIO = new PoseIO();\r\n }", "public static void save(Directory directory) {\n\t\tUtils.FileUtils.write(\n\t\t\t\tdirectory.getDocuments(), \n\t\t\t\tGlobal.Constants.DIRECTORY_LOCATION \n\t\t\t\t+ Global.Variables.session.getCurrentUser().getName() \n\t\t\t\t+ \"$\" + directory.getName()\n\t\t\t\t);\n\t}", "public Save(Game game) {\n\t\tthis(game, \"/\");\n\t\t\n\t\twritePrefs(\"Preferences\");\n\t}", "private void saveProject() {\n File f = new File(getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS), projectName + File.separator + \"render.cfg\");\n\n JSONObject json = new JSONObject();\n\n try {\n json.put(\"frames\", frames);\n json.put(\"a\", a);\n json.put(\"b\", b);\n json.put(\"P\", P);\n } catch (JSONException e) {\n Log.v(\"RenderSettings\", \"saveProject failed with a JSON Exception: \" + e.getMessage());\n }\n\n try (FileWriter file = new FileWriter(f)) {\n file.write(json.toString());\n } catch (IOException e) {\n Log.v(\"RenderSettings\", \"saveProject failed with a IO Exception: \" + e.getMessage());\n }\n }", "void store() {\n UserPreferences.setLogFileCount(Integer.parseInt(logFileCount.getText()));\n if (!agencyLogoPathField.getText().isEmpty()) {\n File file = new File(agencyLogoPathField.getText());\n if (file.exists()) {\n ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, agencyLogoPathField.getText());\n }\n } else {\n ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, \"\");\n }\n UserPreferences.setMaxSolrVMSize((int)solrMaxHeapSpinner.getValue());\n if (memField.isEnabled()) { //if the field could of been changed we need to try and save it\n try {\n writeEtcConfFile();\n } catch (IOException ex) {\n logger.log(Level.WARNING, \"Unable to save config file to \" + PlatformUtil.getUserDirectory() + \"\\\\\" + ETC_FOLDER_NAME, ex);\n }\n }\n }", "private void saveAs() {\n\t\tFileChooser fileChooser = new FileChooser();\n\n\t\t// Set extension filter\n\t\tFileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(\n\t\t\t\t\"XML files (*.xml)\", \"*.xml\");\n\t\tfileChooser.getExtensionFilters().add(extFilter);\n\n\t\t// Show save file dialog\n\t\tFile file = fileChooser.showSaveDialog(mainApp.getPrimaryStage());\n\n\t\tif (file != null) {\n\t\t\t// Make sure it has the correct extension\n\t\t\tif (!file.getPath().endsWith(\".xml\")) {\n\t\t\t\tfile = new File(file.getPath() + \".xml\");\n\t\t\t}\n\t\t\tmainApp.saveFilmDataToFile(file);\n\t\t}\n\t}", "private void setupDirectory(String name){\n this.pokemon = toLowerCase(name);\n ServerSmogon sm;\n File folder = new File(getFilesDir() +\n \"/strategy_\" + gen + \"/\");\n File f = new File(getFilesDir() +\n \"/strategy_\" + gen + \"/\" + pokemon + \".txt\");\n //File[] contents = folder.listFiles();\n Thread thread;\n //check if directory is made\n if(folder.exists() && folder.isDirectory() && f.exists()){\n setupArticleandStats();\n refreshlayoutpart2();\n return;\n }\n //if not make it\n\n folder.mkdirs();\n try{\n f.createNewFile();\n } catch(IOException e){\n e.printStackTrace();\n }\n\n\n //download strategy articles\n sm = new ServerSmogon(getBaseContext(), gen, \"strategy\", pokemon, handler);\n thread = new Thread(sm);\n\n thread.start();\n dialog=new ProgressDialog(this);\n dialog.setMessage(\"Downloading \"+pokemon);\n dialog.setCancelable(false);\n dialog.setInverseBackgroundForced(false);\n dialog.show();\n// try{\n//\n// thread.join();\n// }catch (InterruptedException e){\n// e.printStackTrace();\n// }\n\n }", "public void saveDatabase() {\r\n\t\ttry {\r\n\t\t\tFile databaseDirectory = new File (System.getProperty(\"user.home\")\r\n\t\t\t\t\t+ File.separator + \"Documents\" + File.separator + \"DatabaseUniverse\"\r\n\t\t\t\t\t+ File.separator + name);\r\n\t\t\tdatabaseDirectory.mkdirs();\r\n\t\t\tFile[] files = databaseDirectory.listFiles();\r\n\t\t\tSystem.gc();\r\n\t\t\tfor (File file : files) {\r\n\t\t\t\tFiles.delete(file.toPath());\r\n\t\t\t}\r\n\t\t\tfor (Table table : tables) {\r\n\t\t\t\ttable.saveTable(databaseDirectory.getPath());\r\n\t\t\t}\r\n\t\t} catch (SecurityException e) {\r\n\t\t\tSystem.out.println(\"Access Denied in Documents folder. Please check your security settings\"\r\n\t\t\t\t\t+ \"to enable file saving\");\r\n\t\t} catch (NullPointerException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IllegalArgumentException e) {\r\n\t\t\tSystem.err.print(e);\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.err.println(e);\r\n\t\t}\r\n\t}" ]
[ "0.6793049", "0.65889025", "0.6536632", "0.6516336", "0.6445017", "0.6432052", "0.63593554", "0.6338352", "0.6326414", "0.6272113", "0.62719953", "0.6249716", "0.6232041", "0.6189157", "0.6188114", "0.6147103", "0.61417603", "0.61331856", "0.6119732", "0.61187524", "0.61072195", "0.61045396", "0.6101804", "0.6097064", "0.60858065", "0.6076039", "0.60578144", "0.60488105", "0.60487497", "0.60484016", "0.6041528", "0.6036399", "0.6002958", "0.59939176", "0.5990969", "0.59883523", "0.5983507", "0.5978614", "0.59692305", "0.59637296", "0.5913374", "0.5902033", "0.5893596", "0.58870345", "0.5882173", "0.5859621", "0.58586437", "0.58573157", "0.5828884", "0.58208567", "0.58046424", "0.5791039", "0.5789863", "0.5780134", "0.5766336", "0.57659507", "0.57659215", "0.5762459", "0.5761937", "0.5738281", "0.5737353", "0.57345617", "0.57304835", "0.5719705", "0.5716241", "0.57062376", "0.5704957", "0.570479", "0.5697902", "0.56976014", "0.5693879", "0.5692177", "0.5692003", "0.569168", "0.56853837", "0.5677998", "0.56660396", "0.5663886", "0.5653193", "0.56518006", "0.5624765", "0.5622163", "0.5616982", "0.56137514", "0.561069", "0.56095237", "0.5607976", "0.55991346", "0.5592769", "0.558146", "0.5578693", "0.5578066", "0.5577379", "0.55714595", "0.55621976", "0.5561784", "0.5555858", "0.55486256", "0.5543817", "0.5542128", "0.5536339" ]
0.0
-1
Sets up a uri matcher for search suggestion and shortcut refresh queries.
private static UriMatcher buildUriMatcher() { UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH); matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGEST); matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST); matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT, SHORTCUT_REFRESH); matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*", SHORTCUT_REFRESH); return matcher; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static UriMatcher buildUriMatcher(){\r\n UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);\r\n matcher.addURI(AUTHORITY, \"task\", LIST_TASK);\r\n matcher.addURI(AUTHORITY, \"task/#\", ITEM_TASK);\r\n return matcher;\r\n }", "private static UriMatcher buildUriMatcher() {\n // Initialize a UriMatcher\n UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);\n // Add URI matches\n\n // Recipe Paths\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_RECIPES,\n CODE_RECIPES);\n\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_RECIPES\n + \"/#\", CODE_RECIPE_WITH_ID);\n\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_RECIPES\n + \"/\" + RecipeDbContract.PATH_APP_WIDGET_IDS\n + \"/#\", CODE_RECIPE_WITH_APP_WIDGET_ID);\n\n\n // Ingredient Paths\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_INGREDIENTS,\n CODE_INGREDIENTS);\n\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_INGREDIENTS\n + \"/#\", CODE_INGREDIENT_WITH_ID);\n\n // Step Paths\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_STEPS,\n CODE_STEPS);\n\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_STEPS\n + \"/#\", CODE_STEP_WITH_ID);\n\n // Favorite Paths\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_FAVORITES,\n CODE_FAVORITES);\n\n // App Widget\n uriMatcher.addURI(RecipeDbContract.AUTHORITY, RecipeDbContract.PATH_APP_WIDGET_IDS,\n CODE_APP_WIDGET_IDS);\n\n return uriMatcher;\n }", "static UriMatcher buildUriMatcher() {\n final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);\n final String authority = LocationContract.CONTENT_AUTHORITY;\n\n // For each type of URI you want to add, create a corresponding code.\n matcher.addURI(authority, LocationContract.PATH_LOCATION, LOCATION);\n matcher.addURI(authority, LocationContract.PATH_USER, USER);\n matcher.addURI(authority, LocationContract.PATH_USER + \"/*\", USER_BY_UID);\n return matcher;\n }", "public static UriMatcher buildUriMatcher() {\n // Initialize a UriMatcher\n UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);\n // Add URI matches\n\n uriMatcher.addURI(RecipeContract.AUTHORITY, RecipeContract.PATH_RECIPES, RECIPES);\n uriMatcher.addURI(RecipeContract.AUTHORITY, RecipeContract.PATH_RECIPES + \"/#\", RECIPE_WITH_ID);\n uriMatcher.addURI(RecipeContract.AUTHORITY, RecipeContract.PATH_INGREDIENTS, INGREDIENTS);\n uriMatcher.addURI(RecipeContract.AUTHORITY, RecipeContract.PATH_INGREDIENTS + \"/#\", INGREDIENTS_WITH_ID);\n uriMatcher.addURI(RecipeContract.AUTHORITY, RecipeContract.PATH_STEPS, STEPS);\n uriMatcher.addURI(RecipeContract.AUTHORITY, RecipeContract.PATH_STEPS + \"/#\", STEPS_WITH_ID);\n\n return uriMatcher;\n }", "public void testUriMatcher() {\n UriMatcher testMatcher = RecipeProvider.buildUriMatcher();\n\n assertEquals(\"Error: The INGREDIENT URI was matched incorrectly.\",\n testMatcher.match(TEST_INGREDIENT), RecipeProvider.INGREDIENT);\n assertEquals(\"Error on all ingredient match.\", testMatcher.match(TEST_INGREDIENT_ALL), RecipeProvider.INGREDIENT_ALL);\n assertEquals(\"Error: The WEATHER WITH LOCATION URI was matched incorrectly.\",\n testMatcher.match(TEST_RECIPE), RecipeProvider.RECIPE);\n }", "public static UriMatcher buildUriMatcher() {\n\n // Initialize a UriMatcher with no matches by passing in NO_MATCH to the constructor\n UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);\n\n /*\n All paths added to the UriMatcher have a corresponding int.\n For each kind of uri you may want to access, add the corresponding match with addURI.\n The two calls below add matches for the task directory and a single item by ID.\n */\n uriMatcher.addURI(OrderContract.AUTHORITY, OrderContract.PATH_ORDERS, ORDERS);\n uriMatcher.addURI(OrderContract.AUTHORITY, OrderContract.PATH_ORDERS + \"/*\", ORDERS_WITH_NAME);\n uriMatcher.addURI(OrderContract.AUTHORITY, OrderContract.PATH_ORDERS + \"/#\", ORDERS_WITH_CAL);\n\n return uriMatcher;\n }", "public void testUriMatcher() {\n UriMatcher testMatcher = TrackProvider.buildUriMatcher();\n\n assertEquals(\"Error: The TRACK URI was matched incorrectly.\",\n testMatcher.match(TEST_TRACK_DIR), TrackProvider.TRACK);\n assertEquals(\"Error: The TRACK WITH LOCATION URI was matched incorrectly.\",\n testMatcher.match(TEST_TRACK_WITH_LOCATION_DIR), TrackProvider.TRACK_WITH_LOCATION);\n assertEquals(\"Error: The TRACK WITH LOCATION AND DATE URI was matched incorrectly.\",\n testMatcher.match(TEST_TRACK_WITH_LOCATION_AND_DATE_DIR), TrackProvider.TRACK_WITH_LOCATION_AND_DATE);\n assertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n testMatcher.match(TEST_LOCATION_DIR), TrackProvider.LOCATION);\n }", "public static UriMatcher buildUriMatcher() {\n final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);\n final String authority = TrafficContract.CONTENT_AUTHORITY;\n\n /*\n * For each type of URI you want to add, create a corresponding code. Preferably, these are\n * constant fields in your class so that you can use them throughout the class and you no\n * they aren't going to change.\n */\n\n /* This URI is content://com.example.android.roadnews */\n matcher.addURI(authority, TrafficContract.PATH_TRAFFIC, CODE_TRAFFIC);\n\n\n return matcher;\n }", "public void testUriMatcher() {\n\t\tUriMatcher testMatcher = MoviesProvider.buildUriMatcher();\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_MOVIE_TRAILERS: %s MoviesProvider.MOVIE_TRAILERS: %s\", TEST_MOVIE_TRAILERS, MoviesProvider.MOVIE_TRAILERS));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_MOVIE_TRAILERS), MoviesProvider.MOVIE_TRAILERS);\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_MOVIE_REVIEWS: %s MoviesProvider.MOVIE_REVIEWS: %s\", TEST_MOVIE_REVIEWS, MoviesProvider.MOVIE_REVIEWS));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_MOVIE_REVIEWS), MoviesProvider.MOVIE_REVIEWS);\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_MOVIE_BY_ID: %s MoviesProvider.MOVIE_BY_ID: %s\", TEST_MOVIE_BY_ID, MoviesProvider.MOVIE_BY_ID));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_MOVIE_BY_ID), MoviesProvider.MOVIE_BY_ID);\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_MOVIES_DIR: %s MoviesProvider.MOVIES: %s\", TEST_MOVIES_DIR, MoviesProvider.MOVIES));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_MOVIES_DIR), MoviesProvider.MOVIES);\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_FAVORITE_BY_ID: %s MoviesProvider.FAVORITE_BY_ID: %s\", TEST_FAVORITE_BY_ID, MoviesProvider.FAVORITE_BY_ID));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_FAVORITE_BY_ID), MoviesProvider.FAVORITE_BY_ID);\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_REMOVE_FAVORITE_BY_ID: %s MoviesProvider.REMOVE_FAVORITE_BY_ID: %s\", TEST_REMOVE_FAVORITE_BY_ID, MoviesProvider.REMOVE_FAVORITE_BY_ID));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_REMOVE_FAVORITE_BY_ID), MoviesProvider.REMOVE_FAVORITE_BY_ID);\n\t\tLog.d(getClass().getSimpleName(), String.format(\"TEST_FAVORITE_MOVIES: %s MoviesProvider.TEST_FAVORITE_MOVIES: %s\", TEST_FAVORITE_MOVIES, MoviesProvider.FAVORITE_MOVIES));\n\t\tassertEquals(\"Error: The LOCATION URI was matched incorrectly.\",\n\t\t\t\ttestMatcher.match(TEST_FAVORITE_MOVIES), MoviesProvider.FAVORITE_MOVIES);\n\t}", "public Matcher matcher(String uri);", "@Override\n public void search(Uri uri) {\n }", "abstract UrlPatternMatcher create( String pattern );", "public void setPathMatcher(PathMatcher pathMatcher)\n/* */ {\n/* 552 */ this.pathMatcher = pathMatcher;\n/* */ }", "protected void setMatcher(Matcher matcher) {\n this.matcher = matcher;\n }", "public void setUrlMatcher(final UrlMatcher urlMatcher) {\n \t\t_urlMatcher = urlMatcher;\n \t\t_stripQueryStringFromUrls = _urlMatcher instanceof AntUrlPathMatcher;\n \t}", "private Matcher() {\n super(querySpecification());\n }", "public MMExptTupleMatcher() {\n this.conceptMatcher = new kb.matching.SynonymConceptMatcher();\n // Need to set synonyms right here\n }", "public RouteInterface setUri(String uri);", "public boolean matches(String uri);", "@Test\n\tpublic void testGetSet() {\n\t\t\n\t\tString location = \"vancouver\";\n\t\turiBuilder = new EventfulURIBuilder(location);\n\t\tassertEquals(uriBuilder.getLocationKeyword(), location);\n\t\t\n\t\tString keyword = \"food\";\n\t\turiBuilder.setSearchKeyword(keyword);\n\t\tassertEquals(uriBuilder.getSearchKeyword(), keyword);\n\t}", "protected UrlPattern() {\n }", "private void initialize(URI p_base, String p_uriSpec)\n throws MalformedURIException {\n \n String uriSpec = p_uriSpec;\n int uriSpecLen = (uriSpec != null) ? uriSpec.length() : 0;\n \n if (p_base == null && uriSpecLen == 0) {\n throw new MalformedURIException(\n \"Cannot initialize URI with empty parameters.\");\n }\n \n // just make a copy of the base if spec is empty\n if (uriSpecLen == 0) {\n initialize(p_base);\n return;\n }\n \n int index = 0;\n \n // Check for scheme, which must be before '/', '?' or '#'. Also handle\n // names with DOS drive letters ('D:'), so 1-character schemes are not\n // allowed.\n int colonIdx = uriSpec.indexOf(':');\n if (colonIdx != -1) {\n final int searchFrom = colonIdx - 1;\n // search backwards starting from character before ':'.\n int slashIdx = uriSpec.lastIndexOf('/', searchFrom);\n int queryIdx = uriSpec.lastIndexOf('?', searchFrom);\n int fragmentIdx = uriSpec.lastIndexOf('#', searchFrom);\n \n if (colonIdx < 2 || slashIdx != -1 || \n queryIdx != -1 || fragmentIdx != -1) {\n // A standalone base is a valid URI according to spec\n if (colonIdx == 0 || (p_base == null && fragmentIdx != 0)) {\n throw new MalformedURIException(\"No scheme found in URI.\");\n }\n }\n else {\n initializeScheme(uriSpec);\n index = m_scheme.length()+1;\n \n // Neither 'scheme:' or 'scheme:#fragment' are valid URIs.\n if (colonIdx == uriSpecLen - 1 || uriSpec.charAt(colonIdx+1) == '#') {\n throw new MalformedURIException(\"Scheme specific part cannot be empty.\"); \n }\n }\n }\n else if (p_base == null && uriSpec.indexOf('#') != 0) {\n throw new MalformedURIException(\"No scheme found in URI.\"); \n }\n \n // Two slashes means we may have authority, but definitely means we're either\n // matching net_path or abs_path. These two productions are ambiguous in that\n // every net_path (except those containing an IPv6Reference) is an abs_path. \n // RFC 2396 resolves this ambiguity by applying a greedy left most matching rule. \n // Try matching net_path first, and if that fails we don't have authority so \n // then attempt to match abs_path.\n //\n // net_path = \"//\" authority [ abs_path ]\n // abs_path = \"/\" path_segments\n if (((index+1) < uriSpecLen) &&\n (uriSpec.charAt(index) == '/' && uriSpec.charAt(index+1) == '/')) {\n index += 2;\n int startPos = index;\n \n // Authority will be everything up to path, query or fragment\n char testChar = '\\0';\n while (index < uriSpecLen) {\n testChar = uriSpec.charAt(index);\n if (testChar == '/' || testChar == '?' || testChar == '#') {\n break;\n }\n index++;\n }\n \n // Attempt to parse authority. If the section is an empty string\n // this is a valid server based authority, so set the host to this\n // value.\n if (index > startPos) {\n // If we didn't find authority we need to back up. Attempt to\n // match against abs_path next.\n if (!initializeAuthority(uriSpec.substring(startPos, index))) {\n index = startPos - 2;\n }\n }\n else {\n m_host = \"\";\n }\n }\n \n initializePath(uriSpec, index);\n \n // Resolve relative URI to base URI - see RFC 2396 Section 5.2\n // In some cases, it might make more sense to throw an exception\n // (when scheme is specified is the string spec and the base URI\n // is also specified, for example), but we're just following the\n // RFC specifications\n if (p_base != null) {\n \n // check to see if this is the current doc - RFC 2396 5.2 #2\n // note that this is slightly different from the RFC spec in that\n // we don't include the check for query string being null\n // - this handles cases where the urispec is just a query\n // string or a fragment (e.g. \"?y\" or \"#s\") -\n // see <http://www.ics.uci.edu/~fielding/url/test1.html> which\n // identified this as a bug in the RFC\n if (m_path.length() == 0 && m_scheme == null &&\n m_host == null && m_regAuthority == null) {\n m_scheme = p_base.getScheme();\n m_userinfo = p_base.getUserinfo();\n m_host = p_base.getHost();\n m_port = p_base.getPort();\n m_regAuthority = p_base.getRegBasedAuthority();\n m_path = p_base.getPath();\n \n if (m_queryString == null) {\n m_queryString = p_base.getQueryString();\n }\n return;\n }\n \n // check for scheme - RFC 2396 5.2 #3\n // if we found a scheme, it means absolute URI, so we're done\n if (m_scheme == null) {\n m_scheme = p_base.getScheme();\n }\n else {\n return;\n }\n \n // check for authority - RFC 2396 5.2 #4\n // if we found a host, then we've got a network path, so we're done\n if (m_host == null && m_regAuthority == null) {\n m_userinfo = p_base.getUserinfo();\n m_host = p_base.getHost();\n m_port = p_base.getPort();\n m_regAuthority = p_base.getRegBasedAuthority();\n }\n else {\n return;\n }\n \n // check for absolute path - RFC 2396 5.2 #5\n if (m_path.length() > 0 &&\n m_path.startsWith(\"/\")) {\n return;\n }\n \n // if we get to this point, we need to resolve relative path\n // RFC 2396 5.2 #6\n String path = \"\";\n String basePath = p_base.getPath();\n \n // 6a - get all but the last segment of the base URI path\n if (basePath != null && basePath.length() > 0) {\n int lastSlash = basePath.lastIndexOf('/');\n if (lastSlash != -1) {\n path = basePath.substring(0, lastSlash+1);\n }\n }\n else if (m_path.length() > 0) {\n path = \"/\";\n }\n \n // 6b - append the relative URI path\n path = path.concat(m_path);\n \n // 6c - remove all \"./\" where \".\" is a complete path segment\n index = -1;\n while ((index = path.indexOf(\"/./\")) != -1) {\n path = path.substring(0, index+1).concat(path.substring(index+3));\n }\n \n // 6d - remove \".\" if path ends with \".\" as a complete path segment\n if (path.endsWith(\"/.\")) {\n path = path.substring(0, path.length()-1);\n }\n \n // 6e - remove all \"<segment>/../\" where \"<segment>\" is a complete\n // path segment not equal to \"..\"\n index = 1;\n int segIndex = -1;\n String tempString = null;\n \n while ((index = path.indexOf(\"/../\", index)) > 0) {\n tempString = path.substring(0, path.indexOf(\"/../\"));\n segIndex = tempString.lastIndexOf('/');\n if (segIndex != -1) {\n if (!tempString.substring(segIndex).equals(\"..\")) {\n path = path.substring(0, segIndex+1).concat(path.substring(index+4));\n index = segIndex;\n }\n else\n index += 4;\n }\n else\n index += 4;\n }\n \n // 6f - remove ending \"<segment>/..\" where \"<segment>\" is a\n // complete path segment\n if (path.endsWith(\"/..\")) {\n tempString = path.substring(0, path.length()-3);\n segIndex = tempString.lastIndexOf('/');\n if (segIndex != -1) {\n path = path.substring(0, segIndex+1);\n }\n }\n m_path = path;\n }\n }", "public void testSetURI() {\n }", "public static void matchMaker()\n {\n \n }", "@Override\n public void configurePathMatch(PathMatchConfigurer configurer) {\n UrlPathHelper urlPathHelper = new UrlPathHelper();\n urlPathHelper.setRemoveSemicolonContent(false);\n configurer.setUrlPathHelper(urlPathHelper);\n }", "protected void init() {\n super.init();\n uriExpr = null;\n uri = null;\n nameExpr = null;\n name = null;\n qname = null;\n attrExpr = null;\n attr = null;\n emptyExpr = null;\n empty = false;\n }", "public void setMatcherConfigs(List<IntentMatcherConfig> matcherConfigs) {\n this.matcherConfigs = matcherConfigs;\n }", "R matchByUri(AsyncRequest request) {\n final R[] routes = urlLookup.get(request.path());\n if (routes == null || routes.length == 0) {\n return null;\n }\n return findFor(routes, request);\n }", "protected void setupMatcherExpectations() {\n expectedMatchRecordIds.put(\"x028abMatcher\", 0);\r\n expectedMatchRecords.put (\"x028abMatcher\", 0);\r\n\r\n expectedMatchRecordIds.put(\"x245ahMatcher\", 0);\r\n expectedMatchRecords.put (\"x245ahMatcher\", 0);\r\n\r\n expectedMatchRecordIds.put(\"x240aMatcher\", 0);\r\n expectedMatchRecords.put (\"x240aMatcher\", 0);\r\n\r\n expectedMatchRecordIds.put(\"x260abcMatcher\", 0);\r\n expectedMatchRecords.put (\"x260abcMatcher\", 0);\r\n\r\n expectedMatchRecordIds.put(\"x130aMatcher\", 0);\r\n expectedMatchRecords.put (\"x130aMatcher\", 0);\r\n //TODO end of above TODO\r\n\r\n expectedMatchRecordIds.put(\"ISSNMatcher\", 14); //confirmed\r\n expectedMatchRecords.put (\"ISSNMatcher\", 2); //confirmed\r\n\r\n expectedMatchRecordIds.put(\"ISBNMatcher\", 78); //TODO confirm both of these\r\n expectedMatchRecords.put (\"ISBNMatcher\", 23);\r\n\r\n expectedMatchRecordIds.put(\"x024aMatcher\", 3); //confirmed\r\n expectedMatchRecords.put (\"x024aMatcher\", 3); //confirmed\r\n\r\n expectedMatchRecordIds.put(\"LccnMatcher\", 49); //TODO confirm both of these\r\n expectedMatchRecords.put (\"LccnMatcher\", 8);\r\n\r\n expectedMatchRecordIds.put(\"SystemControlNumberMatcher\", 92); //TODO confirm both of these\r\n expectedMatchRecords.put (\"SystemControlNumberMatcher\", 27);\r\n\r\n\r\n /*\r\n rule 2 matchsets?:\r\n- *** Matchset: {62, 160, 201, }\r\n- *** Matchset: {10, 29, 52, 66, 132, 171, 205, 255, }\r\n- *** Matchset: {33, 71, 113, 137, 175, 207, 262, }\r\n\r\n 035 matchsets?:\r\n- *** Matchset: {1, 25, 48, 94, 107, 167, 197, 234, 251, 316, }\r\n- *** Matchset: {3, 27, 50, 64, 96, 109, 162, 169, 203, 236, 253, 318, }\r\n- *** Matchset: {31, 68, 111, 134, 173, 238, 257, 320, }\r\n- *** Matchset: {12, 73, 98, 115, 177, 209, 264, 324, }\r\n- *** Matchset: {5, 14, 35, 54, 75, 100, 117, 179, 240, 267, 326, }\r\n- *** Matchset: {56, 58, 82, 121, 141, 164, 185, 211, 243, 275, 329, }\r\n- *** Matchset: {22, 60, 89, 104, 125, 154, 191, 222, 248, 308, 312, 333, }\r\n */\r\n\r\n expectedResults.add(getExpectedMatchSet(new long[]{5,14,35,54,75,100,117,179,240,267,326}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{22,60,89,104,125,154,191,222,248,308,312,333}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{56,58,82,121,141,164,185,211,243,275,329}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{12,73,98,115,177,209,264,324}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{31,68,111,134,173,238,257,320}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{3,27,50,64,96,109,162,169,203,236,253,318}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{1,25,48,94,107,167,197,234,251,316}));\r\n\r\n expectedResults.add(getExpectedMatchSet(new long[]{62, 160, 201}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{10, 29, 52, 66, 132, 171, 205, 255}));\r\n expectedResults.add(getExpectedMatchSet(new long[]{33, 71, 113, 137, 175, 207, 262}));\r\n }", "private void setupNewMatch() {\n\t\tif (!startupSettings.getKeepMatchStartSettings()) {\n\t\t\tcurrentMatchSettings.setMakerFactory(startView.setupMaker(globalSettings.getMakers()));\n\t\t\tcurrentMatchSettings.setBreakerFactory(startView.setupBreaker(globalSettings.getBreakers()));\n\t\t\tcurrentMatchSettings.resetLengthAttempts();\n\t\t\tif (startView.askNewLengthsAndAttempts()) {\n\t\t\t\tcurrentMatchSettings\n\t\t\t\t\t\t.setAttempts(startView.askNewAttempts(currentMatchSettings.getLowTresholdAttempts()));\n\t\t\t\tcurrentMatchSettings.setSequenceLength(startView.askNewLength(\n\t\t\t\t\t\tcurrentMatchSettings.getLowTresholdLength(), currentMatchSettings.getHighTresholdLength()));\n\t\t\t}\n\t\t}\n\t\tsetCurrentMatch(this.matchBuilder());\n\t}", "public void setUriInfo(UriInfo uriInfo) {\n this._uriInfo = uriInfo;\n }", "protected DomainMatcher createDomainMatcher() {\r\n\t\treturn new RegisteredConstraintLinkMatcher();\r\n\t}", "public void setUri(URI uri)\n {\n this.uri = uri;\n }", "protected Matcher getMatcher() {\n return matcher;\n }", "@Test\n public void testMatchValid() {\n Matcher mtch = filter.getMatcher(FULL_URI);\n assertTrue(\"no match\", filter.isResourceAccess(mtch));\n }", "public URIBuilder(final URI uri) {\n super();\n digestURI(uri);\n }", "public UriSegment(String uriSegment) {\n this.pattern = extractPattern(uriSegment);\n this.paramId = extractParamId();\n this.paramClass = extractParamClass();\n this.paramField = extractParamField();\n this.paramMethod = extractParamMethod();\n this.segments = new HashSet<>();\n }", "public QueryLocator() {\n this(new Random().nextInt(1024));\n }", "public MMExptTupleMatcher( AbstractConceptMatcher matcher ) {\n if ( matcher != null ) {\n this.conceptMatcher = matcher;\n } else {\n this.conceptMatcher = new kb.matching.SynonymConceptMatcher();\n }\n }", "public PathMatcher getPathMatcher()\n/* */ {\n/* 559 */ return this.pathMatcher;\n/* */ }", "public void setUri(URI uri) {\n this.uri = uri;\n }", "public void setUri(URI uri) {\n this.uri = uri;\n }", "public void initialise(IMatcherConfig config) {\n\n\t\tcoreMatcher.initialise(config);\n\t\tcustomisers.initialisePostStoreBuild();\n\t}", "private JBurgPatternMatcher()\n\t{\n\t}", "public Template match(URI uri, URI base)\n {\n if (uri == null) throw new IllegalArgumentException(\"URI being matched cannot be null\");\n if (base == null) throw new IllegalArgumentException(\"Base URI cannot be null\");\n if (!uri.isAbsolute()) throw new IllegalArgumentException(\"URI being matched \\\"\" + uri + \"\\\" is not absolute\");\n if (base.relativize(uri).equals(uri)) throw new IllegalArgumentException(\"URI being matched \\\"\" + uri + \"\\\" is not relative to the base URI \\\"\" + base + \"\\\"\");\n \n StringBuilder path = new StringBuilder();\n // instead of path, include query string by relativizing request URI against base URI\n path.append(\"/\").append(base.relativize(uri));\n return match(getOntology(), path);\n }", "@Override\n public Route route(AsyncRequest request) {\n R route = matchByUri(request);\n if (route == null) {\n route = matchAll(request);\n }\n if (route == null) {\n return null;\n }\n return route.route;\n }", "@Override\n\tpublic Cursor query(Uri uri, String[] projection, String selection,\n\t\t\tString[] selectionArgs, String sortOrder) {\n\t\tDbHelper db=new DbHelper(getContext());\n\t\tSQLiteDatabase database=db.getReadableDatabase();\n\t\tLog.i(\"MATCHER.match(uri)\", MATCHER.match(uri)+\"\");\n\t\t\n\t\tswitch (MATCHER.match(uri)) {\n\t\tcase 1:\n\t\t\treturn database.query(\"user\", projection, selection, selectionArgs, null, null, sortOrder);\n\t\tcase 2:\n\t\t\tlong id=ContentUris.parseId(uri);\n\t\t\tString where=\"id=\"+id;\n\t\t\tif(selection!=null && !\"\".equals(selection)){ \n where = selection + \" and \" + where; \n } \n return database.query(\"user\", projection, where, selectionArgs, null, null, sortOrder);\n\t\tdefault:\n\t\t\tthrow new IllegalArgumentException(\"Unkwon Uri:\"+ uri.toString()); \n\t\t}\n\t\t\n\t}", "private void m26dj(com.google.android.apps.nexuslauncher.search.SearchResult r8) {\n /*\n r7 = this;\n android.net.Uri$Builder r0 = new android.net.Uri$Builder\n r0.<init>()\n java.lang.String r1 = \"content\"\n android.net.Uri$Builder r0 = r0.scheme(r1)\n java.lang.String r1 = com.google.android.apps.nexuslauncher.search.AppSearchProvider.AUTHORITY\n android.net.Uri$Builder r0 = r0.authority(r1)\n java.lang.String r1 = r8.mQuery\n android.net.Uri$Builder r0 = r0.appendPath(r1)\n android.net.Uri r2 = r0.build()\n r0 = 0\n android.content.Context r1 = r7.mContext // Catch:{ all -> 0x005f }\n android.content.ContentResolver r1 = r1.getContentResolver() // Catch:{ all -> 0x005f }\n r3 = 0\n r4 = 0\n r5 = 0\n r6 = 0\n android.database.Cursor r1 = r1.query(r2, r3, r4, r5, r6) // Catch:{ all -> 0x005f }\n if (r1 == 0) goto L_0x004e\n java.lang.String r0 = \"suggest_intent_data\"\n int r0 = r1.getColumnIndex(r0) // Catch:{ all -> 0x004c }\n L_0x0032:\n boolean r2 = r1.moveToNext() // Catch:{ all -> 0x004c }\n if (r2 == 0) goto L_0x004e\n java.util.ArrayList<com.android.launcher3.util.ComponentKey> r2 = r8.mApps // Catch:{ all -> 0x004c }\n java.lang.String r3 = r1.getString(r0) // Catch:{ all -> 0x004c }\n android.net.Uri r3 = android.net.Uri.parse(r3) // Catch:{ all -> 0x004c }\n android.content.Context r4 = r7.mContext // Catch:{ all -> 0x004c }\n com.android.launcher3.util.ComponentKey r3 = com.google.android.apps.nexuslauncher.search.AppSearchProvider.uriToComponent(r3, r4) // Catch:{ all -> 0x004c }\n r2.add(r3) // Catch:{ all -> 0x004c }\n goto L_0x0032\n L_0x004c:\n r8 = move-exception\n goto L_0x0061\n L_0x004e:\n if (r1 == 0) goto L_0x0053\n r1.close()\n L_0x0053:\n android.os.Handler r0 = r7.mUiHandler\n r1 = 200(0xc8, float:2.8E-43)\n android.os.Message r8 = android.os.Message.obtain(r0, r1, r8)\n r8.sendToTarget()\n return\n L_0x005f:\n r8 = move-exception\n r1 = r0\n L_0x0061:\n if (r1 == 0) goto L_0x0066\n r1.close()\n L_0x0066:\n throw r8\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.apps.nexuslauncher.search.SearchThread.m26dj(com.google.android.apps.nexuslauncher.search.SearchResult):void\");\n }", "public BodyMatchesRegexAnalyzer(BodyRegexProperties properties) {\n super(properties);\n this.pattern = Pattern.compile(properties.getPattern());\n }", "public RoundhousePatternMatcher(A_PatternMatcher parent) {\n super(parent, \"ROUNDHOUSE\");\n }", "void setDefaultEndpointUri(String endpointUri);", "public URIImpl(String uriString) {\r\n\t\tthis(uriString, true);\r\n\t}", "void updateMatcher() {\r\n int begin = getPosition();\r\n int end = getText().length();\r\n // System.out.println(begin + \",\" + end);\r\n matcher.reset(getText());\r\n matcher.region(begin, end);\r\n }", "@Test\n public void testSetUri() {\n System.out.println(\"setUri\");\n }", "public void setUri(String uri) {\n this.uri = uri;\n }", "public void setUri(String uri) {\n this.uri = uri;\n }", "public void setUri(String uri) {\n this.uri = uri;\n }", "@Override\n public Set<Restaurant> getMatches(String queryString) {\n\n /* Setup grammar listener */\n CharStream stream = new ANTLRInputStream(queryString);\n QueryLexer lexer = new QueryLexer(stream);\n TokenStream tokens = new CommonTokenStream(lexer);\n QueryParser parser = new QueryParser(tokens);\n ParseTree tree = parser.root();\n ParseTreeWalker walker = new ParseTreeWalker();\n\n // Setup custom walker\n QueryCreator creator = new QueryCreator();\n walker.walk(creator, tree);\n\n Set<Restaurant> matches = new HashSet<Restaurant>();\n RestaurantHandle rH = creator.getHandle();\n Expression expTree = creator.getExpression();\n\n // Look through every restaurant, if one matches query add it to the set\n for (Restaurant r : this.restaurantMap.values()) {\n rH.setRestaurant(r);\n if (expTree.eval()) {\n matches.add(r);\n }\n }\n\n return matches;\n }", "public void testGetURI() {\n }", "private Matcher locationMatches(String location) {\n return PATTERN.matcher(location);\n }", "@Override\n\tpublic PathMatcher getPathMatcher(String arg0) {\n\t\treturn null;\n\t}", "public RegularExpressionValueMatcher() {\n\t\tthis(null);\n\t}", "public void setRequestURI(URI requestURI);", "public void setUri( final String uri )\r\n {\r\n this.uri = uri;\r\n }", "@Override\r\n public List<String> getMatchedURIs() {\n return null;\r\n }", "public interface ActionMatcher {\n boolean match(Action action, ActionParameters actionUri);\n}", "@Override\n public Cursor query(@NonNull Uri uri, String[] projection, String selection,\n String[] selectionArgs, String sortOrder) {\n final SQLiteDatabase db = mRecipeDbHelper.getReadableDatabase();\n\n // Write URI match code and set a variable to return a Cursor\n int match = sUriMatcher.match(uri);\n Cursor retCursor;\n String id;\n switch (match) {\n // Query for the recipes directory\n case RECIPES:\n Log.d(TAG, \"Retrieving all recipes\");\n retCursor = db.query(RecipeContract.RecipeEntry.TABLE_NAME_RECIPES,\n projection,\n selection,\n selectionArgs,\n null,\n null,\n sortOrder);\n break;\n case RECIPE_WITH_ID:\n id = uri.getPathSegments().get(1);\n Log.d(TAG, \"Retrieving recipe: \" + id);\n retCursor = db.query(RecipeContract.RecipeEntry.TABLE_NAME_RECIPES,\n projection,\n \"id=?\",\n new String[]{id},\n null,\n null,\n sortOrder);\n break;\n // Query for the ingredients directory\n case INGREDIENTS:\n Log.d(TAG, \"Retrieving all ingredients\");\n retCursor = db.query(RecipeContract.IngredientsEntry.TABLE_NAME_INGREDIENTS,\n projection,\n selection,\n selectionArgs,\n null,\n null,\n sortOrder);\n break;\n case INGREDIENTS_WITH_ID:\n id = uri.getPathSegments().get(1);\n Log.d(TAG, \"Retrieving ingredients for recipe: \" + id);\n retCursor = db.query(RecipeContract.IngredientsEntry.TABLE_NAME_INGREDIENTS,\n projection,\n RecipeContract.IngredientsEntry.COLUMN_INGREDIENTS_PARENT_ID + \"=?\",\n new String[]{id},\n null,\n null,\n sortOrder);\n break;\n // Query for the recipes directory\n case STEPS:\n Log.d(TAG, \"Retrieving all steps\");\n retCursor = db.query(RecipeContract.StepsEntry.TABLE_NAME_STEPS,\n projection,\n selection,\n selectionArgs,\n null,\n null,\n sortOrder);\n break;\n case STEPS_WITH_ID:\n id = uri.getPathSegments().get(1);\n Log.d(TAG, \"Retrieving steps for recipe: \" + id);\n retCursor = db.query(RecipeContract.StepsEntry.TABLE_NAME_STEPS,\n projection,\n RecipeContract.StepsEntry.COLUMN_STEPS_PARENT_ID + \"=?\",\n new String[]{id},\n null,\n null,\n sortOrder);\n break;\n // Default exception\n default:\n throw new UnsupportedOperationException(\"Unknown uri: \" + uri);\n }\n\n // Set a notification URI on the Cursor and return that Cursor\n retCursor.setNotificationUri(getContext().getContentResolver(), uri);\n\n // Return the desired Cursor\n return retCursor;\n }", "public UriParser(String uri) {\n try {\n checkedParse(uri);\n\n } catch (URISyntaxException e) {\n throw new RuntimeException(e);\n }\n }", "@Override\n public void resolveUrls(KeycloakUriBuilder authUrlBuilder) {\n }", "public NameBuilderInfoImpl(Matcher matcher) {\n\t\tthis.matcher = matcher;\n\t}", "public void suit_me_listner(Uri uri);", "public void setUri(java.lang.String uri) {\n this.uri = uri;\n }", "public void configure() {\n from(\"as2://\" + PATH_PREFIX + \"/listen?requestUriPattern=/\")\n .to(\"mock:as2RcvMsgs\");\n\n // test route processing exception\n Processor failingProcessor = new Processor() {\n public void process(org.apache.camel.Exchange exchange) throws Exception {\n throw new Exception(PROCESSOR_EXCEPTION_MSG);\n }\n };\n from(\"as2://\" + PATH_PREFIX + \"/listen?requestUriPattern=/process_error\")\n .process(failingProcessor)\n .to(\"mock:as2RcvMsgs\");\n\n // test route for listen with custom MDN parameters\n from(\"as2://\" + PATH_PREFIX\n + \"/listen?requestUriPattern=/mdnTest&from=MdnTestFrom&subject=MdnTestSubjectPrefix\")\n .to(\"mock:as2RcvMsgs\");\n }", "protected void internalSetUris(String[] uris) {\n m_uris = uris;\n m_prefixes = new String[uris.length];\n m_prefixes[0] = \"\";\n m_prefixes[1] = \"xml\";\n }", "public TokenMatcherList() {\n matcherList = new ArrayList<>();\n }", "@Override\r\n public void initialize(URL url, ResourceBundle rb) {\r\n txtSearch.textProperty().addListener(new ChangeListener<String>() {\r\n @Override\r\n public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {\r\n Bookfy.setSearch(newValue);\r\n }\r\n });\r\n }", "public void setUri(final URI uri) {\n this.uri = uri;\n }", "private void setupSearchView() {\r\n searchView = rootView.findViewById(R.id.search_view);\r\n searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {\r\n private Timer timer = new Timer();\r\n\r\n /**\r\n * action lors de la soumission du texte\r\n * @param query le texte rentré par l'utilisateur dans le champs qui sert à rechercher un animé\r\n * @return un booléen\r\n */\r\n @Override\r\n public boolean onQueryTextSubmit(String query) {\r\n return false;\r\n }\r\n\r\n /**\r\n * action lorsque le texte du champs dédié à la recherche change\r\n * @param s le texte dans le champs dédié à la recherche\r\n * @return un booléen\r\n */\r\n @Override\r\n public boolean onQueryTextChange(final String s) {\r\n if (s.length() == 0) {\r\n animeSearchViewModel.cancelSubscription();\r\n } else {\r\n timer.cancel();\r\n timer = new Timer();\r\n int sleep = 350;\r\n if (s.length() == 1)\r\n sleep = 5000;\r\n else if (s.length() <= 3)\r\n sleep = 300;\r\n else if (s.length() <= 5)\r\n sleep = 200;\r\n timer.schedule(new TimerTask() {\r\n @Override\r\n public void run() {\r\n animeSearchViewModel.searchAnimes(s);\r\n }\r\n }, sleep);\r\n }\r\n return true;\r\n }\r\n });\r\n }", "public boolean matchesRegex(URI uri);", "public void setUri(String uri) {\n\t\tthis.uri = uri;\n\t}", "public void compute() {\r\n this.host = \".*\";\r\n this.hostPattern = new Pattern(host);\r\n // staticDir\r\n if (action.startsWith(\"staticDir:\")) {\r\n if (!method.equalsIgnoreCase(\"*\") && !method.equalsIgnoreCase(\"GET\")) {\r\n Logger.warn(\"Static route only support GET method\");\r\n return;\r\n }\r\n if (!this.path.endsWith(\"/\") && !this.path.equals(\"/\")) {\r\n Logger.warn(\"The path for a staticDir route must end with / (%s)\", this);\r\n this.path += \"/\";\r\n }\r\n this.pattern = new Pattern(\"^\" + path + \"({resource}.*)$\");\r\n this.staticDir = action.substring(\"staticDir:\".length());\r\n } else {\r\n // URL pattern\r\n // Is there is a host argument, append it.\r\n if (!path.startsWith(\"/\")) {\r\n String p = this.path;\r\n this.path = p.substring(p.indexOf(\"/\"));\r\n this.host = p.substring(0, p.indexOf(\"/\"));\r\n\r\n Matcher m = new Pattern(\".*\\\\{({name}.*)\\\\}.*\").matcher(host);\r\n\r\n if (m.matches()) {\r\n String name = m.group(\"name\");\r\n hostArg = new Arg();\r\n hostArg.name = name;\r\n }\r\n this.host = this.host.replaceFirst(\"\\\\{.*\\\\}\", \"\");\r\n this.hostPattern = new Pattern(host);\r\n }\r\n String patternString = path;\r\n patternString = customRegexPattern.replacer(\"\\\\{<[^/]+>$1\\\\}\").replace(patternString);\r\n Matcher matcher = argsPattern.matcher(patternString);\r\n while (matcher.find()) {\r\n Route.Arg arg = new Arg();\r\n arg.name = matcher.group(2);\r\n arg.constraint = new Pattern(matcher.group(1));\r\n args.add(arg);\r\n }\r\n\r\n patternString = argsPattern.replacer(\"({$2}$1)\").replace(patternString);\r\n this.pattern = new Pattern(patternString);\r\n // Action pattern\r\n patternString = action;\r\n patternString = patternString.replace(\".\", \"[.]\");\r\n for (Route.Arg arg : args) {\r\n if (patternString.contains(\"{\" + arg.name + \"}\")) {\r\n patternString = patternString.replace(\"{\" + arg.name + \"}\", \"({\" + arg.name + \"}\" + arg.constraint.toString() + \")\");\r\n actionArgs.add(arg.name);\r\n }\r\n }\r\n actionPattern = new Pattern(patternString, REFlags.IGNORE_CASE);\r\n }\r\n }", "private void buildExtractionRoutes(String workItemQueueUri, String parserQueueUri) {\n\n // routeId: extraction\n from(workItemQueueUri).routeId(\"extraction\")\n .bean(batchJobManager, \"prepareTenantContext\").choice()\n .when(header(INGESTION_MESSAGE_TYPE).isEqualTo(MessageType.ERROR.name()))\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Error in processing. Routing to stop.\").to(\"direct:stop\")\n\n .when(header(INGESTION_MESSAGE_TYPE).isEqualTo(MessageType.BATCH_REQUEST.name()))\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Routing to ControlFileProcessor.\").process(ctlFileProcessor)\n .to(\"direct:assembledJobs\")\n\n .when(header(INGESTION_MESSAGE_TYPE).isEqualTo(MessageType.PURGE.name()))\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Purge command. Routing to PurgeProcessor.\")\n .process(purgeProcessor).to(\"direct:stop\")\n\n .when(header(INGESTION_MESSAGE_TYPE).isEqualTo(MessageType.CONTROL_FILE_PROCESSED.name()))\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Routing to zipFileSplitter.\")\n .choice()\n .when().method(batchJobManager, \"isEligibleForDeltaPurge\")\n .beanRef(\"deltaHashPurgeProcessor\")\n .endChoice()\n .split().method(\"ZipFileSplitter\", \"splitZipFile\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Zip file split\").to(parserQueueUri);\n\n from(parserQueueUri).routeId(\"edFiParser\")\n .bean(batchJobManager, \"prepareTenantContext\")\n .log(LoggingLevel.INFO, \"File entry received. Processing: ${body}\")\n .beanRef(\"edFiParserProcessor\")\n .to(\"direct:fileEntryLatch\");\n\n from(\"direct:deltaFilter\").routeId(\"deltaFilter\")\n .bean(batchJobManager, \"prepareTenantContext\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Batch of ${body.neutralRecords.size} is recieved for delta processing\")\n .beanRef(\"deltaFilterProcessor\")\n .choice()\n .when(header(INGESTION_MESSAGE_TYPE).isEqualTo(MessageType.PERSIST_REQUEST.name()))\n .choice()\n .when()\n .method(batchJobManager, \"isDryRun\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Dry-run specified. Bypassing persistence.\")\n .otherwise()\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Routing to PersistenceProcessor.\")\n .to(\"direct:persister\");\n\n from(\"direct:persister\").routeId(\"persister\")\n .bean(batchJobManager, \"prepareTenantContext\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Batch of ${body.neutralRecords.size} is recieved to persist\")\n .beanRef(\"persistenceProcessor\");\n\n // file entry Latch\n from(\"direct:fileEntryLatch\").routeId(\"fileEntryLatch\")\n .bean(batchJobManager, \"prepareTenantContext\")\n .log(LoggingLevel.INFO, \"Removing file entry from latch. Processing: ${body}\")\n .choice()\n .when().method(\"fileEntryLatch\", \"lastFileProcessed\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"FileEntryWorkNote latch opened.\")\n .to(\"direct:stop\");\n\n // routeId: assembledJobs\n from(\"direct:assembledJobs\").routeId(\"assembledJobs\")\n .bean(batchJobManager, \"prepareTenantContext\").choice().when()\n .method(batchJobManager, \"hasErrors\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Error in processing. Routing to stop.\").to(\"direct:stop\")\n .otherwise().to(workItemQueueUri);\n\n // end of routing\n from(\"direct:stop\").routeId(\"stop\")\n .bean(batchJobManager, \"prepareTenantContext\")\n .log(LoggingLevel.INFO, \"CamelRouting\", \"Routing to JobReportingProcessor.\")\n .process(jobReportingProcessor).log(LoggingLevel.INFO, \"CamelRouting\", \"Stop. Job routing complete.\")\n .stop();\n }", "private URI lookupURI(URI imdbURI) throws IOException,\n URISyntaxException {\n // lookup uri if not yet set\n String imdbString = IMDBLink.getMovieURIString(target\n .getMovieTitle(), target.getYear());\n if (imdbString != null) {\n imdbURI = new URI(imdbString);\n target.setIMDBMovieURI(imdbURI);\n }\n return imdbURI;\n }", "public void setUri(final String uri) {\r\n\t\tthis.uri = uri;\r\n\t}", "public void doInitFilterPattern() {\n if (includeRegex != null) {\n includePattern = Pattern.compile(includeRegex);\n }\n }", "private void initialize(){\n if(uri != null)\n httpUriRequest = getHttpGet(uri);\n httpClient = HttpClients.createDefault();\n }", "Optional<RuleMatch<T>> match(Request message) throws InvalidUriException;", "public void uriParse() {\n uri = Uri.parse(getUrlVideo());\n }", "public AnyUriPanel() {\r\n String[] entries = Util.addNoSelectionEntry(Configuration.getInstance().getAddressTypes());\r\n addressTypeModel = new DefaultComboBoxModel(entries);\r\n\r\n model = new AnyUriModel();\r\n initComponents();\r\n }", "private void initialize(URI p_other) {\n m_scheme = p_other.getScheme();\n m_userinfo = p_other.getUserinfo();\n m_host = p_other.getHost();\n m_port = p_other.getPort();\n m_regAuthority = p_other.getRegBasedAuthority();\n m_path = p_other.getPath();\n m_queryString = p_other.getQueryString();\n m_fragment = p_other.getFragment();\n }", "@Override\r\n public List<String> getMatchedURIs(boolean arg0) {\n return null;\r\n }", "@Override\n protected void initListeners() {\n this.adapter.setOnItemClickListener((view, i) -> {\n final String className = classes.get(i).getSimpleName();\n if (SmartRouterSampleActivity.class.getSimpleName().equals(className)) {\n SmartRouters.start(this,\n MainApplication.getScheme() + \"://\" +\n \"router-0x01?\" +\n \"char=z&\" +\n \"byte=x&\" +\n \"short=2&\" +\n \"int=233&\" +\n \"float=233.233&\" +\n \"double=2333.2333&\" +\n \"long=2333&\" +\n \"boolean=true&\" +\n \"boxedCharacter=Z&\" +\n \"boxedByte=u&\" +\n \"boxedShort=3&\" +\n \"boxedInteger=1233&\" +\n \"boxedFloat=1233.233&\" +\n \"boxedDouble=12333.2333&\" +\n \"boxedLong=12333&\" +\n \"boxedBoolean=true&\" +\n \"boxedString=CaMnter\"\n );\n } else if (CustomRouterActivity.class.getSimpleName().equals(className)) {\n /*\n * In Application:\n *\n * SmartRouters.register(new Router<CustomRouterActivity>() {\n *\n * @Override\n * public void register(@NonNull Map<String, Class<? extends Activity>> routerMapping) {\n * routerMapping.put(SmartRouters.getScheme() + \"://\" + \"router-0x02\",\n * CustomRouterActivity.class);\n * }\n *\n *\n * @Override\n * public void setFieldValue(@NonNull CustomRouterActivity activity) {\n * final Intent intent = activity.getIntent();\n * final Uri uri = intent.getData();\n * if (uri == null) return;\n *\n * activity.exampleBoxedString = uri.getQueryParameter(\"boxedString\");\n * }\n *\n * });\n */\n SmartRouters.start(this,\n MainApplication.getScheme() + \"://\" +\n \"router-0x02?\" +\n \"boxedString=CaMnter\"\n );\n } else if (RouterCenterActivity.class.getSimpleName().equals(className)) {\n startActivity(new Intent(Intent.ACTION_VIEW,\n Uri.parse(\"smart-routers://router-0x02?boxedString=CaMnter\")));\n }\n });\n }", "public SearchOptions(Edge[] edgesToSearch, Pattern regexPattern) {\n this.edgesToSearch = edgesToSearch;\n this.regexPattern = regexPattern;\n searchNodes = false;\n checkEdgesToSearch();\n }", "public void setRequestUri(String requestUri){\n this.requestUri = requestUri;\n }", "interface UriBuilderFactory {\n UriBuilder fromLink(Link link);\n\n UriBuilder fromPath(String s);\n\n UriBuilder fromUri(URI uri);\n}", "@Override\n\tpublic void initialize(URL location, ResourceBundle resources) {\n\t\tsearch_sup();\n\t\tsearch_unit();\n\t}", "public RegexPatternBuilder ()\n {\n this.regex = null;\n }", "public void setURIResolver(URIResolver resolver){\n m_uriResolver=resolver;\n }", "private void initializeScheme(String p_uriSpec)\n throws MalformedURIException {\n int uriSpecLen = p_uriSpec.length();\n int index = 0;\n String scheme = null;\n char testChar = '\\0';\n \n while (index < uriSpecLen) {\n testChar = p_uriSpec.charAt(index);\n if (testChar == ':' || testChar == '/' ||\n testChar == '?' || testChar == '#') {\n break;\n }\n index++;\n }\n scheme = p_uriSpec.substring(0, index);\n \n if (scheme.length() == 0) {\n throw new MalformedURIException(\"No scheme found in URI.\");\n }\n else {\n setScheme(scheme);\n }\n }", "private void setupInitialValues(){\n\t\tString testDir = getTestDir();\n\t\tsetDirectoryInfoLabel(testDir);\n\t\tlastChoosedDirectory = new File(testDir);\n\t\tregexFrom.setText(sampleRegexFrom);\n\t\tregexTo.setText(sampleRegexTo);\n\t}" ]
[ "0.7129261", "0.6921357", "0.6778768", "0.6732481", "0.6682457", "0.6522157", "0.647808", "0.6258068", "0.61746806", "0.60199755", "0.57745963", "0.5596773", "0.55903673", "0.55671823", "0.54677117", "0.54473144", "0.53396446", "0.52932274", "0.5228242", "0.51568455", "0.5083242", "0.49862552", "0.49861112", "0.49552017", "0.49139953", "0.4909957", "0.4875138", "0.48409215", "0.48182574", "0.47922692", "0.47899312", "0.47732052", "0.47691193", "0.47637892", "0.4735175", "0.4711306", "0.47085217", "0.46715042", "0.46710378", "0.46681416", "0.4667509", "0.4667509", "0.46601975", "0.46507043", "0.4638086", "0.46253303", "0.46081007", "0.4606939", "0.460038", "0.45975614", "0.4591776", "0.45753622", "0.4568322", "0.45592988", "0.45538953", "0.45538953", "0.45538953", "0.45490965", "0.45457345", "0.45454967", "0.45436904", "0.4540636", "0.4539355", "0.45184308", "0.45160323", "0.45134252", "0.45117697", "0.45038694", "0.44857925", "0.44834206", "0.44831374", "0.44719362", "0.44712934", "0.44650736", "0.44618946", "0.44600964", "0.44574705", "0.44524026", "0.4441587", "0.44332802", "0.44249293", "0.44222966", "0.4422245", "0.44208816", "0.44040698", "0.43997458", "0.4391852", "0.4388074", "0.43842986", "0.43811396", "0.43775344", "0.43704692", "0.43438435", "0.4336193", "0.43350464", "0.43330616", "0.43325183", "0.43302625", "0.43258834", "0.43224248" ]
0.7373394
0
All queries for this provider are for the search suggestion and shortcut refresh mime type.
@Override public String getType(Uri uri) { switch (sURIMatcher.match(uri)) { case SEARCH_SUGGEST: return SearchManager.SUGGEST_MIME_TYPE; case SHORTCUT_REFRESH: return SearchManager.SHORTCUT_MIME_TYPE; default: throw new IllegalArgumentException("Unknown URL " + uri); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void findSuggestions(String query) {\n \t\tif (suggestionsLoaderClient != null) {\n \t\t\tif (query.length() == 0) {\n \t\t\t\tsuggestionsLoaderClient.doLoadSuggestions(\"default-query\",\n \t\t\t\t\t\tlimit);\n \t\t\t} else {\n \t\t\t\tsuggestionsLoaderClient.doLoadSuggestions(query, limit);\n \t\t\t}\n \t\t}\n \t}", "@Override\r\n public boolean onQueryTextSubmit(String query) {\n searchAdapter.setSearchResults(DataCache.getInstance().getSearchResults(query));\r\n return false;\r\n }", "@Override\n public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {\n if (arg1 == EditorInfo.IME_ACTION_SEARCH) {\n sw_refresh.setRefreshing(true);\n query();\n }\n return false;\n }", "public String getSearchHint();", "public void performSearch() {\n OASelect<QueryInfo> sel = getQueryInfoSearch().getSelect();\n sel.setSearchHub(getSearchFromHub());\n sel.setFinder(getFinder());\n getHub().select(sel);\n }", "public void setQueryType(String queryType);", "public void refreshSuggestionList() {\n \t\tif (isAttached()) {\n \t\t\trefreshSuggestions();\n \t\t}\n \t}", "@Override\n\tpublic void suggestExchange() {\n\t\t\n\t}", "public interface SearchQuerySet extends QuerySet\n{\n\n // for AbstractSearch\n public static final int STAT_MODELS = 1;\n public static final int STAT_CLUSTERS = 2;\n public static final int STAT_GENOMES = 4;\n public static final int STAT_MODEL_CLUSTERS = 8;\n\n public String getStatsById(Collection data);\n public String getStatsByQuery(String query);\n public String getStatsById(Collection data,int stats);\n public String getStatsByQuery(String query,int stats);\n \n // for BlastSearch\n public String getBlastSearchQuery(Collection dbNames, Collection keys, KeyTypeUser.KeyType keyType);\n \n //for ClusterIDSearch\n public String getClusterIDSearchQuery(Collection input, int limit, int[] DBs, KeyTypeUser.KeyType keyType);\n \n // for ClusterNameSearch\n public String getClusterNameSearchQuery(Collection input, int limit, int[] DBs, KeyTypeUser.KeyType keyType);\n \n // for DescriptionSearch\n public String getDescriptionSearchQuery(Collection input, int limit, int[] DBs, KeyTypeUser.KeyType keyType);\n \n // for GoSearch \n public String getGoSearchQuery(Collection input, int limit, KeyTypeUser.KeyType keyType);\n \n // for GoTextSearch\n public String getGoTextSearchQuery(Collection input, int limit, KeyTypeUser.KeyType keyType);\n \n // for IdSearch\n public String getIdSearchQuery(Collection input, int limit, int[] DBs, KeyTypeUser.KeyType keyType);\n \n // for QueryCompSearch\n public String getQueryCompSearchQuery(String comp_id, String status, KeyTypeUser.KeyType keyType);\n \n // for QuerySearch\n public String getQuerySearchQuery(String queries_id, KeyTypeUser.KeyType keyType); \n \n // for SeqModelSearch\n public String getSeqModelSearchQuery(Collection model_ids, KeyTypeUser.KeyType keyType);\n \n // for UnknowclusterIdSearch\n public String getUnknownClusterIdSearchQuery(int cluster_id, KeyTypeUser.KeyType keyType);\n \n // for ProbeSetSearch\n public String getProbeSetSearchQuery(Collection input, int limit, KeyTypeUser.KeyType keyType);\n \n // for ProbeSetKeySearch\n public String getProbeSetKeySearchQuery(Collection input, int limit, KeyTypeUser.KeyType keyType);\n \n // for QueryTestSearch\n public String getQueryTestSearchQuery(String query_id, String version, String genome_id);\n \n // for QueryStatsSearch\n public String getQueryStatsSearchQuery(List query_ids,List DBs);\n \n // for PskClusterSearch\n public String getPskClusterSearchQuery(int cluster_id,KeyTypeUser.KeyType keyType);\n \n // for ClusterCorrSearch\n public String getClusterCorrSearchQuery(int cluster_id, int psk_id, KeyTypeUser.KeyType keyType);\n \n // for UnknownGenesSearch\n public String getUnknownGenesSearchQuery(Collection sources, KeyTypeUser.KeyType keyType);\n \n}", "public String getQueryType();", "public String getQueryType();", "private void queryList (String query) {\n\t\tmemoListAdapter.query(query);\n\t}", "@Override\r\n public boolean onQueryTextSubmit(String query) {\n searchView.setQuery(\"\", true);\r\n searchView.setIconified(true);\r\n AuxiliarHelper.getAuxiliar().setModificado(false);\r\n\r\n JSON_URL = Uri.encode(\"https://www.e-ranti.com/servicioWeb-1.0/footpathperu/producto/listar/\" + query + \"/\" + AuxiliarHelper.getAuxiliar().getIdioma() + 1, ALLOWED_URI_CHARS);\r\n jsoBandera = false;\r\n iniciarCarga();\r\n new BanderasHelper().getBandera().setBanderaInicio(true);\r\n return true;\r\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n machineAdapter.getFilter().filter(query);\n return false;\n }", "public void showSuggestionsFromServer() {\n \t\tsuggestionReadyCallback.onSuggestionsReady();\n \t}", "private void searchforResults() {\n\n List<String> queryList = new SavePreferences(this).getStringSetPref();\n if(queryList != null && queryList.size() > 0){\n Log.i(TAG, \"Searching for results \" + queryList.get(0));\n Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH);\n searchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n searchIntent.putExtra(SearchManager.QUERY, queryList.get(0));\n this.startActivity(searchIntent);\n }\n }", "@Override\n protected void query(CompletionResultSet completionRS, Document doc, int caretOffset) {\n // First, we retrieve the filters defined for the hAtom microformat completion\n String strFilter = Filter.EMPRTY_STRING;\n Filter filter = Filter.getFilter();\n \n try {\n StyledDocument styledDoc = (StyledDocument) doc; \n // Get the filter's text based on actual carte position.\n strFilter = filter.getText(styledDoc, caretOffset);\n \n } catch (Exception ex) {\n ex.printStackTrace();\n // if an error occurs, an empty filter is set, so that the completion popup \n // will be filled with all the hAtom keywords.\n strFilter = Filter.EMPRTY_STRING;\n }\n\n // Lista completa dei tag/parole chiave hAtom\n List<String> hatomTags = TagCache.getCache().getTagList();\n\n // Gets the hAtom keywords that match the given filter value.\n for (String tag : hatomTags) {\n boolean startWithFilter = tag.startsWith(strFilter); \n if (!tag.equals(Filter.EMPRTY_STRING) && startWithFilter) {\n completionRS.addItem(new HatomCompletionItem(tag, filter.getFilterOffset(), caretOffset));\n }\n }\n\n // This is required by the Netbeans API docs.\n // After finish() is invoked, no further modifications to the result set are allowed.\n completionRS.finish();\n\n }", "@Override\n public boolean onSearchRequested() {\n return super.onSearchRequested();\n }", "@ActionTrigger(action=\"KEY-ENTQRY\", function=KeyFunction.SEARCH)\n\t\tpublic void spriden_Search()\n\t\t{\n\t\t\t\n\t\t\t\texecuteAction(\"QUERY\");\n\t\t\t\tgetTask().getGoqrpls().gCheckFailure();\n\t\t\t}", "@Override\r\n public boolean onQueryTextSubmit(String query) {\r\n mPresenter.getDataBySearch(query);\r\n return false;\r\n }", "@Override\n public boolean onQueryTextSubmit(final String query) {\n Log.i(TAG, \"onQueryTextSubmit '\" + query + \"'\");\n mArtistSearch.clearFocus();\n mLatestQuery = query;\n\n mMusicServiceConnection.whenConnected(new Runnable() {\n @Override\n public void run() {\n mMusicServiceConnection.getService().findArtists(query);\n }\n });\n return true;\n }", "@NonNull\n public String getQuery() {\n return searchView.getQuery().toString();\n }", "@Override\r\n public boolean onQueryTextSubmit(String query) {\n adapter.getFilter().filter(query);\r\n return true;\r\n }", "private void handleIntent(Intent intent) {\n if (Intent.ACTION_SEARCH.equals(intent.getAction())) {\n String query = intent.getStringExtra(SearchManager.QUERY);\n Log.d(TAG, \"Received a new search query: \" + query);\n\n // show suggestion for search\n SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,\n SuggestionProvider.AUTHORITY, SuggestionProvider.MODE);\n suggestions.saveRecentQuery(query, null);\n\n // store search keyword\n PreferenceManager.getDefaultSharedPreferences(this)\n .edit()\n .putString(FlickerClient.PREF_SEARCH_QUERY, query)\n .apply();\n FragmentManager fm = getSupportFragmentManager();\n Fragment fragment = fm.findFragmentById(R.id.fragmentContainer);\n if(fragment != null) {\n // download and update photos according to search keyword\n ((FeedFragment)fragment).refresh();\n }\n }\n }", "@Override\n public void search(Uri uri) {\n }", "@Override\r\n public void onShowQueryResult() {\n }", "@Override\n\tpublic boolean onSearchRequested () {\n\t\tif (!searchMode)\n\t\t\ttoggleSearch();\n\t\treturn true;\n\t}", "@Override\n public void onSearchTermChanged() {\n }", "private String getQueryHint() {\n return ApiProperties.getProperty(\n \"api.bigr.library.\" + ApiFunctions.shortClassName(getClass().getName()) + \".hint\");\n }", "private void populateAdapter(String query) {\n // Create a matrixcursor, add suggtion strings into cursor\n final MatrixCursor c = new MatrixCursor(new String[]{ BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1 });\n List<String> suggestions = History.getSuggestion(query);\n String str = \"\";\n for (int i=0;i<suggestions.size();i++){\n c.addRow(new Object[] {i, suggestions.get(i)});\n str += suggestions.get(i);\n }\n Toast.makeText(context, str,Toast.LENGTH_SHORT).show();\n mAdapter.changeCursor(c);\n }", "private void refreshSuggestions() {\n \t\tString text = textBox.getText();\n \t\tif (text.equals(currentText)) {\n \t\t\treturn;\n \t\t} else {\n \t\t\tcurrentText = text;\n \t\t}\n \t\tfindSuggestions(text);\n \t}", "@Test\n\tpublic void testSearchBasedOnRequest2() {\n\t\tsearchBasedOnRequestSetup();\n\t\t\n\t\tPreference prefs = prefManager.getUserPreference();\n\t\tprefs.setThreshold(10000);\n\t\t\n\t\tList<Suggestion> sugg = dm.searchBasedOnRequest(\"lokeyanhao\", prefs, true);\n\t\tassertTrue(sugg.size() > 0);\n\t\tassertTrue(sugg.get(0).getType() == Suggestion.ENTITY);\n\t}", "@Override\n\tpublic void updateSuggestFuncOracle() {\n\t\tif (searchSuggestFuncTextBox != null) {\n\t\t\tMultiWordSuggestOracle multiWordSuggestOracle = (MultiWordSuggestOracle) searchSuggestFuncTextBox\n\t\t\t\t\t.getSuggestOracle();\n\t\t\tmultiWordSuggestOracle.clear();\n\t\t\tmultiWordSuggestOracle.addAll(funcNameMap.values());\n\t\t}\n\t}", "@Override\n\tpublic SuggestBox getSearchSuggestTextBox() {\n\t\treturn searchSuggestTextBox;\n\t}", "public void search() {\n try {\n for(int i = 0; i < this.queries.size(); i++){\n search(i);\n // in case of error stop\n if(!this.searchOK(i)){\n System.out.println(\"\\t\" + new Date().toString() + \" \" + db + \" Search for rest queries cancelled, because failed for query \" + i + \" : \" + this.queries.get(i));\n break;\n }\n }\n } catch (UnsupportedEncodingException ex) {\n Logger.getLogger(EntrezSearcher.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void search() {\n String q = this.query.getText();\n String cat = this.category.getValue();\n if(cat.equals(\"Book\")) {\n searchBook(q);\n } else {\n searchCharacter(q);\n }\n }", "public void updateNewSuggestParamOracle() {\n\t\tif (searchSuggestDefineTextBox != null) {\n\t\t\tCQLSuggestOracle cqlSuggestOracle = new CQLSuggestOracle(parameterNameMap.values());\n\t\t}\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n\n getMenuInflater().inflate(R.menu.menu_main, menu);\n\n // Associate searchable configuration with the SearchView\n SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);\n SearchView searchView = (SearchView) menu.findItem(R.id.menuSearch).getActionView();\n searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));\n\n searchView.setIconifiedByDefault(false);\n searchView.setFocusable(true);\n searchView.setIconified(false);\n\n\n\n if( Intent.ACTION_VIEW.equals(getIntent().getAction())){\n Intent i = new Intent(SearchActivity.this, SearchActivity.class);\n query = getIntent().getStringExtra(SearchManager.QUERY);\n i.setAction(Intent.ACTION_SEARCH);\n i.putExtra(\"query\", query);\n startActivity(i);\n\n Toast.makeText(SearchActivity.this, query, Toast.LENGTH_SHORT).show();\n }\n\n searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {\n @Override\n public boolean onQueryTextSubmit(String query) {\n // INPUT CODE HERE\n Toast.makeText(SearchActivity.this, query, Toast.LENGTH_SHORT).show();\n return false;\n }\n\n @Override\n public boolean onQueryTextChange(String newText) {\n // INPUT CODE HERE\n// String[] q = {\"promotion_name\"};\n// String[] t = {newText};\n// MySuggestionProvider suggestion = new MySuggestionProvider();\n// suggestion.query(Uri.parse(\"database.it.kmitl.ac.th/it_35\"), q, \"promotion_name LIKE %?%\", t, null);\n return false;\n }\n });\n return true;\n }", "public void refreshSuggestions() {\n resetSections(/* alwaysAllowEmptySections = */false);\n }", "@Override\n public boolean onQueryTextChange(String newText) {\n if (newText.length() >= 2) {\n Intent intent = new Intent(ACTION_QUERY_CHANGED);\n intent.putExtra(\"query\", newText);\n LocalBroadcastManager.getInstance(SearchQueryActivity.this).sendBroadcast(intent);\n }\n return false;\n }", "@Override\n public boolean onQueryTextChange(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextChange(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextChange(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextChange(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\r\n public boolean onQueryTextChange(String s) {\r\n\r\n if(s.equals(\"\")){ //When search bar is empty again the page is reloaded\r\n\r\n Intent refresh = new Intent(getApplicationContext(), MyDevicesActivity.class);\r\n\r\n startActivity(refresh);\r\n\r\n finish();\r\n\r\n }\r\n return false;\r\n }", "private void search() {\n \t\tString searchString = m_searchEditText.getText().toString();\n \n \t\t// Remove the refresh if it's scheduled\n \t\tm_handler.removeCallbacks(m_refreshRunnable);\n \t\t\n\t\tif ((searchString != null) && (!searchString.equals(\"\"))) {\n \t\t\tLog.d(TAG, \"Searching string: \\\"\" + searchString + \"\\\"\");\n \n \t\t\t// Save the search string\n \t\t\tm_lastSearch = searchString;\n \n \t\t\t// Disable the Go button to show that the search is in progress\n \t\t\tm_goButton.setEnabled(false);\n \n \t\t\t// Remove the keyboard to better show results\n \t\t\t((InputMethodManager) this\n \t\t\t\t\t.getSystemService(Service.INPUT_METHOD_SERVICE))\n \t\t\t\t\t.hideSoftInputFromWindow(m_searchEditText.getWindowToken(),\n \t\t\t\t\t\t\t0);\n \n \t\t\t// Start the search task\n \t\t\tnew HTTPTask().execute(searchString);\n \t\t\t\n \t\t\t// Schedule the refresh\n \t\t\tm_handler.postDelayed(m_refreshRunnable, REFRESH_DELAY);\n \t\t} else {\n \t\t\tLog.d(TAG, \"Ignoring null or empty search string.\");\n \t\t}\n \t}", "private void searchQuery(String query) {\n mSearchAheadServiceV3 = new SearchAheadService(this, API_KEY);\n\n String queryString = query;\n\n LatLng surreyBC = new LatLng(49.104599F, -122.823509F);\n\n List searchCollections = Arrays.asList(SearchCollection.AIRPORT, SearchCollection.ADMINAREA,\n SearchCollection.ADDRESS, SearchCollection.FRANCHISE, SearchCollection.POI);\n try {\n SearchAheadQuery searchAheadQuery = new SearchAheadQuery\n .Builder(queryString, searchCollections)\n .location(surreyBC)\n .limit(5)\n .build();\n\n mSearchAheadServiceV3.predictResultsFromQuery(searchAheadQuery,\n new SearchAheadService.SearchAheadResponseCallback() {\n\n @Override\n public void onSuccess(@NonNull SearchAheadResponse searchAheadResponse) {\n\n //Get search results from the request response\n List<SearchAheadResult> searchAheadResults = searchAheadResponse.getResults();\n\n //if we have requests\n if (searchAheadResults.size() > 0) {\n\n //clear the current data to display\n searchResultsData.clear();\n\n try {\n\n int size = (searchAheadResults.size() < 5) ? searchAheadResults.size() : 5;\n\n for (int i = size - 1; i >= 0; i--) {\n // create a hashmap\n HashMap<String, String> hashMap = new HashMap<>();\n\n AddressProperties addressProperties = searchAheadResults.get(i).getPlace().getAddressProperties();\n\n // convert image int to a string and place it into the hashmap with an images key\n hashMap.put(\"address\", searchAheadResults.get(i).getName());\n hashMap.put(\"city\", addressProperties.getCity() + \", \" + addressProperties.getStateCode());\n hashMap.put(\"lat\", String.valueOf(searchAheadResults.get(i).getPlace().getLatLng().getLatitude()));\n hashMap.put(\"long\", String.valueOf(searchAheadResults.get(i).getPlace().getLatLng().getLongitude()));\n\n\n // add this hashmap to the list\n searchResultsData.add(hashMap);\n }\n\n //handle null pointer exception on address properties\n } catch (NullPointerException e) {\n e.printStackTrace();\n }\n\n //adapter inputs\n String[] from = {\n \"address\",\n \"city\",\n \"lat\",\n \"long\"\n };\n\n int[] to = {R.id.text_result_address, R.id.text_result_city, R.id.hidden_location_lat, R.id.hidden_location_long};\n\n searchAdapter = new SimpleAdapter(getApplicationContext(), searchResultsData, R.layout.item_search_result, from, to);\n mListViewSearch.setAdapter(searchAdapter);\n mListViewSearch.setVisibility(View.VISIBLE);\n } else {\n resetSearchAheadList();\n }\n }\n\n @Override\n public void onError(Exception e) {\n Log.e(\"MAPQUEST\", \"Search Ahead V3 Failure\", e);\n }\n });\n } catch (IllegalQueryParameterException e) {\n Log.e(\"Error performing search\", e.getMessage());\n }\n }", "private void query() {\n if (mDriveServiceHelper != null) {\n Log.d(\"error\", \"Querying for files.\");\n\n mDriveServiceHelper.queryFiles()\n .addOnSuccessListener(fileList -> {\n StringBuilder builder = new StringBuilder();\n for (File file : fileList.getFiles()) {\n builder.append(file.getName()).append(\"\\n\");\n }\n String fileNames = builder.toString();\n\n// mFileTitleEditText.setText(\"File List\");\n// mDocContentEditText.setText(fileNames);\n\n setReadOnlyMode();\n })\n .addOnFailureListener(exception -> Log.e(\"error\", \"Unable to query files.\", exception));\n }\n }", "@Override\n\tpublic boolean onSearchRequested()\n\t{\n \tstartSearch(getCurSearch(), true, null, false);\n \treturn true;\n\t}", "@Override\n public boolean onQueryTextChange(String newText) {\n // store the search query being entered in a global object that will be used to persist data\n // note: intentionally we use another string instead of @searchQueryToRestore, as SearchView\n // query is at first set to null (at the time SearchView is initialised), before setQuery()\n // method is called\n searchQueryToListen = newText;\n return false;\n }", "@Override\n protected void startScan() {\n startAutomaticRefresh();\n }", "@Test\n\tpublic void testSearchBasedOnRequest1() {\n\t\tsearchBasedOnRequestSetup();\n\t\t\n\t\tPreference prefs = prefManager.getUserPreference();\n\t\tprefs.setThreshold(10000);\n\t\t\n\t\tList<Suggestion> sugg = dm.searchBasedOnRequest(\"Flavorful\", prefs, true);\n\t\tassertTrue(sugg.size() > 0);\n\t\tassertTrue(sugg.get(0).getType() == Suggestion.SENTENCE);\n\t}", "@Override\n public boolean onQueryTextSubmit(String query) {\n queryMain = query;\n consultarDb();\n return true;\n }", "private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {\n \t//Sparql queries defining retrieval of literals etc.\n \teditConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap<String, String>());\n \teditConfiguration.setSparqlForAdditionalUrisInScope(new HashMap<String, String>());\n \teditConfiguration.setSparqlForExistingLiterals(new HashMap<String, String>());\n \teditConfiguration.setSparqlForExistingUris(new HashMap<String, String>());\n }", "@Override\n\tpublic void queryData() {\n\t\t\n\t}", "@GET(\"w/api.php?action=opensearch&format=json&suggest&redirects=resolve\")\n Call<JsonElement> getSuggestionsFromSearch(@Query(\"search\") String search);", "@Override\n public boolean onQueryTextChange(String s) {\n populateAdapter(s);\n return false;\n }", "public void query()\n\t{\n\t\tJSONObject queryInfo = new JSONObject();\n\t\t\n\t\ttry\n\t\t{\n\t\t\tqueryInfo.put(\"type\", \"query\");\n\t\t\t\n\t\t\tos.println(queryInfo.toString());\n\t\t\tos.flush();\n\t\t\t\n\t\t\tSystem.out.println(\"send query request : \" + queryInfo.toString());\n\t\t}\n\t\tcatch (JSONException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public String getQueryAppendPath(QueryInfo queryInfo) {\n int i = AnonymousClass1.$SwitchMap$com$miui$gallery$search$SearchConstants$SearchType[queryInfo.getSearchType().ordinal()];\n if (i == 1) {\n return \"suggestion\";\n }\n if (i != 2) {\n return null;\n }\n return \"search\";\n }", "@Override\n\t\t public boolean onQueryTextSubmit(String query) {\n\t\t \tcloseSearch();\n\t\t return false;\n\t\t }", "public void performSearch() {\n History.newItem(MyWebApp.SEARCH_RESULTS);\n getMessagePanel().clear();\n if (keywordsTextBox.getValue().isEmpty()) {\n getMessagePanel().displayMessage(\"Search term is required.\");\n return;\n }\n mywebapp.getResultsPanel().resetSearchParameters();\n //keyword search does not restrict to spots\n mywebapp.addCurrentLocation();\n if (markFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setLicensePlate(markFilterCheckbox.getValue());\n }\n if (contestFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setContests(contestFilterCheckbox.getValue());\n }\n if (geoFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setGeospatialOff(!geoFilterCheckbox.getValue());\n }\n if (plateFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setLicensePlate(plateFilterCheckbox.getValue());\n }\n if (spotFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setSpots(spotFilterCheckbox.getValue());\n }\n String color = getValue(colorsListBox);\n mywebapp.getResultsPanel().getSearchParameters().setColor(color);\n String manufacturer = getValue(manufacturersListBox);\n if (manufacturer != null) {\n Long id = new Long(manufacturer);\n mywebapp.getResultsPanel().getSearchParameters().setManufacturerId(id);\n }\n String vehicleType = getValue(vehicleTypeListBox);\n mywebapp.getResultsPanel().getSearchParameters().setVehicleType(vehicleType);\n// for (TagHolder tagHolder : tagHolders) {\n// mywebapp.getResultsPanel().getSearchParameters().getTags().add(tagHolder);\n// }\n mywebapp.getResultsPanel().getSearchParameters().setKeywords(keywordsTextBox.getValue());\n mywebapp.getMessagePanel().clear();\n mywebapp.getResultsPanel().performSearch();\n mywebapp.getTopMenuPanel().setTitleBar(\"Search\");\n //mywebapp.getResultsPanel().setImageResources(resources.search(), resources.searchMobile());\n }", "public boolean canRead()\n\t{\n\t\tString authority = mSearchable.getSuggestAuthority();\n\t\tif (authority == null)\n\t\t{\n\t\t\tLog.w(TAG, getName() + \" has no searchSuggestAuthority\");\n\t\t\treturn false;\n\t\t}\n\t\tUri.Builder uriBuilder = new Uri.Builder().scheme(\n\t\t\t\tContentResolver.SCHEME_CONTENT).authority(authority);\n\t\t// if content path provided, insert it now,获得搜索结果的路径\n\t\tString contentPath = mSearchable.getSuggestPath();\n\t\tif (contentPath != null)\n\t\t{\n\t\t\turiBuilder.appendEncodedPath(contentPath);\n\t\t}\n\t\t// append standard suggestion query path\n\t\turiBuilder.appendEncodedPath(SearchManager.SUGGEST_URI_PATH_QUERY);\n\t\tUri uri = uriBuilder.build();\n\t\treturn canRead(uri);\t\t\t//\n\t}", "@UnsupportedAppUsage\n public Cursor getSuggestions(SearchableInfo searchable, String query) {\n return getSuggestions(searchable, query, -1);\n }", "@Override\n public String getQueryString() {\n return queryString;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n return true;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n return true;\n }", "@Override\n public boolean onQueryTextChange(String query) {\n if (!Utils.isEmptyString(query)) {\n mAdapter.getFilter().filter(query);\n recyclerView.setAdapter(mAdapter);\n } else\n recyclerView.setAdapter(null);\n return false;\n }", "String getRetrieveResourceQuery();", "public interface ISearchEngine {\n\n enum SearchParam {\n CORE,\n EXPERIMENT,\n HOST,\n PORT\n }\n\n /**\n * Query engine for searching relevant documents\n * @return\n */\n SearchResponse query(SearchRequest request, Map<SearchParam, String> params);\n\n /**\n * Query search engine for spell correction\n * @param request: spell check request\n * @return\n */\n SpellResponse spellQuery(SearchRequest request, Map<SearchParam, String> params);\n}", "@Nonnull\n @Override\n protected ProductTypeQuery getQuery() {\n return ProductTypeReferenceReplacementUtils.buildProductTypeQuery(1);\n }", "@Override\n public Cursor query(Uri url, String[] projectionIn, String selection, \n String[] selectionArgs, String sort) {\n SQLiteQueryBuilder qb = new SQLiteQueryBuilder();\n SQLiteDatabase db = getDatabase(getContext()); //mOpenHelper.getReadableDatabase();\n // Modifyed by amt_chenjing for switchui-2192 20120715 begin\n\tif(db == null) {\n\t\tLog.v(TAG, \"open database: Failed\");\n\t\treturn null;\n\t}\n\t// Modifyed by amt_chenjing for switchui-2192 20120715 end\n int match = graphyUri.match(url);\n Cursor cur = null;\n switch (match) {\n case ALL_APPS:\n qb.setTables(Apps.TABLE_NAME);\n cur = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);\n break;\n case ONE_APP:\n qb.setTables(Apps.TABLE_NAME);\n qb.appendWhere(\"_id=\");\n qb.appendWhere(url.getPathSegments().get(1));\n cur = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);\n break;\n case ALL_RANKS:\n qb.setTables(Ranks.TABLE_NAME);\n cur = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);\n break;\n case ONE_RANK:\n qb.setTables(Ranks.TABLE_NAME);\n qb.appendWhere(\"_id=\");\n qb.appendWhere(url.getPathSegments().get(1));\n cur = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);\n break;\n case ALL_MANUALS:\n qb.setTables(ManualList.TABLE_NAME);\n cur = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);\n break;\n case ONE_MANUAL:\n qb.setTables(ManualList.TABLE_NAME);\n qb.appendWhere(\"_id=\");\n qb.appendWhere(url.getPathSegments().get(1));\n cur = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);\n break;\n case EXCUTESQL:\n cur = db.rawQuery(selection, null);\n break;\n default:\n throw new IllegalArgumentException(\"Unknown URi \" + url);\n }\n \n if (cur == null) {\n Log.v(TAG, \"query: failed\");\n } \t\t\n return cur;\n }", "public Map<String, DataModel> getQuery() {\n if (queries == null) {\n queries = FxSharedUtils.getMappedFunction(new FxSharedUtils.ParameterMapper<String, DataModel>() {\n @Override\n public DataModel get(Object key) {\n try {\n final FxResultSet result = EJBLookup.getSearchEngine().search((String) key, 0, -1, null);\n return new FxResultSetDataModel(result);\n } catch (FxApplicationException e) {\n throw e.asRuntimeException();\n }\n }\n }, true);\n }\n return queries;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n mAdapter.getFilter().filter(query);\n return false;\n }", "@Override\n public boolean onQueryTextSubmit(String query) {\n Log.e(\"Search View\", \"Called\");\n return false;\n }", "public String query() {\n return this.query;\n }", "@Override\r\n\tpublic List<String> queryAll() {\n\t\tList<String> list = homePageDao.queryAll();\r\n\t\treturn list;\r\n\t}", "@Override\n public boolean onQueryTextSubmit(String query) {\n if (!Utils.isEmptyString(query)) {\n mAdapter.getFilter().filter(query);\n recyclerView.setAdapter(mAdapter);\n } else\n recyclerView.setAdapter(null);\n return false;\n }", "public void updateNewSuggestFuncOracle() {\n\t\tif (searchSuggestFuncTextBox != null) {\n\t\t\tCQLSuggestOracle cqlSuggestOracle = new CQLSuggestOracle(funcNameMap.values());\n\t\t}\n\t}", "@Override\n public void onSearchOpened() {\n }", "@Override\n public void onSearchOpened() {\n }", "@Override\n public void onSearchOpened() {\n }", "@Override\r\n\tpublic void search() {\n\r\n\t}", "private void m26dj(com.google.android.apps.nexuslauncher.search.SearchResult r8) {\n /*\n r7 = this;\n android.net.Uri$Builder r0 = new android.net.Uri$Builder\n r0.<init>()\n java.lang.String r1 = \"content\"\n android.net.Uri$Builder r0 = r0.scheme(r1)\n java.lang.String r1 = com.google.android.apps.nexuslauncher.search.AppSearchProvider.AUTHORITY\n android.net.Uri$Builder r0 = r0.authority(r1)\n java.lang.String r1 = r8.mQuery\n android.net.Uri$Builder r0 = r0.appendPath(r1)\n android.net.Uri r2 = r0.build()\n r0 = 0\n android.content.Context r1 = r7.mContext // Catch:{ all -> 0x005f }\n android.content.ContentResolver r1 = r1.getContentResolver() // Catch:{ all -> 0x005f }\n r3 = 0\n r4 = 0\n r5 = 0\n r6 = 0\n android.database.Cursor r1 = r1.query(r2, r3, r4, r5, r6) // Catch:{ all -> 0x005f }\n if (r1 == 0) goto L_0x004e\n java.lang.String r0 = \"suggest_intent_data\"\n int r0 = r1.getColumnIndex(r0) // Catch:{ all -> 0x004c }\n L_0x0032:\n boolean r2 = r1.moveToNext() // Catch:{ all -> 0x004c }\n if (r2 == 0) goto L_0x004e\n java.util.ArrayList<com.android.launcher3.util.ComponentKey> r2 = r8.mApps // Catch:{ all -> 0x004c }\n java.lang.String r3 = r1.getString(r0) // Catch:{ all -> 0x004c }\n android.net.Uri r3 = android.net.Uri.parse(r3) // Catch:{ all -> 0x004c }\n android.content.Context r4 = r7.mContext // Catch:{ all -> 0x004c }\n com.android.launcher3.util.ComponentKey r3 = com.google.android.apps.nexuslauncher.search.AppSearchProvider.uriToComponent(r3, r4) // Catch:{ all -> 0x004c }\n r2.add(r3) // Catch:{ all -> 0x004c }\n goto L_0x0032\n L_0x004c:\n r8 = move-exception\n goto L_0x0061\n L_0x004e:\n if (r1 == 0) goto L_0x0053\n r1.close()\n L_0x0053:\n android.os.Handler r0 = r7.mUiHandler\n r1 = 200(0xc8, float:2.8E-43)\n android.os.Message r8 = android.os.Message.obtain(r0, r1, r8)\n r8.sendToTarget()\n return\n L_0x005f:\n r8 = move-exception\n r1 = r0\n L_0x0061:\n if (r1 == 0) goto L_0x0066\n r1.close()\n L_0x0066:\n throw r8\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.apps.nexuslauncher.search.SearchThread.m26dj(com.google.android.apps.nexuslauncher.search.SearchResult):void\");\n }", "public void newQuery(String query){\n for(RecyclerViewWrapper wrapper : mRecyclerViews){\n wrapper.data.clear();\n wrapper.adapter.notifyDataSetChanged();\n Log.d(TAG, \"Test: \" + wrapper.data.size());\n }\n\n mQueryManager.searchAll(query);\n }", "public void performSearch() {\n OASelect<CorpToStore> sel = getCorpToStoreSearch().getSelect();\n sel.setSearchHub(getSearchFromHub());\n sel.setFinder(getFinder());\n getHub().select(sel);\n }", "@Override\n\tpublic void search() {\n\t}", "@Override\n public boolean onQueryTextChange(String s) {\n\n FetchSearchData(s);\n //return false;\n if (data_list.size() == 0) {\n tv_nofound.setVisibility(View.VISIBLE);\n recyclerView.getRecycledViewPool().clear();\n } else {\n tv_nofound.setVisibility(View.GONE);\n }\n\n return true;\n }", "public abstract RefreshResults refresh();", "@Override\r\n\t\t\tpublic List<ScoredDocument> search(Query query) {\n\t\t\t\treturn null;\r\n\t\t\t}", "@Override\n public boolean onQueryTextSubmit(String query) {\n topStories = false;\n filter.setQuery(query);\n gvResults.clearOnScrollListeners();\n setUpRecycler();\n findViewById(R.id.relativeLayout).setVisibility(View.GONE);\n findViewById(R.id.tvHeading).setVisibility(View.GONE);\n fetchArticles(0,true);\n searchView.clearFocus();\n return true;\n }", "public void setNewSearch(String query){\n isNewSearch = true;\n this.query = query;\n }", "@Override\n public boolean onQueryTextChange(String s) {\n if(s.isEmpty() && amenList.isEmpty()){\n searchResultsCard.setVisibility(View.GONE);\n }else {\n searchResultsCard.setVisibility(View.VISIBLE);\n }\n placesAdaptor.getFilter( ).filter(s);\n //if no results available, hide the result card\n //self-checking if there is any results, as filter results only available after\n //this method ends\n boolean noResult=true;\n ArrayList<PlacesDataClass> tempFilter=placesAdaptor.getFiltered( );\n if(tempFilter.isEmpty()) {\n ArrayList<String> temp_filter=new ArrayList<String>(Arrays.asList(placesName));\n for(String a:temp_filter){\n if(a.toLowerCase().contains(s.toLowerCase())){\n noResult=false;\n }\n }\n }else {\n for (PlacesDataClass object : tempFilter) {\n // the filtering itself:\n if (object.toString( ).toLowerCase( ).contains(s.toLowerCase( )))\n noResult=false;\n }\n }//if no results available then display the no results text\n if (noResult) {\n noResultsFoundText.setVisibility(View.VISIBLE);\n } else noResultsFoundText.setVisibility(View.GONE);\n Log.i(\"results number\", \"query: \"+s+\"; no result: \"+noResult);\n // ---------------Change-----------------\n while (!origin.isEmpty( )) {\n origin.remove(0);\n }\n\n return false;\n }", "public interface SuggestApi {\n\n String API_TYPES = \"geocode\";\n String API_KEY = \"AIzaSyB93d9Y2I-UWEFEQGLdWUfHCjF7cFmlUm8\";\n\n @GET(\"autocomplete/json\")\n Single<SuggestionResponseModel> obtainSuggestedCities(@Query(\"input\") String input,\n @Query(\"types\") String types,\n @Query(\"key\") String apiKey);\n\n @GET(\"details/json\")\n Single<CityResponseModel> obtainCity(@Query(\"placeid\") String placeId,\n @Query(\"key\") String apiKey);\n}", "@Override\n public boolean onQueryTextChange(String query) {\n presenter.getMovies(query);\n return false;\n }", "public void testUsingQueriesFromQueryManger(){\n\t\tSet<String> names = testDataMap.keySet();\n\t\tUtils.prtObMess(this.getClass(), \"atm query\");\n\t\tDseInputQuery<BigDecimal> atmq = \n\t\t\t\tqm.getQuery(new AtmDiot());\n\t\tMap<String, ComplexQueryResult<BigDecimal>> bdResult = \n\t\t\t\tatmq.get(names, 1, TimeUnit.SECONDS);\n\t\tCollectionsStaticMethods.prtMapItems(bdResult);\n\n\t\tUtils.prtObMess(this.getClass(), \"vol query\");\n\t\tDseInputQuery<BigDecimal> volq = \n\t\t\t\tqm.getQuery(new VolDiotForTest());\n\t\tMap<String, ComplexQueryResult<BigDecimal>> dbResult = \n\t\t\t\tvolq.get(names, 1, TimeUnit.SECONDS);\n\t\tCollectionsStaticMethods.prtMapItems(dbResult);\n\t\n\t\tUtils.prtObMess(this.getClass(), \"integer query\");\n\t\tDseInputQuery<BigDecimal> strikeq = \n\t\t\t\tqm.getQuery(new StrikeDiotForTest());\n\t\tMap<String, ComplexQueryResult<BigDecimal>> strikeResult = \n\t\t\t\tstrikeq.get(names, 1, TimeUnit.SECONDS);\n\t\tCollectionsStaticMethods.prtMapItems(strikeResult);\n\t\n\t}", "@Override\n public boolean onQueryTextChange(String newText) {\n\n devicesFragment.getDevicesAdapter().getFilter().filter(newText);\n actionsFragment.getActionsAdapter().getFilter().filter(newText);\n return true;\n }", "public Map<String, String> getQueryParams(QueryInfo queryInfo) {\n Map<String, String> queryParams = super.getQueryParams(queryInfo);\n String str = queryParams.get(\"query\");\n if (!TextUtils.isEmpty(str)) {\n String queryExtras = SearchConfig.get().getSuggestionConfig().getQueryExtras(str);\n if (!TextUtils.isEmpty(queryExtras)) {\n queryParams.put(\"extraInfo\", queryExtras);\n Log.d(\"SearchSource\", \"On append extra [%s] to query [%s]\", queryExtras, str);\n }\n }\n queryParams.remove(\"enableShortcut\");\n return queryParams;\n }" ]
[ "0.5742079", "0.5564495", "0.55229807", "0.5378884", "0.53779167", "0.5372541", "0.535279", "0.53523403", "0.5330596", "0.5251861", "0.5251861", "0.52412784", "0.52326393", "0.52180386", "0.52169013", "0.519995", "0.5179282", "0.5158837", "0.51369613", "0.51346517", "0.5122687", "0.51122075", "0.51074344", "0.51051724", "0.5097573", "0.50958085", "0.5087563", "0.5083888", "0.5069307", "0.5069231", "0.5067253", "0.50608104", "0.5055327", "0.5053027", "0.50464547", "0.5035024", "0.50256264", "0.5012276", "0.5011332", "0.50105095", "0.50097376", "0.50097376", "0.50097376", "0.50097376", "0.5006979", "0.50029975", "0.50004065", "0.49978825", "0.49969098", "0.49952364", "0.49932954", "0.49908787", "0.49900132", "0.49868456", "0.49868056", "0.4984851", "0.49811813", "0.4963751", "0.4962919", "0.49621266", "0.49576226", "0.4955927", "0.49532565", "0.49459416", "0.49442366", "0.49442366", "0.49342674", "0.49303567", "0.49122593", "0.49084428", "0.49006107", "0.48904335", "0.48827466", "0.48827466", "0.48827466", "0.48827466", "0.4877642", "0.4874055", "0.48721156", "0.48718023", "0.48711774", "0.48556402", "0.48556402", "0.48556402", "0.48514622", "0.48510095", "0.48505938", "0.48459798", "0.4844032", "0.48425224", "0.4836666", "0.48332128", "0.48331067", "0.48256478", "0.48239076", "0.48157278", "0.48122686", "0.4811519", "0.48108393", "0.48105446" ]
0.4816777
95
Use this factory method to create a new instance of this fragment using the provided parameters.
public static SubmitPromptFragment newInstance(int sectionNumber) { SubmitPromptFragment fragment = new SubmitPromptFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static FragmentTousWanted newInstance() {\n FragmentTousWanted fragment = new FragmentTousWanted();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n return fragment;\n }", "protected abstract Fragment createFragment();", "public void createFragment() {\n\n }", "@Override\n protected Fragment createFragment() {\n Intent intent = getIntent();\n\n long id = intent.getLongExtra(MovieDetailFragment.EXTRA_ID, -1);\n return MovieDetailFragment.newInstance(id);\n }", "public CuartoFragment() {\n }", "public StintFragment() {\n }", "public ExploreFragment() {\n\n }", "public RickAndMortyFragment() {\n }", "public FragmentMy() {\n }", "public LogFragment() {\n }", "public FeedFragment() {\n }", "public HistoryFragment() {\n }", "public HistoryFragment() {\n }", "public static MyFeedFragment newInstance() {\n return new MyFeedFragment();\n }", "public WkfFragment() {\n }", "public static ScheduleFragment newInstance() {\n ScheduleFragment fragment = new ScheduleFragment();\n Bundle args = new Bundle();\n //args.putString(ARG_PARAM1, param1);\n //args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public ProfileFragment(){}", "public WelcomeFragment() {}", "public static ForumFragment newInstance() {\n ForumFragment fragment = new ForumFragment();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n\n return fragment;\n }", "public static NotificationFragment newInstance() {\n NotificationFragment fragment = new NotificationFragment();\n Bundle args = new Bundle();\n// args.putString(ARG_PARAM1, param1);\n// args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public progFragment() {\n }", "public HeaderFragment() {}", "public static RouteFragment newInstance() {\n RouteFragment fragment = new RouteFragment();\n Bundle args = new Bundle();\n //fragment.setArguments(args);\n return fragment;\n }", "public EmployeeFragment() {\n }", "public Fragment_Tutorial() {}", "public NewShopFragment() {\n }", "public FavoriteFragment() {\n }", "public static MyCourseFragment newInstance() {\n MyCourseFragment fragment = new MyCourseFragment();\r\n// fragment.setArguments(args);\r\n return fragment;\r\n }", "public static MessageFragment newInstance() {\n MessageFragment fragment = new MessageFragment();\n Bundle args = new Bundle();\n\n fragment.setArguments(args);\n return fragment;\n }", "public static ReservationFragment newInstance() {\n\n ReservationFragment _fragment = new ReservationFragment();\n// Bundle args = new Bundle();\n// args.putString(ARG_PARAM1, param1);\n// args.putString(ARG_PARAM2, param2);\n// fragment.setArguments(args);\n return _fragment;\n }", "public CreateEventFragment() {\n // Required empty public constructor\n }", "public static RecipeListFragment newInstance() {\n RecipeListFragment fragment = new RecipeListFragment();\n// Bundle args = new Bundle();\n// args.putString(ARG_PARAM1, param1);\n// args.putString(ARG_PARAM2, param2);\n// fragment.setArguments(args);\n return fragment;\n }", "public static Fragment newInstance() {\n\t\treturn new ScreenSlidePageFragment();\n\t}", "public NoteActivityFragment() {\n }", "public static WeekViewFragment newInstance(int param1, int param2) {\n WeekViewFragment fragment = new WeekViewFragment();\n //WeekViewFragment 객체 생성\n Bundle args = new Bundle();\n //Bundle 객체 생성\n args.putInt(ARG_PARAM1, param1);\n //ARG_PARAM1에 param1의 정수값 넣어서 args에 저장\n args.putInt(ARG_PARAM2, param2);\n //ARG_PARAM2에 param2의 정수값 넣어서 args에 저장\n fragment.setArguments(args);\n //args를 매개변수로 한 setArguments() 메소드 수행하여 fragment에 저장\n return fragment; //fragment 반환\n }", "public static Fragment0 newInstance(String param1, String param2) {\n Fragment0 fragment = new Fragment0();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public static QueenBEmbassyF newInstance() {\n QueenBEmbassyF fragment = new QueenBEmbassyF();\n //the way to pass arguments between fragments\n Bundle args = new Bundle();\n\n fragment.setArguments(args);\n return fragment;\n }", "public static Fragment newInstance() {\n StatisticsFragment fragment = new StatisticsFragment();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n return fragment;\n }", "public EventHistoryFragment() {\n\t}", "public HomeFragment() {}", "public PeopleFragment() {\n // Required empty public constructor\n }", "public static FeedFragment newInstance() {\n FeedFragment fragment = new FeedFragment();\n return fragment;\n }", "public static MainFragment newInstance(String param1, String param2) {\n MainFragment fragment = new MainFragment();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n return fragment;\n }", "public VantaggiFragment() {\n // Required empty public constructor\n }", "public AddressDetailFragment() {\n }", "public ArticleDetailFragment() { }", "public static DropboxMainFrag newInstance() {\n DropboxMainFrag fragment = new DropboxMainFrag();\n // set arguments in Bundle\n return fragment;\n }", "public RegisterFragment() {\n }", "public EmailFragment() {\n }", "public static CommentFragment newInstance() {\n CommentFragment fragment = new CommentFragment();\n\n return fragment;\n }", "public static FragmentComida newInstance(String param1) {\n FragmentComida fragment = new FragmentComida();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n fragment.setArguments(args);\n return fragment;\n\n\n }", "public static ParqueosFragment newInstance() {\n ParqueosFragment fragment = new ParqueosFragment();\n return fragment;\n }", "public ForecastFragment() {\n }", "public FExDetailFragment() {\n \t}", "public static AddressFragment newInstance(String param1) {\n AddressFragment fragment = new AddressFragment();\n\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n fragment.setArguments(args);\n\n return fragment;\n }", "public TripNoteFragment() {\n }", "public ItemFragment() {\n }", "public NoteListFragment() {\n }", "public CreatePatientFragment() {\n\n }", "public DisplayFragment() {\n\n }", "public static frag4_viewcompliment newInstance(String param1, String param2) {\r\n frag4_viewcompliment fragment = new frag4_viewcompliment();\r\n Bundle args = new Bundle();\r\n args.putString(ARG_PARAM1, param1);\r\n args.putString(ARG_PARAM2, param2);\r\n fragment.setArguments(args);\r\n return fragment;\r\n }", "public static fragment_profile newInstance(String param1, String param2) {\n fragment_profile fragment = new fragment_profile();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "@Override\n\tprotected Fragment createFragment() {\n\t\treturn new FormFragment();\n\t}", "public static MainFragment newInstance() {\n MainFragment fragment = new MainFragment();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n return fragment;\n }", "public ProfileFragment() {\n\n }", "public BackEndFragment() {\n }", "public CustomerFragment() {\n }", "public static FriendsFragment newInstance(int sectionNumber) {\n \tFriendsFragment fragment = new FriendsFragment();\n Bundle args = new Bundle();\n args.putInt(ARG_SECTION_NUMBER, sectionNumber);\n fragment.setArguments(args);\n return fragment;\n }", "public ArticleDetailFragment() {\n }", "public ArticleDetailFragment() {\n }", "public ArticleDetailFragment() {\n }", "public static Fragment newInstance() {\n return new SettingsFragment();\n }", "public SummaryFragment newInstance()\n {\n return new SummaryFragment();\n }", "public PeersFragment() {\n }", "public TagsFragment() {\n }", "public static ProfileFragment newInstance() {\n ProfileFragment fragment = new ProfileFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, \"\");\n args.putString(ARG_PARAM2, \"\");\n fragment.setArguments(args);\n return fragment;\n }", "public static FriendsFragment newInstance() {\n FriendsFragment fragment = new FriendsFragment();\n\n return fragment;\n }", "public HomeSectionFragment() {\n\t}", "public static FirstFragment newInstance(String text) {\n\n FirstFragment f = new FirstFragment();\n Bundle b = new Bundle();\n b.putString(\"msg\", text);\n\n f.setArguments(b);\n\n return f;\n }", "public PersonDetailFragment() {\r\n }", "public static LogFragment newInstance(Bundle params) {\n LogFragment fragment = new LogFragment();\n fragment.setArguments(params);\n return fragment;\n }", "public RegisterFragment() {\n // Required empty public constructor\n }", "public VehicleFragment() {\r\n }", "public static Fine newInstance(String param1, String param2) {\n Fine fragment = new Fine();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public static FriendsFragment newInstance(String param1, String param2) {\n FriendsFragment fragment = new FriendsFragment();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n return fragment;\n }", "public static ChangesViewFragment newInstance() {\n\t\tChangesViewFragment fragment = new ChangesViewFragment();\n\t\tBundle args = new Bundle();\n\t\targs.putInt(HomeViewActivity.ARG_SECTION_NUMBER, 2);\n\t\tfragment.setArguments(args);\n\t\treturn fragment;\n\t}", "public static NoteFragment newInstance(String param1, String param2) {\n NoteFragment fragment = new NoteFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public static MainFragment newInstance(Context context) {\n MainFragment fragment = new MainFragment();\n if(context != null)\n fragment.setVariables(context);\n return fragment;\n }", "@Override\n\tprotected Fragment createFragment() {\n\t\treturn new CrimeListFragment();\n\t}", "public static MoneyLogFragment newInstance() {\n MoneyLogFragment fragment = new MoneyLogFragment();\n return fragment;\n }", "public static ForecastFragment newInstance() {\n\n //Create new fragment\n ForecastFragment frag = new ForecastFragment();\n return(frag);\n }", "public static MainFragment newInstance(String param1, String param2) {\n MainFragment fragment = new MainFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public static MainFragment newInstance(String param1, String param2) {\n MainFragment fragment = new MainFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public static MainFragment newInstance(String param1, String param2) {\n MainFragment fragment = new MainFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public static MyTaskFragment newInstance(String param1) {\n MyTaskFragment fragment = new MyTaskFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n fragment.setArguments(args);\n return fragment;\n }", "public static MyProfileFragment newInstance(String param1, String param2) {\n MyProfileFragment fragment = new MyProfileFragment();\n return fragment;\n }", "public static MainFragment newInstance(int param1, String param2) {\n MainFragment fragment = new MainFragment();\n Bundle args = new Bundle();\n args.putInt(ARG_PARAM1, param1);\n\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public PlaylistFragment() {\n }", "public static HistoryFragment newInstance() {\n HistoryFragment fragment = new HistoryFragment();\n return fragment;\n }", "public static SurvivorIncidentFormFragment newInstance(String param1, String param2) {\n// SurvivorIncidentFormFragment fragment = new SurvivorIncidentFormFragment();\n// Bundle args = new Bundle();\n// args.putString(ARG_PARAM1, param1);\n// args.putString(ARG_PARAM2, param2);\n// fragment.setArguments(args);\n// return fragment;\n\n SurvivorIncidentFormFragment fragment = new SurvivorIncidentFormFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n\n\n }", "public static PersonalFragment newInstance(String param1, String param2) {\n PersonalFragment fragment = new PersonalFragment();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, param1);\n args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }" ]
[ "0.7259329", "0.72331375", "0.71140355", "0.69909847", "0.69902235", "0.6834592", "0.683074", "0.68134046", "0.6801526", "0.6801054", "0.67653185", "0.6739714", "0.6739714", "0.6727412", "0.6717231", "0.6705855", "0.6692112", "0.6691661", "0.66869426", "0.66606814", "0.6646188", "0.66410166", "0.6640725", "0.6634425", "0.66188246", "0.66140765", "0.6608169", "0.66045964", "0.65977716", "0.6592119", "0.659137", "0.65910816", "0.65830594", "0.65786606", "0.6562876", "0.65607685", "0.6557126", "0.65513307", "0.65510213", "0.65431285", "0.6540448", "0.65336084", "0.6532555", "0.6528302", "0.6524409", "0.652328", "0.6523149", "0.6516528", "0.65049976", "0.6497274", "0.6497235", "0.64949715", "0.64944136", "0.6484968", "0.6484214", "0.64805835", "0.64784926", "0.64755154", "0.64710265", "0.6466466", "0.6457089", "0.645606", "0.6454554", "0.6452161", "0.64520335", "0.6450325", "0.64488834", "0.6446765", "0.64430225", "0.64430225", "0.64430225", "0.64420956", "0.6441306", "0.64411277", "0.6438451", "0.64345145", "0.64289486", "0.64287597", "0.6423755", "0.64193285", "0.6418699", "0.6414679", "0.6412867", "0.6402168", "0.6400724", "0.6395624", "0.6395109", "0.6391252", "0.63891554", "0.63835025", "0.63788056", "0.63751805", "0.63751805", "0.63751805", "0.6374796", "0.63653135", "0.6364529", "0.6360922", "0.63538784", "0.6351111", "0.635067" ]
0.0
-1
Inflate the layout for this fragment
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v= inflater.inflate(R.layout.fragment_submit_prompt, container, false); user_email=(EditText) v.findViewById(R.id.userEmail); user_password=(EditText) v.findViewById(R.id.userPassword); Button b= (Button) v.findViewById(R.id.signUpButton); b.setOnClickListener(this); dailyPromptView=(TextView) v.findViewById(R.id.promptView); final EditText et = (EditText) v.findViewById(R.id.editText); Button submitPrompt = (Button) v.findViewById(R.id.button5); submitPrompt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String prompt= et.getText().toString(); dailyPrompt = new DailyPrompt(prompt); putInFireBase(prompt); } }); // Add value event listener to the post // [START post_value_event_listener] mDatabase = FirebaseDatabase.getInstance().getReference("Daily_WP").child("0"); ValueEventListener postListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI DailyPrompt dp = dataSnapshot.getValue(DailyPrompt.class); dailyPromptView.setText(dp.content); Toast.makeText(getContext(),"content "+dp.content,Toast.LENGTH_SHORT).show(); // [START_EXCLUDE] // [END_EXCLUDE] } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // [START_EXCLUDE] // [END_EXCLUDE] } }; mDatabase.addValueEventListener(postListener); // [END post_value_event_listener] return v; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_main_allinfo, container, false);\n }", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n\t\t\tBundle savedInstanceState) {\n\t\treturn inflater.inflate(R.layout.wallpager_layout, null);\r\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_invit_friends, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View inflate = inflater.inflate(R.layout.fragment_zhuye, container, false);\n initView(inflate);\n initData();\n return inflate;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {\n // Defines the xml file for the fragment\n return inflater.inflate(R.layout.fragment_posts, parent, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n return inflater.inflate(R.layout.ilustration_fragment, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_sow_drug_cost_per_week, container, false);\n\n db = new DataBaseAdapter(getActivity());\n hc = new HelperClass();\n pop = new FeedSowsFragment();\n\n infltr = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n parent = (LinearLayout) v.findViewById(R.id.layout_for_add);\n tvTotalCost = (TextView) v.findViewById(R.id.totalCost);\n\n getData();\n setData();\n\n return v;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_stream_list, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_event, container, false);\n\n\n\n\n\n\n\n\n return v;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_feed, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.screen_select_list_student, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_overall, container, false);\n mNamesLayout = (LinearLayout) rootView.findViewById(R.id.fragment_overall_names_layout);\n mOverallView = (OverallView) rootView.findViewById(R.id.fragment_overall_view);\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState)\n {\n\n\n view = inflater.inflate(R.layout.fragment_earning_fragmant, container, false);\n ini(view);\n return view;\n }", "@Nullable\n @Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n super.onCreateView(inflater, container, savedInstanceState);\n final View rootview = inflater.inflate(R.layout.activity_email_frag, container, false);\n ConfigInnerElements(rootview);\n return rootview;\n }", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n\t\t\tBundle savedInstanceState) {\n\t\trootView = inflater.inflate(R.layout.fragment_attack_armor, container, false);\r\n\r\n\t\tfindInterfaceElements();\r\n\t\taddRangeSelector();\r\n\t\tupdateHeadings();\r\n\t\tsetListeners();\r\n\r\n\t\tsetFromData();\r\n\r\n\t\treturn rootView;\r\n\t}", "@SuppressLint(\"InflateParams\")\r\n\t@Override\r\n\tpublic View initLayout(LayoutInflater inflater) {\n\t\tView view = inflater.inflate(R.layout.frag_customer_all, null);\r\n\t\treturn view;\r\n\t}", "@Override\r\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_fore_cast, container, false);\r\n initView();\r\n mainLayout.setVisibility(View.GONE);\r\n apiInterface = RestClinet.getClient().create(ApiInterface.class);\r\n loadData();\r\n return view;\r\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_friend, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n rootView = inflater.inflate(R.layout.fragment_detail, container, false);\n image = rootView.findViewById(R.id.fr_image);\n name = rootView.findViewById(R.id.fr_name);\n phoneNumber = rootView.findViewById(R.id.fr_phone_number);\n email = rootView.findViewById(R.id.fr_email);\n street = rootView.findViewById(R.id.fr_street);\n city = rootView.findViewById(R.id.fr_city);\n state = rootView.findViewById(R.id.fr_state);\n zipcode = rootView.findViewById(R.id.fr_zipcode);\n dBrith = rootView.findViewById(R.id.date_brith);\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_pm25, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_kkbox_playlist, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_feed_pager, container, false);\n\n// loadData();\n\n findViews(rootView);\n\n setViews();\n\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n layout = (FrameLayout) inflater.inflate(R.layout.fragment_actualites, container, false);\n\n relLayout = (RelativeLayout) layout.findViewById(R.id.relLayoutActus);\n\n initListView();\n getXMLData();\n\n return layout;\n }", "@Nullable\n @Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n rootView = inflater.inflate(R.layout.frag_post_prayer_video, container, false);\n setCustomDesign();\n setCustomClickListeners();\n return rootView;\n }", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\t\treturn inflater.inflate(R.layout.lf_em4305_fragment, container, false);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_recordings, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view=inflater.inflate(R.layout.fragment_category, container, false);\n initView(view);\n bindRefreshListener();\n loadParams();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_cm_box_details, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view=inflater.inflate(R.layout.fragment_layout12, container, false);\n\n iniv();\n\n init();\n\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_details, container, false);\n //return inflater.inflate(R.layout.fragment_details, container, false);\n getIntentValues();\n initViews();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_mem_body_blood, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_qiugouxiaoxi, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View inflate = inflater.inflate(R.layout.fragment_coll_blank, container, false);\n initView(inflate);\n initData();\n return inflate;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_attendance_divide, container, false);\n\n initView(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {\n // Defines the xml file for the fragment\n return inflater.inflate(R.layout.show_program_fragment, parent, false);\n }", "@Override\n public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,\n @Nullable Bundle savedInstanceState) {\n return inflater.inflate(R.layout.visualization_fragment, container, false);\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n rootView = inflater.inflate(R.layout.fragment_category_details_page, container, false);\n initializeAll();\n\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n final View v = inflater.inflate(R.layout.fragemnt_reserve, container, false);\n\n\n\n\n return v;\n }", "protected int getLayoutResId() {\n return R.layout.activity_fragment;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_all_quizs, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n role = getArguments().getInt(\"role\");\n rootview = inflater.inflate(R.layout.fragment_application, container, false);\n layout = rootview.findViewById(R.id.patentDetails);\n progressBar = rootview.findViewById(R.id.progressBar);\n try {\n run();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return rootview;\n }", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\t\tview = inflater.inflate(R.layout.fragment_zhu, null);\n\t\tinitView();\n\t\tinitData();\n\t\treturn view;\n\t}", "@Override\n\t\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n\t\t{\n\t\t\tView rootView = inflater.inflate(R.layout.maimfragment, container, false);\n\t\t\treturn rootView;\n\t\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // Inflate the layout for this fragment\n return inflater.inflate(R.layout.fragment__record__week, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_porishongkhan, container, false);\n\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_dashboard, container, false);\n resultsRv = view.findViewById(R.id.db_results_rv);\n resultText = view.findViewById(R.id.db_search_empty);\n progressBar = view.findViewById(R.id.db_progressbar);\n lastVisitText = view.findViewById(R.id.db_last_visit);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(getLayoutId(), container, false);\n init(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_feedback, container, false);\n self = getActivity();\n initUI(view);\n initControlUI();\n initData();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_service_summery, container, false);\n tvVoiceMS = v.findViewById(R.id.tvVoiceValue);\n tvDataMS = v.findViewById(R.id.tvdataValue);\n tvSMSMS = v.findViewById(R.id.tvSMSValue);\n tvVoiceFL = v.findViewById(R.id.tvVoiceFLValue);\n tvDataBS = v.findViewById(R.id.tvDataBRValue);\n tvTotal = v.findViewById(R.id.tvTotalAccountvalue);\n return v;\n }", "@Override\r\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_clan_rank_details, container, false);\r\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_star_wars_list, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View inflate = inflater.inflate(R.layout.fragment_lei, container, false);\n\n initView(inflate);\n initData();\n return inflate;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_quotation, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_wode_ragment, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {\n\n\n\n\n\n return inflater.inflate(R.layout.fragment_appoint_list, parent, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n if (rootView == null) {\n rootView = inflater.inflate(R.layout.fragment_ip_info, container, false);\n initView();\n }\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_offer, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_rooms, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\n View view = inflater.inflate(R.layout.fragment_img_eva, container, false);\n\n getSendData();\n\n initView(view);\n\n initData();\n\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_project_collection, container, false);\n ButterKnife.bind(this, view);\n fragment = this;\n initView();\n getCollectionType();\n // getCategoryList();\n initBroadcastReceiver();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_yzm, container, false);\n initView(view);\n return view;\n }", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\t\tmainLayout = inflater.inflate(R.layout.fragment_play, container, false);\r\n\t\treturn mainLayout;\r\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_invite_request, container, false);\n initialiseVariables();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n getLocationPermission();\n return inflater.inflate(R.layout.centrum_fragment, container, false);\n\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_habit_type_details, container, false);\n\n habitTitle = rootView.findViewById(R.id.textViewTitle);\n habitReason = rootView.findViewById(R.id.textViewReason);\n habitStartDate = rootView.findViewById(R.id.textViewStartDate);\n habitWeeklyPlan = rootView.findViewById(R.id.textViewWeeklyPlan);\n\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_information_friends4, container, false);\n\n if (getArguments() != null) {\n FriendsID = getArguments().getString(\"keyFriends\");\n }\n\n return v;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_post_details, container, false);\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_hotel, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view=inflater.inflate(R.layout.fragment_bus_inquiry, container, false);\n initView();\n initData();\n initDialog();\n getDataFromNet();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_weather, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_srgl, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_ground_detail_frgment, container, false);\n init();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_book_appointment, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_wheretogo, container, false);\n ids();\n setup();\n click();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n binding = DataBindingUtil\n .inflate(inflater, R.layout.fragment_learning_leaders, container, false);\n init();\n\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_end_game_tab, container, false);\n\n setupWidgets();\n setupTextFields(view);\n setupSpinners(view);\n\n // Inflate the layout for this fragment\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.memoir_fragment, container, false);\n\n getUserIdFromSharedPref();\n configureUI(view);\n configureSortSpinner();\n configureFilterSpinner();\n\n networkConnection = new NetworkConnection();\n new GetAllMemoirTask().execute();\n\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_jadwal, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_delivery_detail, container, false);\n initialise();\n\n\n\n return view;\n }", "@Nullable\n @Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_4, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_all_product, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_group_details, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment06_7, container, false);\n initView(view);\n setLegend();\n setXAxis();\n setYAxis();\n setData();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_downloadables, container, false);\n }", "@Override\n public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.movie_list_fragment, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_like, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_hall, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_unit_main, container, false);\n TextView mTxvBusinessAassistant = (TextView) view.findViewById(R.id.txv_business_assistant);\n TextView mTxvCardINformation = (TextView) view.findViewById(R.id.txv_card_information);\n RelativeLayout mRelOfficialWebsite = (RelativeLayout) view.findViewById(R.id.rel_official_website);\n RelativeLayout mRelPictureAblum = (RelativeLayout) view.findViewById(R.id.rel_picture_album);\n TextView mTxvQrCodeCard = (TextView) view.findViewById(R.id.txv_qr_code_card);\n TextView mTxvShareCard = (TextView) view.findViewById(R.id.txv_share_card);\n mTxvBusinessAassistant.setOnClickListener(this.mOnClickListener);\n mTxvCardINformation.setOnClickListener(this.mOnClickListener);\n mRelOfficialWebsite.setOnClickListener(this.mOnClickListener);\n mRelPictureAblum.setOnClickListener(this.mOnClickListener);\n mTxvQrCodeCard.setOnClickListener(this.mOnClickListener);\n mTxvShareCard.setOnClickListener(this.mOnClickListener);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_moviespage, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_s, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_overview, container, false);\n\n initOverviewComponents(view);\n registerListeners();\n initTagListener();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_bahan_ajar, container, false);\n initView(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n root = (ViewGroup) inflater.inflate(R.layout.money_main, container, false);\n context = getActivity();\n initHeaderView(root);\n initView(root);\n\n getDate();\n initEvetn();\n return root;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {\n // Defines the xml file for the fragment\n return inflater.inflate(R.layout.fragment_historical_event, parent, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_event_details, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_video, container, false);\n unbinder = ButterKnife.bind(this, view);\n initView();\n initData();\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n\n v= inflater.inflate(R.layout.fragment_post_contacts, container, false);\n this.mapping(v);\n return v;\n }", "@Nullable\n @Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_measures, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_feed, container, false);\n findViews(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_surah_list, container, false);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_data_binded, container, false);\n }" ]
[ "0.6739604", "0.67235583", "0.6721706", "0.6698254", "0.6691869", "0.6687986", "0.66869223", "0.6684548", "0.66766286", "0.6674615", "0.66654444", "0.66654384", "0.6664403", "0.66596216", "0.6653321", "0.6647136", "0.66423255", "0.66388357", "0.6637491", "0.6634193", "0.6625158", "0.66195583", "0.66164845", "0.6608733", "0.6596594", "0.65928894", "0.6585293", "0.65842897", "0.65730995", "0.6571248", "0.6569152", "0.65689117", "0.656853", "0.6566686", "0.65652984", "0.6553419", "0.65525705", "0.65432084", "0.6542382", "0.65411425", "0.6538022", "0.65366334", "0.65355957", "0.6535043", "0.65329415", "0.65311074", "0.65310687", "0.6528645", "0.65277404", "0.6525902", "0.6524516", "0.6524048", "0.65232015", "0.65224624", "0.65185034", "0.65130377", "0.6512968", "0.65122765", "0.65116245", "0.65106046", "0.65103024", "0.6509013", "0.65088093", "0.6508651", "0.6508225", "0.6504662", "0.650149", "0.65011525", "0.6500686", "0.64974767", "0.64935696", "0.6492234", "0.6490034", "0.6487609", "0.6487216", "0.64872116", "0.6486594", "0.64861935", "0.6486018", "0.6484269", "0.648366", "0.6481476", "0.6481086", "0.6480985", "0.6480396", "0.64797544", "0.647696", "0.64758915", "0.6475649", "0.6474114", "0.6474004", "0.6470706", "0.6470275", "0.64702207", "0.6470039", "0.6467449", "0.646602", "0.6462256", "0.64617974", "0.6461681", "0.6461214" ]
0.0
-1
Get Post object and use the values to update the UI
@Override public void onDataChange(DataSnapshot dataSnapshot) { DailyPrompt dp = dataSnapshot.getValue(DailyPrompt.class); dailyPromptView.setText(dp.content); Toast.makeText(getContext(),"content "+dp.content,Toast.LENGTH_SHORT).show(); // [START_EXCLUDE] // [END_EXCLUDE] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void bind(Post post) {\n // Profile Picture\n // Username\n tvUsername.setText(post.getUser().getUsername());\n // Post Image\n ParseFile postImage = post.getImage();\n if (postImage != null) {\n Glide.with(context).load(postImage.getUrl()).fitCenter().into(ivPostImage);\n }\n // Description\n tvDescription.setText(post.getDescription());\n // Profile Picture Comment\n // Time Ago\n Date createdAt = post.getCreatedAt();\n String timeAgo = Post.calculateTimeAgo(createdAt);\n tvTimeAgo.setText(timeAgo);\n }", "public void bind(Post post) {\n tvDesc.setText(post.getDescription());\n tvUser.setText(post.getUser().getUsername());\n ParseFile image = post.getImage();\n if(image != null) {\n Glide.with(context).load(post.getImage().getUrl()).into(ivPost);\n }\n createdAt = post.getCreatedAt();\n timeAgo = post.calculateTimeAgo(createdAt);\n tvTime.setText(timeAgo);\n }", "private void updatePostPatch() {\n PostModel model = new PostModel(12, null, \"This is the newest one.\");\n Call<PostModel> call = jsonPlaceHolderAPI.patchPosts(5, model);\n call.enqueue(new Callback<PostModel>() {\n @Override\n @EverythingIsNonNull\n public void onResponse(Call<PostModel> call, Response<PostModel> response) {\n if (!response.isSuccessful()) {\n textResult.setText(response.code());\n return;\n }\n PostModel postResponse = response.body();\n String content = \"\";\n assert postResponse != null;\n content += \"Code: \" + response.code() + \"\\n\";\n content += \"ID: \" + postResponse.getId() + \"\\n\";\n content += \"User ID: \" + postResponse.getUserId() + \"\\n\";\n content += \"Title: \" + postResponse.getTitle() + \"\\n\";\n content += \"Body: \" + postResponse.getText();\n textResult.append(content);\n }\n\n @Override\n @EverythingIsNonNull\n public void onFailure(Call<PostModel> call, Throwable t) {\n textResult.setText(t.getMessage());\n }\n });\n }", "public WPPost getPost() {return post;}", "private void updatePostPut() {\n PostModel model = new PostModel(12, null, \"This is the newest one.\");\n Call<PostModel> call = jsonPlaceHolderAPI.putPosts(5, model);\n call.enqueue(new Callback<PostModel>() {\n @Override\n @EverythingIsNonNull\n public void onResponse(Call<PostModel> call, Response<PostModel> response) {\n if (!response.isSuccessful()) {\n textResult.setText(response.code());\n return;\n }\n PostModel postResponse = response.body();\n String content = \"\";\n assert postResponse != null;\n content += \"Code: \" + response.code() + \"\\n\";\n content += \"ID: \" + postResponse.getId() + \"\\n\";\n content += \"User ID: \" + postResponse.getUserId() + \"\\n\";\n content += \"Title: \" + postResponse.getTitle() + \"\\n\";\n content += \"Body: \" + postResponse.getText();\n textResult.append(content);\n }\n\n @Override\n @EverythingIsNonNull\n public void onFailure(Call<PostModel> call, Throwable t) {\n textResult.setText(t.getMessage());\n }\n });\n }", "void editMyPost(Post post);", "public void setData(PrismPost prismPostObject) {\n this.prismPost = prismPostObject;\n postId = this.prismPost.getPostId();\n postDate = Helper.getFancyDateDifferenceString(prismPost.getTimestamp() * -1);\n likeCount = this.prismPost.getLikes();\n repostCount = this.prismPost.getReposts();\n isPostLiked = CurrentUser.hasLiked(prismPost);\n isPostReposted = CurrentUser.hasReposted(prismPost);\n\n if (likeCount == null) likeCount = 0;\n if (repostCount == null) repostCount = 0;\n populateInterfaceElements();\n }", "public void getPostInfo(String objectId){\n final Post.Query query = new Post.Query();\n query.getTop().withUser();\n query.getInBackground(objectId, new GetCallback<Post>() {\n @Override\n public void done(Post object, ParseException e) {\n if (e == null){\n // populate fields with information\n\n if (!object.getDescription().equals(\"\")){\n SpannableString ss1= new SpannableString(object.getHandle() + \" \");\n ss1.setSpan(new StyleSpan(Typeface.BOLD), 0, ss1.length(), 0);\n tvCaption2.append(ss1);\n tvCaption2.append(object.getDescription());\n } else{\n tvCaption2.setText(\"\");\n tvCaption2.setVisibility(View.GONE);\n }\n\n tvHandle2.setText(object.getHandle());\n if (object.getImage() != null){\n GlideApp.with(PostDetails.this)\n .load(object.getImage().getUrl())\n .placeholder(R.drawable.placeholder)\n .into(ivImage2);\n }\n if (object.getProfileImage() != null) {\n GlideApp.with(PostDetails.this)\n .load(object.getProfileImage().getUrl())\n .transform(new CircleCrop())\n .placeholder(R.drawable.instagram_user)\n .into(ivProfileImage2);\n }\n\n tvTimeStamp2.setText(TimeFormatter.getTimeDifference(object.getCreatedAt().toString()));\n } else{ e.printStackTrace(); }\n }\n });\n }", "public void setPost(WPPost post) {this.post = post;}", "public String getPost() {\r\n return post;\r\n }", "public String getPost() {\n return post;\n }", "public String getPost() {\n return post;\n }", "public static Result posts() {\n\t\tPost post = new Post();\n\t\tUser user = UserController.loggedInUser();\n\t\tif (user != null) {\n\t\t\tpost.city= user.city;\n\t\t\tpost.state = user.state;\n\t\t\tpost.country = user.country;\n\t\t\tpost.zipcode = user.zipcode;\n\t\t\tpost.createdBy = user.userName;\t\t\t\n\t\t}\n\t\t//TODO:Use bind() instead of the above to avoid 0.0 in price field\n\t\treturn ok(index.render(Post.listPosts(), form(Post.class).fill(post), user));\n\t}", "public static void refreshPostDetails(Post post) {\n\t\tbp.setCenter(showPostDetails(post));\n\t}", "public java.lang.String getPost() {\n return instance.getPost();\n }", "private void createPost() {\n PostModel model = new PostModel(23, \"New Title\", \"New Text\");\n Call<PostModel> call = jsonPlaceHolderAPI.createPost(model);\n call.enqueue(new Callback<PostModel>() {\n @Override\n @EverythingIsNonNull\n public void onResponse(Call<PostModel> call, Response<PostModel> response) {\n if (!response.isSuccessful()) {\n textResult.setText(response.code());\n return;\n }\n PostModel postResponse = response.body();\n String content = \"\";\n assert postResponse != null;\n content += \"Code: \" + response.code() + \"\\n\";\n content += \"ID: \" + postResponse.getId() + \"\\n\";\n content += \"User ID: \" + postResponse.getUserId() + \"\\n\";\n content += \"Title: \" + postResponse.getUserId() + \"\\n\";\n content += \"Body: \" + postResponse.getText();\n textResult.append(content);\n }\n\n @Override\n @EverythingIsNonNull\n public void onFailure(Call<PostModel> call, Throwable t) {\n textResult.setText(t.getMessage());\n }\n });\n }", "Achievements getPostDetails();", "void bindTo(Post currentPost){\n mUsernameText.setText(currentPost.getUser().getUsername());\n mDescriptionText.setText(currentPost.getDescription());\n mNumOfLikes.setText(String.valueOf(currentPost.getNumberOfLikes()));\n mDate.setText(currentPost.getDate());\n //Get the current sport\n mCurrentPost = currentPost;\n\n //Load the images into the ImageView using the Glide library\n Glide.with(mContext).load(currentPost.\n getImageResource()).placeholder(mGradientDrawable).into(mPostsImage);\n\n Glide.with(mContext).load(currentPost.getUser().\n getImageRes()).placeholder(mGradientDrawable).into(mAvatarImage);\n\n }", "public void bind(final Post post) {\n SpannableStringBuilder str = new SpannableStringBuilder(post.getUser().getUsername() +\n \" \" + post.getDescription());\n str.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), 0,\n post.getUser().getUsername().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);\n descriptionTextView.setText(str);\n\n usernameTextView.setText(post.getUser().getUsername());\n relativeDate = DateUtils.getRelativeTimeSpanString(post.getCreatedAt().getTime()) + \"\";\n timestampText.setText(DateUtils.getRelativeTimeSpanString(post.getCreatedAt().getTime()));\n final ParseFile image = post.getImage();\n if (image != null) {\n Glide.with(context).load(image.getUrl()).into(imgView);\n }\n final ParseFile profilePic = post.getUser().getParseFile(\"profilePic\");\n if (profilePic != null) {\n GlideApp.with(context)\n .load(profilePic.getUrl())\n .transform(new CircleCrop())\n .into(profileImgView);\n } else {\n GlideApp.with(context)\n .load(R.drawable.instagram_user_filled_24)\n .transform(new CircleCrop())\n .into(profileImgView);\n }\n imgView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent intent = new Intent(context, PostDetailsActivity.class);\n intent.putExtra(\"KEY_DESCRIPTION\", post.getDescription());\n intent.putExtra(\"KEY_CREATED_KEY\", relativeDate);\n intent.putExtra(\"KEY_USER\", Parcels.wrap(post.getUser()));\n intent.putExtra(\"KEY_IMAGE\", Parcels.wrap(image));\n context.startActivity(intent);\n }\n });\n usernameTextView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent intent = new Intent(context, ProfileFragment.class);\n// intent.putExtra(\"KEY_USER\", post.getUser());\n intent.putExtra(\"KEY_IMAGE\", Parcels.wrap(image));\n context.startActivity(intent);\n }\n });\n }", "public void setPost(JSONObject post) {\n try {\n JSONObject metadata = new JSONObject();\n Iterator<String> i = this.prefHelper_.getRequestMetadata().keys();\n while (i.hasNext()) {\n String k = (String) i.next();\n metadata.put(k, this.prefHelper_.getRequestMetadata().get(k));\n }\n if (post.has(Jsonkey.Metadata.getKey())) {\n Iterator<String> postIter = post.getJSONObject(Jsonkey.Metadata.getKey()).keys();\n while (postIter.hasNext()) {\n String key = (String) postIter.next();\n metadata.put(key, post.getJSONObject(Jsonkey.Metadata.getKey()).get(key));\n }\n }\n post.put(Jsonkey.Metadata.getKey(), metadata);\n } catch (JSONException e) {\n Log.e(\"BranchSDK\", \"Could not merge metadata, ignoring user metadata.\");\n }\n this.params_ = post;\n DeviceInfo.getInstance(this.prefHelper_.getExternDebug(), this.systemObserver_, this.disableAndroidIDFetch_).updateRequestWithDeviceParams(this.params_);\n }", "@Override\n\tpublic Post updatePost(Post post) {\n\t\treturn null;\n\t}", "public void bind(Post post) {\n tvDescription.setText(post.getDescription());\n tvUsername.setText(post.getUser().getUsername());\n tvTime.setText(Post.calculateTimeAgo(post.getCreatedAt()));\n\n ParseFile image = post.getImage();\n if (image != null) {\n Glide.with(context).load(image.getUrl()).into(ivImage);\n }\n\n itemView.findViewById(R.id.ivImage).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(context, PostDetailActivity.class);\n intent.putExtra(\"post\", Parcels.wrap(post));\n context.startActivity(intent);\n }\n });\n\n //Change heart to be liked\n ivLike.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Resources res = context.getResources();\n if(ivLike.getBackground().equals(res.getDrawable(R.drawable.ufi_heart_active))) {\n Drawable drawable = res.getDrawable(R.drawable.ufi_heart);\n ivLike.setBackground(drawable);\n }\n else {\n Drawable drawable = res.getDrawable(R.drawable.ufi_heart_active);\n ivLike.setBackground(drawable);\n }\n }\n });\n\n //change save Image\n ivSave.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Resources res = context.getResources();\n if(ivSave.getBackground().equals(res.getDrawable(R.drawable.ufi_save_active))) {\n Drawable drawable = res.getDrawable(R.drawable.ufi_save_icon);\n ivSave.setBackground(drawable);\n }\n else {\n Drawable drawable = res.getDrawable(R.drawable.ufi_save_active);\n ivSave.setBackground(drawable);\n }\n }\n });\n\n }", "public PostDTO refreshPost(PostDTO currentPost) {\n postId = currentPost.getId();\n this.currentPost = ctrl.getPost(postId);\n return this.currentPost;\n }", "void savePost(Post post);", "@Override\n\tpublic Post toPost(PostDto postDto ) {\n\t\treturn new Post(employeeDao.readEmployeeById(postDto.getEmployeeId()), postDto.getBody(), LocalDateTime.now(), ticketDao.readTicket(postDto.getTicketId()));\n\t}", "Post getPostByID(long postId);", "void displayPostWithId(String id);", "private void createPostMap() {\n Map<String, String> map = new HashMap<>();\n map.put(\"userId\", \"12\");\n map.put(\"title\", \"New Title\");\n Call<PostModel> call = jsonPlaceHolderAPI.createPostMap(map);\n call.enqueue(new Callback<PostModel>() {\n @Override\n @EverythingIsNonNull\n public void onResponse(Call<PostModel> call, Response<PostModel> response) {\n if (!response.isSuccessful()) {\n textResult.setText(response.code());\n return;\n }\n PostModel postResponse = response.body();\n String content = \"\";\n assert postResponse != null;\n content += \"Code: \" + response.code() + \"\\n\";\n content += \"ID: \" + postResponse.getId() + \"\\n\";\n content += \"User ID: \" + postResponse.getUserId() + \"\\n\";\n content += \"Title: \" + postResponse.getTitle() + \"\\n\";\n content += \"Body: \" + postResponse.getText();\n textResult.append(content);\n }\n\n @Override\n @EverythingIsNonNull\n public void onFailure(Call<PostModel> call, Throwable t) {\n textResult.setText(t.getMessage());\n }\n });\n }", "private Bundle bundleData(Post post) {\n\n Bundle bundle = new Bundle();\n\n// bundle.putString(\"postId\", postId);\n// bundle.putString(\"postUsername\", postUsername);\n// bundle.putParcelable(\"postUserPicture\", userProfilePic);\n// bundle.putString(\"postDescription\", postDescription);\n// bundle.putString(\"postTitle\", postTitle);\n// bundle.putString(\"postDate\", postDate);\n// bundle.putFloat(\"postRating\", postRating);\n// bundle.putString(\"resultId\", resultId);\n// bundle.putString(\"resultImageUrl\", resultImageUrl);\n// bundle.putString(\"resultName\", resultName);\n// bundle.putString(\"resultType\", resultType);\n// bundle.putString(\"resultArtist\", resultArtist);\n bundle.putParcelable(\"post\", post);\n\n return bundle;\n }", "CompletableFuture<PostResponse> updatePost(Post post);", "public PostDetails(Post post, String userid) {\n\t\tpostStage = new Stage();\n\t\tpostStage.initModality(Modality.APPLICATION_MODAL);\n\t\tpostDetailsController = new PostDetailsController();\n\t\tuserId = userid;\n\t\t\n\t\tbp = new BorderPane();\n\t\tbp.setPadding(new Insets(5));\n\t\tbp.setTop(showTitle(post));\n\t\tbp.setCenter(showPostDetails(post));\n\t\tbp.setBottom(showReplyList(post));\n\t\t\n\t\tScene mainScene = new Scene(bp, 1000, 600);\n\t\tpostStage.setScene(mainScene);\n\n\t\tpostStage.show();\n\t}", "public static GridPane showPostDetails(Post post) {\n\t\tGridPane grid = new GridPane();\n\t\tgrid.setHgap(10);\n\t\tgrid.setVgap(10);\n\t\tgrid.setPadding(new Insets(20, 20, 20, 20));\n\t\t\n\t\tString imagePath = post.getImagePath();\n\t\tif(imagePath.equalsIgnoreCase(\"none\") || imagePath.isEmpty()) {\n\t\t\timagePath = \"../../Images/No_image_available.jpg\";\n\t\t}\n\t\tImageView image = new ImageView(new Image(\"file:\" + imagePath, 300, 300, false, false));\n\t\tgrid.add(image, 0, 0);\n\t\t\n\t\tButton uploadImage = new Button(\"Upload Image\");\n\t\tuploadImage.setOnAction(PostDetailsController.uploadImageHandler(postStage, post));\n\t\tHBox hbBtn = new HBox(300);\n\t\thbBtn.getChildren().add(uploadImage);\n\t\thbBtn.setAlignment(Pos.BOTTOM_CENTER);\n\t\tgrid.add(hbBtn, 0, 1);\n\t\t\n\t\tVBox details = new VBox();\n\t\tdetails.setSpacing(10);\n\t\t\n\t\tdetails.getChildren().add(getLabel(\"Post ID: \", post.getId(), false, \"string\"));\n\t\tdetails.getChildren().add(getLabel(\"Title: \", post.getTitle(), true, \"string\"));\n\t\tdetails.getChildren().add(getLabel(\"Description: \", post.getDescription(), true, \"string\"));\n\t\tdetails.getChildren().add(getLabel(\"Creator ID: \", post.getCid(), false, \"string\"));\n\t\tdetails.getChildren().add(getLabel(\"Status: \", post.getStatus(), false, \"string\"));\n\t\tif(post instanceof Event) {\n\t\t\tdetails.getChildren().add(getLabel(\"Venue: \", ((Event) post).getVenue(), true, \"string\"));\n\t\t\tdetails.getChildren().add(getLabel(\"Date: \", ((Event) post).getDate(), true, \"date\"));\n\t\t\tdetails.getChildren().add(getLabel(\"Capacity: \", Integer.toString(((Event) post).getCapacity()), true, \"int\"));\n\t\t\tdetails.getChildren().add(getLabel(\"Attendee Count: \", Integer.toString(((Event) post).getAttcount()), false, \"int\"));\n\t\t}\n\t\telse if(post instanceof Job) {\n\t\t\tdetails.getChildren().add(getLabel(\"Proposed Price: \", Double.toString(((Job) post).getProprice()), true, \"double\"));\n\t\t\tdetails.getChildren().add(getLabel(\"Lowest Offer: \", Double.toString(((Job) post).getLowoffer()), false, \"double\"));\n\t\t}\n\t\telse {\n\t\t\tdetails.getChildren().add(getLabel(\"Highest Offer: \", Double.toString(((Sale) post).getHighoffer()), false, \"double\"));\n\t\t\tdetails.getChildren().add(getLabel(\"Minimum Raise: \", Double.toString(((Sale) post).getMinraise()), true, \"double\"));\n\t\t\tdetails.getChildren().add(getLabel(\"Asking Price: \", Double.toString(((Sale) post).getAskprice()), true, \"double\"));\n\t\t}\n\t\tgrid.add(details, 3, 0);\n\t\t\n\t\tButton closePost = new Button(\"Close Post\");\n\t\tclosePost.setOnAction(PostDetailsController.closePostHandler(userId));\n\t\t\n\t\tButton deletePost = new Button(\"Delete Post\");\n\t\tdeletePost.setOnAction(PostDetailsController.deletePostHandler(userId));\n\t\t\n\t\tButton savePost = new Button(\"Save(after edit)\");\n\t\tsavePost.setOnAction(PostDetailsController.savePostHandler(userId, post));\n\t\t\n\t\tRegion region1 = new Region();\n HBox.setHgrow(region1, Priority.ALWAYS);\n Region region2 = new Region();\n HBox.setHgrow(region2, Priority.ALWAYS);\n\t\tHBox btn = new HBox(closePost, region1, deletePost, region2, savePost);\n\t\t\n\t\tbtn.setAlignment(Pos.BOTTOM_CENTER);\n\t\tgrid.add(btn, 3, 1, 10, 1);\n\t\t\n\t\treturn grid;\n\t}", "public interface Post {\n\n\tpublic Long getId();\n\n\tpublic void setId(Long id);\n\n\tpublic Date getDate();\n\n\tpublic void setDate(Date date);\n\n\tpublic String getMessage();\n\n\tpublic void setMessage(String message);\n\n}", "private void sendPost() {\n Map<String,Object> values = new HashMap<>();\n values.put(Constants.MANAGEMENT,management);\n values.put(Constants.GENERAL_INFORMATION,generalnformation);\n values.put(Constants.SYMPTOMS,symptoms);\n\n FireBaseUtils.mDatabaseDiseases.child(caseStudyUrl).child(url).updateChildren(values);\n Toast.makeText(DiseaseEditActivity.this, \"Item Posted\",LENGTH_LONG).show();\n finish();\n }", "private void doUpdatePost(PostInfo post, TopicInfo topic, WebScriptRequest req, \r\n JSONObject json)\r\n {\n if (json.containsKey(\"title\"))\r\n {\r\n String title = (String)json.get(\"title\");\r\n post.setTitle(title);\r\n if (title.length() > 0)\r\n {\r\n topic.setTitle(title);\r\n }\r\n }\r\n \r\n // Contents is on the post\r\n if (json.containsKey(\"content\"))\r\n {\r\n post.setContents((String)json.get(\"content\"));\r\n }\r\n \r\n // Tags are on the topic\r\n if (json.containsKey(\"tags\"))\r\n {\r\n topic.getTags().clear();\r\n \r\n List<String> tags = getTags(json);\r\n if (tags != null)\r\n {\r\n topic.getTags().addAll(tags);\r\n }\r\n }\r\n \r\n // Save the topic and the post\r\n discussionService.updateTopic(topic);\r\n discussionService.updatePost(post);\r\n }", "public void setPosts(List<Post> posts){\n this.posts = posts;\n }", "@PutMapping(\"/\")\n private ResponseEntity<Post> updatePost(@RequestBody Post post) {\n User user = getCurrentUser();\n Post oldPost = postService.findById(post.getId()).orElse(null);\n\n if (oldPost == null && !user.getId().equals(post.getId()))\n return ResponseEntity.notFound().build();\n\n if (oldPost != null) {\n oldPost.setCreated(new Date());\n oldPost.setSubject(post.getSubject());\n oldPost.setContent(post.getContent());\n\n postService.add(oldPost);\n return new ResponseEntity<>(oldPost, HttpStatus.OK);\n } else\n return ResponseEntity.badRequest().build();\n }", "public void getAndPopulateData() {\n mAuth = FirebaseAuth.getInstance();\n firestore = FirebaseFirestore.getInstance();\n firestore.collection(\"Posts\").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {\n @Override\n public void onComplete(@NonNull Task<QuerySnapshot> task) {\n final ArrayList<Post> tempPost = new ArrayList<>();\n for (DocumentSnapshot ds : task.getResult().getDocuments())\n {\n Post post = ds.toObject(Post.class);\n if (post.getApprovalStatus().equals(\"awaiting\"))\n {\n tempPost.add(post);\n }\n }\n help(tempPost);\n }\n });\n }", "public String getPostUser() {\n return postUser;\n }", "private void queryPost() {\n tv_search.setText(\"Recently Added Posts:\");\n ParseQuery<Post> query = ParseQuery.getQuery(Post.class);\n query.include(Post.KEY_USER);\n query.setLimit(15);\n query.addDescendingOrder(Post.KEY_CREATED);\n query.findInBackground(new FindCallback<Post>() {\n @Override\n public void done(List<Post> posts, ParseException e) {\n if(e!= null){\n Log.e(tag, \"Issue with getting post\", e);\n return;\n }\n adaptor.clear();\n adaptor.addAll(posts);\n //allPost.addAll(posts);\n //adaptor.notifyDataSetChanged();\n //swipeRefreshLayout.setRefreshing(false);\n\n //user just created a post\n if (isJustCreatedNewPost == true)\n {\n //reset bool\n isJustCreatedNewPost = false;\n// //subscribe user to their new post channel\n// String postChannel = \"POST_\"+posts.get(0).getObjectId();\n// ParsePush.subscribeInBackground(postChannel);\n\n }\n }\n });\n }", "public List<Post> getPosts(){return this.posts;}", "@Override\n\tpublic void getPost(Scanner sc) {\n\t\tPost p;\n\t\tgetAll();\n\t\tSystem.out.print(\"보고 싶은 리뷰의 번호를 입력해 주세요 >>\");\n\t\tp = dao.selectPost(sc.nextInt());\n\t\tSystem.out.println(p.getPostName());\n\t\tSystem.out.println(p.getContent());\n\t}", "void post(Post post) {\n if (post instanceof Video) {\n vd.compressVideo((Video) post);\n } else if (post instanceof Image) {\n id.decorateImage((Image) post);\n } else if (post instanceof Text) {\n tg.checkGrammar((Text) post);\n }\n }", "private void getPosts_Id() {\n Call<List<Post>> call = apiInterface.getPosts_Id(new Integer[]{2, 3, 6}, null, null); //show data according which which userID\n\n call.enqueue(new Callback<List<Post>>() {\n @Override\n public void onResponse(Call<List<Post>> call, Response<List<Post>> response) {\n if (!response.isSuccessful()) {\n progressDialog.dismiss();\n textView_Results.setText(\"Code : \" + response.code());\n return;\n }\n List<Post> posts = response.body();\n for (Post post : posts) {\n progressDialog.dismiss();\n String content = \"\";\n content += \"ID: \" + post.getId() + \"\\n\";\n content += \"UserID: \" + post.getUserId() + \"\\n\";\n content += \"Title: \" + post.getTitle() + \"\\n\";\n content += \"Text: \" + post.getText() + \"\\n\\n\";\n button.setVisibility(View.GONE);\n textView_Results.append(content);\n }\n }\n\n @Override\n public void onFailure(Call<List<Post>> call, Throwable t) {\n textView_Results.setText(t.getMessage());\n }\n });\n }", "public VBeatPostModel getPost(String postId){\n List<VBeatPostModel> postList = AppLocalDB.getInstance().db.postDao().getPost(postId);\n\n if(postList.size() == 0) {\n return null;\n } else {\n return postList.get(0);\n }\n\n }", "@PostMapping(\"/posts\")\n ResponseEntity<?> createPost(@RequestBody Post post) {\n post.setOwner(SecurityContextHolder.getContext().getAuthentication().getName());\n post.setDateCreated(LocalDateTime.now());\n\n EntityModel<Post> newPost = modelAssembler.toModel(postRepository.save(post));\n return ResponseEntity.created(newPost.getRequiredLink(IanaLinkRelations.SELF).toUri()).body(newPost);\n }", "public List<PostDto> displayPostList(UserDto user);", "@Test(enabled=false)\n\tpublic void objectPost() {\t\n\t\tPosts posts = new Posts(\"3\", \"Seahawks\", \"Wilson\");\n\t\t\n\t\tResponse res = given().\n\t\twhen().\n\t\tcontentType(ContentType.JSON).\n\t\tbody(posts).\n\t\tpost(\"http://localhost:3000/posts/\");\n\t\n\t\tSystem.out.println(\"Response as object: \"+res.asString());\n\t}", "public void bind(Post post) {\n tvUsername.setText(post.getUser().getUsername());\n String descriptionString = \"<b>\" + post.getUser().getUsername() + \"</b> \" + post.getDescription();\n tvDescription.setText(Html.fromHtml(descriptionString));\n //Log.i(\"Posts Adapter\", post.getDescription() + post.getCreatedAt());\n tvDate.setText(post.getCreatedAt().toString());\n ParseFile image = post.getImage();\n if(image != null){\n Glide.with(context).load(image.getUrl()).into(ivImage);\n }\n ParseFile imageProfile = post.getUser().getParseFile(\"profileImage\");\n if(imageProfile != null){\n Glide.with(context).load(imageProfile.getUrl()).transform(new CircleCrop()).into(ivProfilePic);\n }\n rlPostProfile.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n int position = getAdapterPosition();\n //Log.i(\"myApp\", \"on click\");\n // make sure the position is valid, i.e. actually exists in the view\n if (position != RecyclerView.NO_POSITION) {\n // get the movie at the position, this won't work if the class is static\n Post post = posts.get(position);\n // create intent for the new activity\n Intent intent = new Intent(context, UserPostActivity.class);\n // serialize the movie using parceler, use its short name as a key\n intent.putExtra(Post.class.getSimpleName(), Parcels.wrap(post));\n ///intent.putExtra(Tweet.class.getSimpleName(), Parcels.wrap(tweet));\n // show the activity\n context.startActivity(intent);\n }\n }\n });\n }", "Post save(Post post) throws Exception;", "@RequestMapping(value = \"/blog/{postId}\", method = RequestMethod.GET)\n @ResponseBody\n public Post getBlogPostPage(@PathVariable(\"postId\") int postId) {\n Post selectedPost = daoP.getPostById(postId);\n return selectedPost; //is this correct? we want to return the post object to Ajax to parse and place in page.\n\n }", "List<PostInfo> getPostList();", "private PostDTO buildReturnDto( Post post ) {\n PostDTO postDTO = postMapper.postToPostDto( post );\n postDTO.setPostUrl( buildPostUrl( post ) );\n postDTO.getUser().setAvatarUrl( avatarService.buildAvatarUrl( post.getUser() ) );\n //if post is a child post, set the parentPostUrl\n if ( post.getParent() != null ) postDTO.setParentPostUrl( buildPostUrl( post.getParent() ));\n if ( post.getChildren() != null ) {\n for ( int i = 0; i < post.getChildren().size(); i++ ) {\n PostDTO childDTO = postDTO.getChildren().get( i );\n Post child = post.getChildren().get( i );\n childDTO.setPostUrl( buildPostUrl( post.getChildren().get( i ) ) );\n childDTO.getUser().setAvatarUrl( avatarService.buildAvatarUrl( child.getUser() ) );\n childDTO.setParentPostUrl( buildParentPostUrl( child ) );\n }\n }\n return postDTO;\n }", "public void refreshForDifferentPostParams() {\n GobalPostLoader.Params newParams = new GobalPostLoader.Params(\n postLoaderMethodList.getSelectedMethod(),\n postLoaderMethodList.getContentType()\n );\n newParams.interpretAsGlobal = postLoaderMethodList.interpretAsGlobalPosts();\n newParams.showGlobalPosts = postLoaderMethodList.showGlobalPosts();\n\n postLoaderParams = newParams;\n\n if (!newParams.interpretAsGlobal) {\n refreshWithHidePublicUpdate();\n } else {\n refreshNoHidePublicUpdate();\n }\n\n getActivity().supportInvalidateOptionsMenu();\n }", "public Post(String user, String postContent, String webAddress) {\n this.orderPosted = nextOrderPosted;\n nextOrderPosted++;\n this.user = user;\n this.postContent = postContent;\n this.webAddress = webAddress;\n// this.myAuthor=myAuthor;\n\n }", "@Override\n\tpublic void editPost(Scanner sc) {\n\t\tPost p = new Post();\n\t\tgetPostByMemberId();\n\t\tSystem.out.print(\"수정할 번호를 입력해 주세요 >>\");\n\t\tp.setPostId(sc.nextInt());\n\t\tsc.nextLine();\n\t\tp.setMemberId(cur.getId());\n\t\tSystem.out.print(\"제목을 수정해 주세요 :\");\n\t\tp.setPostName(sc.nextLine());\n\t\tSystem.out.print(\"내용을 수정해 주세요 :\");\n\t\tp.setContent(sc.nextLine());\n\t\tdao.updatePost(p);\n\t}", "public void setPostId(Integer postId) {\n this.postId = postId;\n }", "@Override\n public List<Post> postList() {\n List<Post> savedPosts = (List<Post>) postRepository.findAll();\n Set<Long> userIdList = savedPosts.stream().map(Post::getUserId).collect(Collectors.toSet());\n\n User[] rateResponse = sender.getUsersByUserId(userIdList);\n\n HashMap<Long, User> userHashMap = new LinkedHashMap<>();\n for (User user : rateResponse) {\n userHashMap.put(user.getUserId(), user);\n }\n for (Post savedPost : savedPosts) {\n savedPost.setUser(userHashMap.get(savedPost.getUserId()));\n }\n return savedPosts;\n }", "PostSaveDTO queryDetailById(String postId);", "Optional<Post> getPost(String postId) throws Exception;", "@Override\r\n\tpublic void updatePost(Post post) {\n\t\tPost p = getPostById(post.getPost_id());\r\n\t\tp.setDepartment(post.getDepartment());\r\n\t\tp.setDescription(post.getDescription());\r\n\t\tp.setEmployeeSet(post.getEmployeeSet());\r\n\t\tp.setPost_id(post.getPost_id());\r\n\t\tp.setPost_name(post.getPost_name());\r\n\t\tp.setPost_wage(post.getPost_wage());\r\n\t\tgetHibernateTemplate().update(p);\r\n\t}", "public void postData() {\n\n\t}", "public void help (ArrayList<Post> post)\n {\n adminRecView = findViewById(R.id.adminRecView);\n posts = post;\n ModRecAdapter adapt = new ModRecAdapter(posts, this);\n adminRecView.setAdapter(adapt);\n adminRecView.setLayoutManager(new LinearLayoutManager(this));\n }", "private void assignPosts(List<Post> posts) {\n\t\ttextPosts = Lists.newArrayList();\n\t\tphotoPosts = Lists.newArrayList();\n\t\tvideoPosts = Lists.newArrayList();\n\t\tfor (Post post : posts) {\n\t\t\tif (post instanceof TextPost) {\n\t\t\t\ttextPosts.add((TextPost)post);\n\t\t\t} else if (post instanceof PhotoPost) {\n\t\t\t\tphotoPosts.add((PhotoPost)post);\n\t\t\t} else if (post instanceof VideoPost) {\n\t\t\t\tvideoPosts.add((VideoPost)post);\n\t\t\t}\n\t\t}\n\t}", "public Post selectPostChange(Post post) {\n\t\treturn postDao.selectPostChange(post);\r\n\t}", "@Override\n public void onClick(View view) {\n CreatePost createPost = new CreatePost(context, selectedPic);\n createPost.execute(title.getText().toString(), description.getText().toString());\n }", "public Builder setPost(\n java.lang.String value) {\n copyOnWrite();\n instance.setPost(value);\n return this;\n }", "@Override\n\tpublic void onRefresh() {\n\t\tmodel.getPostsByType(userId, 0, method, postListiner);\n\t\tcurrentPage = 0;\n\n\t}", "void setPostId(int postId);", "public void doPost( )\n {\n \n }", "public String getPostBody() {\n return postBody;\n }", "public void postPosts(HttpServletRequest req) {\n\t\tArrayList<Post> posts = null;\n\t\tArrayList<Post> bPosts = null;\n\t\tString errorMessage2 = null;\n\n\t\tPostController controller2 = new PostController();\n\n\t\t// get list of authors returned from query\n\t\tposts = controller2.getAllPosts(4);\n\t\tbPosts = controller2.getAllPosts(2);\n\n\t\t// any authors found?\n\t\tif (posts == null) {\n\t\t\terrorMessage2 = \"No Posts were found in the Library\";\n\t\t}\n\n\t\t// Add result objects as request attributes\n\t\treq.setAttribute(\"errorMessage\", errorMessage2);\n\t\treq.setAttribute(\"posts\", posts);\n\t\treq.setAttribute(\"bPosts\", bPosts);\n\t}", "@Override\n public void onPostAdded(final Post post) {\n new Thread(new Runnable() {\n @Override\n public void run() {\n post.setFullView(false);\n post.processData();\n post.setCallbackManager(manager);\n\n manager.addCallback(new CallbackManager.Callback<BaseGlobalPostListFragment>() {\n @Override\n public void execute(BaseGlobalPostListFragment object) {\n object.postsAdapter.add(0, post);\n object.offset++;\n }\n });\n }\n }).start();\n }", "public Integer getPostId() {\n return postId;\n }", "public Post getPost(int postID)\n {\n Post post = null;\n try\n {\n database = dbH.getReadableDatabase();\n dbH.openDataBase();\n String query = \"SELECT * FROM Post WHERE postID=\"+\"'\"+postID+\"'\";\n Cursor c = database.rawQuery(query, null);\n if (c.moveToFirst()) {\n post = new Post();\n post.setPostID(c.getColumnIndex(\"postID\"));\n post.setPostBody(c.getString(c.getColumnIndex(\"postBody\")));\n post.setPostedBy(c.getString(c.getColumnIndex(\"postedBy\")));\n post.setBitmap(c.getString(c.getColumnIndex(\"image\")));\n\n }\n else\n {\n Log.i(TAG, \"This postID doesn't exist in the DB.\");\n }\n dbH.close();\n }\n catch (SQLException e)\n {\n e.printStackTrace();\n Log.i(TAG, \"Error in getting post from DB.\");\n\n }\n return post;\n }", "public String getDatePost() {\n return datePost;\n }", "CompletableFuture<PostResponse> createNewPost(Post post);", "@FormUrlEncoded\n @POST(\"posts\")\n Call<Post> createPost(@Field(\"userId\") int userId, @Field(\"title\") String title, @Field(\"body\") String text);", "@PostMapping(\"/\")\n private ResponseEntity<Post> createPost(@RequestBody Post post) {\n User user = getCurrentUser();\n post.setCreated(new Date());\n post.setUserId(user.getId());\n post = postService.add(post);\n\n return new ResponseEntity<>(post, HttpStatus.OK);\n }", "@Override\n\tpublic Post createPost(Post post) {\n\t\treturn postDao.createPost(post);\n\t}", "public void createPost( BlogPost post );", "@Override\r\n protected Map<String, Object> executeImpl(SiteInfo site, NodeRef nodeRef,\r\n TopicInfo topic, PostInfo post, WebScriptRequest req, JSONObject json,\r\n Status status, Cache cache) \r\n {\n Map<String, Object> model = buildCommonModel(site, topic, post, req);\r\n \r\n // Did they want to change a reply or the whole topic?\r\n if (post != null)\r\n {\r\n // Update the specified post\r\n doUpdatePost(post, post.getTopic(), req, json);\r\n \r\n // Add the activity entry for the reply change\r\n addActivityEntry(\"reply\", \"updated\", post.getTopic(), post, site, req, json);\r\n \r\n // Build the JSON for just this post\r\n model.put(KEY_POSTDATA, renderPost(post, site));\r\n }\r\n else if (topic != null)\r\n {\r\n // Update the primary post of the topic\r\n post = discussionService.getPrimaryPost(topic);\r\n if (post == null)\r\n {\r\n throw new WebScriptException(Status.STATUS_PRECONDITION_FAILED,\r\n \"First (primary) post was missing from the topic, can't fetch\");\r\n }\r\n doUpdatePost(post, topic, req, json);\r\n \r\n // Add the activity entry for the topic change\r\n addActivityEntry(\"post\", \"updated\", topic, null, site, req, json);\r\n \r\n // Build the JSON for the whole topic\r\n model.put(KEY_POSTDATA, renderTopic(topic, site));\r\n }\r\n else\r\n {\r\n String error = \"Node was of the wrong type, only Topic and Post are supported\";\r\n throw new WebScriptException(Status.STATUS_BAD_REQUEST, error);\r\n }\r\n \r\n // All done\r\n return model;\r\n }", "public void bind(Post post) {\n\n tvUsername.setText(post.getUser().getUsername());\n\n ParseFile userProfilePic = (ParseFile) post.getUser().get(\"profile_picture\");\n\n Log.i(\"PostsAdapter\", \"user profile \" + userProfilePic);\n\n if(userProfilePic != null) {\n Glide.with(context).load(userProfilePic.getUrl())\n .placeholder(R.drawable.defaultavatar)\n .circleCrop()\n .into(ivProfileImage);\n\n }\n\n ivProfileImage.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent i = new Intent(context, UserPageActivity.class);\n Bundle bundle = new Bundle();\n\n String username = post.getUser().getUsername();\n String userpic = ((ParseFile) post.getUser().get(\"profile_picture\")).getUrl();\n ParseUser parseUser = post.getUser();\n\n bundle.putString(\"username\", username);\n bundle.putString(\"userpic\", userpic);\n bundle.putParcelable(\"parseUser\", parseUser);\n\n i.putExtras(bundle);\n context.startActivity(i);\n }\n });\n\n tvUsername.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent i = new Intent(context, UserPageActivity.class);\n Bundle bundle = new Bundle();\n\n String username = post.getUser().getUsername();\n String userpic = ((ParseFile) post.getUser().get(\"profile_picture\")).getUrl();\n ParseUser parseUser = post.getUser();\n\n bundle.putString(\"username\", username);\n bundle.putString(\"userpic\", userpic);\n bundle.putParcelable(\"parseUser\", parseUser);\n\n i.putExtras(bundle);\n context.startActivity(i);\n }\n });\n\n if (post.getResultType().equals(\"Artist\")) {\n tvResultType.setText(post.getResultType());\n tvResultName.setText(post.getResultName());\n tvResultBullet.setText(\"\");\n tvResultArtist.setText(\"\");\n\n Glide.with(context)\n .asBitmap()\n .load(post.getResultImageUrl())\n .circleCrop()\n .into(ivResultImage);\n\n } else if (post.getResultType().equals(\"Album\")) {\n tvResultType.setText(post.getResultType());\n tvResultName.setText(post.getResultName());\n tvResultBullet.setText(\"•\");\n tvResultArtist.setText(post.getResultArtist());\n\n Glide.with(context)\n .asBitmap()\n .load(post.getResultImageUrl())\n .transform(new CenterCrop(),new RoundedCorners(10))\n .into(ivResultImage);\n\n } else if (post.getResultType().equals(\"Track\")) {\n tvResultType.setText(post.getResultType());\n tvResultName.setText(post.getResultName());\n tvResultBullet.setText(\"•\");\n tvResultArtist.setText(post.getResultArtist());\n\n Glide.with(context)\n .asBitmap()\n .load(post.getResultImageUrl())\n .transform(new CenterCrop(),new RoundedCorners(10))\n .into(ivResultImage);\n\n }\n\n ratingBar.setRating(post.getRating());\n ratingBar.setIsIndicator(true);\n tvReviewTitle.setText(post.getReviewTitle());\n tvReviewDescription.setText(post.getDescription());\n\n if (!post.isLikedByUser) {\n checkIsLikedByUser(post);\n //mLikeAnim.toggleLikeOutline(context);\n Drawable heartDrawable = context.getDrawable(R.drawable.ic_like_outline);\n ivLikeHeart.setImageDrawable(heartDrawable);\n if (post.numOfLikes == 0) {\n tvNumLikes.setText(\"\");\n }\n else if (post.numOfLikes == 1) {\n tvNumLikes.setText(post.numOfLikes + \" like\");\n }\n else if (post.numOfLikes > 1) {\n tvNumLikes.setText(post.numOfLikes + \" likes\");\n }\n } else {\n mLikeAnim.toggleLikeFilled(context);\n if (post.numOfLikes == 0) {\n tvNumLikes.setText(\"\");\n }\n else if (post.numOfLikes == 1) {\n tvNumLikes.setText(post.numOfLikes + \" like\");\n }\n else if (post.numOfLikes > 1) {\n tvNumLikes.setText(post.numOfLikes + \" likes\");\n }\n }\n\n ivLikeHeart.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n // if post is already liked get rid of the like\n // else like the post\n if (post.isLikedByUser) {\n removeLike(post);\n } else {\n likePost(post);\n }\n }\n });\n\n ivComment.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Bundle bundle = bundleData(post);\n bundle.putString(\"scroll\",\"scroll\");\n sendToReviewPost(bundle);\n }\n });\n\n if (post.numOfComments == 0) {\n tvNumComments.setText(\"\");\n }\n else if (post.numOfComments == 1) {\n tvNumComments.setText(post.numOfComments + \" comment\");\n }\n else if (post.numOfComments > 1) {\n tvNumComments.setText(post.numOfComments + \" comments\");\n }\n }", "@Override\n public void onPostUpdated(final Post post) {\n manager.addCallback(new CallbackManager.Callback<BaseGlobalPostListFragment>() {\n @Override\n public void execute(BaseGlobalPostListFragment object) {\n object.postsAdapter.replacePost(post);\n }\n });\n }", "private void setupPostUserUIElements() {\n if (prismPost.getPrismUser() != null) {\n Glide.with(context)\n .asBitmap()\n .thumbnail(0.05f)\n .load(prismPost.getPrismUser().getProfilePicture().getLowResProfilePicUri())\n .apply(new RequestOptions().fitCenter())\n .into(new BitmapImageViewTarget(userProfilePicImageView) {\n @Override\n protected void setResource(Bitmap resource) {\n int imageViewPadding = (int) (1.5 * Default.scale);\n RoundedBitmapDrawable profilePictureDrawable =\n BitmapHelper.createCircularProfilePicture(\n context,\n userProfilePicImageView,\n prismPost.getPrismUser().getProfilePicture().isDefault(),\n resource,\n imageViewPadding);\n userProfilePicImageView.setImageDrawable(profilePictureDrawable);\n }\n });\n prismUserTextView.setText(prismPost.getPrismUser().getUsername());\n prismPostDateTextView.setText(postDate);\n\n postInformationRelativeLayout.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n IntentHelper.intentToUserProfileActivity(context, prismPost.getPrismUser());\n }\n });\n }\n }", "public VerticalPanel createPost2(Post post){\n\t\t\tVerticalPanel result = new VerticalPanel();\n\t\t\tLabel lbl = new Label(post.getContent());\n\t\t\tresult.add(lbl);\n\t\t\treturn result;\n\t\t}", "@Override\n public void onRefresh() {\n fetchPosts();\n }", "public void setData(Post item) {\n a.setText(points + \" points\");\n this.dataItem = item;\n title.setText(item.getTitle());\n desc.setText(item.getDesc());\n upvoted.setEnabled(!item.isUpvoted());\n downvoted.setEnabled(!item.isDownvoted());\n // Picasso.with(itemView.getContext()).load(item.getImg()).into(img);\n // Picasso.with(itemView.getContext()).load(item.getImg()).into(img);\n\n\n\n }", "public Post() {\n\t\t\n\t}", "protected void populateFeed() {\n ParseQuery<Post> query = ParseQuery.getQuery(Post.class);\n query.include(Post.KEY_USER);\n query.addDescendingOrder(Post.CREATED_AT);\n query.setLimit(20);\n query.findInBackground(new FindCallback<Post>() {\n // Result of the call to Parse\n @Override\n public void done(List<Post> queryPosts, ParseException e) {\n // There is an error\n if(e != null) {\n Log.e(TAG, \"Error in getting posts\");\n return;\n }\n for(Post post : queryPosts) {\n // post.getUser() gets the Id... post.getUser().getUsername() gets the Username associated to the id of getUser in User's table\n Log.i(TAG, \"Post \" + post.getDescription() + \" username: \" + post.getUser().getUsername());\n }\n posts.addAll(queryPosts);\n adapter.notifyDataSetChanged();\n }\n });\n }", "protected void updatePostTime() {\n mPostTime = calculatePostTime();\n }", "@GetMapping(\"/{id}\")\n public ResponseEntity<Post> getPostById(@PathVariable Long id){\n Post post = postService.getPostById(id);\n return ResponseEntity.ok(post);\n }", "public void post(ActionEvent actionEvent) throws IOException, ClassNotFoundException {\n Post post;\n if (postPic != null) {\n post = new Post(thisUser.getUser().getUsername(), title.getText()\n , description.getText(), new Date(), thisUser.getUser().getProfileImage(), postPic);\n post.setPostPicAddress(file.toString());\n } else {\n post = new Post(thisUser.getUser().getUsername(), title.getText()\n , description.getText(), new Date(), thisUser.getUser().getProfileImage());\n post.setPostPicAddress(\"No postPic\");\n }\n\n post.setOwner(thisUser.getUser().getUsername());\n\n CommandSender commandSender = new CommandSender(CommandType.NEWPOST\n , post);\n\n Client.getObjectOutputStream().writeObject(commandSender);\n\n thisUser.setSearchedUser(thisUser.getUser());\n Main.loadAPage(actionEvent\n , \"../FXMLs/MyProfile.fxml\"\n , \"SBUgram - Your Profile\"\n );\n\n }", "public Post(){\n\n }", "@PostMapping(\"/addPost\")\n public ResponseEntity addNewPost(@RequestBody Post post){\n postService.postNewInfo(post);\n return new ResponseEntity(HttpStatus.OK);\n }", "@PostMapping(\"/posts/create\")\n public String createPost(\n Model model,\n @RequestParam(name = \"title\") String title,\n @RequestParam(name = \"body\") String body,\n @RequestParam(name = \"team\") String teamIDString,\n @RequestParam(name = \"sport\") String sportIDString) {\n\n long teamID = Long.parseLong(teamIDString);\n long sportID = Long.parseLong(sportIDString);\n\n Team thisTeam = teamRepository.findOne(teamID);\n Sport thisSport = sportRepository.findOne(sportID);\n\n\n// Which user is being assigned to this post?\n\n User foundUser = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();\n User dbUser = userRepository.findOne(foundUser.getId());\n\n\n\n\n// Now it's time to actually make the post.\n\n Post post = new Post();\n post.setTitle(title);\n post.setBody(body);\n post.setSport(thisSport);\n post.setTeam(thisTeam);\n post.setAuthor(dbUser);\n\n postRepository.save(post);\n\n// After post is created, give user options to do something next\n\n Post createdPost = postRepository.findOne(post.getId());\n model.addAttribute(\"createdPost\", createdPost);\n\n\n// Send email commented out for now so I don't send an email every time\n\n// emailService.prepareAndSend(post, \"Congratulations James! You have been hired for this position\", \"You have been hired for this position: 1007A McDonalds Region Manager\");\n\n return \"posts/create-success\";\n }", "@RequestMapping(value = \"/newPost\", method = RequestMethod.POST)\n\tpublic String setNewPost(@ModelAttribute(\"post\") @Valid Post post, BindingResult result, ModelMap model) {\n\n\t\tif (result.hasErrors()) {\n\t\t\tSystem.out.println(\"There are errors newPost\");\n\t\t\tmodel.addAttribute(\"allpostTypes\", postService.AllPostType());\n\t\t\treturn \"/admin/post/newPost\";\n\t\t}\n\n\t\tpost = createPost(post);\n\n\t\tLike like = new Like();\n\t\tlike.setPost(post);\n\t\tlikeService.saveLike(like);\n\n\t\tUser user = userService.findUserByUsername(getPrincipal());\n\t\tpost.setUser(user);\n\t\tpostService.updatePost(post);\n\n\t\tmodel.addAttribute(\"operationmessage\",\n\t\t\t\tmessageSource.getMessage(\"message.newpost.success\", null, LocaleContextHolder.getLocale()));\n\t\treturn \"redirect:/profile/\" + getPrincipal();\n\t}", "public Date getTimePost() {\n return timePost;\n }", "@GetMapping(\"/{post_id}\")\n private ResponseEntity<Post> getPost(@PathVariable Long post_id) {\n User user = getCurrentUser();\n Post post = postService.findById(post_id).orElse(null);\n\n if (post == null) {\n return ResponseEntity.notFound().build();\n } else {\n return ResponseEntity.ok(post);\n }\n }", "@Override\n public void done(List<Post> queryPosts, ParseException e) {\n // There is an error\n if(e != null) {\n Log.e(TAG, \"Error in getting posts\");\n return;\n }\n for(Post post : queryPosts) {\n // post.getUser() gets the Id... post.getUser().getUsername() gets the Username associated to the id of getUser in User's table\n Log.i(TAG, \"Post \" + post.getDescription() + \" username: \" + post.getUser().getUsername());\n }\n posts.addAll(queryPosts);\n adapter.notifyDataSetChanged();\n }", "public void savePost(VBeatPostModel post) {\n AppLocalDB.getInstance().db.postDao().insertAll(post);\n }" ]
[ "0.6634134", "0.65328807", "0.6395189", "0.6393057", "0.6392863", "0.6285597", "0.62298036", "0.6201209", "0.6201008", "0.6185457", "0.6122679", "0.6122679", "0.60396004", "0.5958734", "0.5957789", "0.59500295", "0.59484285", "0.5924146", "0.5886274", "0.5836514", "0.5834009", "0.57564884", "0.573685", "0.57160395", "0.56959337", "0.5690002", "0.56667143", "0.5660298", "0.56320304", "0.5621366", "0.5610221", "0.5586863", "0.55401677", "0.55007917", "0.54763985", "0.54437476", "0.5439671", "0.54299855", "0.54112744", "0.5408075", "0.5400045", "0.53675956", "0.5366107", "0.53571755", "0.53547573", "0.5349896", "0.5329855", "0.5329752", "0.5325695", "0.5319624", "0.5315863", "0.5293085", "0.5283594", "0.5277426", "0.52729493", "0.52687186", "0.52320373", "0.52285403", "0.5224511", "0.5214981", "0.51990825", "0.5172089", "0.5169447", "0.515989", "0.5157863", "0.5155261", "0.51536196", "0.5149814", "0.5143861", "0.5143321", "0.5135192", "0.5131117", "0.5118693", "0.51066184", "0.5096402", "0.50910825", "0.50901407", "0.5079295", "0.5078552", "0.5073338", "0.50647753", "0.50585294", "0.5056413", "0.5049737", "0.50485533", "0.50454426", "0.5037892", "0.5037421", "0.5032457", "0.5030025", "0.5029406", "0.50245994", "0.502202", "0.5021096", "0.5018338", "0.50170684", "0.50133115", "0.50099236", "0.5006892", "0.50047636", "0.50029886" ]
0.0
-1
Getting Post failed, log a message
@Override public void onCancelled(DatabaseError databaseError) { Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // [START_EXCLUDE] // [END_EXCLUDE] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\t\t\t\t\tpublic void onError(Exception e) {\n\t\t\t\t\t\tLog.e(\"HttpPost\", \"LIES \" + e.getMessage());\r\n\r\n\t\t\t\t\t}", "@GET(\"posts/trois\")\n ErrorHandlingCall<Post> getPostOneWithError();", "@Override\n public void failure(RetrofitError retrofitError) {\n Log.e(TAG, \"Error retrieving posts from the feed: \" + retrofitError.getCause().toString());\n \n if (!retrofitError.isNetworkError()) {\n Log.i(TAG, \"Not network error, so likely cookie has expired; return user to login page\");\n sessionManager.terminateSession();\n startActivity(new Intent(getApplicationContext(), MainActivity.class));\n }\n else {\n Toast toast = new Toast(context);\n toast.makeText(context, getString(R.string.error_connecting), Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n\t\t\t\t\t\t\t\t\t\tpublic void onRequestFail() {\n\n\t\t\t\t\t\t\t\t\t\t}", "@Override\n public void onFailure(Call<List<Post>> call, Throwable t) {\n }", "@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\tfail(\"Request failure: \" + caught.getMessage());\n\t\t\t}", "public void httpfailure(String errmsg) {\n\t\t\n\t}", "@Override\n\t\t\t\t\tpublic void httpFail(String response) {\n\t\t\t\t\t}", "@Override\r\n\t\t\t\tpublic void onFail(String desc) {\n\t\t\t\t Log.e(\"upload\",desc);\t\r\n\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFailure(int statusCode, Header[] headers,\n\t\t\t\t\t\t\tThrowable throwable, JSONObject errorResponse) {\n\t\t\t\t\t\tToast.makeText(getActivity().getApplicationContext(), \"提交超时\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFailure(int statusCode, Header[] headers,\n\t\t\t\t\t\t\tThrowable throwable, JSONObject errorResponse) {\n\t\t\t\t\t\tToast.makeText(getActivity().getApplicationContext(), \"提交超时\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFailure(int statusCode, Header[] headers,\n\t\t\t\t\t\t\tThrowable throwable, JSONObject errorResponse) {\n\t\t\t\t\t\tToast.makeText(getActivity().getApplicationContext(), \"提交超时\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFailure(int statusCode, Header[] headers,\n\t\t\t\t\t\t\tThrowable throwable, JSONObject errorResponse) {\n\t\t\t\t\t\tToast.makeText(getActivity().getApplicationContext(), \"提交超时\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}", "@Override\n\t\t\tpublic void onFailure(int arg0, String arg1) {\n\t\t\t\tToast.makeText(MainActivity.this, \"submit failure\", Toast.LENGTH_LONG).show();\n\t\t\t}", "@Override\n public void failure(RetrofitError error) {\n Log.e(\"error\",error.getResponse().getReason());\n }", "@Override\n\t\t\tpublic void onFailure(Request request, IOException e) {\n\t\t\t\t Log.i(\"info\",\"hehe\");\n\t\t\t}", "@Override\n public void failure(TwitterException exception) {\n Toast.makeText(getApplicationContext(), \"Fail Logged.....ٍ\", Toast.LENGTH_LONG).show();\n\n }", "@Override\n public void failure(RetrofitError arg0) {\n Log.info(\"net err:\"+arg0.toString());\n }", "@Override\r\n\t\t\t\t\t\t\tpublic void onFail(String msg) {\n\t\t\t\t\t\t\t\tToast.makeText(PhotoImagePagerActivity.this, \"服务器错误\", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\t\t\t}", "String getFailureMessage();", "protected void responseFail(){\n\t\tqueue.clear();\n\t}", "@Override\n public void onErrorResponse(VolleyError error) {\n //This code is executed if there is an error.\n Log.d(\"POST\", \"ERROR: \" + error.toString());\n Snackbar.make(mView.findViewById(R.id.activity_register_screen), R.string.email_already_registered_text,\n Snackbar.LENGTH_SHORT)\n .show();\n }", "protected void handlePostExecution(Logger log) {\n \n handleException(log);\n \n // TODO: should status=0 (success?) be left as-is in the response header?\n SolrCore.postDecorateResponse(null, solrRequest, solrResponse);\n addDeprecatedWarning();\n\n if (log.isInfoEnabled() && solrResponse.getToLog().size() > 0) {\n log.info(solrResponse.getToLogAsString(solrCore.getLogId()));\n }\n }", "@Override\n public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {\n postState = true;\n CustomDialog.closeProgressDialog();\n CustomToast.showShortToast(mContext, \"签到失败,网络错误!\");\n }", "void onFailureRedirection(String errorMessage);", "public void onLoadingFailure() {\n AppSession.showDataLoadError(\"post\");\n onLoadingComplete();\n }", "void sendFailureMessage(int statusCode, Header[] headers, byte[] responseBody, Throwable error);", "@PostMapping(\"/error\")\n public String handleErrorPost() {\n return \"ErrorPage\";\n }", "protected void handleFailMessage(Request request, IOException e) {\n\t\tonRequestFailure(request, e);\n\t}", "@Then(\"^Post should be created successfully$\")\n\tpublic void post_should_be_created_successfully() throws Throwable {\n\t throw new PendingException();\n\t}", "@Override\n public void failure(Throwable t)\n {\n System.err.println(\"Call to Embedded Social failed with exception: \" + t.getMessage());\n }", "public void onFail(int statusCode, String address);", "@Override\n\t\t\t\t\t\t\tpublic void HttpFail(int ErrCode) {\n\n\t\t\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic void onResponse(HttpResponse resp) {\n\t\t\t\t\t\tLog.i(\"HttpPost\", \"Success\");\r\n\r\n\t\t\t\t\t}", "public void onFailure();", "public String networkFailureMessage();", "protected void sendFailureMessage(Request request, IOException e) {\n\t\tsendMessage(obtainMessage(HttpConsts.REQUEST_FAIL, new Object[] {request, e}));\n\t}", "public void onApiRequestFailed();", "public void onRequestFailure(Request request, IOException e) { }", "private void notifyUploadFail() {\n numberOfFail++;\n notificationBuilder.setContentText(getNotificationContent());\n notificationManger.notify(0, notificationBuilder.build());\n }", "@Override\n public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {\n loopjListener.getResponse(\"Error Bro:(\");\n Log.d(TAG, \"onFailure#2: \" + responseString);\n }", "@Override\r\n\t\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t\tSystem.out.println(\"fail!\");\r\n\r\n\t\t\t\t}", "@Override\n public void onFailure(Request request, IOException e) {\n Toast.makeText(MainActivity.this, \"Request Failed\", Toast.LENGTH_SHORT).show();\n }", "public void requestFailed(RequestFailureEvent e);", "@Test\n void testGivenFaultyRequestWithExceptionString_thenFail() throws Exception {\n URL u = new URL(\"http://localhost:8080/sentry-servlet/fault?exception=true\");\n HttpURLConnection conn = (HttpURLConnection)u.openConnection();\n int rc = conn.getResponseCode();\n assertThat(rc)\n .isEqualTo(500);\n }", "@Override\r\n\t\t\t\t\t\tpublic void onFailure(int statusCode, Header[] headers,\r\n\t\t\t\t\t\t\t\tString responseString, Throwable throwable) {\n\t\t\t\t\t\t\tLoger.i(\"TEST\", \"topic->statusCode->\"+statusCode);\r\n\t\t\t\t\t\t\tLoger.i(\"TEST\", \"topic->error->\"+responseString);\r\n\t\t\t\t\t\t\tMessage message = new Message();\r\n\t\t\t\t\t\t\tmessage.what = REFUSE_CODE;\r\n\t\t\t\t\t\t\tgetTopicHandler.sendMessage(message);\r\n\t\t\t\t\t\t\tnew ErrorServer(PropertyRepairActivity.this, responseString.toString());\r\n\t\t\t\t\t\t\tsuper.onFailure(statusCode, headers, responseString, throwable);\r\n\t\t\t\t\t\t}", "@Override\n public void onFailure(Throwable t) {\n isSucessful.compareAndSet(true, false);\n failedMessages.put(id.getName(), t.getMessage());\n handleIfFinished(t, isSucessful.get());\n }", "@Override\n public void onFailure(retrofit2.Call<FinalResponsePoJo> call, Throwable t) {\n Log.e(\"TAG\", t.toString());\n\n }", "@Override\n public void onFailure(retrofit2.Call<FinalResponsePoJo> call, Throwable t) {\n Log.e(\"TAG\", t.toString());\n\n }", "@Override\r\n\t\t\t\t\t\t\tpublic void onFail(String msg) {\n\t\t\t\t\t\t\t}", "@Override\n public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) {\n Log.i(\"doRequest\", \"doRequest failed\");\n\n }", "@Override\n public void failure(RetrofitError error) {\n Log.d(TAG, String.valueOf(error));\n WearSocket.getInstance().sendMessage(Values.MESSAGE_PATH, \"Error: \" + phrase + \" didn't work\");\n }", "@Override\n\t\tpublic void onFailure(HttpException error, String msg) {\n\t\t\t\n\t\t}", "@Override\n public void failure(TwitterException e) {\n }", "public synchronized void onRequestFailed(String message, Throwable ex) {\r\n\t\tString reason = message + \": \" + ex.getClass().getName() + \": \" + ex.getMessage();\r\n\t\tallRequestsTracker.onRequestFailed(reason);\r\n\t\trecentRequestsTracker.onRequestFailed(reason);\r\n\t\tmeter.mark();\r\n\t}", "@Override\n public void onFailure(int statusCode, Header[] headers, String res, Throwable t) {\n\n Log.i(\"onFailure\", res);\n }", "@Override\n public void onFailure(int statusCode, Header[] headers, Throwable t, JSONObject resp) {\n\n Log.d(\"kartik failure \", resp.toString());\n\n Toast toast = Toast.makeText(context, \"Failure \" + resp.toString(), Toast.LENGTH_SHORT);\n toast.show();\n }", "public void onFailure(Throwable caught) {\n\t\t\t\tSystem.out.println(\"XMLStreamTracer: Failed to post the event.\");\r\n\t\t\t}", "@Override\r\n\tpublic Response error(String message) {\r\n\t\tJSONObject json = new JSONObject();\r\n\r\n\t\ttry {\r\n\t\t\tjson.put(STAT, FAIL);\r\n\t\t\tjson.put(MESSAGE, message);\r\n\t\t} catch (JSONException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn buildResponse(json);\r\n\t}", "@Override\n public void uploadFailed() {\n }", "@Override\r\n\t\t\t\t\tpublic void onFailure(int statusCode, Header[] headers,\r\n\t\t\t\t\t\t\tString responseString, Throwable throwable) {\n\t\t\t\t\t\tLoger.i(\"TEST\", \"topic->statusCode->\"+statusCode);\r\n\t\t\t\t\t\tMessage message = new Message();\r\n\t\t\t\t\t\tmessage.what = REFUSE_CODE;\r\n\t\t\t\t\t\tgetTopicHandler.sendMessage(message);\r\n\t\t\t\t\t\tnew ErrorServer(PropertyRepairActivity.this, responseString.toString());\r\n\t\t\t\t\t\tsuper.onFailure(statusCode, headers, responseString, throwable);\r\n\t\t\t\t\t}", "void onFailure();", "void onFailure();", "void onFailure();", "@Override\n public void failure(RetrofitError error) {\n Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_LONG).show();\n }", "@Override\n public void onFailure(Throwable t) {\n errorOut();\n }", "void onFailure(String description);", "public void failure(RetrofitError arg0) {\n\t\t\t\t\n\t\t\t}", "public void failure(RetrofitError arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n public void onFailure(int statusCode, Header[] headers, Throwable t, JSONObject resp) {\n\n Log.d(\"kartik failure \", resp.toString());\n nfy.onLoadFailure();\n\n Toast toast = Toast.makeText(context, \"Failure \" + resp.toString(), Toast.LENGTH_SHORT);\n toast.show();\n }", "@Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {\n loopjListener.getResponse(\"Error Bro:(\");\n Log.d(TAG, \"onFailure#1: \" + errorResponse);\n }", "@Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {\n loopjListener.getResponse(\"Error Bro:(\");\n Log.d(TAG, \"onFailure#1: \" + errorResponse);\n }", "@Override\n public void onFailure(Rule rule, Exception e) {\n RulesContext.put(\"status\", \"failed\");\n RulesContext.put(\"message\", this.getClass().getCanonicalName() + \" \" + e.getCause().getMessage());\n\n }", "@Override\n public void onFailure(int statusCode, Throwable error,\n String content) {\n\n if(statusCode == 404){\n Toast.makeText(context, \"Requested resource not found\", Toast.LENGTH_LONG).show();\n }else if(statusCode == 500){\n Toast.makeText(context, \"Something went wrong at server end\", Toast.LENGTH_LONG).show();\n }else{\n // Toast.makeText(context, \"Unexpected Error occcured! [Most common Error: Device might not be connected to Internet]\", Toast.LENGTH_LONG).show();\n }\n }", "@Override\n public void onAnalysisFailed(IntegrationAnalyzer.FailReason failReason) {\n String message = failReason.getMessage();\n Log.d(TAG, \"Fail Reason message is\" + message);\n //..\n\n }", "@Override\r\n\tpublic void onFail() {\n\t\tif(bSendStatus)\r\n\t\t\tnativeadstatus(E_ONFAIL);\r\n\t}", "@Override\n public void failure(TwitterException exception) {\n Log.d(\"TwitterKit\", \"Login with Twitter failure\", exception);\n }", "void uploadFailed(long bytes);", "@Override\n public void onFailure(@NonNull Exception e) {\n Log.d(TAG,\"onFailure : \" +e.toString());\n }", "@Override\n public void onFailure(@NonNull Exception e) {\n Log.d(TAG,\"onFailure : \" +e.toString());\n }", "@When(\"User clicks post\")\n\tpublic void user_clicks_post() {\n\t throw new io.cucumber.java.PendingException();\n\t}", "@Override\n public void failure(RetrofitError error) {\n }", "@Override\n public void onFailure(Throwable t) {\n Toast.makeText(context, t.getMessage(), Toast.LENGTH_LONG).show();\n }", "@Override\n public void onFailure(Throwable t) {\n Toast.makeText(context, t.getMessage(), Toast.LENGTH_LONG).show();\n }", "@Override\n \t\t\tpublic void onFailure(Throwable arg0) {\n \t\t\t\tSystem.err.println(\"***failure:\" + arg0);\n \n \t\t\t}", "@Override\n public void onRequestFailure(SpiceException spiceException) {\n }", "@Override\n public void failure(RetrofitError error) {\n }", "@Override\n public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {\n // Hide Progress Dialog\n prgDialog.hide();\n // When Http response code is '400'\n if(statusCode == 400){\n Toast.makeText(getApplicationContext(), \"Error Creating Donation!!\", Toast.LENGTH_LONG).show();\n }\n // When Http response code is '500'\n else if(statusCode == 500){\n Toast.makeText(getApplicationContext(), \"Something went wrong at server end\", Toast.LENGTH_LONG).show();\n }\n // When Http response code other than 400, 500\n else{\n Toast.makeText(getApplicationContext(), \"Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]\", Toast.LENGTH_LONG).show();\n }\n }", "@Override\n public void onFailure(@NonNull Exception exception) {\n Log.i(\"update\", \"failed\");\n }", "@Override\r\n\t\t\t\t\tpublic void failed(String message) {\n\r\n\t\t\t\t\t}", "@Override\n public void onFailure(@NonNull @NotNull Exception e) {\n Snackbar.make(save, R.string.update_fail, BaseTransientBottomBar.LENGTH_SHORT).show();\n }", "@Override\n public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {\n Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), \"Error occurred! Please log out and log in again to upload the interview.\" + \"\\n\" + \"Note: Do not log out if you want to resume the offline interview process.\", Snackbar.LENGTH_LONG);\n View snackbarView = snackbar.getView();\n TextView tv = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);\n tv.setTextColor(getResources().getColor(R.color.dashboard_count_color));\n tv.setMaxLines(5);\n //tv.setTextSize(17);\n //tv.setGravity(0);\n //snackbarView.setBackgroundColor(getResources().getColor(R.color.newblack));\n snackbar.show();\n }", "@Override\n public void onFailure(Call<ResponseContent> call, Throwable t) {\n\n Log.e( mss.TAG, \"Error en la peticion al hacer debug \"+ t.toString());\n\n }", "@Override\n public void failed() {\n Log.d(\"elomelo\",\"not saved\");\n }", "@Override\r\n\tpublic void httpResponse_fail(Map<String, String> map, String msg,\r\n\t\t\tObject jsonObj) {\n\t\tMessage msg2 = new Message();\r\n\t\tmsg2.what = 2;\r\n\t\tBundle bundle = new Bundle();\r\n\t\tbundle.putString(\"msg\", msg);\r\n\t\tmsg2.setData(bundle);\r\n\t\tmHandler.sendMessage(msg2);\r\n\t}", "public void onFailure(Throwable caught) {\n SC.say(\"Failed to add the entry : \" + caught.getMessage());\n }", "@Override\r\n\t\t\t\t\tpublic void onFailure(Request arg0, IOException arg1) {\n\t\t\t\t\t\tsToast(\"失败\");\r\n\t\t\t\t\t}", "@Override\n\t\t\tpublic void onFailed(String message, int code) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onFailed(String message, int code) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onFailed(String message, int code) {\n\t\t\t\t\n\t\t\t}", "@Override\n public void onFailure(Call<List<SocialMediaPost>> call, Throwable t) {\n textView.setText(t.getMessage());\n }" ]
[ "0.62673163", "0.5988436", "0.5953744", "0.58912337", "0.5879798", "0.58434856", "0.58233726", "0.5815397", "0.5748599", "0.5698072", "0.5698072", "0.5698072", "0.5698072", "0.5695987", "0.5689131", "0.56802636", "0.56691086", "0.5628018", "0.5624219", "0.561803", "0.55761683", "0.55750847", "0.55600715", "0.5557079", "0.55561215", "0.55460286", "0.55272716", "0.5501792", "0.54973906", "0.5496256", "0.5492163", "0.5487918", "0.54870456", "0.5485645", "0.5485329", "0.547794", "0.5465357", "0.54617214", "0.54438066", "0.5442394", "0.54123116", "0.5407931", "0.54048073", "0.54019123", "0.540161", "0.5392824", "0.5387703", "0.5387001", "0.5387001", "0.53830564", "0.5372547", "0.53682303", "0.53681076", "0.53676355", "0.53676206", "0.5365067", "0.5360333", "0.53603035", "0.5354842", "0.53504896", "0.53491354", "0.53484946", "0.53484946", "0.53484946", "0.53473943", "0.53420424", "0.53418773", "0.53284127", "0.53284127", "0.53231287", "0.53193635", "0.53193635", "0.5318599", "0.5318247", "0.5316998", "0.5312289", "0.5310968", "0.52915865", "0.52902776", "0.52902776", "0.5289834", "0.5279651", "0.5274231", "0.527123", "0.52677155", "0.526618", "0.526429", "0.526148", "0.5254983", "0.52532214", "0.5252926", "0.52510613", "0.5234192", "0.52321875", "0.52292293", "0.52146053", "0.52117443", "0.52085245", "0.52085245", "0.52085245", "0.52046335" ]
0.0
-1
TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) { if (mListener != null) { } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t\t}", "@Override\n\t\t\t\tpublic void handle(ActionEvent event) {\n\n\t\t\t\t}", "@Override\n\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t}", "public abstract void update(UIReader event);", "@Override\r\n\t\t\tpublic void handle(ActionEvent arg0) {\n\t\t\t}", "@Override\n\tpublic void handle(ActionEvent event) {\n\t\t\n\t}", "@Override\n\tpublic void handle(ActionEvent event) {\n\n\t}", "@Override\n\tpublic void handleUpdateUI(String text, int code) {\n\t\t\n\t}", "@Override\n\tpublic void update(Event e) {\n\t}", "public abstract void onInvoked(CommandSender sender, String[] args);", "@Override\r\n public void updateUI() {\r\n }", "@Override\r\n\tpublic void handle(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\n\tprotected void UpdateUI() {\n\t\t\n\t}", "@Override\n\tprotected void UpdateUI() {\n\t\t\n\t}", "@Override\n\tpublic void processEvent(Event e) {\n\n\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t\t \n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t\t \n\t\t\t}", "@Override\n\tpublic void processCommand(JMVCommandEvent arg0) {\n\t}", "@Override\n\tpublic void inputChanged( Viewer arg0, Object arg1, Object arg2 ) {\n\t}", "@Override\n\tpublic void handleEvent(Event arg0) {\n\t\t\n\t}", "@Override\r\n\tpublic void onCustomUpdate() {\n\t\t\r\n\t}", "public void updateUI(){}", "private synchronized void updateScreen(String arg){\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n setChanged();\n notifyObservers(arg);\n }\n });\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\n\t\t\t}", "@Override\r\n public void actionPerformed( ActionEvent e )\r\n {\n }", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\tpublic void updateObjectListener(ActionEvent e) {\n\t\t\r\n\t}", "Event () {\n // Nothing to do here.\n }", "void onArgumentsChanged();", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t}", "void eventChanged();", "@Override\r\n\t\t\tpublic void execute(LiftEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void execute(LiftEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override public void handle(ActionEvent e)\n\t {\n\t }", "@Override\r\n\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\r\n\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\n\t\t\t}", "@Override //se repita\r\n public void actionPerformed(ActionEvent ae) {\r\n \r\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\n\t\t\t}", "public abstract CommandResponse onCommand(CommandSender sender, String label, String[] args);", "@Override\n public void actionPerformed(ActionEvent actionEvent) {\n }", "@Override\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t}", "@Override\r\n public void actionPerformed(ActionEvent e) {\n \r\n }", "public abstract void onCommand(MessageEvent context) throws Exception;", "@Override\r\n\tpublic void onEvent(Event arg0) {\n\r\n\t}", "private void addParameterEventHandler(){\n\t\t\n\t\tgetParameterNameListBox().addDoubleClickHandler(new DoubleClickHandler() {\n\t\t\t@Override\n\t\t\tpublic void onDoubleClick(DoubleClickEvent event) {\n\t\t\t\tparameterAceEditor.clearAnnotations();\n\t\t\t\tparameterAceEditor.removeAllMarkers();\n\t\t\t\tparameterAceEditor.redisplay();\n\t\t\t\tSystem.out.println(\"In addParameterEventHandler on DoubleClick isPageDirty = \" + getIsPageDirty() + \" selectedIndex = \" + getParameterNameListBox().getSelectedIndex());\n\t\t\t\tsetIsDoubleClick(true);\n\t\t\t\tsetIsNavBarClick(false);\n\t\t\t\tif (getIsPageDirty()) {\n\t\t\t\t\tshowUnsavedChangesWarning();\n\t\t\t\t} else {\n\t\t\t\t\tint selectedIndex = getParameterNameListBox().getSelectedIndex();\n\t\t\t\t\tif (selectedIndex != -1) {\n\t\t\t\t\t\tfinal String selectedParamID = getParameterNameListBox().getValue(selectedIndex);\n\t\t\t\t\t\tcurrentSelectedParamerterObjId = selectedParamID;\n\t\t\t\t\t\tif(getParameterMap().get(selectedParamID) != null){\n\t\t\t\t\t\t\tgetParameterNameTxtArea().setText(getParameterMap().get(selectedParamID).getParameterName());\n\t\t\t\t\t\t\tgetParameterAceEditor().setText(getParameterMap().get(selectedParamID).getParameterLogic());\n\t\t\t\t\t\t\tSystem.out.println(\"In Parameter DoubleClickHandler, doing setText()\");\n\t\t\t\t\t\t\t//disable parameterName and Logic fields for Default Parameter\n\t\t\t\t\t\t\tboolean isReadOnly = getParameterMap().get(selectedParamID).isReadOnly();\n\t\t\t\t\t\t\tgetParameterButtonBar().getDeleteButton().setTitle(\"Delete\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(MatContext.get().getMeasureLockService()\n\t\t\t\t\t\t\t\t\t.checkForEditPermission()){\n\t\t\t\t\t\t\t\tsetParameterWidgetReadOnly(!isReadOnly);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// load most recent used cql artifacts\n\t\t\t\t\t\t\tMatContext.get().getMeasureService().getUsedCQLArtifacts(MatContext.get().getCurrentMeasureId(), new AsyncCallback<GetUsedCQLArtifactsResult>() {\n\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t\t\t\t\t\tWindow.alert(MatContext.get().getMessageDelegate().getGenericErrorMessage());\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void onSuccess(GetUsedCQLArtifactsResult result) {\n\t\t\t\t\t\t\t\t\tif(result.getUsedCQLParameters().contains(getParameterMap().get(selectedParamID).getParameterName())) {\n\t\t\t\t\t\t\t\t\t\tgetParameterButtonBar().getDeleteButton().setEnabled(false);\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\t\t\t\t\t\n\t\t\t\t\tsuccessMessageAlert.clearAlert();\n\t\t\t\t\terrorMessageAlert.clearAlert();\n\t\t\t\t\twarningMessageAlert.clearAlert();\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}", "@Override\n public void handle(Event event) {\n }", "@Override\n\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\n\t\t}", "@Override\n\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\n\t\t}", "@Override\n public void actionPerformed(AnActionEvent e) {\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n \n }", "@Override\n public void actionPerformed(ActionEvent e) {\n \n }", "@Override\n public void actionPerformed(ActionEvent e) {\n \n }", "@Override\n public void actionPerformed(ActionEvent e) {\n \n }", "@Override\r\n\tpublic void handleEvent(Event event) {\n\r\n\t}", "public void ImageView(ActionEvent event) {\n\t}", "@Override\n public void updateUi() {\n\n }", "@Override\n public void updateUi() {\n\n }", "@Override\n public void updateUi() {\n\n }", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\tpublic void mouseDown(MouseEvent arg0) {\n\n\t\t\t\t\t\t}", "public void runInUi(ElexisEvent ev){}", "@Override\n public void delta() {\n \n }", "@Override\n\tpublic void onClick(ClickEvent arg0) {\n\t\t\n\t}", "@Override\n public void actionPerformed(ActionEvent e) {\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n }", "@Override\n\tprotected void OnClick() {\n\t\t\n\t}", "@Override\n public void actionPerformed(ActionEvent ev) {\n }", "@Override\n public void actionPerformed(ActionEvent e)\n {\n \n }", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\r\n\t}", "@Override\n public void update(Observable o, Object arg)\n {\n \n }", "@Override\n public void actionPerformed(ActionEvent e) {\n\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tupdate();\n\t\t\t}", "@Override\r\n public void processEvent(IAEvent e) {\n\r\n }" ]
[ "0.6619185", "0.65246344", "0.6473144", "0.6473144", "0.64351684", "0.6325494", "0.62368196", "0.6189416", "0.6158721", "0.61455715", "0.6123594", "0.6107332", "0.6101038", "0.6092755", "0.6049496", "0.6049496", "0.60442764", "0.604003", "0.604003", "0.6007846", "0.59999037", "0.59848183", "0.59776366", "0.59587413", "0.5940049", "0.5925668", "0.5925668", "0.59208333", "0.5915737", "0.5915737", "0.5915737", "0.5915737", "0.5915737", "0.5915554", "0.5909643", "0.5895144", "0.58947057", "0.589277", "0.58885247", "0.58885247", "0.58885247", "0.58671176", "0.58671176", "0.58671176", "0.58636886", "0.5862447", "0.5862447", "0.58613557", "0.5855828", "0.5846504", "0.5846504", "0.5846504", "0.5846504", "0.5837475", "0.58366984", "0.5820788", "0.58068436", "0.58022934", "0.5772422", "0.57714665", "0.5770862", "0.5765655", "0.5763872", "0.57544947", "0.57542855", "0.57542855", "0.57450074", "0.57441026", "0.57441026", "0.57441026", "0.5741053", "0.574037", "0.5739314", "0.57367086", "0.57367086", "0.57367086", "0.57322264", "0.57322264", "0.57322264", "0.57322264", "0.57322264", "0.57322264", "0.57322264", "0.57235956", "0.57232994", "0.5721006", "0.571978", "0.571978", "0.57187414", "0.57177836", "0.57133436", "0.57110935", "0.57110935", "0.57110935", "0.57110935", "0.57110935", "0.57110935", "0.5707859", "0.5707546", "0.5704973", "0.57016516" ]
0.0
-1
This interface must be implemented by activities that contain this fragment to allow an interaction in this fragment to be communicated to the activity and potentially other fragments contained in that activity. See the Android Training lesson Communicating with Other Fragments for more information.
public interface OnSignInButtonClickedListener { // TODO: Update argument type and name void onSignInButtonClicked(String userEmail, String userPassword); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface OnFragmentInteractionListener {\n void onFragmentMessage(String TAG, Object data);\n}", "public interface FragmentInteraction {\n void switchToBoardView();\n void switchToPinsView();\n void switchToPins(PDKBoard pdkBoard);\n void switchToDescription(PDKPin pin);\n}", "public interface IFragmentView {\n public Activity getActivity();\n public void onItemClick(int position);\n}", "public interface OnFragmentInteractionListener {\n void onMainFragmentInteraction(String string);\n }", "@Override\n public void onAttach(Context context) {\n super.onAttach(context);\n if (context instanceof RequestFragmentInterface) {\n mInterface = (RequestFragmentInterface) context;\n } else {\n throw new RuntimeException(context.toString()\n + \" must implement OnFragmentInteractionListener\");\n }\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onCallBellPressed(MessageReason reason);\n }", "void onFragmentInteraction();", "void onFragmentInteraction();", "void onFragmentInteraction();", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n\n\n void onFragmentInteraction(String mId, String mProductName, String mItemRate, int minteger, int update);\n }", "public interface OnFragmentInteractionListener {\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction();\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onComidaSelected(int comidaId);\n }", "public interface OnFragmentInteractionListener {\n public void onFragmentInteraction(Qualification q);\n }", "public interface OnFragmentInteractionListener {\n void onReceiverAcceptRequest(int nextState, String requestId);\n }", "public interface FragMainLife\n{\n\tpublic void onResumeFragMainLife();\n}", "public interface OnFragmentListener {\n\n void onAction(Intent intent);\n}", "public interface IBaseFragmentActivity {\n void onFragmentExit(BaseFragment fragment);\n\n void onFragmentStartLoading(BaseFragment fragment);\n\n void onFragmentFinishLoad(BaseFragment fragment);\n}", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction(String string);\n }", "void onFragmentInteraction(Object ref);", "public interface OnParametersFragmentInteractionListener {\n public void startTask();\n }", "public interface OnFragmentInteractionListener {\n // Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n void onFragmentInteraction(Parcelable selectedItem);\n }", "public interface FragmentInterface {\r\n void fragmentBecameVisible();\r\n}", "public interface OnFragmentInteractionListener {\n public void onFragmentInteraction(String key);\n }", "public interface OnFragmentInteractionListener {\n void newList();\n\n void searchList();\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void pasarALista();\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n\n /**\n * This interface's single method. The hosting Activity must implement this interface and\n * provide an implementation of this method so that this Fragment can communicate with the\n * Activity.\n *\n * @param spotId\n */\n// void onFragmentInteraction(Uri uri);\n void onFragmentInteraction(int spotId);\n// void onFragmentInteraction(LatLng spotPosition);\n\n }", "public interface MainGameActivityCallBacks {\n public void onMsgFromFragmentToMainGame(String sender, String strValue);\n}", "public interface IFragment {\n void onFragmentRefresh();\n\n void onMenuClick();\n}", "public interface FragmentInterface {\n\n void onCreate();\n\n void initLayout();\n\n void updateLayout();\n\n void sendInitialRequest();\n}", "public interface OnFragmentInteractionListener {\n void onFragmentInteraction(String accessToken, String network);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction(View v);\n }", "public interface OnFragmentInteractionListener {\n void swapFragments(SetupActivity.SetupActivityFragmentType type);\n\n void addServer(String name, String ipAddress, String port);\n }", "public interface OnFragmentInteractionListener {\n\t\tvoid restUp(IGameState gameState);\n\t\tvoid restartGame();\n\t}", "public interface OnFragmentInteractionListener\n {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface PersonalFragmentView extends BaseMvpView {\n\n}", "public interface OnFragmentInteractionListener {\n void onFinishCreatingRequest();\n }", "void onFragmentInteraction(View v);", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void onFragmentInteraction(String id);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction(ArrayList<Recepie> recepieList);\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction(String id);\n }", "void onFragmentInteractionMain();", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n public void showRestaurantDetail(Map<String, Object> objectMap);\n\n public void showAddRestaurantFragment(String location);\n }", "public interface FragmentNavigator {\n\n void SwitchFragment(Fragment fragment);\n}", "public interface FragmentModellnt {\n void FragmentM(OnFinishListener onFinishListener,String dataId);\n}", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n //void onFragmentInteraction(Uri uri);\n }", "void onFragmentInteraction(String id);", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction(ArrayList naleznosci, String KLUCZ);\n }", "public interface OnFragmentInteractionListener {\r\n // TODO: Update argument type and name\r\n void onEditFragmentInteraction(Student student);\r\n }", "public interface OnFragmentInteractionListener {\n void onStartFragmentStarted();\n\n void onStartFragmentStartTracking();\n\n void onStartFragmentStopTracking();\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n Long onFragmentInteraction();\n }", "public interface OnFragmentInteractionListener {\n void onFragmentInteraction(Uri uri);\n void onFragmentInteraction(String id);\n}", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public void onFragmentInteraction(String id);", "public interface IBaseFragment extends IBaseView {\n /**\n * 出栈到目标fragment\n * @param targetFragmentClass 目标fragment\n * @param includeTargetFragment 是否包涵目标fragment\n * true 目标fragment也出栈\n * false 出栈到目标fragment,目标fragment不出栈\n */\n void popToFragment(Class<?> targetFragmentClass, boolean includeTargetFragment);\n\n /**\n * 跳转到新的fragment\n * @param supportFragment 新的fragment继承SupportFragment\n */\n void startNewFragment(@NonNull SupportFragment supportFragment);\n\n /**\n * 跳转到新的fragment并出栈当前fragment\n * @param supportFragment\n */\n void startNewFragmentWithPop(@NonNull SupportFragment supportFragment);\n\n /**\n * 跳转到新的fragment并返回结果\n * @param supportFragment\n * @param requestCode\n */\n void startNewFragmentForResult(@NonNull SupportFragment supportFragment,int requestCode);\n\n /**\n * 设置fragment返回的result\n * @param requestCode\n * @param bundle\n */\n void setOnFragmentResult(int requestCode, Bundle bundle);\n\n /**\n * 跳转到新的Activity\n * @param clz\n */\n void startNewActivity(@NonNull Class<?> clz);\n\n /**\n * 携带数据跳转到新的Activity\n * @param clz\n * @param bundle\n */\n void startNewActivity(@NonNull Class<?> clz,Bundle bundle);\n\n /**\n * 携带数据跳转到新的Activity并返回结果\n * @param clz\n * @param bundle\n * @param requestCode\n */\n void startNewActivityForResult(@NonNull Class<?> clz,Bundle bundle,int requestCode);\n\n /**\n * 当前Fragment是否可见\n * @return true 可见,false 不可见\n */\n boolean isVisiable();\n\n /**\n * 获取当前fragment绑定的activity\n * @return\n */\n Activity getBindActivity();\n\n}", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onSocialLoginInteraction();\n }", "public interface OnFragmentInteractionListener {\n /**\n * On fragment interaction.\n *\n * @param uri the uri\n */\n// TODO: Update argument type and name\n public void onFragmentInteraction(Uri uri);\n }", "public interface OnFragmentListener {\n void onClick(Fragment fragment);\n}", "public interface OnFragmentInteractionListener {\n void playGame(Uri location);\n }", "public interface LoginFragmentListener {\n public void OnRegisterClicked();\n public void OnLoginClicked(String User, String Pass);\n}", "public interface MoveFragment {\n\n\n public void moveFragment(Fragment selectedFragment);\n\n}", "public interface OnProductItemFragmentInteraction{\r\n public void itemSelected(Producto product);\r\n }", "public interface ChangeFragmentListener {\n void changeFragment();\n}", "public interface FragmentInterface {\n public void fragmentResult(Fragment fragment, String title);\n}", "@Override\n public void onAttach(Context context) {\n super.onAttach(context);\n //this registers this fragment to recieve any EventBus\n EventBus.getDefault().register(this);\n }", "void onFragmentInteraction(int position);", "public interface AddFarmFragmentView extends BaseView {\n\n\n}", "void OpenFragmentInteraction();", "public interface OnFragmentInteractionListener {\n\t\t// TODO: Update argument type and name\n\t\tpublic void onFragmentInteraction(Uri uri);\n\t}", "public interface FragmentDataObserver {\n void getDataFromActivity(String data);\n\n}", "public interface OnFragInteractionListener {\n\n // replace top fragment with this fragment\n interface OnMainFragInteractionListener {\n void onWifiFragReplace();\n void onHistoryFragReplace();\n void onHistoryWithOsmMapFragReplace();\n void onMainFragReplace();\n }\n\n // interface for WifiPresenterFragment\n interface OnWifiScanFragInteractionListener {\n void onGetDataAfterScanWifi(ArrayList<WifiLocationModel> list);\n void onAllowToSaveWifiHotspotToDb(String ssid, String pass, String encryption, String bssid);\n }\n\n // interface for HistoryPresenterFragment\n interface OnHistoryFragInteractionListener {\n // get wifi info\n void onGetWifiHistoryCursor(Cursor cursor);\n // get mobile network generation\n void onGetMobileHistoryCursor(Cursor cursor);\n // get wifi state and date\n void onGetWifiStateAndDateCursor(Cursor cursor);\n }\n\n interface OnMapFragInteractionListerer {\n void onGetWifiLocationCursor(Cursor cursor);\n }\n}", "public interface PesonageFragmentView extends MvpView {\n\n}", "public interface OnUsersFragmentInteractionListener {\n void onListFragmentInteraction(User item);\n }", "public interface MainScreeInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteractionMain();\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onClickNextTurn();\n }", "public interface OnFragmentInteractionListener {\n // TODO: Update argument type and name\n void onFragmentInteraction();\n\n void changeBottomNavSelection(int menuItem);\n }", "public interface OnFragmentInteractionListener {\n void onFragmentInteraction(Uri uri);\n}", "public interface OnFragmentInteractionListener {\n public void onFragmentInteraction(Uri uri);\n }", "public interface OnFragmentInteractionListener {\n public void onFragmentInteraction(Uri uri);\n }", "public interface OnFragmentInteractionListener {\n public void onFragmentInteraction(Uri uri);\n }", "public interface OnFragmentInteractionListener {\n void onSignoutClicked();\n\n void onExtraScopeRequested();\n }", "interface OnMainFragInteractionListener {\n void onWifiFragReplace();\n void onHistoryFragReplace();\n void onHistoryWithOsmMapFragReplace();\n void onMainFragReplace();\n }", "public interface OnListFragmentInteractionListener {\n void onListFragmentInteraction(Note note);\n}" ]
[ "0.7325217", "0.72096896", "0.71358377", "0.71250176", "0.7122224", "0.7015683", "0.6978251", "0.6978251", "0.6978251", "0.69750017", "0.69684523", "0.6966373", "0.6961696", "0.69543165", "0.6944402", "0.6934082", "0.6930699", "0.692802", "0.69235384", "0.69122416", "0.6903269", "0.6897603", "0.6895175", "0.6882526", "0.68821716", "0.68757826", "0.68646353", "0.68613577", "0.6860587", "0.685871", "0.6855354", "0.68442327", "0.6840251", "0.68302596", "0.68183935", "0.6817224", "0.6809969", "0.67866045", "0.67713267", "0.6769901", "0.6769901", "0.6769901", "0.6769901", "0.6769901", "0.6769901", "0.6769901", "0.6769901", "0.6769901", "0.6766863", "0.67620504", "0.6757267", "0.67537534", "0.66990054", "0.6681438", "0.66743076", "0.6672531", "0.66703063", "0.66620916", "0.666157", "0.66562545", "0.66530526", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.6645319", "0.66449755", "0.6638945", "0.6636633", "0.66325885", "0.6625733", "0.6625702", "0.66184276", "0.6610368", "0.6610134", "0.6609454", "0.66052145", "0.65993726", "0.65970284", "0.65893096", "0.6572981", "0.65695447", "0.6560765", "0.6559661", "0.65554863", "0.6550306", "0.6549704", "0.6543469", "0.65399235", "0.65347576", "0.65347576", "0.65347576", "0.65203285", "0.6517853", "0.6517113" ]
0.0
-1
TODO: Update argument type and name
void onSignInButtonClicked(String userEmail, String userPassword);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public String getFirstArg() {\n return name;\r\n }", "@Override\n public int getNumberArguments() {\n return 1;\n }", "java.lang.String getArg();", "@Override\n public int getArgLength() {\n return 4;\n }", "Argument createArgument();", "@Override\r\n\tpublic String getFirstArg() {\n\t\treturn null;\r\n\t}", "@Override\n protected PacketArgs.ArgumentType[] getArgumentTypes() {\n return new PacketArgs.ArgumentType[] { PacketArgs.ArgumentType.String };\n }", "@Override\n\tpublic void traverseArg(UniArg node) {\n\t}", "@Override\n\t\t\t\t\tpublic Parameter handleParameter(Method parent,\n\t\t\t\t\t\t\tEParamType direction, FArgument src) {\n\t\t\t\t\t\treturn super.handleParameter(parent, direction, src);\n\t\t\t\t\t}", "Object[] getArguments();", "Object[] getArguments();", "String getArguments();", "@Override\n\tpublic void handleArgument(ArrayList<String> argument) {\n\t\t\n\t}", "@Override\n public final int parseArguments(Parameters params) {\n return 1;\n }", "ArgList createArgList();", "public Object[] getArguments() { return args;}", "@Override\n public String getInputArg(String argName) {\n Log.w(TAG, \"Test input args is not supported.\");\n return null;\n }", "@Override\n protected String getName() {return _parms.name;}", "private static AbstractType<?>[] argumentsType(@Nullable StringType algorithmArgumentType)\n {\n return algorithmArgumentType == null\n ? DEFAULT_ARGUMENTS\n : new AbstractType<?>[]{ algorithmArgumentType };\n }", "uicargs createuicargs();", "java.util.List<com.mwr.jdiesel.api.Protobuf.Message.Argument> \n getArgumentList();", "java.util.List<com.mwr.jdiesel.api.Protobuf.Message.Argument> \n getArgumentList();", "public static void main(String[] args) {\n\t\t\tmeth(args);\r\n\t\t\targument_test:meth(args);\r\n\t}", "@Override\r\n\tpublic int getSecondArg() {\n\t\treturn 0;\r\n\t}", "public getType_args(getType_args other) {\n }", "Object[] args();", "protected void validateArguments( Object[] args ) throws ActionExecutionException {\n\n Annotation[][] annotations = method.getParameterAnnotations();\n for (int i = 0; i < annotations.length; i++) {\n\n Annotation[] paramAnnotations = annotations[i];\n\n for (Annotation paramAnnotation : paramAnnotations) {\n if (paramAnnotation instanceof Parameter) {\n Parameter paramDescriptionAnnotation = (Parameter) paramAnnotation;\n ValidationType validationType = paramDescriptionAnnotation.validation();\n\n String[] validationArgs;\n\n // if we are checking for valid constants, then the\n // args array should contain\n // the name of the array holding the valid constants\n if (validationType == ValidationType.STRING_CONSTANT\n || validationType == ValidationType.NUMBER_CONSTANT) {\n try {\n String arrayName = paramDescriptionAnnotation.args()[0];\n\n // get the field and set access level if\n // necessary\n Field arrayField = method.getDeclaringClass().getDeclaredField(arrayName);\n if (!arrayField.isAccessible()) {\n arrayField.setAccessible(true);\n }\n Object arrayValidConstants = arrayField.get(null);\n\n // convert the object array to string array\n String[] arrayValidConstatnsStr = new String[Array.getLength(arrayValidConstants)];\n for (int j = 0; j < Array.getLength(arrayValidConstants); j++) {\n arrayValidConstatnsStr[j] = Array.get(arrayValidConstants, j).toString();\n }\n\n validationArgs = arrayValidConstatnsStr;\n\n } catch (IndexOutOfBoundsException iobe) {\n // this is a fatal error\n throw new ActionExecutionException(\"You need to specify the name of the array with valid constants in the 'args' field of the Parameter annotation\");\n } catch (Exception e) {\n // this is a fatal error\n throw new ActionExecutionException(\"Could not get array with valid constants - action annotations are incorrect\");\n }\n } else {\n validationArgs = paramDescriptionAnnotation.args();\n }\n\n List<BaseType> typeValidators = createBaseTypes(paramDescriptionAnnotation.validation(),\n paramDescriptionAnnotation.name(),\n args[i], validationArgs);\n //perform validation\n for (BaseType baseType : typeValidators) {\n if (baseType != null) {\n try {\n baseType.validate();\n } catch (TypeException e) {\n throw new InvalidInputArgumentsException(\"Validation failed while validating argument \"\n + paramDescriptionAnnotation.name()\n + e.getMessage());\n }\n } else {\n log.warn(\"Could not perform validation on argument \"\n + paramDescriptionAnnotation.name());\n }\n }\n }\n }\n }\n }", "@Test\n void getArgString() {\n }", "@Override\n\t\t\t\t\tpublic Parameter handleParameter(Method parent,\n\t\t\t\t\t\t\tEParamType direction, FEnumerator src) {\n\t\t\t\t\t\treturn super.handleParameter(parent, direction, src);\n\t\t\t\t\t}", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "@Override\n public void prepareArguments(ActionInvocation invocation)\n throws InvalidValueException {\n }", "int getArgIndex();", "@Override\n\tpublic void addArg(FormulaElement arg){\n\t}", "public Type[] getArgumentTypes() {\n/* 236 */ return Type.getArgumentTypes(this.desc);\n/* */ }", "@Override\n public Object[] getArguments() {\n return null;\n }", "public login_1_argument() {\n }", "Optional<String[]> arguments();", "private Main(String... arguments) {\n this.operations = new ArrayDeque<>(List.of(arguments));\n }", "@Override\n\tprotected GATKArgumentCollection getArgumentCollection() {\n\t\treturn argCollection;\n\t}", "protected void sequence_Argument(ISerializationContext context, Argument semanticObject) {\n\t\tif (errorAcceptor != null) {\n\t\t\tif (transientValues.isValueTransient(semanticObject, TdlPackage.Literals.ARGUMENT__NAME) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TdlPackage.Literals.ARGUMENT__NAME));\n\t\t}\n\t\tSequenceFeeder feeder = createSequencerFeeder(context, semanticObject);\n\t\tfeeder.accept(grammarAccess.getArgumentAccess().getNameSTRINGTerminalRuleCall_0_0(), semanticObject.getName());\n\t\tfeeder.finish();\n\t}", "void setArguments(String arguments);", "@Override\n\tpublic List<String> getArgumentDesc() {\n\t\treturn desc;\n\t}", "OpFunctionArgAgregate createOpFunctionArgAgregate();", "protected abstract Feature<T,?> convertArgument(Class<?> parameterType, Feature<T,?> originalArgument);", "void visitArgument(Argument argument);", "public Thaw_args(Thaw_args other) {\r\n }", "@Override\r\n\tpublic List<String> getArguments()\r\n\t{\n\t\treturn null;\r\n\t}", "private static String getArgumentString(Object arg) {\n if (arg instanceof String) {\n return \"\\\\\\\"\"+arg+\"\\\\\\\"\";\n }\n else return arg.toString();\n }", "public interface Param {\n\n int[] args();\n String exec(ExecutePack pack);\n String label();\n}", "@Override\n public void verifyArgs(ArrayList<String> args) throws ArgumentFormatException {\n super.checkNumArgs(args);\n _args = true;\n }", "public abstract ValidationResults validArguments(String[] arguments);", "public ArgumentException() {\n super(\"Wrong arguments passed to function\");\n }", "public String getArgumentString() {\n\t\treturn null;\n\t}", "@Override\n public String kind() {\n return \"@param\";\n }", "@Override\n\t\t\t\t\tpublic Parameter handleParameter(Method parent,\n\t\t\t\t\t\t\tEParamType direction, FEnumerationType src) {\n\t\t\t\t\t\treturn super.handleParameter(parent, direction, src);\n\t\t\t\t\t}", "public void addArgumentTypeSerialization(String functionName, String argumentName, TensorType type) {\n wrappedSerializationContext.addArgumentTypeSerialization(functionName, argumentName, type);\n }", "void setArgument(int idx,int v) \t\t{ setArgument(idx,Integer.valueOf(v)); }", "@Override\n\tprotected byte[] getArgByte() {\n\t\treturn paramsJson.getBytes();\n\t}", "void onArgumentsChanged();", "com.google.protobuf.ByteString\n\t\tgetArgBytes();", "@Override public int getNumArguments()\t\t\t{ return arg_list.size(); }", "MyArg(int value){\n this.value = value;\n }", "public ArgList(Object arg1) {\n super(1);\n addElement(arg1);\n }", "public Clear_args(Clear_args other) {\r\n }", "private ParameterInformation processArgumentReference(Argument argument,\n List<NameDescriptionType> argTypeSet,\n SequenceEntryType seqEntry,\n int seqIndex)\n {\n ParameterInformation argumentInfo = null;\n\n // Initialize the argument's attributes\n String argName = argument.getName();\n String dataType = null;\n String arraySize = null;\n String bitLength = null;\n BigInteger argBitSize = null;\n String enumeration = null;\n String description = null;\n UnitSet unitSet = null;\n String units = null;\n String minimum = null;\n String maximum = null;\n\n // Step through each command argument type\n for (NameDescriptionType argType : argTypeSet)\n {\n // Check if this is the same command argument referenced in the argument list (by\n // matching the command and argument names between the two)\n if (argument.getArgumentTypeRef().equals(argType.getName()))\n {\n boolean isInteger = false;\n boolean isUnsigned = false;\n boolean isFloat = false;\n boolean isString = false;\n\n // Check if this is an array parameter\n if (seqEntry instanceof ArrayParameterRefEntryType)\n {\n arraySize = \"\";\n\n // Store the reference to the array parameter type\n ArrayDataTypeType arrayType = (ArrayDataTypeType) argType;\n argType = null;\n\n // Step through each dimension for the array variable\n for (Dimension dim : ((ArrayParameterRefEntryType) seqEntry).getDimensionList().getDimension())\n {\n // Check if the fixed value exists\n if (dim.getEndingIndex().getFixedValue() != null)\n {\n // Build the array size string\n arraySize += String.valueOf(Integer.valueOf(dim.getEndingIndex().getFixedValue()) + 1)\n + \",\";\n }\n }\n\n arraySize = CcddUtilities.removeTrailer(arraySize, \",\");\n\n // The array parameter type references a non-array parameter type that\n // describes the individual array members. Step through each data type in the\n // parameter type set in order to locate this data type entry\n for (NameDescriptionType type : argTypeSet)\n {\n // Check if the array parameter's array type reference matches the data\n // type name\n if (arrayType.getArrayTypeRef().equals(type.getName()))\n {\n // Store the reference to the array parameter's data type and stop\n // searching\n argType = type;\n break;\n }\n }\n }\n\n // Check if a data type entry for the parameter exists in the parameter type set\n // (note that if the parameter is an array the steps above locate the data type\n // entry for the individual array members)\n if (argType != null)\n {\n long dataTypeBitSize = 0;\n\n // Check if the argument is an integer data type\n if (argType instanceof IntegerArgumentType)\n {\n IntegerArgumentType icmd = (IntegerArgumentType) argType;\n\n // Get the number of bits occupied by the argument\n argBitSize = icmd.getSizeInBits();\n\n // Get the argument units reference\n unitSet = icmd.getUnitSet();\n\n // Check if integer encoding is set to 'unsigned'\n if (icmd.getIntegerDataEncoding().getEncoding().equalsIgnoreCase(\"unsigned\"))\n {\n isUnsigned = true;\n }\n\n // Determine the smallest integer size that contains the number of bits\n // occupied by the argument\n dataTypeBitSize = 8;\n\n while (argBitSize.longValue() > dataTypeBitSize)\n {\n dataTypeBitSize *= 2;\n }\n\n // Get the argument alarm\n IntegerArgumentType.ValidRangeSet alarmType = icmd.getValidRangeSet();\n\n // Check if the argument has an alarm\n if (alarmType != null)\n {\n // Get the alarm range\n List<IntegerRangeType> alarmRange = alarmType.getValidRange();\n\n // Check if the alarm range exists\n if (alarmRange != null)\n {\n // Store the minimum alarm value\n minimum = alarmRange.get(0).getMinInclusive();\n\n // Store the maximum alarm value\n maximum = alarmRange.get(0).getMaxInclusive();\n }\n }\n\n isInteger = true;\n }\n // Check if the argument is a floating point data type\n else if (argType instanceof FloatArgumentType)\n {\n // Get the float argument attributes\n FloatArgumentType fcmd = (FloatArgumentType) argType;\n dataTypeBitSize = fcmd.getSizeInBits().longValue();\n unitSet = fcmd.getUnitSet();\n\n // Get the argument alarm\n FloatArgumentType.ValidRangeSet alarmType = fcmd.getValidRangeSet();\n\n // Check if the argument has an alarm\n if (alarmType != null)\n {\n // Get the alarm range\n List<FloatRangeType> alarmRange = alarmType.getValidRange();\n\n // Check if the alarm range exists\n if (alarmRange != null)\n {\n // Get the minimum value\n Double min = alarmRange.get(0).getMinInclusive();\n\n // Check if a minimum value exists\n if (min != null)\n {\n // Get the minimum alarm value\n minimum = String.valueOf(min);\n }\n\n // Get the maximum value\n Double max = alarmRange.get(0).getMaxInclusive();\n\n // Check if a maximum value exists\n if (max != null)\n {\n // Get the maximum alarm value\n maximum = String.valueOf(max);\n }\n }\n }\n\n isFloat = true;\n }\n // Check if the argument is a string data type\n else if (argType instanceof StringDataType)\n {\n // Get the string argument attributes\n StringDataType scmd = (StringDataType) argType;\n dataTypeBitSize = Integer.valueOf(scmd.getStringDataEncoding()\n .getSizeInBits()\n .getFixed()\n .getFixedValue());\n unitSet = scmd.getUnitSet();\n isString = true;\n }\n // Check if the argument is an enumerated data type\n else if (argType instanceof EnumeratedDataType)\n {\n EnumeratedDataType ecmd = (EnumeratedDataType) argType;\n EnumerationList enumList = ecmd.getEnumerationList();\n\n // Check if any enumeration parameters are defined\n if (enumList != null)\n {\n // Step through each enumeration parameter\n for (ValueEnumerationType enumType : enumList.getEnumeration())\n {\n // Check if this is the first parameter\n if (enumeration == null)\n {\n // Initialize the enumeration string\n enumeration = \"\";\n }\n // Not the first parameter\n else\n {\n // Add the separator for the enumerations\n enumeration += \", \";\n }\n\n // Begin building this enumeration\n enumeration += enumType.getValue() + \" | \" + enumType.getLabel();\n }\n\n argBitSize = ecmd.getIntegerDataEncoding().getSizeInBits();\n unitSet = ecmd.getUnitSet();\n\n // Check if integer encoding is set to 'unsigned'\n if (ecmd.getIntegerDataEncoding().getEncoding().equalsIgnoreCase(\"unsigned\"))\n {\n isUnsigned = true;\n }\n\n // Determine the smallest integer size that contains the number of bits\n // occupied by the argument\n dataTypeBitSize = 8;\n\n while (argBitSize.longValue() > dataTypeBitSize)\n {\n dataTypeBitSize *= 2;\n }\n\n isInteger = true;\n }\n }\n\n // Get the name of the data type from the data type table that matches the base\n // type and size of the parameter\n dataType = getMatchingDataType(dataTypeBitSize / 8,\n isInteger,\n isUnsigned,\n isFloat,\n isString,\n dataTypeHandler);\n\n // Check if the description exists\n if (argType.getLongDescription() != null)\n {\n // Store the description\n description = argType.getLongDescription();\n }\n\n // Check if the argument bit size exists\n if (argBitSize != null && argBitSize.longValue() != dataTypeBitSize)\n {\n // Store the bit length\n bitLength = argBitSize.toString();\n }\n\n // Check if the units exists\n if (unitSet != null)\n {\n List<UnitType> unitType = unitSet.getUnit();\n\n // Check if the units is set\n if (!unitType.isEmpty())\n {\n // Store the units\n units = unitType.get(0).getContent();\n }\n }\n\n argumentInfo = new ParameterInformation(argName,\n dataType,\n arraySize,\n bitLength,\n enumeration,\n units,\n minimum,\n maximum,\n description,\n 0,\n seqIndex);\n }\n\n break;\n }\n }\n\n return argumentInfo;\n }", "public abstract interface QueryArgs {\n\n /** Return the catalog associated with this object */\n public Catalog getCatalog();\n\n /** Set the value for the ith parameter */\n public void setParamValue(int i, Object value);\n\n /** Set the value for the parameter with the given label */\n public void setParamValue(String label, Object value);\n\n /** Set the min and max values for the parameter with the given label */\n public void setParamValueRange(String label, Object minValue, Object maxValue);\n\n /** Set the int value for the parameter with the given label */\n public void setParamValue(String label, int value);\n\n /** Set the double value for the parameter with the given label */\n public void setParamValue(String label, double value);\n\n /** Set the double value for the parameter with the given label */\n public void setParamValueRange(String label, double minValue, double maxValue);\n\n /** Set the array of parameter values directly. */\n public void setParamValues(Object[] values);\n\n /** Get the value of the ith parameter */\n public Object getParamValue(int i);\n\n /** Get the value of the named parameter\n *\n * @param label the parameter name or id\n * @return the value of the parameter, or null if not specified\n */\n public Object getParamValue(String label);\n\n /**\n * Get the value of the named parameter as an integer.\n *\n * @param label the parameter label\n * @param defaultValue the default value, if the parameter was not specified\n * @return the value of the parameter\n */\n public int getParamValueAsInt(String label, int defaultValue);\n\n /**\n * Get the value of the named parameter as a double.\n *\n * @param label the parameter label\n * @param defaultValue the default value, if the parameter was not specified\n * @return the value of the parameter\n */\n public double getParamValueAsDouble(String label, double defaultValue);\n\n /**\n * Get the value of the named parameter as a String.\n *\n * @param label the parameter label\n * @param defaultValue the default value, if the parameter was not specified\n * @return the value of the parameter\n */\n public String getParamValueAsString(String label, String defaultValue);\n\n\n /**\n * Return the object id being searched for, or null if none was defined.\n */\n public String getId();\n\n /**\n * Set the object id to search for.\n */\n public void setId(String id);\n\n\n /**\n * Return an object describing the query region (center position and\n * radius range), or null if none was defined.\n */\n public CoordinateRadius getRegion();\n\n /**\n * Set the query region (center position and radius range) for\n * the search.\n */\n public void setRegion(CoordinateRadius region);\n\n\n /**\n * Return an array of SearchCondition objects indicating the\n * values or range of values to search for.\n */\n public SearchCondition[] getConditions();\n\n /** Returns the max number of rows to be returned from a table query */\n public int getMaxRows();\n\n /** Set the max number of rows to be returned from a table query */\n public void setMaxRows(int maxRows);\n\n\n /** Returns the query type (an optional string, which may be interpreted by some catalogs) */\n public String getQueryType();\n\n /** Set the query type (an optional string, which may be interpreted by some catalogs) */\n public void setQueryType(String queryType);\n\n /**\n * Returns a copy of this object\n */\n public QueryArgs copy();\n\n /**\n * Optional: If not null, use this object for displaying the progress of the background query\n */\n public StatusLogger getStatusLogger();\n}", "@Override\n public void doExeception(Map<String, Object> args)\n {\n \n }", "@Override\n public void doExeception(Map<String, Object> args)\n {\n \n }", "@Override\n\tprotected Collection<ArgumentTypeDescriptor> getArgumentTypeDescriptors() {\n\t\treturn Arrays.asList(new VCFWriterArgumentTypeDescriptor(engine, System.out, bisulfiteArgumentSources), new SAMReaderArgumentTypeDescriptor(engine),\n\t\t\t\tnew SAMFileWriterArgumentTypeDescriptor(engine, System.out), new OutputStreamArgumentTypeDescriptor(engine, System.out));\n\t}", "@Override\n public int getArgent() {\n return _argent;\n }", "private static @NonNull String resolveInputName(@NonNull Argument<?> argument) {\n String inputName = argument.getAnnotationMetadata().stringValue(Bindable.NAME).orElse(null);\n if (StringUtils.isEmpty(inputName)) {\n inputName = argument.getName();\n }\n return inputName;\n }", "private Object[] getArguments (String className, Object field)\n\t{\n\t\treturn ((field == null) ? new Object[]{className} : \n\t\t\tnew Object[]{className, field});\n\t}", "PermissionSerializer (GetArg arg) throws IOException, ClassNotFoundException {\n\tthis( \n\t create(\n\t\targ.get(\"targetType\", null, Class.class),\n\t\targ.get(\"type\", null, String.class),\n\t\targ.get(\"targetName\", null, String.class),\n\t\targ.get(\"targetActions\", null, String.class) \n\t )\n\t);\n }", "public Type getArgumentDirection() {\n return direction;\n }", "public String argTypes() {\n return \"I\";//NOI18N\n }", "public static void main(String arg[]) {\n\n }", "godot.wire.Wire.Value getArgs(int index);", "@Override\n protected String[] getArguments() {\n String[] args = new String[1];\n args[0] = _game_file_name;\n return args;\n }", "public void setArgs(java.lang.String value) {\n this.args = value;\n }", "private Argument(Builder builder) {\n super(builder);\n }", "@Override\n public void execute(String[] args) {\n\n }", "@Override\n\tprotected final void setFromArgument(CommandContext<ServerCommandSource> context, String name) {\n\t}", "UUID createArgument(ArgumentCreateRequest request);", "@Override\n public void initialise(String[] arguments) {\n\n }", "public static ParameterExpression parameter(Class type, String name) { throw Extensions.todo(); }", "protected abstract void parseArgs() throws IOException;" ]
[ "0.7164074", "0.6946075", "0.6714363", "0.65115863", "0.63969076", "0.6375468", "0.63481104", "0.63162106", "0.6260299", "0.6208487", "0.6208487", "0.62070644", "0.6197276", "0.61806154", "0.6177103", "0.61530507", "0.61472267", "0.61243707", "0.60771817", "0.6054482", "0.59906125", "0.59906125", "0.5984017", "0.59791875", "0.5977681", "0.59532714", "0.5946838", "0.59457266", "0.59452903", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.59352577", "0.5909717", "0.5889277", "0.588111", "0.5871162", "0.5866624", "0.58613646", "0.58519953", "0.58381283", "0.58083445", "0.58059824", "0.5795826", "0.57816726", "0.57670826", "0.57556796", "0.57471323", "0.57418406", "0.5729463", "0.57291526", "0.5716928", "0.5713024", "0.56974274", "0.56782854", "0.56723106", "0.5664594", "0.5664104", "0.5660337", "0.5652865", "0.5647883", "0.5642134", "0.5635645", "0.5634968", "0.562251", "0.56210977", "0.56167537", "0.56138444", "0.56044126", "0.56044126", "0.5602371", "0.56012225", "0.55986875", "0.55893147", "0.5588273", "0.5583255", "0.5582767", "0.55681497", "0.55626017", "0.55577534", "0.55524325", "0.5549442", "0.55378276", "0.5536797", "0.5527675", "0.5511817", "0.55099154", "0.550257" ]
0.0
-1
TODO Autogenerated method stub
@Override public Element bind(String arg0, final String arg1) { final Element e[] = { null }; final Comunitat c[] = { null }; final String comunitat = arg1.substring(0, arg1.indexOf('&')); final String element = arg1.substring(arg1.indexOf('&') + 1); JPA.withTransaction(new F.Callback0() { @Override public void invoke() throws Throwable { c[0] = (Comunitat.recercaPerNif(comunitat)); e[0] = (Element.recercaPerCodi(c[0], element)); } }); return (e[0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.66713095", "0.6567948", "0.652319", "0.648097", "0.64770466", "0.64586824", "0.64132667", "0.6376419", "0.62759", "0.62545097", "0.62371093", "0.62237984", "0.6201738", "0.619477", "0.619477", "0.61924416", "0.61872935", "0.6173417", "0.613289", "0.6127952", "0.6080854", "0.6076905", "0.6041205", "0.6024897", "0.60200036", "0.59985113", "0.5967729", "0.5967729", "0.5965808", "0.5949083", "0.5941002", "0.59236866", "0.5909713", "0.59030116", "0.589475", "0.58857024", "0.58837134", "0.586915", "0.58575684", "0.5850424", "0.5847001", "0.5824116", "0.5810248", "0.5809659", "0.58069366", "0.58069366", "0.5800507", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.57900196", "0.5790005", "0.578691", "0.578416", "0.578416", "0.5774115", "0.5774115", "0.5774115", "0.5774115", "0.5774115", "0.5761079", "0.57592577", "0.57592577", "0.5749888", "0.5749888", "0.5749888", "0.5748457", "0.5733414", "0.5733414", "0.5733414", "0.57209575", "0.57154554", "0.57149583", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.571194", "0.57043016", "0.56993437", "0.5696782", "0.5687825", "0.5677794", "0.5673577", "0.5672046", "0.5669512", "0.5661156", "0.56579345", "0.5655569", "0.5655569", "0.5655569", "0.56546396", "0.56543446", "0.5653163", "0.56502634" ]
0.0
-1
TODO Autogenerated method stub
@Override public String javascriptUnbind() { return (this.comunitat.nif + "&" + this.codi); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public String unbind(String arg0) { return (this.comunitat.nif + "&" + this.codi); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
public static void borrarElement(Element element) throws Exception { EntityManager em = JPA.em(); ElementPK pk = new ElementPK(); pk.setCodi(element.codi); pk.setComunitat(element.comunitat.nif); Element actorToBeRemoved = em.find(Element.class, pk); try { em.remove(actorToBeRemoved); em.flush(); } catch (Exception e) { throw e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
/ metodo de prueba que pide un dato por JOptionPane y retorna el String correspondiente Reemplazar por lo que se necesiten
public String pedirDato(String mensaje) { return (JOptionPane.showInputDialog(null, mensaje,"Elija una opcion",JOptionPane.INFORMATION_MESSAGE)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String pedirDato() \r\n\t{\r\n\t\treturn (JOptionPane.showInputDialog(null,\"Ingrese un dato\",\"Titulo del InputDialog\",JOptionPane.INFORMATION_MESSAGE));\r\n\t}", "public String verMenu(){\r\n try {\r\n Object opcion=JOptionPane.showInputDialog(\r\n null,\r\n \"Seleccione Opcion\",\"Agenda de Anexos\",\r\n JOptionPane.QUESTION_MESSAGE,\r\n null,\r\n new String[]{\"1.- Registrar Empleado\",\r\n \"2.- Asignar Anexo a Empleado\",\r\n \"3.- Obtener ubicacion de un Anexo\",\r\n \"4.- Modificar Anexo a Empleado\",\r\n \"5.- Desasignar Anexo a Empleado\",\r\n \"6.- Listado de Asignaciones\",\r\n \"7.- Salir del Programa\"},\r\n \"1.- Registrar Empleado\");\r\n return(String.valueOf(opcion).substring(0, 1)); // RETORNA A FUNCION VOID MAIN\r\n } catch (Exception ex) {\r\n System.out.println(\"Hubo un error al ingresar una opcion \"+ex.toString());\r\n }\r\n return \"0\";\r\n }", "public void escribirDato(String dato) \r\n\t{\r\n\t\tJOptionPane.showMessageDialog(null, dato, \"Título del Message Dialog\", JOptionPane.INFORMATION_MESSAGE);\r\n\t}", "private static void SaidaDados(String saida){\n JOptionPane.showMessageDialog(null, saida);\n }", "private void MensajeInf(String strMensaje){\n javax.swing.JOptionPane obj =new javax.swing.JOptionPane();\n String strTit;\n strTit=\"Mensaje del sistema Zafiro\";\n obj.showMessageDialog(this,strMensaje,strTit,javax.swing.JOptionPane.INFORMATION_MESSAGE);\n }", "private String promptLoadOrNew(){\r\n Object[] options = {\"Start A New Game!\", \"Load A Previous Game.\"};\r\n String result = (String) JOptionPane.showInputDialog(\r\n null,\r\n \"What would you like to do?\",\r\n \"Welcome!\",\r\n JOptionPane.PLAIN_MESSAGE,\r\n null,\r\n options,\r\n 1);\r\n return result;\r\n \r\n }", "public static void main(String[] args) {\n String matriz = \"ABCDEFGHIJLMNOPQRSTUVWXYZ\";\n Ejercicio1 c = new Ejercicio1();\n String retorno;\n String mensaje = JOptionPane.showInputDialog(\"Digite el mensaje\");\n// Convierte el mensaje a mayusculas\n mensaje = mensaje.toUpperCase();\n c.llenaMatriz(matriz);\n retorno = c.aTap(mensaje);\n JOptionPane.showMessageDialog(null, retorno);\n\n //Fin de la Primera parte del examen\n /*\n Inicio de la Segunda parte del examen\n */\n /*\n String[] lista = {\" auto \", \" pato \", \" palo \", \" poto \", \" amar \", \" amor \",\n \" loca \", \" loco \", \" polo \", \" poco \", \" poca \", \" rota \", \" roto \"};\n AdminPalabras admin = new AdminPalabras( lista );\n String[] letras = {\" escalopa \", \" automotor\", \" percatado\"};\n for(int i = 0; i < letras . length ; i ++) {\n int cont = admin .ContarPalabrasPosibles(letras [i ]);\n JOptionPane.showMessageDialog(null,letras [i] + \": \" + cont );\n }*/\n //Fin de la Segunda parte del Examen\n }", "public static void main(String[] args) {\n\n JOptionPane.showMessageDialog(null, \"This is a message dialog box\", \"title\", JOptionPane.PLAIN_MESSAGE);\n JOptionPane.showMessageDialog(null, \"Here is some useless info\", \"title\", JOptionPane.INFORMATION_MESSAGE);\n JOptionPane.showMessageDialog(null, \"really?\", \"title\", JOptionPane.QUESTION_MESSAGE);\n JOptionPane.showMessageDialog(null, \"Your computer has a VIRUS!\", \"title\", JOptionPane.WARNING_MESSAGE);\n JOptionPane.showMessageDialog(null, \"CALL TECH SUPPORT OR ELSE!\", \"title\", JOptionPane.ERROR_MESSAGE);\n\n\n //int answer = JOptionPane.showConfirmDialog(null, \"bro, do you even code?\");\n //String name = JOptionPane.showInputDialog(\"What is your name?: \");\n\n ImageIcon icon = new ImageIcon(\"smile.png\");\n String[] responses = {\"No, you are!\",\"thank you!\",\"*blush*\"};\n int answer = JOptionPane.showOptionDialog(\n null,\n \"You are the best! :D\",\n \"Secret message\",\n JOptionPane.DEFAULT_OPTION,\n 0,\n icon,\n responses,\n responses[0]);\n System.out.println(answer);\n\n }", "public static String getString(String inputDialog) {\n return(JOptionPane.showInputDialog(inputDialog));\n }", "private int obtenerMensajeDeConfirmacion() {\n String mess = \"¿Seguro que desea \";\n switch (opcionForm) {\n case FormEscOpcion.CREAR:\n mess += \" Guardar?\";\n break;\n case FormEscOpcion.MODIFICAR:\n mess += \" Modificar?\";\n break;\n case FormEscOpcion.ELIMINAR:\n mess += \" Eliminar?\";\n break;\n default:\n break;\n }\n // pedir confirmacion al usuario de la pantalla si desea enviar la informacion o no utilizando un showConfirmDialog\n int input = JOptionPane.showConfirmDialog(this, mess, \"\",\n JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);\n return input; // retornar la respuesta del usuario de la pantalla al utilizar el showConfirmDialog\n }", "private static void showHelp(){\r\n JOptionPane.showMessageDialog(null, \"1. Choose the faculty.\\n\"\r\n + \"2. Type in the year when the school year started in format YYYY.\\n\"\r\n + \"3. Choose the semester.\\n\"\r\n + \"4. Enter subject codes separated by semicolon. You can add them all at once or add other subjects later.\\n\"\r\n + \"5. Press the Add button to load schedule options.\\n\"\r\n + \"6. Click on the loaded options you want to choose. Their color will turn red.\\n\"\r\n + \"7. Save the options you chose to the text file through File -> Save.\\n\",\r\n \"How-to\", JOptionPane.PLAIN_MESSAGE);\r\n }", "public static void main(String[] args) throws Exception {\n Object [] tipos = {\"Gerente\", \"Funcionario\"};\n\n //inputs\n String resposta1, resposta2;\n double salario_bruto, salario_corrigido;\n\n //primeiro dialogo\n resposta1 = (String) JOptionPane.showInputDialog(null,\n \"Selecione o tipo de funcionario:\",\n \"Por favor\",\n JOptionPane.WARNING_MESSAGE,\n null,\n tipos,\n \"Gerente\"\n );\n\n resposta2 = (String) JOptionPane.showInputDialog(null,\n \"Digite o salario do funcionario (com ponto):\",\n \"Por favor\",\n JOptionPane.QUESTION_MESSAGE //icon\n );\n\n salario_bruto = Double.parseDouble(resposta2);\n\n switch(resposta1) {\n case \"Gerente\":\n salario_corrigido = salario_bruto * 1.15;\n break;\n\n case \"Funcionario\":\n salario_corrigido = salario_bruto * 1.075;\n break;\n\n default:\n salario_corrigido = 0.0;\n }\n\n JOptionPane.showMessageDialog(null,\n \"O salario corrigo é de R$ \" + salario_corrigido\n );\n }", "public static void main(String[] args) {\nint replaced = JOptionPane.showConfirmDialog(null,\"Replace existing selection?\");\n String result = \"?\";\n switch (replaced) {\n case JOptionPane.CANCEL_OPTION:\n result = \"Canceled\";\n break;\n case JOptionPane.CLOSED_OPTION:\n result = \"Closed\";\n break;\n case JOptionPane.NO_OPTION:\n result = \"No\";\n break;\n case JOptionPane.YES_OPTION:\n result = \"Yes\";\n break;\n default:\n ;\n }\nSystem.out.println(\"Replace? \" + result);\n }", "public void TipoCliente() {\n\tint cambio=1;\n\tString tipoCliente=\"\";\n\tdo {\n\t\ttry {\n\t\t\ttipoCliente = (JOptionPane.showInputDialog(null, \"Selecciona el tipo de cliente\", null, JOptionPane.PLAIN_MESSAGE,null, new Object[]\n\t\t\t\t\t{ \"Selecciona\",\"Docente\", \"Administrativo\"}, \"Selecciona\")).toString() ;\n\t\t\t\n\t\t\tif(tipoCliente.equalsIgnoreCase(\"Docente\")) {\n\t\t\t\tingresaDocente();\n\t\t\t\tsetTipoCliente(\"Docente\");\n\t\t\t\t\n\t\t\t}else if(tipoCliente.equalsIgnoreCase(\"Administrativo\")) {\n\t\t\t\tingresaAdministrativo();\n\t\t\t\tsetTipoCliente(\"Administrativo\");\n\t\t\t}else{\n\t\t\t\t\n\t\t\t\tJOptionPane.showMessageDialog(null,\"Escoge una de las dos opciones\");\n\t\t\t}\n\t} catch (Exception e) {\n\t\tJOptionPane.showMessageDialog(null, \"Debes escoger una opcion\");\n\t\tcambio=0;\n\t}\n\t} while (tipoCliente==\"Selecciona\"||tipoCliente==null||cambio==0);\t\n}", "public String lerNome() {\n\t\treturn JOptionPane.showInputDialog(\"Digite seu Nome:\");\n\t\t// janela de entrada\n\t}", "private void mostrarMensagemDeErro(String informacao) {\n\t\tJOptionPane.showMessageDialog(null, informacao, \"Aten��o\",\n\t\t\t\tJOptionPane.INFORMATION_MESSAGE);\n\t}", "public String menuProducto() {\n\n\t\tIcon icono = new ImageIcon(getClass().getResource(\"../img/producto.png\"));\n\n\t\tString[] opciones = { \"Mostrar todos los valores\", \"Borrar Producto\", \"Crear Producto\", \"Modificar Producto\",\n\t\t\t\t\"Buscar por nombre\", \"Buscar por clave\", \"Salir\" };\n\n\t\tString opcionElegida = (String) JOptionPane.showInputDialog(null, \"¿Que deseas realizar?\", \"Tabla Producto\",\n\t\t\t\tJOptionPane.QUESTION_MESSAGE, icono, opciones, opciones[0]);\n\n\t\treturn opcionElegida;\n\n\t}", "public static void respuesta() { TODO code application logic here\n\n //\n int nNumeroFilas = 0;\n int nNumeroColumnas = 0;\n int nValorMaximo = 0;\n int nValorMinimo = 0;\n String MensajeError = \"\";\n MensajeError += \"No ha ingresado número\";\n String MensajeError2 = \"\";\n MensajeError2 += \"No puede salir del programa\";\n try {\n nNumeroFilas = Integer.parseInt(JOptionPane.showInputDialog(\"Ingrese el # de Filas : \"));\n nNumeroColumnas = Integer.parseInt(JOptionPane.showInputDialog(\"Ingrese el # de Columnas : \"));\n nValorMinimo = Integer.parseInt(JOptionPane.showInputDialog(\"Ingrese el Valor Minimo : \"));\n nValorMaximo = Integer.parseInt(JOptionPane.showInputDialog(\"Ingrese el Valor Maximo : \"));\n } catch (NumberFormatException e) {\n\n JOptionPane.showMessageDialog(null, MensajeError);\n } catch (NullPointerException e) {\n\n JOptionPane.showMessageDialog(null, MensajeError2);\n }\n JOptionPane.showMessageDialog(null, ImpresionMatriz(DevuelveMatriz(nNumeroFilas, nNumeroColumnas,\n nValorMaximo, nValorMinimo), nNumeroFilas, nNumeroColumnas));\n\n }", "public static void mensagemRealizarCadastro() {\n\t\tJOptionPane.showMessageDialog(null, \"Favor clique em atualizar para re-listar e selecionar o novo item recem cadastrado.\", \"Informação\", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(Toolkit.getDefaultToolkit().getImage(CadastroQuartos.class.getResource(\"/Imagens/Informacao32.png\"))));\n\t}", "public static String getString(String message) {\r\n final Stage dialog = new Stage();\r\n Window owner = Main.getStage().getOwner();\r\n dialog.setTitle(message);\r\n dialog.initOwner(owner);\r\n dialog.initStyle(StageStyle.UTILITY);\r\n dialog.initModality(Modality.WINDOW_MODAL);\r\n dialog.setX(owner.getX());\r\n dialog.setY(owner.getY());\r\n\r\n final TextField textField = new TextField();\r\n final Button submitButton = new Button(\"Submit\");\r\n submitButton.setDefaultButton(true);\r\n submitButton.setOnAction(new EventHandler<ActionEvent>() {\r\n @Override\r\n public void handle(ActionEvent t) {\r\n dialog.close();\r\n }\r\n });\r\n textField.setMinHeight(TextField.USE_PREF_SIZE);\r\n\r\n final VBox layout = new VBox(10);\r\n layout.setAlignment(Pos.CENTER_RIGHT);\r\n layout.setStyle(\"-fx-background-color: azure; -fx-padding: 10;\");\r\n layout.getChildren().setAll(\r\n textField,\r\n submitButton\r\n );\r\n\r\n dialog.setScene(new Scene(layout));\r\n dialog.showAndWait();\r\n\r\n return textField.getText();\r\n }", "public void emitirSaludoConGui()\n {\n JOptionPane.showMessageDialog(null, \n\t\t\t\t\t\"<html><p style ='color: red'>Saludo en modo gráfico </p></html>\" + \n\t\t\t\t\t\"\\n\\nBienvenido/a al curso de programación orientada a objetos\\n en Java utilizando BlueJ\",\n\t\t\t\t\t\"Ejemplo de prueba\", JOptionPane.INFORMATION_MESSAGE);\n }", "private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed\n try {\n JOptionPane.showMessageDialog(this,String.valueOf(myFacePaper.calcularMeGustaUltimaSemana()));\n } catch (FacePaperException ex) {\n Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "static void giveInfo(String message){\n JOptionPane.showMessageDialog(null, message);\n }", "public void Sair() {\r\n\t\t\t\r\n\t\t\tnome = JOptionPane.showInputDialog(\"Informe o seu nome ou SAIR para finalizar\");\r\n }", "public void estableceEquipoComputo() {\n\tsetDispositivo(JOptionPane.showInputDialog(\"Ingrese el nombre del dispositivo a adquirir\"));\n\tsetComercio(JOptionPane.showInputDialog(\"Ingrese el nombre del comercio donde lo comprara\"));\n}", "public static String readWindowString(Object messageToUser) {\n\t\tFont fontMonospaced = new Font(\"Consolas\", Font.BOLD, 18);\n\n\t\t//Preparing the text message\n\t\tJTextArea textMessage = new JTextArea();\n\t\ttextMessage.setEditable(false);\n\t\ttextMessage.setBackground(Color.decode(\"0x3c3f41\"));\n\t\ttextMessage.setForeground(Color.decode(\"0xdee4e5\"));\n\t\ttextMessage.setFont(fontMonospaced);\n\t\ttextMessage.setText(messageToUser.toString());\n\n\t\t//Changing JOptionPane colors\n\t\tUIManager.put(\"OptionPane.background\", textMessage.getBackground());\n\t\tUIManager.put(\"Panel.background\", textMessage.getBackground());\n\t\tUIManager.put(\"Button.background\", Color.decode(\"0x727A7C\"));\n\t\tUIManager.put(\"Button.foreground\", textMessage.getForeground());\n\t\tUIManager.put(\"Button.font\", fontMonospaced);\n\n\t\tBorder inputBorder = BorderFactory.createMatteBorder(0, 0, 2, 0, Color.gray);\n\t\tUIManager.put(\"TextField.background\", textMessage.getBackground());\n\t\tUIManager.put(\"TextField.foreground\", Color.white);\n\t\tUIManager.put(\"TextField.border\", inputBorder);\n\t\tUIManager.put(\"TextField.font\", fontMonospaced);\n\n\t\t//Changin JOptionPane OK button\n\t\tUIManager.put(\"OptionPane.okButtonText\", \"Insert\");\n\t\tUIManager.put(\"OptionPane.cancelButtonText\", \"Cancel\");\n\t\t// </editor-fold>\n\n\t\tString readValue = null;\n\t\ttry {\n\t\t\treadValue = JOptionPane.showInputDialog(null, textMessage, \"Read Operation\", JOptionPane.PLAIN_MESSAGE);\n\t\t} catch (Exception e) {\n\t\t}\n\t\treturn readValue;\n\t}", "private static String promptString(String descricao) {\n System.out.print(\"\\t>>> \" + descricao + \": \");\n return scan.nextLine();\n }", "public void MostrarValores() {\r\n Nodo recorrido = UltimoValorIngresado;\r\n\r\n while (recorrido != null) {\r\n Lista += recorrido.informacion + \"\\n\";\r\n recorrido = recorrido.siguiente;\r\n }\r\n\r\n JOptionPane.showMessageDialog(null, Lista);\r\n Lista = \"\";\r\n }", "public String[] showInputDialog()\n {\n class GetData extends JDialog implements ActionListener\n {\n JTextField textLogin = new JTextField();\n JPasswordField texPasswd = new JPasswordField(16);\n JButton btnOK = new JButton(\" OK \");\n JButton btnCancel = new JButton(\"Cancel\");\n String returnlogin = null;\n String returnPasswd = null;\n /**\n * Zpracovani dat\n */\n public GetData()\n {\n setModal(true);\n getContentPane().setLayout(new BorderLayout());\n setDefaultCloseOperation(DISPOSE_ON_CLOSE);\n setLocation(400,300);\n JPanel myLogin = new JPanel();\n myLogin.setLayout(new BorderLayout());\n JPanel myPasswd = new JPanel();\n myPasswd.setLayout(new BorderLayout());\n myLogin.add(new JLabel(\"Username\"),BorderLayout.NORTH);\n myLogin.add(textLogin,BorderLayout.CENTER);\n getContentPane().add(myLogin,BorderLayout.NORTH);\n myPasswd.add(new JLabel(\"Password\"),BorderLayout.NORTH);\n myPasswd.add(texPasswd,BorderLayout.CENTER);\n getContentPane().add(myPasswd,BorderLayout.CENTER);\n JPanel jp = new JPanel();\n btnOK.addActionListener(this);\n btnCancel.addActionListener(this);\n jp.add(btnOK);\n jp.add(btnCancel);\n getContentPane().add(jp,BorderLayout.SOUTH);\n pack();\n setVisible(true);\n }\n /**\n * Kliknuti na tlacitko a nasledne poslani jmena a hesla.\n */\n public void actionPerformed(ActionEvent ae)\n {\n if(ae.getSource() == btnOK){\n login = textLogin.getText();\n passwd = texPasswd.getText();\n }\n dispose();\n\n }\n }\n new GetData();\n return new String[] {login, passwd};\n }", "public static void main(String[] args) {\n\t\r\nString Bob = \"You make great jokes!\";\r\nString Amie = \"Your art is beautiful!\";\r\nString Grace = \"You're clever!\";\r\n\r\n\t\t// 2. Ask the user to enter a name. Store their answer in a variable.\r\n\r\nString name = JOptionPane.showInputDialog(\"Enter a name.\");\r\n\r\n\t\t// 3. In a pop-up, tell the user what is remarkable about that person. \r\n\r\nif (name.equalsIgnoreCase(\"Bob\")) {\r\n\t\r\nJOptionPane.showMessageDialog(null, Bob); }\r\n\r\n\r\nelse if (name.equalsIgnoreCase(\"Amie\")) {\r\n\r\nJOptionPane.showMessageDialog(null, Amie);\r\n}\r\n\r\nelse if (name.equalsIgnoreCase(\"Grace\")) {\r\n\r\nJOptionPane.showMessageDialog(null, Grace); \r\n}\r\n}", "public static void main(String[] args) {\nString answer= JOptionPane.showInputDialog(\"do you like dogs\");\n\tJOptionPane.showMessageDialog(null,(answer));\n\t}", "public static String input (Resources loader,\r\n\t\tComponent frame, String name, Object args[], Object defaultVal) {\r\n\r\n\t\tString retVal = (String)JOptionPane.showInputDialog(frame,\r\n\t\t\tloader.getResourceMessage(name.concat(\".message\"), args),\r\n\t\t\tloader.getResourceMessage(name.concat(\".title\"), args),\r\n\t\t\tJOptionPane.QUESTION_MESSAGE, null, null, defaultVal);\r\n\r\n\t\treturn (retVal);\r\n\t}", "static String getNameFromUser( Frame owner )\n\t{\n\t\treturn JOptionPane.showInputDialog( owner,\n\t\t\t\t \"You are a high scorer! Please enter your name.\",\n\t\t\t\t \"Congratulations!\",\n\t\t\t\t JOptionPane.QUESTION_MESSAGE );\n\t}", "public void circulo(){\n JOptionPane.showMessageDialog(null,\"Bienvenido\\nA continuacion sabra el Area y Perimetro de un Circulo\");\n texto = JOptionPane.showInputDialog(\"Ingrese el radio\");\n l = Double.parseDouble(texto);\n if (l<=0){\n JOptionPane.showMessageDialog(null,\"Valor Invalido\\nA continuacion ingrese un valor positivo\");\n texto = JOptionPane.showInputDialog(\"Ingrese el radio\");\n l = Double.parseDouble(texto);\n }\n a = 3.1416*(l*l);\n p = 3.1416*(l*2);\n JOptionPane.showMessageDialog(null,\"El Area es de \"+a+\" u^2 y un Perimetro un de \"+p+\" u\");\n \n }", "public static void main(String[] args) {\n String[] SexOptions = {\"Laki-Laki\",\"Perempuan\"};\r\n ImageIcon icon = new ImageIcon(\"PraktikumPemrogramanJava/Pertemuan_III/baseline_accessibility_new_black_18dp.png\");\r\n String n = (String)JOptionPane.showInputDialog(null, \"Apa Jenis Kelamin anda ?\", \"Jenis Kelamin\", JOptionPane.QUESTION_MESSAGE, null, SexOptions, SexOptions[0]);\r\n \r\n // 0=yes, 1=no, 2=cancel\r\n if (\"Laki-Laki\".equals(n)) {\r\n int confirmLaki = JOptionPane.showConfirmDialog(null, \"Apakah anda konfirmasi bahwa anda : Laki-Kali\", \"Konfirmasi Jenis Kelamin\",JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);\r\n switch (confirmLaki) {\r\n case 0:\r\n {\r\n String msg = \"Jenis Kelamin anda \"+n;\r\n JOptionPane.showMessageDialog(null, msg);\r\n break;\r\n }\r\n case 1:\r\n {\r\n String msg = \"Jenis Kelamin anda bukan \"+n;\r\n JOptionPane.showMessageDialog(null, msg);\r\n break;\r\n }\r\n default:\r\n {\r\n String msg = \"Jenis Kelamin anda Tidak ada \";\r\n JOptionPane.showMessageDialog(null, msg);\r\n break;\r\n }\r\n }\r\n } else {\r\n int confirmPerempuan = JOptionPane.showConfirmDialog(null, \"Apakah anda konfirmasi bahwa anda : Perempuan\", \"Konfirmasi Jenis Kelamin\", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);\r\n switch (confirmPerempuan) {\r\n case 0:\r\n {\r\n String msg = \"Jenis Kelamin anda \"+n;\r\n JOptionPane.showMessageDialog(null, msg);\r\n break;\r\n }\r\n case 1:\r\n {\r\n String msg = \"Jenis Kelamin anda bukan \"+n;\r\n JOptionPane.showMessageDialog(null, msg);\r\n break;\r\n }\r\n default:\r\n {\r\n String msg = \"Jenis Kelamin anda Tidak ada \";\r\n JOptionPane.showMessageDialog(null, msg);\r\n break;\r\n }\r\n }\r\n \r\n \r\n }\r\n}", "public void mensagemErroCadastro() {\n\t\tJOptionPane.showMessageDialog(null, \"Erro!\\nVerifique se todos os campos estão preenchidos.\"\n\t\t\t\t+ \"\\nVerifique se os dados em formato numérico são números.\"\n\t\t\t\t+ \"\\nVerifique se as datas foram inseridas corretamente.\" + \"\\nNão use vírgulas ','. Use pontos!\", null,\n\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t}", "public String getAnswer(String input)\n\t{\n\t\tString answer = \"\";\n\t\t\n\t\tanswer = JOptionPane.showInputDialog(null, input);\n\t\t\n\t\treturn answer;\n\t}", "private String getPlayerName() {\n\t\tString[] options = {\"OK\"};\n\t\tJPanel namePanel = new JPanel(new GridLayout(0, 1));\n\t\tJLabel lbl = new JLabel(\"Next player, what is your name?\");\n\t\tJTextField txt = new JTextField(10);\n\t\tnamePanel.add(lbl);\n\t\tnamePanel.add(txt);\n\t\t\n\t\t// show dialog box\n\t\tJOptionPane.showOptionDialog(frame, namePanel, \"Player name\",\n\t\t\t\tJOptionPane.NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options , options[0]);\n\t\tString playerName = txt.getText();\n\t\twhile(playerName.length() < 1){\n\t\t\tlbl.setText(\"Name must be at least one character long.\");\n\t\t\tJOptionPane.showOptionDialog(frame, namePanel, \"Player name\",\n\t\t\t\t\tJOptionPane.NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options , options[0]);\n\t\t\tplayerName = txt.getText();\n\t\t}\n\t\treturn playerName;\n\t}", "public static JDialog createSummonerNameDialog(final ChampionSelectGUI t) {\n\t\tfinal JPanel contentPanel = new JPanel();\n\t\tJLabel request = new JLabel(\"Please enter your summoner name\");\n\t\tcontentPanel.add(request);\n\t\trequest.setAlignmentX(Component.CENTER_ALIGNMENT);\n\t\tfinal JTextField input = new JTextField(10);\n\t\tinput.setHorizontalAlignment(SwingConstants.CENTER);\n\t\tcontentPanel.add(input);\n\t\tJButton ok = new JButton(\"ok\");\n\t\tcontentPanel.add(ok);\n\t\tok.setSize(200, 150);\n\t\tok.setAlignmentX(Component.CENTER_ALIGNMENT);\n\t\tfinal JDialog d = new JDialog(t, \"Summoner Name\", true);\n\t\td.setContentPane(contentPanel);\n\t\td.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);\n\t\td.setSize(400, 100);\n\t\td.setLocationRelativeTo(t);\n\t\td.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));\n\t\td.addWindowListener(new WindowListener() {\n\t\t\tpublic void windowClosing(WindowEvent e) {\n\t\t\t\tint ret = JOptionPane.showConfirmDialog(contentPanel, \"Are you sure you want to exit?\", \"Choose an option\", JOptionPane.YES_NO_OPTION);\n\t\t\t\tif (ret == 0) {\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic void windowOpened(WindowEvent e) {\n\t\t\t\tinput.requestFocus();\n\t\t\t}\n\t\t\tpublic void windowClosed(WindowEvent e) {}\n\t\t\tpublic void windowIconified(WindowEvent e) { }\n\t\t\tpublic void windowDeiconified(WindowEvent e) { }\n\t\t\tpublic void windowActivated(WindowEvent e) { }\n\t\t\tpublic void windowDeactivated(WindowEvent e) { }\n\t\t});\n\t\tok.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tif (input.getText().equals(\"\")) {\n\t\t\t\t\tJOptionPane.showMessageDialog(contentPanel, \"Please input a summoner name.\", \"Message\", JOptionPane.ERROR_MESSAGE);\n\t\t\t\t} else {\n\t\t\t\t\tt.summNameArr[0] = input.getText();\n\t\t\t\t\td.setVisible(false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn d;\n\t}", "public String visualizzaCampo(){\n\t\tString info= new String(\"Nome: \"+ nome +\"\\n\" +\"Descrizione: \" + descrizione+ \"\\n\"+ \"Obbligatoria: \" + obbligatorio +\"\\n\");\n\t\treturn info;\n\t}", "public void exibeMatriculaJaExiste() {\n JOptionPane.showMessageDialog(\n null,\n Constantes.GERENCIAR_FUNCIONARIO_MATRICULA_JA_EXISTENTE,\n Constantes.GERENCIAR_FUNCIONARIO_TITULO,\n JOptionPane.PLAIN_MESSAGE\n );\n }", "public String getToernooiSoort(){\n if(typeField.getText().equals(\"Toernooi\")){\n try {\n Connection con = Main.getConnection();\n PreparedStatement st = con.prepareStatement(\"SELECT soort_toernooi FROM Toernooi WHERE TC = ?\");\n st.setInt(1, Integer.parseInt(codeField.getText()));\n ResultSet rs = st.executeQuery();\n if (rs.next()) {\n String toernooiSoort = rs.getString(\"soort_toernooi\");\n System.out.println(toernooiSoort);\n return toernooiSoort;\n }\n\n }catch(Exception e){\n System.out.println(e);\n System.out.println(\"ERROR: er is een probleem met de database(getToernooiSoort)\");\n }\n }\n\n return \"poepieScheetje\";}", "public String comunica() {\r\n// ritorna una stringa\r\n// posso usare il metodo astratto \r\n return msg + AggiungiQualcosa();\r\n }", "public String getFechatxt(Date d){\n \n try {\n String formato = selectorfecha.getDateFormatString();\n //Formato\n \n SimpleDateFormat sdf = new SimpleDateFormat(formato);\n String txtfechap = sdf.format(d);\n return txtfechap;\n } catch (NullPointerException ex) {\n JOptionPane.showMessageDialog(this, \"Al menos selecciona una fecha válida!\", \"Error!\", JOptionPane.INFORMATION_MESSAGE);\n return null;\n\n }\n\n\n \n }", "public static void mensegemSucessoCadastro() {\n\t\tJOptionPane.showMessageDialog(null, \"Sucesso ao cadastrar.\", \"Sucesso\", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(Toolkit.getDefaultToolkit().getImage(CadastroQuartos.class.getResource(\"/Imagens/Sucesso32.png\"))));\n\t}", "public static int Menu(){\n \n String StrOp=JOptionPane.showInputDialog(null, \"Ingrese una opcion:\\n\"+\"0.- Salir\\n\"+\n \"1-Calificacion de notas\\n\"+\n \"2-Promedio de la clase\");\n return(Integer.parseInt(StrOp));\n }", "public static void main(String[] args) {\nString Arshia=\"Super Cool\";\r\nString Ashay=\"Hard-working\";\r\nString Devin=\"Positive\";\r\nString Andrew=\"Helpful\";\r\nString Darren=\"Kind and Nice\";\r\n\t\t// 2. Ask the user to enter a name. Store their answer in a variable.\r\nString input= JOptionPane.showInputDialog(null, \"Enter a name\");\r\nif(input.equalsIgnoreCase(\"Arshia\")) {\r\nJOptionPane.showMessageDialog(null, Arshia);\r\n\r\n}else if( input.equalsIgnoreCase(\"Ashay\")){\r\n\tJOptionPane.showMessageDialog(null, Ashay);\r\n\tif(input.equalsIgnoreCase(\"Devin\")) {\r\n\t\tJOptionPane.showMessageDialog(null, Devin);\r\n\t\tif(input.equalsIgnoreCase(\"Andrew\")) {\r\n\t\t\tJOptionPane.showMessageDialog(null, Andrew);\r\n\t\t\tif(input.equalsIgnoreCase(\"Darren\")) {\r\n\t\t\t\tJOptionPane.showMessageDialog(null, Darren);\r\n\t\t\r\n\r\n// 3. In a pop-up, tell the user what is remarkable about that person. \r\n}\r\n\t}\r\n}\r\n}\r\n}", "public void exibeDataNascimentoInvalida() {\n JOptionPane.showMessageDialog(\n null,\n Constantes.GERENCIAR_FUNCIONARIO_DATA_NASCIMENTO_INVALIDA,\n Constantes.GERENCIAR_FUNCIONARIO_TITULO,\n JOptionPane.PLAIN_MESSAGE\n );\n }", "public static void main(String [] args){\n\tdouble radio,pi=3.14,area,perimetro;\n\ttry{\n\tradio=Double.parseDouble(JOptionPane.showInputDialog(null,\"Ingrese El Radio Del Circulo\"));\n\tarea=pi*(radio*radio);\n\tperimetro = (radio*2)*pi;\n\tJOptionPane.showMessageDialog(null, \"El Ciurculo Tiene Un Area De= \"+area+\"cm2 Y Un Perimetro De= \"+perimetro+\"cm\");\n\t}catch(NumberFormatException x){\n\t\tJOptionPane.showMessageDialog(null, \"Has Ingresado Una Letra\");\n\t}\n}", "private String printHelp()//refactored\n { String result = \"\";\n result += \"\\n\";\n result += \"You are weak if you have to ask me\\n\";\n result += \"Try not to die, while i´am mocking you.\\n\";\n result += \"\\n\";\n result += \"\" + currentRoom.getDescription() + \"\\n\"; //new\n result += \"\\nExits: \" + currentRoom.getExitDescription() + \"\\n\";//new\n result += \"\\nCommand words:\\n\";\n result += ValidAction.getValidCommandWords();\n result += \"\\n\";\n \n return result;\n }", "private void ImproperFillOutException() {\n JOptionPane.showMessageDialog(null, \"Fill out the form properly\");\n }", "public void verificaJogo(){\n\t\t\t\tif(jogo.verificaPerdeu()) {\n\t \t\tJOptionPane dialogo = new JOptionPane();\n\t \t\t\n\t \t\tint opcao = dialogo.showConfirmDialog(this, \"Voce Perdeu!!\\nDeseja jogar novamente?\", \"mensagem\", JOptionPane.YES_NO_OPTION);\n\t \t\t\n\t \t\tif(opcao == JOptionPane.YES_OPTION) {\n\t \t\t\tMatriz novamente = new Matriz();\n\t \t\t}\n\t \t\tsetVisible(false);\n\t \t\tdispose();\n\t \t}\n\t\t\t\t\n\t\t\t\tif(jogo.verificaGanhou()) {\n\t\t\t\t\tJOptionPane dialogo = new JOptionPane();\n\t \t\t\n\t \t\tint opcao = dialogo.showConfirmDialog(this, \"Voce GANHOOOOO!!\\nDeseja jogar novamente?\", \"mensagem\", JOptionPane.YES_NO_OPTION);\n\t \t\t\n\t \t\tif(opcao == JOptionPane.YES_OPTION) {\n\t \t\t\tMatriz novamente = new Matriz();\n\t \t\t}\n\t \t\tsetVisible(false);\n\t \t\tdispose();\n\t \t}\n\t\t\t\t\n\t\t\t}", "private void Screentocharge() {\r\n\r\n\t\t\t\t\r\n\t\tJTextField nombre = new JTextField();\r\n\t\tJTextField edad = new JTextField();\r\n\t\tJTextField raza = new JTextField();\r\n\t\tJTextField cuento = new JTextField();\r\n\t\tChoice tipo = new Choice();\r\n\t\t\t\t\t\t\r\n\t\ttipo.add(\"Perro\");\r\n\t\ttipo.add(\"Gato\");\r\n\t\ttipo.add(\"Conejo\");\r\n\t\t\r\n\t\tedad.addKeyListener(new KeyAdapter()\r\n\t\t{\r\n\t\t public void keyTyped(KeyEvent e)\r\n\t\t {\r\n\t\t char caracter = e.getKeyChar();\r\n\t\t if(((caracter<'0')||(caracter>'9'))&&(caracter!='\\b'))\r\n\t\t {\r\n\t\t e.consume(); \r\n\t\t }\r\n\t\t }\r\n\t\t});\r\n\t\t\r\n\t\tObject[] message = { \"Tipo:\", tipo, \"Nombre:\", nombre, \"Edad\", edad, \"Raza\", raza, \"Causa\", cuento };\r\n\r\n\t\tUIManager.put(\"OptionPane.minimumSize\",new Dimension(500,400));\r\n\t\tint option = JOptionPane.showConfirmDialog(null, message, \"Ingreso de Pasiente\", JOptionPane.OK_CANCEL_OPTION);\r\n\t\tif (option == JOptionPane.OK_OPTION) {\t\r\n\t\t\tif (edad.getText().equals(\"\")) {\r\n\t\t\t\tedad.setText(\"0\");\r\n\t\t\t\treturnAnimal(tipo.getSelectedItem(), nombre.getText(), raza.getText(), \r\n\t\t\t\t\t\tInteger.valueOf(edad.getText()), cuento.getText());\r\n\t\t\t}\r\n\t\t\t returnAnimal(tipo.getSelectedItem(), nombre.getText(), raza.getText(), \r\n\t\t\t\t\t\t\tInteger.valueOf(edad.getText()), cuento.getText());\r\n\t\t}\r\n\t\t\r\n\t\tnombre = null;\r\n\t\tedad =null;\r\n\t\traza = null;\r\n\t\tcuento = null;\r\n\t\ttipo =null;\r\n\t\t\r\n\t}", "int confirmar(String s) {\n\t\treturn JOptionPane.showConfirmDialog(this, s, \"Alerta\", 0, 1, null);\n\t}", "public static void mensagemErroCadastrar() {\n\t\tJOptionPane.showMessageDialog(null, \"Erro ao cadastrar. Revise os dados inseridos.\", \"Erro\", JOptionPane.ERROR_MESSAGE, new ImageIcon(Toolkit.getDefaultToolkit().getImage(CadastroQuartos.class.getResource(\"/Imagens/Erro32.png\"))));\n\t}", "private static void printBoard() {\n\n\t//\tJOptionPane.showMessageDialog(null, \"Heyoo\", \".-*Board*-.\", -1);\n\t\t//String name = JOptionPane.showInputDialog(\"Vat is dain name?\");\n\t\t//JOptionPane.showMessageDialog(null, \"Aiight you good, \" + name);\n\t\t\n\t\t\n\t\tString[] options = {\"Sten\", \"Sax\", \"Påse\"};\n\t\tString Val = (String)JOptionPane.showInputDialog(null, \"Sten, Sax eller Påse?\",\n \"Game nr\", JOptionPane.QUESTION_MESSAGE, null, options, options[2]);\n\t\t\n\t\t\n\t\t\n\t}", "private String optionsManager() {\n\t\tSystem.out.print(\"\\nEntrez votre choix SVP: \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tString option = \"\";\n\t\toption = scan.nextLine();\n\t\t\n\t\tString etatDeHotel = this.isOuvert()? \"L'Hôtel est ouvert ! \" : \"L'Hôtel n'est pas ouvert ! \";\t\t\n\t\tString doitEtreAfficher = option.equalsIgnoreCase(\"A\")? \"\\n\"+etatDeHotel+\"\\n\" \n\t\t\t\t: option.equalsIgnoreCase(\"B\")? \"\\nLe nombre de chambres réservées est: \"+ this.chambresNonVides().size()+\"\\n\"\n\t\t\t\t: option.equalsIgnoreCase(\"C\") ? \"\\nLe nombre de chambres vides est: \"+ this.chambresVides().size()+\"\\n\"\n\t\t\t\t: option.equalsIgnoreCase(\"D\")? \"\\nLe nombre de la première chambre vide est : \"+this.chambresVides().get(0).getId()+\"\\n\"\n\t\t\t\t: option.equalsIgnoreCase(\"E\")? \"\\nLe nombre de la dernière chambre vide est : \"+this.chambresVides().get(this.chambresVides().size()-1).getId()+\"\\n\"\n\t\t\t\t: option.equalsIgnoreCase(\"H\")? \"\\n-La commande Q ou Quit sont pour arrêtrer le programe.\\n-Il faut choisir un letter pour les options.\\n-La commande O pour afficher toutes les options possibles! \"\n\t\t\t\t: option.equalsIgnoreCase(\"n\")? \"----------------------------------\\nVous avez été dirigé vers le menu principale\"\n\t\t\t\t: option.equalsIgnoreCase(\"m\")? \"\\n-----------\\nMerci\\n----------------\\n\"\n\t\t\t\t: option.equalsIgnoreCase(\"q\")? \"q\"\n\t\t\t\t: option.equalsIgnoreCase(\"quit\")? \"q\"\n\t\t\t\t: option.equalsIgnoreCase(\"o\")? \"o\"\n\t\t\t\t: option.equalsIgnoreCase(\"f\")? \"f\"\n\t\t\t\t: option.equalsIgnoreCase(\"g\")? \"g\"\n\t\t\t\t:\"x\";\n\t\treturn doitEtreAfficher;\n\t}", "private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {\n \n if(jComboBox1.getSelectedIndex()==0 || jComboBox1.getSelectedIndex()==2) {\n try {\n res1 = verifynumcarn(0);\n \n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_enfant.class.getName()).log(Level.SEVERE, null, ex);\n }\n } else if (jComboBox1.getSelectedIndex()==1 || jComboBox1.getSelectedIndex()==2) {\n try {\n res2 = verifynumcarn(1);\n \n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_enfant.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n \n }\n System.out.println(\"res1\"+res1+\"res2\"+res2);\n if(jTextField1.getText().isEmpty()){\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ raison sociale\");\n// } else if(jFormattedTextField1.getText().equalsIgnoreCase(\"dd/MM/yyyy\")){\n// JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ date de création\");\n// } else if(demoDateField1.getDate()==null){\n// JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ date de création\");\n// } else if(jTextField11.getText().isEmpty()){\n// JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ lieu de création\");\n } else if(jTextField2.getText().isEmpty()){\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ activité principale\");\n// } else if(jTextField3.getText().isEmpty()){\n// JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ adresse\");\n// } else if(jTextField4.getText().isEmpty()){\n// JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ numéro COE\");\n } else if(jTextField5.getText().isEmpty()){\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ nom personne de référence\");\n } else if(jTextField12.getText().isEmpty()){\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ prénom personne de référence\");\n }\n \n else if(jFormattedTextField2.getText().equalsIgnoreCase(\" - - - \") || jFormattedTextField2.getText().equalsIgnoreCase(\"+\") ){\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner le champ téléphone\");\n } else if (jTextField6.getText().isEmpty()){\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner les droits d'adhésion \");\n \n// } else if (!isDouble(jTextField6.getText())){\n// JOptionPane.showMessageDialog(this, \"Les droits d'adhésion doivent être des chiffres\");\n// } else if (!isDouble(jTextField7.getText())){\n// JOptionPane.showMessageDialog(this, \"La part sociale doit être des chiffres\");\n// } else if (!isDouble(jTextField8.getText())){\n// JOptionPane.showMessageDialog(this, \"Le dépôt initial doit être des chiffres\");\n// }else if (jTextField7.getText().isEmpty()){\n// JOptionPane.showMessageDialog(this, \"Veuillez renseigner la part sociale \");\n } else if (jFormattedTextField3.getText().equalsIgnoreCase(\"0000\") || jFormattedTextField4.getText().equalsIgnoreCase(\"0000\")) { \n \n JOptionPane.showMessageDialog(this, \"Numéro de carnet 0000 invalide\");\n } else if (jComboBox1.getSelectedIndex()==0 && jFormattedTextField3.getText().isEmpty()) {\n JOptionPane.showMessageDialog(this, \"Numéro de carnet Epargne invalide\"); \n }else if (jComboBox1.getSelectedIndex()==1 && jFormattedTextField4.getText().isEmpty()) { \n JOptionPane.showMessageDialog(this, \"Numéro de carnet Tontine invalide\"); \n } else if (jComboBox1.getSelectedIndex()==2 && (jFormattedTextField3.getText().isEmpty() || jFormattedTextField4.getText().isEmpty())){\n JOptionPane.showMessageDialog(this, \"Numéro de carnet invalide\"); \n } else if(jComboBox1.getSelectedIndex()==0 && res1==true) {\n JOptionPane.showMessageDialog(this, \"Ce numéro carnet épargne est déjà utilisé\"); \n }else if(jComboBox1.getSelectedIndex()==1 && res2==true) { \n JOptionPane.showMessageDialog(this, \"Ce numéro carnet tontine est déjà utilisé\"); \n } else if(jComboBox1.getSelectedIndex()==2 && res1==true) { \n JOptionPane.showMessageDialog(this, \"Ce numéro carnet épargne est déjà utilisé\"); \n } else if(jComboBox1.getSelectedIndex()==2 && res2==true) { \n JOptionPane.showMessageDialog(this, \"Ce numéro carnet tontine est déjà utilisé\"); \n } else if (demoDateField2.getDate()==null && (jComboBox1.getSelectedIndex()==0 || jComboBox1.getSelectedIndex()==2)) {\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner la date d'adhésion Epargne\"); \n } else if (demoDateField3.getDate()==null && (jComboBox1.getSelectedIndex()==1 || jComboBox1.getSelectedIndex()==2)) {\n JOptionPane.showMessageDialog(this, \"Veuillez renseigner la date d'adhésion Tontine\"); \n } else { \n boolean success= true;\n String sql01=\"SELECT idProfil_persmorale FROM Profil_persmorale WHERE Raison_sociale= '\" + jTextField1.getText() +\"'\";\n Statement stmt = null;\n boolean inserted=false;\n ResultSet rs2=null;\n connect=Connect.ConnectDb();\n try {\n stmt= connect.createStatement();\n rs2=stmt.executeQuery(sql01);\n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_enfant.class.getName()).log(Level.SEVERE, null, ex);\n }\n try {\n if (rs2.next() ){\n JOptionPane.showMessageDialog(null, \"Attention la personne morale indiquée est déjà enregistré\");\n success=false;\n inserted=true;\n }\n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_adulte.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n if (! inserted) {\n \n String numcarn=\"\";\n if(jComboBox1.getSelectedIndex()==0) {\n numcarn=jFormattedTextField3.getText();\n } else if (jComboBox1.getSelectedIndex()==1){\n numcarn=jFormattedTextField4.getText();\n } else {\n numcarn=jFormattedTextField3.getText() +\"-\"+jFormattedTextField4.getText();\n }\n \n int partsociale=0;\n if(!jTextField7.getText().isEmpty())\n partsociale=Integer.parseInt(jTextField7.getText());\n \n // String datecrea2=jFormattedTextField1.getText();\n // sqlDate=new java.sql.Date(demoDateField1.getDate().getTime());\n java.sql.Date sqlDate=null;\n java.sql.Date sqlDate2=null;\n java.sql.Date sqlDate3=null;\n if (demoDateField1.getDate()!=null) sqlDate=new java.sql.Date(demoDateField1.getDate().getTime());\n if (demoDateField2.getDate()!=null) sqlDate2=new java.sql.Date(demoDateField2.getDate().getTime());\n if (demoDateField3.getDate()!=null) sqlDate3=new java.sql.Date(demoDateField3.getDate().getTime());\n// DateFormat formatter = new SimpleDateFormat(\"dd/MM/yyyy\");\n// try {\n// datecrea= formatter.parse(datecrea2);\n// sqlDate= new java.sql.Date(datecrea.getTime());\n// } catch (ParseException ex) {\n// Logger.getLogger(Adhesion_persmor.class.getName()).log(Level.SEVERE, null, ex);\n// success=false;\n// }\n // On vérifie si la personne morale n'existe pas déjà \n \n String fullname= jTextField5.getText()+ \" \"+ jTextField12.getText();\n String sql = \"INSERT INTO Profil_persmorale \" + \n \"VALUES (\"+ null +\", '\"+ jTextField1.getText(); \n \n if (sqlDate==null){\n sql=sql+\"', null, '\"+jTextField11.getText()+\"', '\"+jTextField2.getText()+\"', '\"+jTextField3.getText()+\"', '\"+jTextField4.getText()+\"', '\"+fullname+\"', '\"+jFormattedTextField2.getText()+\"', '\"+String.valueOf(jComboBox1.getSelectedItem()).trim()+\"', '\"+numcarn+\"', '\"+Integer.valueOf(jTextField6.getText().replace(\" \", \"\"))+\"', '\"+partsociale;\n } else if (sqlDate !=null) {\n sql=sql+\"', '\"+sqlDate +\"', '\"+jTextField11.getText()+\"', '\"+jTextField2.getText()+\n \"', '\"+jTextField3.getText()+\"', '\"+jTextField4.getText()+\"', '\"+fullname+\"', '\"+jFormattedTextField2.getText()+\"', '\"+String.valueOf(jComboBox1.getSelectedItem()).trim()+\"', '\"+numcarn+\"', '\"+Integer.valueOf(jTextField6.getText().replace(\" \", \"\"))+\"', '\"+partsociale; \n } \n \n if (sqlDate2==null){\n sql=sql+\"', null,\";\n } else if (sqlDate2!=null){\n sql=sql+\"','\"+sqlDate2+\"',\";\n } \n \n if (sqlDate3==null){ \n sql=sql+\"null\"+\", 1);\";\n } else if (sqlDate3!=null){ \n sql=sql+\"'\"+sqlDate3+\"',1);\";\n } \n \n \n System.out.println(sql);\n int generatdkey = 0;\n\n try { \n pst=connect.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);\n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_persmor.class.getName()).log(Level.SEVERE, null, ex);\n success=false;\n }\n try {\n \n pst.execute();\n ResultSet rst= pst.getGeneratedKeys();\n generatdkey=0;\n if(rst.next()){\n generatdkey= rst.getInt(1);\n }\n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_persmor.class.getName()).log(Level.SEVERE, null, ex);\n JOptionPane.showMessageDialog(null, \"Erreur d'enregistrement\");\n success=false;\n \n }\n if(!jTextField8.getText().isEmpty() && jTextField8.isEnabled()) {\n java.util.Date dt = new java.util.Date();\n java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n String currentTime = sdf.format(dt);\n String sql002 = \"INSERT INTO Epargne VALUES (\"+null+\", '\"+ currentTime + \"', '\"+\"Dépot initial\"+\"', '\"+jTextField8.getText()+\"', '\"+generatdkey+\"', '\"+\"Pers Morale\"+\"');\";\n try { \n pst=connect.prepareStatement(sql002);\n pst.execute();\n } catch (SQLException ex) {\n JOptionPane.showMessageDialog(null, \"Erreur d'enregistrement du dépot initial\");\n Logger.getLogger(Adhesion_persmor.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n try {\n pst.close();\n connect.close();\n if (rs2!=null) rs2.close();\n if (stmt!=null) stmt.close();\n } catch (SQLException ex) {\n Logger.getLogger(Adhesion_persmor.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n \n }\n \n if (success) {\n JOptionPane.showMessageDialog(null, \"Enregistrement effectué avec succès\");\n jTextField1.setText(\"\");\n jTextField2.setText(\"\");\n jTextField3.setText(\"\");\n jTextField4.setText(\"\");\n demoDateField1.setDate(null);\n demoDateField2.setDate(null);\n demoDateField3.setDate(null);\n jFormattedTextField3.setText(\"\");\n jFormattedTextField4.setText(\"\");\n jComboBox2.setSelectedIndex(0);\n jFormattedTextField2.setText(\"\");\n // jFormattedTextField1.setText(\"dd/MM/yyyy\");\n jTextField5.setText(\"\");\n jTextField12.setText(\"\");\n jTextField6.setText(\"\");\n jTextField7.setText(\"\");\n jTextField8.setText(\"\");\n jTextField9.setText(\"\");\n // jTextField10.setText(\"(+IND-)NN-NN-NN-NN\");\n jTextField11.setText(\"\");\n this.main.refresh();\n\n }\n \n }\n }", "public static String inputBox(String promptMsg) {\n return JOptionPane.showInputDialog(promptMsg);\n }", "private String showCharacterSuggestions(String room) {\n\t\tButtonGroup characterButtons = new ButtonGroup();\n\t\tList<JRadioButton> btns = setupCharacterButtons();\n\t\t\n\t // set up dialog box\n\t\tJPanel characterPanel = new JPanel(new GridLayout(0, 1));\n\t\tJLabel lbl = new JLabel(\"You are in the \"+room+\".\"\n\t\t\t\t+ \"\\n Select the character that you suspect.\");\n\t\tcharacterPanel.add(lbl);\n\t\t\n\t // add the buttons to the panel\n\t for(JRadioButton b : btns){\n\t \tcharacterButtons.add(b);\n\t \tcharacterPanel.add(b);\n\t }\n\t \n\t\t// show dialog\n\t JOptionPane.showMessageDialog(frame, characterPanel);\n\t // decide which button has been selected\n\t for(JRadioButton b : btns){\n\t \tif(b.isSelected()){\n\t \t\treturn b.getText();\n\t \t}\n\t }\n\t return null;\n\t}", "public void sucessoCadastro(){\n JOptionPane.showMessageDialog(null, \"Cadastro realizado com sucesso!\", null, \n\t\t\t\tJOptionPane.INFORMATION_MESSAGE);\n\t\tjanela.dispose();\n }", "public void listar() {\r\n Collections.sort(coleccion);\r\n for (int i = 0; i < coleccion.size(); i++) {\r\n String resumen = (coleccion.get(i).toString());\r\n JOptionPane.showMessageDialog(null, resumen);\r\n }\r\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n final String fieldText = field.getText();\n JOptionPane.showMessageDialog(null, fieldText);\n System.out.println(\"YESSSSSSSSSSSS\");\n }", "private void muestraResultado(float vimc, String msg){\n //Mensaje en notificacion de Toast\n // Toast.makeText(this, vimc+ msg, Toast.LENGTH_SHORT).show();\n\n //Mensaje con alert\n AlertDialog.Builder vent = new AlertDialog.Builder(this);\n //Modificar las propiedades del de vent\n vent.setTitle(\"Resultado\");\n String cad = String.valueOf(vimc);\n vent.setMessage(\"IMC: \" + vimc+\"\\n\"+msg);\n //Crear boton de modal\n vent.setPositiveButton(\"Aceptar\", null);\n //Crear modal\n vent.create();\n //Mostarr en la poantalla\n vent.show();\n txtA.setText(null);\n txtP.setText(null);\n }", "public static String chequeoCampos (JTextField nombre, JTextField apellido, \r\n JTextField cedula, JTextArea Direccion, JTextField email,\r\n JPasswordField password, JPasswordField comprobacion,\r\n JLabel errorCampos, JTextField username, JDateChooser DoB, VentanaBase ventana) {\n\t\t\r\n\t\tint errores = 0;\r\n String pass1 = \"0\", pass2 = \"0\";\r\n\t\t\r\n\t\tif (nombre.getText().equals(\"\") || apellido.getText().equals(\"\") || email.getText().equals(\"\") || comprobacion.getPassword().equals(\"\")\r\n\t\t\t\t || password.getPassword().equals(\"\") || comprobacion.getPassword().equals(\"\")) { //Si algun campo est� lleno, debe mostrar la etiqueta de error\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\terrorCampos.setVisible(true); //Con esto habilita la etiqueta de error\r\n errorCampos.setText(\"Campos incompletos, por favor revise nuevamente.\");\r\n\t\t\t\terrorCampos.setForeground(Color.red); // Y la pone en color rojo\t\r\n\t\t\t\terrores++;\r\n \r\n pass1 = password.getText();\r\n pass2 = comprobacion.getText();\r\n\t\t\t\r\n\t\t}\r\n\t \t \r\n\t\t//if (!password.getPassword().equals(comprobacion.getPassword())) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\r\n if (!pass1.equals(pass2)) {\r\n\t\t\t if (!password.getPassword().equals(\"\")) {\r\n\t\t\t\terrorCampos.setText(\"Campos incompletos, por favor revise nuevamente.\");\t\t\t\t\t\r\n\t\t\t\terrorCampos.setVisible(true); //Con esto habilita la etiqueta de error\r\n\t\t\t\terrorCampos.setForeground(Color.red); // Y la pone en color rojo\r\n\t\t\t\terrores++;\r\n\t\t\t\t\r\n\t\t\t }\r\n\t\t}\r\n\t\t\r\n\t\tif ((password.getPassword().length < 4 || password.getPassword().length > 12) && password.getPassword().equals(\"\")){ \r\n\t\t\t//Si la contrase�a tiene entre 4 y 12 caracteres.\r\n\t\t\t\r\n //REVISAR AQUI, CORRECCION??\r\n\t\t\terrorCampos.setText(\"La contrasena debe tener entre 4 y 12 caracteres\");\r\n\t\t\terrorCampos.setVisible(true); //Con esto habilita la etiqueta de error\r\n\t\t\terrorCampos.setForeground(Color.red); // Y la pone en color rojo\r\n\t\t\terrores++;\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println(pass1+ \" ---> \" + pass2 + \" \" + password.getText());\r\n\t\t\r\n\t\tif (errores > 0) {\r\n\t\t return (\"ErrorSistema\"); }\r\n\t\telse {\r\n \r\n //Si entra por aca, todo está en orden y procederá a registrar al usuario\r\n \r\n \r\n RegistroUsuario( nombre.getText(), apellido.getText(), \r\n cedula.getText(), username.getText(), password.getText(), \r\n email.getText(), DoB.getDate(), Direccion.getText());\r\n\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\treturn (\"RegistroAprobado\");\r\n\t\t\t}", "java.lang.String getPrenume();", "private void tampilPesan(String message) {\n JOptionPane.showMessageDialog(this, message);\n }", "public void writeClue()\r\n {\n\r\n String s = JOptionPane.showInputDialog(\"Please enter your clue.\",\r\n selectedWord.getClue());\r\n //Word w = selectedSquare.getWord();\r\n selectedWord.setClue(s);\r\n }", "public String respostaBanco() {\r\n\t\tString[] resposta = { \" \" };\r\n\t\twhile (resposta[0].equals(\" \")) {\r\n\t\t\tJFrame caixa = new JFrame();\r\n\t\t\tJOptionPane.showMessageDialog(caixa, \"Aguarda comunicação...\");\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\ttry {\r\n\t\t\t\tFile f = new File(\"resposta.dat\");\r\n\t\t\t\tif (f.exists()) {\r\n\t\t\t\t\tFileInputStream ficheiro = new FileInputStream(f);\r\n\t\t\t\t\tObjectInputStream in = new ObjectInputStream(ficheiro);\r\n\t\t\t\t\tresposta[0] = (String) in.readObject();\r\n\t\t\t\t\tin.close();\r\n\t\t\t\t\tficheiro.close();\r\n\t\t\t\t}\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\t//\r\n\t\t\t}\r\n\t\t\tcaixa.dispose();\r\n\t\t}\r\n\t\treturn resposta[0];\r\n\t}", "private Object displayOptionsPanel(String message, Object[] possibleValues) {\n return JOptionPane.showInputDialog(\n mainPanel, // parentComponent\n message, // message\n \"\", // title\n JOptionPane.QUESTION_MESSAGE, // messageType\n null, // icon\n possibleValues, // selectionValues\n possibleValues[0] // initialSelectionValue\n );\n }", "public void erroCadastro(){\n JOptionPane.showMessageDialog(null, \"Erro ao cadastrar!\", null, \n\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t\tjanela.dispose();\n }", "void Consulta(String consulta){\n if(numUsuario2.getText().equals(\"\") || numUsuario2.getText().length() < 3){\n JOptionPane.showMessageDialog(null,\"Ingresa un Núm. de usuario\");\n numUsuario2.requestFocus();\n }else{//si ya hay numero de usuario\n Double ant = Double.parseDouble(jLabelLecturaAnterior.getText());\n Double act = Double.parseDouble(jTextLectura.getText());\n \n if(reinicio.isSelected()!=false){ \n //si ha seleccionado reinciar registro\n ant = 0.0; //poner lectura anterior = 0\n }\n if(act < ant){\n JOptionPane.showMessageDialog(null,\"LECTURA INVALIDA. \\n La lectura actual es menor a la anterior:\"\n + \"\\n\" + jTextLectura.getText() + \" < \" + jLabelLecturaAnterior.getText());\n jTextLectura.requestFocus();\n }else{\n int seleccion;\n if(consulta.equals(\"guardar\")){\n seleccion = JOptionPane.showConfirmDialog(null, \"¿Guardar cambios?\", \"Confirmar cambios\", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);\n }else{\n seleccion = JOptionPane.showConfirmDialog(null, \"¿Actualizar cambios?\", \"Confirmar cambios\", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); \n }\n \n if(seleccion == 0){//Si la respuesta fue SÍ\n\n consumoLectura = act - ant;\n try { \n conn = conecionBD.conexion();\n consumoDAOImpl daoConsumo = new consumoDAOImpl(conn);\n consumo c = new consumo();\n\n String numUser = numUsuario2.getText(); \n\n lecturaAct = Double.valueOf(jTextLectura.getText());\n Double recargo = Double.valueOf(jTextRecargo1.getText());\n Double cooperacion = Double.valueOf(jTextCooperacion1.getText());\n Double bonificacion = Double.valueOf(jTextBonificaciones1.getText());\n Double sanciones = Double.valueOf(jTextSanciones1.getText());\n Double varios = Double.valueOf(jTextVarios1.getText());\n String fecha = null;\n String notas = jTextAreaMotivo1.getText();\n String aviso = \"Sin aviso\";\n int status = 0;\n \n if(estadoUser == 3 || estadoUser == 4){//si usuario no paga status =1 o es pago anual\n status = 1;\n SimpleDateFormat formato = new SimpleDateFormat(\"yyyy-MM-dd\");\n String fechaformateada = formato.format(new Date());\n fecha = fechaformateada;\n }\n if(consumoLectura > 10){\n importe = consumoLectura*precio;\n }else{\n importe = 0.0;\n cuota = 40.0;\n }\n Double total = importe+cuota+recargo+cooperacion+bonificacion+sanciones+varios;\n\n c.setNumUsuario(numUser);\n c.setPeriodo(periodo);\n c.setAnio(anio);\n c.setLecturaActual(lecturaAct);\n c.setConsumoMedidor(consumoLectura);\n c.setPrecio(precio);\n c.setImporteConsumo(importe);\n c.setCoutaFija(cuota);\n c.setRecargos(recargo);\n c.setCooperacion(cooperacion);\n c.setBonificaciones(bonificacion);\n c.setSanciones(sanciones);\n c.setVarios(varios);\n c.setTotalPagar(total);\n c.setFechaPAgo(fecha);\n c.setNotas(notas);\n c.setAviso(aviso);\n\n c.setStatus(status);\n\n if(consulta.equals(\"guardar\")){ \n daoConsumo.insertar(c);\n }else{\n daoConsumo.actualizar(c);\n }\n\n numUsuario2.setText(\"\");\n numUsuario2.requestFocus();\n limpiarCampos();\n } catch (DAOException ex) {\n JOptionPane.showMessageDialog(null,\"Este registro ya EXISTE\");\n }\n }\n }\n } \n }", "private void jMenuItemTemasAyudaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemTemasAyudaActionPerformed\n JOptionPane.showMessageDialog(this, \"Leer informe\",\n this.getTitle(), JOptionPane.INFORMATION_MESSAGE);\n}", "private void showInfo() {\n JOptionPane.showMessageDialog(\n this,\n \"Пока что никакой\\nинформации тут нет.\\nДа и вряд ли будет.\",\n \"^^(,oO,)^^\",\n JOptionPane.INFORMATION_MESSAGE);\n }", "void prosegui(String messaggio);", "public String extraerCombo(){\n String consulta=null,combo;\n \n combo=comboBuscar.getSelectedItem().toString();\n \n if(combo.equals(\"Buscar por No.Control:\")){\n consulta=\"noControl\";\n } \n if(combo.equals(\"Buscar por Nombre:\")){\n consulta=\"nombreCompleto\"; \n }\n if(combo.equals(\"Buscar por Carrera:\")){\n consulta=\"nombreCarrera\";\n }\n return consulta;\n }", "public static void main(String[] args) {\n String primerNumero = JOptionPane.showInputDialog(\"Introduzca el primer entero\");\r\n String segundoNumero = JOptionPane.showInputDialog(\"Introduzca el segundo entero\");\r\n \r\n //Convertir las entradas String en valores int para usarlos en un calculo\r\n int numero1 = Integer.parseInt(primerNumero);\r\n int numero2 = Integer.parseInt(segundoNumero);\r\n int suma = numero1 + numero2;\r\n \r\n //Muestra los resultados en un dialogo de mensajes de JOptionPane\r\n JOptionPane.showMessageDialog(null,\"La suma es \" + suma, \"Suma de dos enteros\", JOptionPane.PLAIN_MESSAGE);\r\n }", "public static String informationUpdatedDialog_txt(){\t\t\t\t\t\t\t\n\t\tid = \"divMessageOK\";\t\t\t\t\t\t\n\t\treturn id;\t\t\t\t\t\t\n\t}", "private String GetPlayerString_UI()\n {\n String ret = GetPlayerString_UI(mPositionComboBox.getSelectedItem().toString());\n return ret;\n }", "private String showCharacterAccusations() {\n\t\tButtonGroup characterButtons = new ButtonGroup();\n\t\tList<JRadioButton> btns = setupCharacterButtons();\n\t \n\t\t// set up dialog box\n\t\tJPanel characterPanel = new JPanel(new GridLayout(0, 1));\n\t\tJLabel lbl = new JLabel(\"Select the character that you suspect.\");\n\t\tcharacterPanel.add(lbl);\n\t // add buttons to panel\n\t for(JRadioButton b : btns){\n\t \tcharacterButtons.add(b);\n\t \tcharacterPanel.add(b);\n\t }\n\t\t\n\t // show dialog box\n\t JOptionPane.showMessageDialog(frame, characterPanel);\n\t // decide which button was selected\n\t for(JRadioButton b : btns){\n\t \tif(b.isSelected()){\n\t \t\treturn b.getText();\n\t \t}\n\t }\n\t return null;\n\t}", "public void PoblarINFO(String llamado) {//C.P.M Aqui llega como argumento llamado\r\n try {\r\n rs = modelo.Obteninfo();//C.P.M Mandamos a poblar la informacion de negocio\r\n if (llamado.equals(\"\")) {//C.P.M si el llamado llega vacio es que viene de la interface\r\n while (rs.next()) {//C.P.M recorremos el resultado para obtener los datos\r\n vista.jTNombreempresa.setText(rs.getString(1));//C.P.M los datos los enviamos a la vista de la interface\r\n vista.jTDireccion.setText(rs.getString(2));\r\n vista.jTTelefono.setText(rs.getString(3));\r\n vista.jTRFC.setText(rs.getString(4));\r\n }\r\n }\r\n if (llamado.equals(\"factura\")) {//C.P.M de lo contrario es llamado de factura y los valores se van a la vista de vactura \r\n while (rs.next()) {//C.P.M recorremos el resultado \r\n vistafactura.jTNombreempresa.setText(rs.getString(1));//C.P.M enviamos los datos a la vista de factura\r\n vistafactura.jTDireccion.setText(rs.getString(2));\r\n vistafactura.jTTelefono.setText(rs.getString(3));\r\n vistafactura.jTRFC.setText(rs.getString(4));\r\n }\r\n }\r\n } catch (SQLException ex) {//C.P.M Notificamos a el usuario si ocurre algun error\r\n JOptionPane.showMessageDialog(null,\"Ocurio un error al intentar consultar la informacion del negocio\");\r\n }\r\n }", "private void jMenuItemSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSalirActionPerformed\n LOG.trace(evt.paramString());\n\n int opc = JOptionPane.showConfirmDialog(this, \"Seguro que desea salir\",\n this.getTitle(), JOptionPane.YES_NO_OPTION);\n if (opc == 0) {\n System.exit(0);\n }\n}", "private void jButton40ActionPerformed(java.awt.event.ActionEvent evt) {\n int button = JOptionPane.YES_NO_OPTION;\n if(list1.getSelectedItem().equals(\"Novo...\")){\n int result = JOptionPane.showConfirmDialog(null,\"Tem a certeza que deseja criar o novo FAQ?\",\"Warning\",button);\n if(result == JOptionPane.YES_OPTION){\n this.faq.createFaq(jTextArea10.getText(),jTextArea11.getText()); \n UpdateFaqUI();\n }else{}\n }else{\n String parts[] = list1.getSelectedItem().split(\" - \");\n String array[][] = faq.getFaq();\n for(int row = 0;row <= array.length - 1;row++){\n if(array[row][2].equals(parts[0])){\n int result2 = JOptionPane.showConfirmDialog(null,\"Tem a certeza que deseja aplicar as alterações?\",\"Warning\",button);\n if(result2 == JOptionPane.YES_OPTION){\n this.faq.UpdateFaq(parseInt(parts[0]),jTextArea10.getText(),jTextArea11.getText());\n UpdateFaqUI();\n \n }else{}\n }\n }\n }\n }", "public void exibeMensagem(String mensagem) {\n JOptionPane.showMessageDialog(null, mensagem);\n }", "private void showHelp() {\n\t\tJOptionPane.showMessageDialog(this, \"Created by Mario Bobić\", \"About File Encryptor\", JOptionPane.INFORMATION_MESSAGE);\n\t}", "public static void main(String[] args) {\n\t\tString operadorUno = JOptionPane.showInputDialog(null, \"Introduce el valor de Operador 1: \");\n\t\t// transformar a tipo int\n\t\tint operadorUnoInt = Integer.parseInt(operadorUno);\n\t\t// entrada operador2 tipo string\n\t\tString operadorDos = JOptionPane.showInputDialog(null, \"Introduce el valor de Operador 2: \");\n\t\t// transformar a tipo int\n\t\tint operadorDosInt = Integer.parseInt(operadorDos);\n\t\t// entrada signoAritmetico tipo string\n\t\tString signoAritmetico = JOptionPane.showInputDialog(null, \"Introduce un signo aritmetico: \");\n\n\t\tswitch (signoAritmetico) {\n\t\tcase \"+\":\n\t\t\t// suma los dos operadores\n\t\t\tJOptionPane.showMessageDialog(null,\n\t\t\t\t\toperadorUnoInt + \" + \" + operadorDosInt + \" = \" + (operadorUnoInt + operadorDosInt));\n\t\t\tbreak;\n\t\tcase \"-\":\n\t\t\t// resta los dos operadores\n\t\t\tJOptionPane.showMessageDialog(null,\n\t\t\t\t\toperadorUnoInt + \" - \" + operadorDosInt + \" = \" + (operadorUnoInt - operadorDosInt));\n\t\t\tbreak;\n\t\tcase \"*\":\n\t\t\t// multiplica los dos operadores\n\t\t\tJOptionPane.showMessageDialog(null,\n\t\t\t\t\toperadorUnoInt + \" * \" + operadorDosInt + \" = \" + (operadorUnoInt * operadorDosInt));\n\t\t\tbreak;\n\t\tcase \"/\":\n\t\t\t// divide los dos operadores\n\t\t\tJOptionPane.showMessageDialog(null,\n\t\t\t\t\toperadorUnoInt + \" / \" + operadorDosInt + \" = \" + (operadorUnoInt / operadorDosInt));\n\t\t\tbreak;\n\t\tcase \"^\":\n\t\t\t// 1º operando como base y 2º como exponente\n\t\t\tJOptionPane.showMessageDialog(null,\n\t\t\t\t\toperadorUnoInt + \" ^ \" + operadorDosInt + \" = \" + (Math.pow(operadorUnoInt, operadorDosInt)));\n\t\t\tbreak;\n\t\tcase \"%\":\n\t\t\t// módulo, resto de la división entre operando1 y operando2\n\t\t\tJOptionPane.showMessageDialog(null,\n\t\t\t\t\toperadorUnoInt + \" % \" + operadorDosInt + \" = \" + (operadorUnoInt % operadorDosInt));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// Si no se introduce un signo de los anteriores\n\t\t\t// aparecera un mensaje de error y fin de la aplicacion\n\t\t\tJOptionPane.showMessageDialog(null, \"Signo aritmetico incorrecto!\");\n\t\t\tbreak;\n\t\t}\n\t}", "@Action\n public void fecharTela()\n {\n try\n {\n float valor = sv.nfMoeda.parse( ftfEncaminhado.getText() ).floatValue();\n if ( valor < 0 )\n {\n JOptionPane.showMessageDialog( sv.getComponent(), \"O valor encaminhado não pode ser negativo. Tente novamente.\", \"Resultados\", JOptionPane.WARNING_MESSAGE );\n ftfEncaminhado.setText( \"\" );\n ftfEncaminhado.grabFocus();\n }\n else\n {\n bOk.grabFocus();\n jornada.setEncaminhamento( valor );\n bd.realizarEncaminhamento( valor );\n }\n }\n catch ( ParseException ex )\n {\n JOptionPane.showMessageDialog( sv.getComponent(), \"Valor informado inválido. Tente novamente.\", \"Resultados\", JOptionPane.WARNING_MESSAGE );\n Logger.getLogger( TelaResultadoJornada.class.getName() ).log( Level.SEVERE, null, ex );\n }\n catch ( SQLException e )\n {\n JOptionPane.showMessageDialog( sv.getComponent(), \"Erro ao escrever valor encaminhado no banco de dados. Informe ao responsável.\", \"Resultados\", JOptionPane.WARNING_MESSAGE );\n }\n\n // Rotina de fechamento:\n int resposta = JOptionPane.showConfirmDialog( painelPrincipal,\n \"Confirma o encaminhameto de \" + ftfEncaminhado.getText() + \" para a matriz?\",\n \"Resultados\",\n JOptionPane.YES_NO_OPTION,\n JOptionPane.QUESTION_MESSAGE );\n\n if ( resposta == JOptionPane.YES_OPTION )\n {\n resposta = JOptionPane.showConfirmDialog( painelPrincipal,\n \"Os dados de quantidade e valor vendido de cada produto foram anotados?\",\n \"Resultados\",\n JOptionPane.YES_NO_OPTION,\n JOptionPane.QUESTION_MESSAGE );\n\n if ( resposta == JOptionPane.YES_OPTION )\n {\n try\n {\n bd.setEncaminhamento( jornada );\n float novoCaixa = jornada.getCaixaFinal() - jornada.getEncaminhamento();\n sv.sugerirCaixaInicial( novoCaixa );\n dispose();\n }\n catch ( SQLException ex )\n {\n JOptionPane.showMessageDialog( painelPrincipal,\n \"Erro ao gravar valor encaminhado no banco de dados. Informe o responsável.\",\n \"Resultados\",\n JOptionPane.WARNING_MESSAGE);\n Logger.getLogger( TelaResultadoJornada.class.getName() ).log( Level.SEVERE, null, ex );\n } \n }\n }\n }", "void generar_dialog_preguntas();", "private String confirmPassword()\n {\n JPasswordField tf_password = new JPasswordField();\n int response = JOptionPane.showConfirmDialog(null,\n tf_password, \"Confirm Password: \",\n JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);\n\n // Debug: System.out.println(\"Dialog\" + tf_password.getPassword());\n if (response == JOptionPane.OK_OPTION)\n {\n return new String(tf_password.getPassword());\n }\n return null;\n }", "private String showWeaponAccusations() {\n\t\tButtonGroup weaponButtons = new ButtonGroup();\n\t\tList<JRadioButton> btns = setupWeaponButtons();\n\t \n\t\t// set up the dialog box\n\t JPanel weaponPanel = new JPanel(new GridLayout(0, 1));\n\t\tJLabel lbl = new JLabel(\"Select the weapon that you suspect.\");\n\t\tweaponPanel.add(lbl);\n\t // add the buttons to the panel\n\t for(JRadioButton b : btns){\n\t \tweaponButtons.add(b);\n\t \tweaponPanel.add(b);\n\t }\n\t \n\t\t// display the dialog box\n\t JOptionPane.showMessageDialog(frame, weaponPanel);\n\t // decide which button was selected\n\t for(JRadioButton b : btns){\n\t \tif(b.isSelected()){\n\t \t\treturn b.getText();\n\t \t}\n\t }\n\t return null;\n\t}", "public static int choicedialog() {\r\n List<String> choices = new ArrayList<>();\r\n choices.add(\"1a\");\r\n choices.add(\"1b\");\r\n choices.add(\"2\");\r\n choices.add(\"2u\");\r\n choices.add(\"3\");\r\n choices.add(\"3u\");\r\n choices.add(\"4\");\r\n choices.add(\"5\");\r\n\r\n ChoiceDialog<String> dialog = new ChoiceDialog<>(\"SET ZONE HERE\", choices);\r\n dialog.setTitle(\"Zone Selector\");\r\n dialog.setHeaderText(null);\r\n dialog.setContentText(\"Select Zone:\");\r\n \r\n Optional<String> result = dialog.showAndWait();\r\n if (result.isPresent()){\r\n if(result.get() == \"1a\") return 1;\r\n else if (result.get() == \"1b\") return 2;\r\n else if (result.get() == \"2\") return 3;\r\n else if (result.get() == \"2u\") return 4;\r\n else if (result.get() == \"3\") return 5;\r\n else if (result.get() == \"3u\") return 6;\r\n else if (result.get() == \"4\") return 7;\r\n else if (result.get() == \"5\") return 8;\r\n else return 0;\r\n } else return 0;\r\n }", "String promptString();", "public String getString(String pPrompt) {\r\n\t\tSystem.out.println(pPrompt + \"\");\r\n\t\treturn input.nextLine();\r\n\t}", "public String selectMessage() {\r\n\r\n\t\tswitch (choice) {\r\n\t\tcase 1: {\r\n\t\t\treturn \"Stimat(a) \" + invoice.getClient().getName() + \" \" + invoice.getClient().getSurname()\r\n\t\t\t\t\t+ \"\\nFactura dvs. la \" + invoice.getSupplier().getFirmName() + \" a fost emisa.\" + \"\\nAveti de plata \"\r\n\t\t\t\t\t+ invoice.getTotalValue() + \" RON, pana in data de \" + new SimpleDateFormat(\"dd.MM.yyyy\").format(invoice.getMaturityDate()) + \"\\n\\nVa multumim !\";\r\n\t\t}\r\n\t\tcase 2: {\r\n\t\t\treturn \"Stimat(a) \" + invoice.getClient().getName() + \" \" + invoice.getClient().getSurname()\r\n\t\t\t\t\t+ \"\\nFactura dvs. la \" + invoice.getSupplier().getFirmName() + \" a fost emisa.\"\r\n\t\t\t\t\t+ \"\\nFactura a fost platita. S-au extras \" + invoice.getTotalValue() + \" RON din contul dvs.\"\r\n\t\t\t\t\t+ \"\\n\\nVa multumim !\";\r\n\t\t}\r\n\t\tcase 3: {\r\n\t\t\treturn \"Stimat(a) \" + invoice.getClient().getName() + \" \" + invoice.getClient().getSurname()\r\n\t\t\t\t\t+ \"\\nAveti de plata 3 facturi restante la\" + invoice.getSupplier().getFirmName()\r\n\t\t\t\t\t+ \"\\nFurnizorul a oprit furnizarea de servicii pana platiti una dintre cele 3 facturi restante\\n\\nVa multumim !\";\r\n\t\t}\r\n\t\tcase 4: {\r\n\t\t\treturn \"Stimat(a) \" + invoice.getClient().getName() + \" \" + invoice.getClient().getSurname()\r\n\t\t\t\t\t+ \"\\nFactura dvs. din data de \"+new SimpleDateFormat(\"dd.MM.yyyy\").format(invoice.getReleaseDate())+\" a fost platita. S-au extras \" + invoice.getTotalValue() + \" RON din contul dvs.\"\r\n\t\t\t\t\t+ \"\\n\\nVa multumim !\";\r\n\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public static String promptForString(String title) {\n return (JOptionPane.showInputDialog(null,\n title));\n }", "private String getPromptStrings(int choice) {\n //negative numbers correspond with the very first screen (not really anymore)\n //then the positive numbers go based on the choice the user makes\n switch (choice) {\n case 0: return \"\";\n //this is for the introductory screen\n case -1: return \"There is an enemy Ship! Looks like an Inter Planetary Pirate ship.\";\n case -2: return \"What would you like to do? Looks like is has a similar layout to our ship.\";\n case -3: return \"this is a dummy line for the status bar... health for you: 20, shields 1, enemy health: 20, shields 1\";\n case -4: return \"Now What?\";\n case -5: return \"Well that didn't work...\";\n case -6: return \"You are out of missiles.\";\n case -7: return \"All systems operational, and shields are up.\";\n case -8: return \"They are out of missiles...\";\n case -9: return \"Your Laser gun system is damaged, you can't shoot!\";\n case -10: return \"Your Missile system is damaged, you can't shoot!\";\n case -11: return \"Their Laser gun system is damaged, they can't shoot!\";\n case -12: return \"Their Missile system is damaged, they can't shoot!\";\n //this is for what you choose to do\n case 1: return \"You want to shot your laser gun at the enemy ship.\";\n case 2: return \"You want to shot a missile at the enemy ship.\";\n case 3: return \"You decided to wait and let your shields recharge.\";\n\n case 4: return \"Where do you want to shoot?\";\n case 5: return \"Where do you want to shoot?\";\n case 6: return \"\";\n\n case 45: return \"You damaged their Engine system!\";\n case 46: return \"You damaged their Shield system!\";\n case 47: return \"You damaged their Missile system!\";\n case 48: return \"You damaged their Laser Gun system!\";\n case 49: return \"You damaged their Piloting system!\";\n case 51: return \"You shoot at their Piloting system!\";\n case 52: return \"You shoot at their Laser gun system!\";\n case 53: return \"You shoot at their Missile system!\";\n case 54: return \"You shoot at their Shield system!\";\n case 55: return \"You shoot at their Engine system!\";\n\n case -45: return \"They damaged your Engine system!\";\n case -46: return \"They damaged your Shield system!\";\n case -47: return \"They damaged your Missile system!\";\n case -48: return \"They damaged your Laser Gun system!\";\n case -49: return \"They damaged your Piloting system!\";\n case -51: return \"They shoot at your Piloting system!\";\n case -52: return \"They shoot at your Laser gun system!\";\n case -53: return \"They shoot at your Missile system!\";\n case -54: return \"They shoot at your Shield system!\";\n case -55: return \"They shoot at your Engine system!\";\n\n case 80: return \"You decide to wait...\";\n case 81: return \"Your shields recharge and your systems are fixed.\";\n case -80: return \"They decide to wait..\";\n case -81: return \"Their shields recharge, and systems get repaired.\";\n\n case 97: return \"Their shield is down!\";\n case 98: return \"Their shield is up, your laser can't penetrate!\";\n case -98: return \"Your shields are up, their lasers can't penetrate!\";\n case 99: return \"It hit!\";\n case -99: return \"They landed the shot!\";\n case 100: return \"It missed!\";\n case -100: return \"They missed!\";\n\n case -101: return \"The laser hit!\";\n case -102: return \"The missile hit!\";\n case -103: return \"The laser missed.\";\n case -104: return \"The missile missed.\";\n }\n //if the input given is not one of the above\n return \"Error\";\n }", "private String showRoomAccusations() {\n\t\tButtonGroup characterButtons = new ButtonGroup();\n\t\tList<JRadioButton> btns = setupRoomButtons();\n\t \n\t\t// set up the dialog box\n\t\tJPanel roomPanel = new JPanel(new GridLayout(0, 1));\n\t\tJLabel lbl = new JLabel(\"Select the room that you suspect.\");\n\t\troomPanel.add(lbl);\n\t // add the buttons to the panel\n\t for(JRadioButton b : btns){\n\t \tcharacterButtons.add(b);\n\t \troomPanel.add(b);\n\t }\n\t\t\n\t // display dialog box\n\t JOptionPane.showMessageDialog(frame, roomPanel);\n\t // decide which button was selected\n\t for(JRadioButton b : btns){\n\t \tif(b.isSelected()){\n\t \t\treturn b.getText();\n\t \t}\n\t }\n\t return null;\n\t}", "public static String inputChoice(String promptMsg, String[] choices) {\n String[] choicesCleaned = removeNullStrArrItems(choices);\n\n return (String) JOptionPane.showInputDialog(\n null, promptMsg,\n \"Please answer...\",\n JOptionPane.QUESTION_MESSAGE, null,\n choicesCleaned,\n choicesCleaned[0] //select first option by default\n );\n }", "public void popup(String a){\n pop.setLayout(null);\n ControlAction c = new ControlAction();\n pop.setBounds(420, 320, 460, 160);\n pop.setBorder(new LineBorder(Color.BLACK, 2));\n //condition for showing popup message\n if(a.startsWith(\"1\")){\n mas.setText(\"Selamat Anda Telah Melakukan Peminjaman\");\n nolocker.setText(\"No. Locker Anda Yaitu 17\");\n yes.setVisible(false);\n no.setVisible(false);\n nolocker.setVisible(true);\n }else if(a.equals(WARN1)){\n mas.setText(\"Maaf Anda Telah Melakukan Peminjaman\");\n yes.setVisible(false);\n no.setVisible(false);\n nolocker.setVisible(false);\n }else if(a.equals(WARN2)){\n mas.setText(\"Maaf Anda Belum Melakukan Peminjaman\");\n yes.setVisible(false);\n no.setVisible(false);\n nolocker.setVisible(false);\n }else if(a.contains(\"BUKA\")){\n mas.setText(\"Anda Ingin Mengakhiri Peminjaman ?\");\n yes.setVisible(true);\n String key = a.substring(4);\n yes.setActionCommand(\"YES\"+key);\n no.setVisible(true);\n nolocker.setVisible(false);\n }else if(a.equals(NO)){\n mas.setText(\"Loker Anda Telah Terbuka\");\n yes.setVisible(false);\n no.setVisible(false);\n nolocker.setVisible(false);\n } \n mas.setFont(new Font(\"arial\", Font.BOLD, 20));\n mas.setOpaque(false);\n mas.setForeground(Color.BLACK);\n Dimension si1 = mas.getPreferredSize();\n mas.setBounds(10, 40, si1.width, si1.height);\n nolocker.setFont(new Font(\"arial\", Font.BOLD, 20));\n nolocker.setOpaque(false);\n nolocker.setForeground(Color.BLACK);\n Dimension si3 = nolocker.getPreferredSize();\n nolocker.setBounds(10, 70, si3.width, si3.height);\n //close button handling\n close.addActionListener(c);\n close.setActionCommand(EXIT);\n Dimension si2 = close.getPreferredSize();\n close.setBounds(420, 10, si2.width, si2.height);\n close.setBorder(BorderFactory.createEmptyBorder());\n close.setContentAreaFilled(false);\n //yes button handling\n yes.addActionListener(c);\n Dimension si4 = yes.getPreferredSize();\n yes.setBounds(100, 100, si4.width, si4.height);\n yes.setBorder(BorderFactory.createEmptyBorder());\n yes.setContentAreaFilled(false);\n //no button handling\n no.addActionListener(c);\n no.setActionCommand(NO);\n Dimension si5 = no.getPreferredSize();\n no.setBounds(250, 100, si5.width, si5.height);\n no.setBorder(BorderFactory.createEmptyBorder());\n no.setContentAreaFilled(false);\n //add to card3 top most layer\n card3.add(pop,6,0);\n }", "private void betOptionPane(){ \n SpinnerModel sModel = new SpinnerNumberModel(50,1,blackjackController.getHumanPlayer().getBudget(),5); \n JSpinner spinner = new JSpinner(sModel);\n\n Object[] inputFields = {\"Hey! \\nYour current budget is $\"+this.blackjackController.getHumanPlayer().getBudget()+\".\\n\", \"Declare your new bet : \", spinner, \"Good luck!\"};\n int option = JOptionPane.showConfirmDialog(this, inputFields, \"\", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);\n\n if (option == JOptionPane.OK_OPTION) {\n this.blackjackController.setBet((Integer) spinner.getValue());\n }else{\n this.dispose();\n }\n }" ]
[ "0.72887874", "0.707963", "0.68410665", "0.67737436", "0.6487041", "0.64755046", "0.6473967", "0.6398929", "0.6310123", "0.6304531", "0.62885356", "0.62659293", "0.621896", "0.6212524", "0.6211815", "0.6189409", "0.61500597", "0.6134897", "0.61243004", "0.61096567", "0.60837585", "0.60027754", "0.59854704", "0.59592146", "0.59513307", "0.59512424", "0.59509003", "0.5944128", "0.5932359", "0.59201354", "0.59051317", "0.58931416", "0.58854926", "0.5873583", "0.5851713", "0.5837806", "0.5825769", "0.58218616", "0.5817728", "0.58157796", "0.5805028", "0.5797704", "0.57939667", "0.5793909", "0.578347", "0.5764247", "0.57601607", "0.57382894", "0.5726239", "0.5724143", "0.57161486", "0.5706486", "0.57025194", "0.5693576", "0.56904525", "0.5684501", "0.568399", "0.5679841", "0.56712496", "0.5671122", "0.56575185", "0.5655498", "0.565475", "0.56517076", "0.56489146", "0.5640903", "0.56363606", "0.563582", "0.5632282", "0.56287324", "0.5620836", "0.5617353", "0.5614982", "0.56146526", "0.5613787", "0.561357", "0.5607646", "0.5604676", "0.55997264", "0.55997086", "0.55973405", "0.5592059", "0.5589363", "0.5587883", "0.5580857", "0.5573246", "0.55670637", "0.5565124", "0.555954", "0.55574155", "0.55526704", "0.5551026", "0.5539722", "0.5533533", "0.5531609", "0.5530635", "0.5523189", "0.5521203", "0.5512689", "0.55123305" ]
0.675064
4
Start Monday,end by sunday
@Override public List<Long> getWeekReadTimes(Long uid) { Assertions.notNull(uid, "uid must not be null!"); return miniProgramCacheManager.getWeekReadTimeData(uid); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setSundayFirstDay(boolean b) {\n sunday_first_day = b;\n }", "WeekdaySpec getStart();", "@Override\n\t\tpublic WeekDay1 nextDay() {\n\t\t\treturn SUN;\n\t\t}", "public Builder workweekStarts(DayOfWeek day) {\n\t\t\tworkweekStarts = day;\n\t\t\treturn this;\n\t\t}", "private RepeatWeekdays() {}", "public boolean getSundayFirstDay() {\n return sunday_first_day;\n }", "private DayOfWeek convertDayOfWeek(Time.Day studentDay) {\n switch (studentDay) {\n case Sunday:\n return DayOfWeek.SUNDAY;\n\n case Monday:\n return DayOfWeek.MONDAY;\n\n case Tuesday:\n return DayOfWeek.TUESDAY;\n\n case Wednesday:\n return DayOfWeek.WEDNESDAY;\n\n case Thursday:\n return DayOfWeek.THURSDAY;\n\n case Friday:\n return DayOfWeek.FRIDAY;\n\n default:\n return DayOfWeek.SATURDAY;\n }\n }", "DayOfWeek getUserVoteSalaryWeeklyDayOfWeek();", "public Builder setDayOfWeekStartingWithSunday0(final int dayOfWeekStartingWithSunday0) {\n this.dayOfWeekStartingWithSunday0 = dayOfWeekStartingWithSunday0;\n return this;\n }", "private void setDay() {\n Boolean result = false;\n for (int i = 0; i < 7; ++i) {\n if(mAlarmDetails.getRepeatingDay(i))\n result = true;\n mAlarmDetails.setRepeatingDay(i, mAlarmDetails.getRepeatingDay(i));\n }\n if(!result)\n mAlarmDetails.setRepeatingDay((Calendar.getInstance().get(Calendar.DAY_OF_WEEK) - 1), true);\n }", "@Override\n\t\tpublic WeekDay1 nextDay() {\n\t\t\treturn MON;\n\t\t}", "public final void setSunday(final TimeSlot sunday) {\n this.sunday = sunday;\n }", "public void setWeekStartDay(Day weekStartDay)\r\n {\r\n m_weekStartDay = weekStartDay;\r\n }", "private int getWeekday() {\n Calendar cal = Calendar.getInstance();\n int i = cal.get(Calendar.DAY_OF_WEEK);\n int weekday = i == 1 ? 6 : (i - 2) % 7;\n myApplication.setWeekday(weekday);\n return weekday;\n }", "public void setOnWeekend(boolean b) {\r\n\t\tthis.onWeekend=b;\r\n\t}", "public String firstDayOfWeek(){\n cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);\n return (\"Mon\" + \" \" + cal.get(Calendar.DATE) + \" \" + cal.get(Calendar.MONTH) + \" \" + cal.get(Calendar.YEAR));\n }", "public static int getFirstDayOfWeek() {\n int startDay = Calendar.getInstance().getFirstDayOfWeek();\n\n if (startDay == Calendar.SATURDAY) {\n return Time.SATURDAY;\n } else if (startDay == Calendar.MONDAY) {\n return Time.MONDAY;\n } else {\n return Time.SUNDAY;\n }\n }", "public static void outputCalendar(int numDays, int startingSunday) {\n\t\t//Prints first week of calendar if startingSunday > 1\n\t\tif (startingSunday > 1) {\n\t \t\tSystem.out.print(\"|\");\n\t\t\tfor (int i = 7; i >= 1; i--) {\n\t\t\t\tint prev = startingSunday - i;\n\t\t\t\t//prev is the previous week's days with respect to startingSunday\n\n\t\t\t\tif (prev <= 0) {\n\t\t\t\t\tSystem.out.print(spaceRightJustify(\"\", 4));\n\t\t\t\t\tSystem.out.print(\" |\");\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.print(rightJustify(prev, 4));\n\t\t\t\t\tSystem.out.print(\" |\");\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println();\n\n\t\t}\n\t\t//Prints the calendar\n\t\tfor (int i = 0; i <= Math.floor((numDays - startingSunday) / 7); i++) {\n\t\t\tSystem.out.print(\"|\");\n\t\t\tfor (int j = 1; j <= 7; j++) {\n\t\t\t\tint oldD = startingSunday + (j - 1);\t\t\t\t\n\t\t\t\tint newD = oldD + i * 7;\n\t\t\t\tif (newD > numDays) {\n\t\t\t\t\tSystem.out.print(spaceRightJustify(\"\", 4));\n\t\t\t\t\tSystem.out.print(\" |\");\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.print(rightJustify(newD, 4));\n\t\t\t\t\tSystem.out.print(\" |\");\t\t\t\t\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\t\n\t\t}\n\n\t}", "Date getStartDay();", "public static void main(String[] args) {\n\t\n\t\tint day=6 ;\n\t\t\n\t\t\t\tString weekDay;\n\t\t\n\t\t\t\tif ( day==1) {\n\t\t\t\t\tweekDay=\"Monday\";\n\t\t\t\t}else if(day==2) {\n\t\t\t\t\tweekDay=\"Tuesday\";\n\t\t\t\t}else if(day==3) {\n\t\t\t\t\tweekDay=\"Wednesday\";\n\t\t\t\t}else if(day==4) {\n\t\t\t\t\tweekDay=\"Thursday\";\n\t\t\t\t}else if(day==5) {\n\t\t\t\t\tweekDay=\"Friday\";\n\t\t\t\t}else if(day==6) {\n\t\t\t\t\tweekDay=\"Saturday\";\n\t\t\t\t}else if(day==7) {\n\t\t\t\t\tweekDay=\"Sunday\";\n\t\t\t\t}else {\n\t\t\t\t\t\tweekDay=\"invaid\";\n\t\t\t\t\t\n\t\t\t\t\t\t\t\tSystem.out.println(\"weekDay\");\n\t\t\t\t\t}\n\t\t\t\t// switch statement execute one statment from mutiple \n\t\t\t\t//condition a switch works\n\t\t\t\t//with byte, short,char, and string \n\t\t\n\t\t\t\tswitch(day){\n\t\t\t\tcase 1://day==1\n\t\t\t\t\tweekDay=\"Monday\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tweekDay=\"Tuesday\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tweekDay=\"Wedensday\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tweekDay=\"Thursday\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tweekDay=\"Friday\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tweekDay=\"Saturday\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 7: \n\t\t\t\t\tweekDay=\"Sunday\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tweekDay=\"invlid\";\n\t\t\t\t\t\n\t\t\tSystem\n\t\t\t.out.println(weekDay);\n\t\t\t\t\t\t\t\n\t\t\t\t\n\t}\n\n}", "public static int shiftWeekDay(WeekDay day) {\r\n\t\tif (day == SUNDAY)\r\n\t\t\treturn 7;\r\n\t\telse\r\n\t\t\treturn day.ordinal();\r\n\t}", "public Builder setDayOfWeekStartingWithMonday1(final int dayOfWeekStartingWithMonday1) {\n this.dayOfWeekStartingWithMonday1 = dayOfWeekStartingWithMonday1;\n return this;\n }", "public static void main(String[] args) {\nScanner s=new Scanner(System.in);\r\nString day=s.next();\r\nif(day.equalsIgnoreCase(\"sunday\")){\r\n\tSystem.out.println(\"False\");\r\n}else{\r\n\tSystem.out.println(\"True\");\r\n}s.close();\r\n\r\n\t}", "public void startWeek()\n\t{\n\t\tsynchronized (date_db_lock) {\t\t\t\n\t\t\tsynchronized (write_student_db_lock) {\n\t\t\t\tclearAllDatabases();\n\t\t\t}\n\t\t}\n\t}", "private void nextWeek() {\r\n tmp.setDay(tmp.getDay() + daysInWeek);\r\n upDMYcountDMYcount();\r\n }", "boolean hasWeekday();", "public void updateWeekday(){\n Date curDate=new Date(System.currentTimeMillis());\n SimpleDateFormat format=new SimpleDateFormat(\"EEEE\");\n String weekday1=format.format(curDate);\n int numberWeekday1=turnWeekdayToNumber(weekday1);\n updateSpecificDay(numberWeekday1);\n TextView TextWeekday=(TextView)this.findViewById(R.id.tv_weekday);\n TextWeekday.setText(weekday1);\n }", "public static void dayOfWeek(){\n\t\t int x , y0 , m0 , d0;\n\t\t \n\t\t System.out.println(\"enter day month and year\");\n\t\t int day = scanner.nextInt();\n\t\t int month = scanner.nextInt();\n\t\t int year = scanner.nextInt();\n\t\t\n\t\ty0 = year - (14-month) / 12;\n\t\tx = y0 + y0 / 4-y0 / 100+y0 / 400;\n\t\tm0 = month + 12 * ((14-month)/12) -2;\n\t\td0 =(day+x+(31*m0) / 12) % 7;\n\t\t\n\t\tswitch(d0)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\tSystem.out.println(\"it is sunday\");\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 1:\n\t\t\t\tSystem.out.println(\"it is monday\");\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 2:\n\t\t\t\tSystem.out.println(\"it is tuesday\");\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 3:\n\t\t\t\tSystem.out.println(\"it is wednesday\");\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 4:\n\t\t\t\tSystem.out.println(\"it is thursday\");\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 5:\n\t\t\t\tSystem.out.println(\"it is friday\");\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 6:\n\t\t\t\tSystem.out.println(\"it is saturday\");\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t}", "public int getDayOfWeek();", "public static void main(String[] args) {\n\t\t\n\t\tString day = \"Sunday\";\n\t\tswitch(day){\n\t\tcase \"Sunday\" : System.out.println(\"Day 1 of the week\");\n\t\tbreak;\n\t\t\n\t\tcase \"Monday\" : System.out.println(\"Day 2 of the week\");\n\t\tbreak;\n\t\t\n\t\tdefault : System.out.println(\"Invalid input\");\n\t\t\n\t\t}\n\n\t}", "public DayOfWeek primeiroDiaSemanaAno(int ano);", "public static void testSleepIn(boolean weekday, boolean vacation) {\n\n\t}", "public boolean getRunOnWeekends();", "public Builder setDay(app.onepass.apis.DayOfWeek value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n day_ = value.getNumber();\n onChanged();\n return this;\n }", "com.czht.face.recognition.Czhtdev.Week getWeekday();", "private void dayOfWeek(HplsqlParser.Expr_func_paramsContext ctx) {\n Integer v = getPartOfDate(ctx, Calendar.DAY_OF_WEEK);\n if (v != null) {\n evalInt(v);\n }\n else {\n evalNull();\n }\n }", "public Day getWeekStartDay()\r\n {\r\n return (m_weekStartDay);\r\n }", "boolean isWorkingDay() {\n return true;\n }", "Integer getStartDay();", "@DynamoDBTypeConverted(converter = TimeSlotConverter.class)\n @DynamoDBAttribute(attributeName = \"sunday\")\n public final TimeSlot getSunday() {\n return sunday;\n }", "private void startEndDay(int day,int month,int year) {\n int dayNum = CalendarEx.convertDay(CalendarDate.getDay(day, month, year));\n startDay = CalendarDate.moveDay(-dayNum, new CalendarDate(day,month,year));\n endDay = CalendarDate.moveDay(-dayNum+6, new CalendarDate(day,month,year));\n }", "private void nextDay() {\r\n tmp.setDay(tmp.getDay() + 1);\r\n int nd = tmp.getDayOfWeek();\r\n nd++;\r\n if (nd > daysInWeek) nd -= daysInWeek;\r\n tmp.setDayOfWeek(nd);\r\n upDMYcountDMYcount();\r\n }", "private String getWeekDay(int i) {\n String day = \"\";\n switch (i) {\n case 0:\n day = \"Sunday\";\n break;\n case 1:\n day = \"Monday\";\n break;\n case 2:\n day = \"Tuesday\";\n break;\n case 3:\n day = \"Wednesday\";\n break;\n case 4:\n day = \"Thursday\";\n break;\n case 5:\n day = \"Friday\";\n break;\n case 6:\n day = \"Saturday\";\n break;\n\n }\n return day;\n }", "@POST\n public FormValidation doCheckMonday(@QueryParameter boolean monday,\n @QueryParameter boolean tuesday,\n @QueryParameter boolean wednesday,\n @QueryParameter boolean thursday,\n @QueryParameter boolean friday,\n @QueryParameter boolean saturday,\n @QueryParameter boolean sunday) {\n if (!(monday || tuesday || wednesday || thursday || friday || saturday || sunday)) {\n return FormValidation.warning(\"At least one day should be checked or minimum number of instances won't be active\");\n }\n return FormValidation.ok();\n }", "public static void SetToNextDayOfWeek(int dayOfWeekToSet, Calendar c){\r\n c.add(Calendar.DAY_OF_YEAR, 1);\r\n int currentDayOfWeek = c.get(Calendar.DAY_OF_WEEK);\r\n Log.d(\"currentDay\", String.valueOf(currentDayOfWeek));\r\n Log.d(\"setDay\", String.valueOf(dayOfWeekToSet));\r\n DateFormat sdf = new SimpleDateFormat(\"MM/dd/yyyy\");\r\n Log.d(\"addDay\", sdf.format(c.getTime()));\r\n //add 1 day to the current day until we get to the day we want\r\n while(currentDayOfWeek != dayOfWeekToSet){\r\n c.add(Calendar.DAY_OF_YEAR, 1);\r\n currentDayOfWeek = c.get(Calendar.DAY_OF_WEEK);\r\n }\r\n }", "public void setShowWeekend(boolean b) {\n weekend = b;\n }", "public final void setMonday(final TimeSlot monday) {\n this.monday = monday;\n log.info(this.monday.toString());\n }", "public static void boarDay (Grid grid) {\n grid.weekday = dateArray[(int) (Math.random() * 7)];\n }", "public int shiftWeekDay() {\r\n\t\treturn shiftWeekDay(this);\r\n\t}", "@Override\r\n\tpublic void english() {\n\t\tSystem.out.println(\"English class is twice every week on monday & saturday all day.\");\r\n\t\t\r\n\t}", "public DayOfWeek diaDaSemana(LocalDate d);", "static void addMondayOnly(Schedules schedules) throws RBEConfigObjectException\n {\n\t\t// Create a new inclusion period\n\t\tPeriod ip = new Period();\n\n\t\t// Include minutes between 8:00am to 5:59pm.\n\t\t// Note: 8:00am = 480 and 6:00pm = 1080\n\t\t// By default a new period includes minutes from\n\t\t// 9:00am to 5:00pm. However, all minutes are\n\t\t// between 8:00am to 5:59pm explicitely included here.\n\t\tfor (int i = 480; i < 1080; i++)\n\t\t\tip.include(Period.MINUTES_IN_DAY, i);\n\n\t\t// Change days in week to include only monday\n\t\t// Note: sunday = 0, saturday = 6.\n\t\tip.excludeAll(Period.WEEKDAYS_IN_MONTH);\n\t\tip.include(Period.WEEKDAYS_IN_MONTH, Period.MONDAY);\n\n\t\t// Note: By default a new period includes all Period.DAYS_IN_MONTH.\n\t\t// So there no need to explicitely include them here.\n\n\t\t// create a new schedule and add the inclusion period to it.\n\t\tSchedule schedule = new Schedule(\"MondayOnly\");\n\t\tschedule.addInclusionPeriod(ip);\n\n\t\t// add the schedule to the list of schedule\n\t\tschedules.addSchedule(schedule);\n\t\tprintln(\"Schedule added: (\"+schedule+\")\");\n }", "public DateTimeFormatterBuilder appendDayOfWeek(int minDigits) {\r\n return appendDecimal(DateTimeFieldType.dayOfWeek(), minDigits, 1);\r\n }", "public Weekday getDayOfWeek() {\n\n long utcDays = CALSYS.transform(this);\n return Weekday.valueOf(MathUtils.floorModulo(utcDays + 5, 7) + 1);\n\n }", "public void setNextWeek()\n\t{\n\t\tm_calendar.set(Calendar.WEEK_OF_MONTH,getWeekOfMonth()+1);\n\n\t}", "public static void main(String[] args) {\n\t\tint day=1;\n\t\tif (day==1 || day==2 || day==3 || day==4 || day==5) {\n\t\t\tSystem.out.println(\"This is a weekday\");\n\t\t}else if (day==6 || day==7) {\n\t\t\tSystem.out.println(\"Hoorray, it's a weekend!!!\");\n\t\t}else {\n\t\t\tSystem.out.println(\"Day should be between 1 and 7\");\n\t\t}\n\t\t\t\n\t\n\t}", "public referential.store.v2.WeekPattern.Builder setSundayTimeRanges(java.util.List<referential.store.v2.TimeRange> value) {\n validate(fields()[9], value);\n this.sundayTimeRanges = value;\n fieldSetFlags()[9] = true;\n return this; \n }", "public void checkEndOfWeek() {\n }", "public void setDayOfWeek(DayTemplate dayOfWeek) {\n this.dayOfWeek = dayOfWeek;\n }", "public void setDayOfTheWeek(String day){\r\n this.dayOfTheWeek.setText(day);\r\n }", "public void setDayOfWeek(int dayOfWeek) {\n this.dayOfWeek = dayOfWeek;\n }", "public String getCurrentDayOfWeekAsShortName() {\n\t\t\t\tDateFormat format = new SimpleDateFormat(\"EEE\");\n\t\t\t\tDate date = new Date(System.currentTimeMillis());\n\t\t\t\tString dayOfWeek = format.format(date);\n\t\t\t\treturn dayOfWeek;\n\t\t\t}", "public void dayIsLike() \r\n\t{ \r\n\t\tswitch (day) \r\n\t\t{ \r\n\t\tcase MONDAY: \r\n\t\t\tSystem.out.println(\"Mondays are bad.\"); \r\n\t\t\tbreak; \r\n\t\tcase FRIDAY: \r\n\t\t\tSystem.out.println(\"Fridays are better.\"); \r\n\t\t\tbreak; \r\n\t\tcase SATURDAY: \r\n\t\t\tSystem.out.println(\"Saturdays are better.\"); \r\n\t\t\tbreak;\r\n\t\tcase SUNDAY: \r\n\t\t\tSystem.out.println(\"Weekends are best.\"); \r\n\t\t\tbreak; \r\n\t\tdefault: \r\n\t\t\tSystem.out.println(\"Midweek days are so-so.\"); \r\n\t\t\tbreak; \r\n\t\t} \r\n\t}", "public String calendarweek(Date startDate) {\n String format = getString(\"calendarweek.abbreviation\");\n int week = DateTools.getWeekInYear(startDate, getLocale());\n String result = format.replace(\"{0}\", \"\" + week);\n // old format also works\n result = result.replace(\"{0,date,w}\", \"\" + week);\n return result;\n }", "@Test\n public void DayOfWeek() {\n System.out.printf(\"%s%n\\n\", DayOfWeek.MONDAY.plus(3));\n\n DayOfWeek dow = DayOfWeek.MONDAY;\n Locale locale = Locale.getDefault();\n System.out.println(dow.getDisplayName(TextStyle.FULL, locale));\n System.out.println(dow.getDisplayName(TextStyle.NARROW, locale));\n System.out.println(dow.getDisplayName(TextStyle.SHORT, locale));\n }", "public static void showDaysFromLastMonday(LocalDate lastMonday){\n String targetDate;\n for(int i = 0; i < 7; i++){\n targetDate = lastMonday.plusDays(i).format(DateTimeFormatter.ISO_DATE);\n System.out.println(\"The date is: \" + targetDate);\n }\n }", "public DayOfWeek getWorkweekStarts() {\n\t\treturn workweekStarts;\n\t}", "public static void createWeeklyReminderAlarm(Context context) {\n String prefWeekStart = PreferenceUtils.readString(PreferenceUtils.SNOOZE_WEEK_START, context);\n int weekStartDay = DateUtils.weekdayFromPrefValue(prefWeekStart);\n int dayBeforeWeekStart = weekStartDay - 1 == 0 ? Calendar.SATURDAY : weekStartDay - 1;\n\n // Load evening start preference.\n String prefEveningStart = PreferenceUtils.readString(PreferenceUtils.SNOOZE_EVENING_START, context);\n int eveningStartHour = TimePreference.getHour(prefEveningStart);\n int eveningStartMinute = TimePreference.getMinute(prefEveningStart);\n\n // Set alarm time based on preference.\n Calendar alarmTime = getBaseCalendar();\n alarmTime.set(Calendar.HOUR_OF_DAY, eveningStartHour);\n alarmTime.set(Calendar.MINUTE, eveningStartMinute);\n alarmTime.set(Calendar.DAY_OF_WEEK, dayBeforeWeekStart);\n\n // Check if alarm should be in the next week.\n if (alarmTime.before(Calendar.getInstance())) {\n alarmTime.setTimeInMillis(alarmTime.getTimeInMillis() + 604800000);\n }\n\n // Create reminders intent.\n PendingIntent alarmIntent = getRemindersIntent(context, Intents.WEEKLY_REMINDER);\n\n // Cancel existing alarms.\n AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n alarmManager.cancel(alarmIntent);\n\n // Trigger the alarm weekly on the given time.\n alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, alarmTime.getTimeInMillis(), 604800000, alarmIntent);\n }", "void onWeekNumberClick ( @NonNull MaterialCalendarView widget, @NonNull CalendarDay date );", "public Weekday() {\n }", "public static void main(String[] args) {\n\t\tWeekDay wd = new WeekDay();\n\t\t// 2\n\t\t\n\t\t// 4 확인\n\t\twd.input();\n\t\t// 4 확인\n\t\t\n\t\t// 6 확인\n\t\tString result = wd.week();\n\t\t\n\t\t// System.out.println(a);\n\t\t// 6 확인\n\t\t\n\t\twd.write(result);\n\t\t\n\n\t}", "@JSProperty(\"startOfWeek\")\n void setStartOfWeek(double value);", "protected final String getWeekDay(Calendar day) {\n switch (day.get(Calendar.DAY_OF_WEEK)) {\n case Calendar.SUNDAY:\n return \"SUNDAY\";\n case Calendar.MONDAY:\n return \"MONDAY\";\n case Calendar.TUESDAY:\n return \"TUESDAY\";\n case Calendar.WEDNESDAY:\n return \"WEDNESDAY\";\n case Calendar.THURSDAY:\n return \"THURSDAY\";\n case Calendar.FRIDAY:\n return \"FRIDAY\";\n case Calendar.SATURDAY:\n return \"SATURDAY\";\n default:\n return \"MONDAY\";\n }\n }", "public static void main(String[] args) {\n\n\n Scanner scan = new Scanner(System.in);\n\n System.out.println(\"Enter a number please \");\n int day = scan.nextInt();\n\n\n\n if (day == 1) {\n System.out.println(\"It's a Monday!\");\n }\n if (day == 2) {\n System.out.println(\"It's a Tuesday!\");\n }\n if (day == 3) {\n System.out.println(\"It's a Wednesday!\");\n }\n if (day == 4) {\n System.out.println(\"It's a Thursday!\");\n }\n if (day == 5) {\n System.out.println(\"It's a Friday!\");\n }\n if (day == 6) {\n System.out.println(\"It's a Saturday!\");\n }\n if (day == 7) {\n System.out.println(\"It's a Sunday!\");\n }else if(day>7 || day <1){\n System.out.println(\"There is no such a day!\");\n }\n\n\n\n\n\n\n }", "public static int calWeekdayToIndex(int weekday) {\n \t\treturn CollectionUtils.indexOf(weekday, Constants.WEEK_DAYS);\n \t}", "public void generateWeeklySchedule(){\r\n for (int i = 0; i < numDayWorkWeek; i++)\r\n weeklySchedule.get(i).clear();\r\n\r\n int day = 0;\r\n int workHrs = 0;\r\n\r\n for (Task unfinishedTask: unfinished){\r\n if (day > numDayWorkWeek - 1) break;\r\n\r\n //if there is room for this task --> add it. Else, move to the next day\r\n if (workHrs + unfinishedTask.getHrsLeft() <= dailyWorkload){\r\n weeklySchedule.get(day).add(unfinishedTask);\r\n workHrs += unfinishedTask.getHrsLeft();\r\n }\r\n else{\r\n day++;\r\n weeklySchedule.get(day).add(unfinishedTask);\r\n workHrs = unfinishedTask.getHrsLeft();\r\n }\r\n }\r\n }", "void setUserVoteSalaryWeeklyDayOfWeek(DayOfWeek voteSalaryDayOfWeek);", "public Builder setWeekOfYearStartingWithSunday(final int weekOfYearStartingWithSunday) {\n this.weekOfYearStartingWithSunday = weekOfYearStartingWithSunday;\n return this;\n }", "public void updateSpecificDay(int i){\n String[] weekArray = {\"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\",\"SAT\",\"SUN\"};\n int weekday2=i;\n weekday2=weekday2%7;\n String weekday2string=weekArray[weekday2];\n TextView TVweekday2=(TextView)this.findViewById(R.id.weekday2);\n TVweekday2.setText(weekday2string);\n\n int weekday3=i+1;\n weekday3=weekday3%7;\n String weekday3string=weekArray[weekday3];\n TextView TVweekday3=(TextView)this.findViewById(R.id.weekday3);\n TVweekday3.setText(weekday3string);\n\n int weekday4=i+2;\n weekday4=weekday4%7;\n String weekday4string=weekArray[weekday4];\n TextView TVweekday4=(TextView)this.findViewById(R.id.weekday4);\n TVweekday4.setText(weekday4string);\n\n int weekday5=i+3;\n weekday5=weekday5%7;\n String weekday5string=weekArray[weekday5];\n TextView TVweekday5=(TextView)this.findViewById(R.id.weekday5);\n TVweekday5.setText(weekday5string);\n }", "public void setDayOfWeek(String dayOfWeek){\n\t\tthis.dayOfWeek = dayOfWeek;\n\t}", "private static void determineDayOfTheWeek() {\n System.out.println(\"Enter a number:\");\r\n Scanner s = new Scanner(System.in);\r\n int d = Integer.parseInt(s.nextLine());\r\n switch (d) {\r\n case 1:\r\n System.out.println(\"It is Monday\");\r\n break;\r\n case 2:\r\n System.out.println(\"It is Tuesday\");\r\n break;\r\n case 3:\r\n System.out.println(\"It is Wednesday\");\r\n break;\r\n case 4:\r\n System.out.println(\"It is Thursday\");\r\n break;\r\n case 5:\r\n System.out.println(\"It is Friday\");\r\n break;\r\n case 6:\r\n System.out.println(\"It is Saturday\");\r\n break;\r\n case 7:\r\n System.out.println(\"It is Sunday\");\r\n break;\r\n default:\r\n System.out.println(\"Wrong input\");\r\n }\r\n }", "public static WithAdjuster next(DayOfWeek dayOfWeek) {\n\n return new RelativeDayOfWeek(2, dayOfWeek);\n }", "public void setDayOfWeek(Integer dayOfWeek) {\n this.dayOfWeek = dayOfWeek;\n }", "public referential.store.v2.WeekPattern.Builder clearSundayTimeRanges() {\n sundayTimeRanges = null;\n fieldSetFlags()[9] = false;\n return this;\n }", "WeekdaySpec getEnd();", "private void getActivatedWeekdays() {\n }", "public DayOfWeekInMonthRule() {\n this(1, SerialDate.MONDAY, MonthConstants.JANUARY);\n }", "public void setDayOfWeek(String dayOfWeek) {\r\n this.dayOfWeek = dayOfWeek;\r\n }", "public Builder setWeekday(com.czht.face.recognition.Czhtdev.Week value) {\n if (weekdayBuilder_ == null) {\n if (value == null) {\n throw new NullPointerException();\n }\n weekday_ = value;\n onChanged();\n } else {\n weekdayBuilder_.setMessage(value);\n }\n bitField0_ |= 0x00000010;\n return this;\n }", "public String getDayOfTheWeek(){\r\n Calendar calendar = Calendar.getInstance();\r\n int day = calendar.get(Calendar.DAY_OF_WEEK);\r\n String calendar_Id = null;\r\n switch (day) {\r\n case Calendar.SUNDAY:\r\n calendar_Id =\"(90300)\";\r\n break;\r\n case Calendar.MONDAY:\r\n calendar_Id =\"(90400,90448)\";\r\n break;\r\n case Calendar.TUESDAY:\r\n calendar_Id =\"(90400,90448)\";\r\n break;\r\n case Calendar.WEDNESDAY:\r\n calendar_Id =\"(90400,90448)\";\r\n break;\r\n case Calendar.THURSDAY:\r\n calendar_Id =\"(90400,90448)\";\r\n break;\r\n case Calendar.FRIDAY:\r\n calendar_Id =\"(90400,90448)\";\r\n break;\r\n case Calendar.SATURDAY:\r\n calendar_Id =\"(90200,90238)\";\r\n break;\r\n }\r\n\r\n return calendar_Id;\r\n }", "public void printDayOfWeek() {\r\n switch (cur.getDayOfWeek()){\r\n case 1:\r\n System.out.println(\"MON\");\r\n break;\r\n case 2:\r\n System.out.println(\"TUE\");\r\n break;\r\n case 3:\r\n System.out.println(\"WED\");\r\n break;\r\n case 4:\r\n System.out.println(\"THU\");\r\n break;\r\n case 5:\r\n System.out.println(\"FRI\");\r\n break;\r\n case 6:\r\n System.out.println(\"SAT\");\r\n break;\r\n case 7:\r\n System.out.println(\"SUN\");\r\n break;\r\n }\r\n }", "ConferenceScheduleBuilderService startEvent();", "public Week(LocalDate date) {\n days = new ArrayList<>();\n LocalDate monday = getStartOfWeek(date);\n days.add(monday);\n for (int i = 1; i < 7; i++) {\n days.add(monday.plusDays(i));\n }\n }", "public final static int dayOfWeek(int ordinal)\n {\n // modulus in Java is \"broken\" for negative numbers\n // so we adjust to make the dividend postive.\n // By \"broken\" I mean the official rules for what\n // is supposed to happen for negative dividends\n // won't give the desired result in this case.\n // See modulus in the Java glossary for more details.\n return(ordinal == NULL_ORDINAL) ? 0 : ((ordinal + SundayIsZeroAdjustment - MIN_ORDINAL) % 7);\n }", "private void weekDateUpdate(GregorianCalendar reference) {\n\t\treference = (GregorianCalendar) reference.clone();\n\t\tthis.weekdates.removeAll();\n\t\treference = DateCalc.startOf(reference, Calendar.WEEK_OF_YEAR);\n\t\tint day = 1;\n\t\tJLabel current;\n\t\twhile (day <= 7) {\n\t\t\tStringBuilder date = new StringBuilder();\n\t\t\tdate.append(reference.getDisplayName(Calendar.DAY_OF_WEEK,\n\t\t\t\t\tCalendar.SHORT, DEFAULT_LOCALE)\n\t\t\t\t\t+ \" \");\n\t\t\tdate.append(reference.get(Calendar.DAY_OF_MONTH));\n\t\t\tdate.append('.');\n\t\t\tdate.append((reference.get(Calendar.MONTH) + 1));\n\n\t\t\tcurrent = new JLabel(date.toString());\n\t\t\tthis.weekdates.add(current);\n\t\t\tthis.weekdates.addSeparator();\n\t\t\treference.add(Calendar.DAY_OF_WEEK, 1);\n\t\t\tday++;\n\t\t}\n\t}", "boolean hasToDay();", "ConferenceScheduleBuilderService startLunch();", "public static int convertWeekDay(WeekDay day) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\tif (day == SUNDAY)\r\n\t\t\treturn (int)Math.pow(2,1);\r\n\t\telse\r\n\t\t\treturn (int)Math.pow(2,values().length - day.ordinal() + 1);\r\n\t}", "public void weekCalendar() throws InterruptedException{\n\t\tgetEBN(\"openWeek\").click();\r\n\t\tThread.sleep(waiteTime);\r\n\t\tWebElement element1 = driver.findElement(By.xpath(\".//*[@id='ir_week']/tbody/tr[1]/th[2]/span\"));\r\n\t\tString date1 = element1.getText();\r\n\t\t//System.out.println(date1);\r\n\t\tgetEBN(\"openCaln\").click();\r\n\t\tThread.sleep(waiteTime);\r\n\t\tgetEBN(\"chooseDayInCalendar\").click();\r\n\t\tThread.sleep(waiteTime);\r\n\t\tWebElement element2 = driver.findElement(By.xpath(\".//*[@id='ir_week']/tbody/tr[1]/th[2]/span\"));\r\n\t\tString date2 = element2.getText();\r\n\t\tif (date1.equals(date2)) {\r\n\t\t\tfail(\"Дата не изменилась\");\r\n\t\t}\r\n\t\t//getEBN(\"openWeek\").click();\t\r\n\t}", "private int getFirstRepresentingDay() {\n\t\tint firstRepresentingDay;\r\n\t\tGregorianCalendar myCalendar = new GregorianCalendar(year, month, 1);\r\n\r\n\t\tint daysofMonth = myCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);\r\n\t\tint firstDayMonth = myCalendar.get(Calendar.DAY_OF_WEEK); // First day of month (relative to the week)\r\n\t\tint globalFirstDayMonth = myCalendar.get(Calendar.DAY_OF_YEAR);\r\n\r\n\t\tif (settings.getBoolean(\"firstDayofWeek\", true)) { //The default option is the week starting on monday\r\n\t\t\tfirstDayMonth = firstDayMonth - 1;\r\n\t\t\tif (firstDayMonth == 0)\r\n\t\t\t\tfirstDayMonth = 7;\r\n\t\t\tfirstRepresentingDay = globalFirstDayMonth - (firstDayMonth - 1);\r\n\t\t}\r\n\t\telse { //else we start the week on Sunday\r\n\t\t\tfirstRepresentingDay = globalFirstDayMonth - (firstDayMonth - 1);\r\n\t\t}\r\n\t\tif (firstDayMonth + daysofMonth < 37)\r\n\t\t\tcount = RingActivity.five_week_calendar;\r\n\t\telse\r\n\t\t\tcount = RingActivity.six_week_calendar;\r\n\r\n\t\treturn firstRepresentingDay;\r\n\t}", "public static void listWeekends() {\n Set<DayOfWeek> weekEnds = EnumSet.of(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);\n\n LocalDate currentDate = LocalDate.now();\n int year = currentDate.getYear();\n Month month = currentDate.getMonth();\n int currentDay = currentDate.getDayOfMonth();\n int daysOfMth = currentDate.lengthOfMonth();\n\n IntStream.rangeClosed(currentDay, daysOfMth)\n .mapToObj(day -> LocalDate.of(year, month, day))\n .filter(date -> weekEnds.contains(date.getDayOfWeek()))\n .forEach(JustBook::weekendListings);\n }" ]
[ "0.70574474", "0.67828125", "0.6680233", "0.65892905", "0.6451712", "0.6391374", "0.6337181", "0.6325801", "0.62977105", "0.62948215", "0.62401503", "0.62292933", "0.61626834", "0.613575", "0.609691", "0.6086125", "0.60726565", "0.601064", "0.600747", "0.59657186", "0.59398407", "0.5939513", "0.592767", "0.5924008", "0.59149367", "0.59119916", "0.59109336", "0.59008723", "0.5853115", "0.5846518", "0.5816583", "0.58130705", "0.5787529", "0.5764154", "0.5756948", "0.5756678", "0.57518786", "0.57497585", "0.5740877", "0.57201695", "0.5718182", "0.57170355", "0.5712243", "0.5710736", "0.57093626", "0.5694188", "0.56929237", "0.566726", "0.56582826", "0.56574684", "0.5656801", "0.5653131", "0.56401384", "0.5636549", "0.563355", "0.55737096", "0.55716646", "0.5552564", "0.55436456", "0.55329305", "0.5528937", "0.55288255", "0.55156446", "0.55065185", "0.55043155", "0.54983604", "0.54960513", "0.54922974", "0.54885477", "0.5487766", "0.54826796", "0.54820895", "0.54787564", "0.54537183", "0.5448745", "0.54371154", "0.54339015", "0.5415603", "0.5398916", "0.5392809", "0.53915906", "0.53885525", "0.5385971", "0.5382744", "0.5382716", "0.53810245", "0.5374514", "0.53729826", "0.53664565", "0.5361041", "0.53602797", "0.53591377", "0.53580153", "0.5351388", "0.5347193", "0.5339198", "0.5339071", "0.53327125", "0.5330996", "0.53253496", "0.53249085" ]
0.0
-1
Creates a new managed chef in the currently set game's universe.
public static Chef creerChef(String nom, String qualificatif, int force) { // Retrieves the current universe's controller BaseGestionnaireUnivers gestionnaireUnivers = GestionnaireUnivers.get_gestionnaireUnivers(); // Create a chef of the current universe int personnageID = nextID++; Chef createdPersonnage = gestionnaireUnivers.creerChef(personnageID, nom, qualificatif, force); // Register the character and return it personnages.put(personnageID, createdPersonnage); return createdPersonnage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private BasicCoffeeMachine createCoffeeMachine() {\n\t\tMap<CoffeeSelection, CoffeeBean> beans = new HashMap<CoffeeSelection, CoffeeBean>();\n\t\tbeans.put(CoffeeSelection.ESPRESSO, new CoffeeBean(\"My favorite espresso bean\", 1000));\n\t\tbeans.put(CoffeeSelection.FILTER_COFFEE, new CoffeeBean(\"My favorite filter coffee bean\", 1000));\n\t\t\n\t\t// instantiate a new CoffeeMachine object\n\t\treturn new PremiumCoffeeMachine(beans);\n\t}", "public void addNewPiece() {\n\t\t// creates a range from 1-7 to choose from each of the pieces\n\t\tint pieceChoice = (int) (Math.random()*7) + 1; \n\t\tif(pieceChoice == 1) {\n\t\t\tcurrentPiece = new TetrisI();\n\t\t}\n\t\telse if(pieceChoice == 2) {\n\t\t\tcurrentPiece = new TetrisJ();\n\t\t}\n\t\telse if(pieceChoice == 3) {\n\t\t\tcurrentPiece = new TetrisL();\n\t\t}\n\t\telse if(pieceChoice == 4) {\n\t\t\tcurrentPiece = new TetrisO();\n\t\t}\n\t\telse if(pieceChoice == 5) {\n\t\t\tcurrentPiece = new TetrisS();\n\t\t}\n\t\telse if(pieceChoice == 6) {\n\t\t\tcurrentPiece = new TetrisT();\n\t\t}\n\t\telse {\n\t\t\tcurrentPiece = new TetrisZ();\n\t\t}\n\t\tcurrentPiece.pieceRotation = 0;\n\t\tinitCurrentGP();\n\t}", "public void create () {\n // TODO random generation of a ~100 x 100 x 100 world\n }", "@Override\r\n\tpublic AbstractBoxGift createBoxGift() {\n\t\treturn new HardPlastic();\r\n\t}", "public void newCandy() {\n\t\tDebugger.print(\"Making new candy\");\n\t\tint x = (Random.nextInt(1, this.SIZE * 2) - 2);\n\t\tint y = (Random.nextInt(1, this.SIZE - 2));\n\n\t\tTile t = new Tile(x, y);\n\t\tboolean foundFreeTile = false;\n\t\twhile (!foundFreeTile) {\n\t\t\tfor (Snake snake : this.snakes) {\n\t\t\t\tif (snake != null) {\n\n\t\t\t\t\tif (snake.find(t)) {\n\t\t\t\t\t\tx = (Random.nextInt(1, this.SIZE * 2) - 1);\n\t\t\t\t\t\ty = (Random.nextInt(1, this.SIZE - 1));\n\t\t\t\t\t\tt.setX(x);\n\t\t\t\t\t\tt.setY(y);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfoundFreeTile = true;\n\t\t}\n\t\tif (this.getGui() != null) {\n\t\t\tthis.getGui().print(\"New candy made\");\n\t\t}\n\t\tthis.setCandy(new Candy(x, y));\n\t}", "public void createNewCube() {\n CUBE = new Cube();\n }", "public static ExerciseCategory createEntity() {\n ExerciseCategory exerciseCategory = new ExerciseCategory()\n .name(DEFAULT_NAME);\n return exerciseCategory;\n }", "private Parent create() {\n root.setPrefSize(600,600);\r\n\r\n for(int i = 0; i < 3; ++i) {\r\n for(int j = 0; j < 3; ++j) {\r\n Tile tile = new Tile();\r\n tile.setTranslateX(j * 200);\r\n tile.setTranslateY(i * 200);\r\n\r\n root.getChildren().add(tile);\r\n board[j][i] = tile;\r\n }\r\n }\r\n\r\n // horizontal strikes\r\n for(int i = 0; i < 3; ++i) {\r\n comboList.add(new Combination(board[0][i], board[1][i], board[2][i]));\r\n }\r\n\r\n // vertical strikes\r\n for(int j = 0; j < 3; ++j) {\r\n comboList.add(new Combination(board[j][0], board[j][1], board[j][2]));\r\n }\r\n\r\n // diagonal strikes\r\n comboList.add(new Combination(board[0][0], board[1][1], board[2][2]));\r\n comboList.add(new Combination(board[2][0], board[1][1], board[0][2]));\r\n\r\n return root;\r\n }", "public static void newGame(){\n\t\tsetUp.buildBoard(8,8);\n\t\tfor(int i = 0; i < boardBoundsRow * boardBoundsColumn; i++){\n\t\t\tJPanel selectedTile = (JPanel) userInterface.boardButtons.getComponent(i);\n\t\t\tselectedTile.removeAll();\n\t\t\tselectedTile.revalidate();\n\t\t}\n\t\tuserInterface.addBlackPiece();\n\t\tuserInterface.addWhitePiece();\n\t\tuserInterface.check.setText(\"You are not in check\");\n\t\tking.blackKingCheck = false;\n\t\tking.whiteKingCheck = false;\n\t\tturn = \"white\";\n\t\tString playerTurn = \"Player turn: \";\n\t\tuserInterface.turn.setText(playerTurn.concat(turn));\n\t\tundoMoveClass.clearStacks();\n\t}", "@NotNull\n @Override\n public Faction createFaction(@NotNull String name) throws IllegalStateException {\n Faction fac = getFactionByName(name);\n if (fac != null && !fac.isServerFaction()) {\n throw new IllegalStateException(\"Faction already exists.\");\n }\n String fId = MStore.createId();\n com.massivecraft.factions.entity.Faction faction = FactionColl.get().create(fId);\n faction.setName(name);\n return new MassiveCoreFactionsFaction(faction);\n }", "public FMISComLocal create() throws javax.ejb.CreateException;", "public Entity newEntity() { return newMyEntity(); }", "public Entity newEntity() { return newMyEntity(); }", "private ChessPieceGUIFactory() {\r\n\r\n\t}", "private Inventory createInventory() {\n\n\t\tInventory inv;\n\n\t\tif (guiMetadata.getInvType() == InventoryType.CHEST) {\n\t\t\tinv = Bukkit.createInventory(null, guiMetadata.getSize(), guiMetadata.getGuiName());\n\t\t} else {\n\t\t\tinv = Bukkit.createInventory(null, guiMetadata.getInvType(), guiMetadata.getGuiName());\n\t\t}\n\n\t\treturn inv;\n\t}", "public void newGame() {\n \tturn = PieceColor.White;\n \t\n \t//the middle are empty squares\n \tfor(int i = 2; i < 6; i++) {\n \t\tfor(int j = 0; j < 8; j++) {\n \t\t\tsetPiece(j, i, new NoPiece(j, i));\n \t\t}\n \t}\n \t\n \t//pawns\n \tfor(int i = 0; i < 8; i++) {\n \t\t//make these pawns\n \t\tsetPiece(i, 1, new Pawn(i, 1, PieceColor.White, this));\n \t\tsetPiece(i, 6, new Pawn(i, 6, PieceColor.Black, this));\n \t}\n \t\n \t//white back row\n \tsetPiece(0, 0, new Rook(0, 0, PieceColor.White, this));\n \tsetPiece(1, 0, new Knight(1, 0, PieceColor.White, this));\n \tsetPiece(2, 0, new Bishop(2, 0, PieceColor.White, this));\n \tsetPiece(3, 0, new Queen(3, 0, PieceColor.White, this));\n \tsetPiece(4, 0, new King(4, 0, PieceColor.White, this));\n \tsetPiece(5, 0, new Bishop(5, 0, PieceColor.White, this));\n \tsetPiece(6, 0, new Knight(6, 0, PieceColor.White, this));\n \tsetPiece(7, 0, new Rook(7, 0, PieceColor.White, this));\n \t\n \t//black back row\n \tsetPiece(0, 7, new Rook(0, 7, PieceColor.Black, this));\n \tsetPiece(1, 7, new Knight(1, 7, PieceColor.Black, this));\n \tsetPiece(2, 7, new Bishop(2, 7, PieceColor.Black, this));\n \tsetPiece(3, 7, new Queen(3, 7, PieceColor.Black, this));\n \tsetPiece(4, 7, new King(4, 7, PieceColor.Black, this));\n \tsetPiece(5, 7, new Bishop(5, 7, PieceColor.Black, this));\n \tsetPiece(6, 7, new Knight(6, 7, PieceColor.Black, this));\n \tsetPiece(7, 7, new Rook(7, 7, PieceColor.Black, this));\n \t\n \t//store locations of king so they can be checked\n \twKing = new Square(4, 0);\n \tbKing = new Square(4, 7);\n }", "Guild createGuild(long gameId, String title, String clanPrefix);", "@Override\n\tpublic CentreVisite add(CentreVisite chef) {\n\t\treturn CR.save(chef);\n\t}", "public ChessPiece getClone(ChessOwner owner){\n\t\tChessPiece temp = new ChessPiece(pieceName, uniquePieceID, attackDirectionVectors,\n\t\t\t\tmovementDirectionVectors, specialMovementVectors, movementVectors,\n\t\t\t\tattackVectors, blackArtFile, whiteArtFile, NPCArtFile);\n\t\ttemp.setOwner(owner);\n\t\treturn temp;\n\t}", "public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)\r\n {\r\n return new TileCampfire();\r\n }", "Stone create();", "public void createNewFarm(){\n this.mFarm = new Farm();\n this.loaded = false;\n }", "public FloatingCow () {\n\t\t\tcow = new EntityCow(((CraftWorld) player.getWorld()).getHandle());\n\t\t\tcow.setLocation(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), 0, 0);\n\t\t\tcow.setCustomName(ChatSerializer.a(\"{\\\"text\\\":\\\"\" + rainbowColoredName(\"Disco Cow\") +\"\\\"}\"));\n\t\t\tcow.setCustomNameVisible(true);\n\t\t\tPacketHandler.spawnNMSLivingEntity(player, cow);\n\t\t}", "public void createPieces(){ \n\t\tfor(int x = 0; x<BOARD_LENGTH; x++){\n\t\t\tfor(int y = 0; y<BOARD_LENGTH; y++){ \n\t\t\t\tif(CHESS_MAP[x][y] != (null)){\n\t\t\t\t\tswitch (CHESS_MAP[x][y]){\n\t\t\t\t\tcase KING:\n\t\t\t\t\t\tpieces[pieceCounter] = new King(pieceCounter, new Point(x+1,y+1), new Point(0,0), true, true, BOARD_PIECE_LENGTH, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase QUEEN:\n\t\t\t\t\t\tpieces[pieceCounter] = new Queen(pieceCounter, new Point(x+1,y+1), new Point(0,0), true, true, BOARD_PIECE_LENGTH, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase BISHOP:\n\t\t\t\t\t\tpieces[pieceCounter] = new Bishop(pieceCounter, new Point(x+1,y+1), new Point(0,0), true, true, BOARD_PIECE_LENGTH, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase KNIGHT:\n\t\t\t\t\t\tpieces[pieceCounter] = new Knight(pieceCounter, new Point(x+1,y+1), new Point(0,0), true, true, BOARD_PIECE_LENGTH, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PAWN:\n\t\t\t\t\t\tpieces[pieceCounter] = new Pawn(pieceCounter, new Point(x+1,y+1), new Point(0,0), true, true, BOARD_PIECE_LENGTH, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase ROOK:\n\t\t\t\t\t\tpieces[pieceCounter] = new Rook(pieceCounter, new Point(x+1,y+1), new Point(0,0), true, true, BOARD_PIECE_LENGTH, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} \n\t\t\t\t\tsetPieceIconAndName(x, y, CHESS_MAP[x][y]); \t\n\t\t\t\t\tpieceCounter++;\n\t\t\t\t}else{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} \n\t}", "public void create() {\n\t\t\n\t}", "public Container newContainer();", "public Camp newEntity() { return new Camp(); }", "public Game getNewInstance() {\n try {\n return classObj.newInstance();\n } catch (Exception e) {\n e.printStackTrace();\n throw new RuntimeException(\"Error generating \" + this + \" game\");\n }\n }", "public void createBoard() {\n\t\tboard = new Piece[8][8];\n\t\t\n\t\tfor(int i=0; i<8; i++) {\n\t\t\tfor(int j=0; j<8; j++) {\n\t\t\t\tboard[i][j] = null;\n\t\t\t}\n\t\t}\n\t}", "@Override\n public TileEntity createNewTileEntity(World world) {\n return new TileEntityAscender();\n }", "public Idea create() {\n \t\t\tIdea idea = new Idea();\n \n \t\t\treturn idea;\n \t\t}", "public static Character[] createCrew()\r\n \t{\r\n \t\tint nb = CharacterProfile.values().length;\r\n \t\t\r\n \t\tCharacter crew[] = new Character[nb];\r\n \t\tint temp_loyalties[] = INITIAL_LOYALTY;\r\n \t\t\r\n \t\tfor(int i = 0; i < nb; i++)\r\n \t\t{\r\n \t\t\tint r = MathHelper.randInt(0, temp_loyalties.length-1);\r\n \t\t\tint secure = 0; //security against infinite loop\r\n \t\t\twhile(temp_loyalties[r] == -1)\r\n \t\t\t{\r\n \t\t\t\tr++;\r\n \t\t\t\tsecure ++;\r\n \t\t\t\tif(r >= nb)\r\n \t\t\t\t\tr = 0;\r\n \t\t\t\tif(secure >= nb)\r\n \t\t\t\t{\r\n \t\t\t\t\tSystem.out.println(\"Error: wrong initial loyalty.\");\r\n \t\t\t\t\tbreak;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t\tcrew[i] = new Character(i, temp_loyalties[r]);\r\n \t\t\tcrew[i].enterRoom(Ship.get().getRoom(RoomType.CORRIDOR.ordinal()));\r\n \t\t\ttemp_loyalties[r] = -1;\r\n \t\t}\r\n \t\treturn crew;\r\n \t}", "public void newGame()\n\t{\n\t\tmap = new World(3, viewSize, playerFactions);\n\t\tview = new WorldView(map, viewSize, this);\n\t\tbar = new Sidebar(map, barSize);\n\t}", "private void startNewGame(){\n if (selectedPiece!=null)\n selectedPiece.setBackground(getDefaultColor(selectedPiece));\n selectedPiece = null;\n setAllToDefaultColor();\n setDefulatMessage();\n board = new ChessBoard(1, false);\n for(int row = 0 ; row < ROWS; row++){\n for(int col = 0; col < COLS ; col++){\n setButtonIcon(row,col);\n }\n }\n }", "void spawnNewPiece () {\n if (nextPiece == null)\n currentPiece = new Piece();\n else\n currentPiece = nextPiece;\n nextPiece = new Piece();\n\n positionToStart();\n isFalling = true;\n\n // Add blocks of the next piece to nextPiece view\n nextPieceBoard.clear();\n final int nRow = 0 - nextPiece.getOffset();\n final int nColumn = nextPieceBoard.rows / 2 - nextPiece.width / 2;\n for (int r = 0; r < nextPiece.height; ++r)\n for (int c = 0; c < nextPiece.width; ++c)\n if (nextPiece.blocks[r][c] == 1)\n nextPieceBoard.addTempBlock(new Block(nextPiece.color), r + nRow, c + nColumn);\n nextPieceView.setBlocks(nextPieceBoard.getCombined());\n nextPieceView.repaint();\n }", "public Piece newNextPiece()\n {\n if(nextPiece!=null)\n nextPiece.removeFromGrid();\n Piece returnPiece = nextPiece;\n nextPiece = PieceBuilder.Random();\n nextPiece.insertIntoGrid(1, 0, grid);\n this.invalidate();\n return returnPiece;\n }", "Clase createClase();", "public static void createColony(){\r\n try {\r\n //Figure out how big the colony and each generation should be - relative to the number of sets in the search space\r\n // Naieve - one ant for every set in sets, one generation\r\n\r\n //Create the colony\r\n while (colony.size() < colonySize) {\r\n colony.add(new Ant());\r\n }\r\n\r\n }catch(Exception e){\r\n System.out.println(\"ERROR in createColony\");\r\n System.out.println(\"Colony: \" + colony);\r\n System.out.println();\r\n System.out.println(e.toString());\r\n }\r\n }", "public static SubsystemNodeContainer createSubsystemNodeContainer() {\n Map<String, String> properties = new HashMap<String, String>();\n properties.put(\"String\", \"String\");\n TransferHandler handler = new TransferHandler(\"\");\n SubsystemNodeContainer snc = null;\n try {\n snc = new SubsystemNodeContainer(AccuracyTestHelper.createGraphNodeForSubsystem(), properties, handler);\n } catch (IllegalGraphElementException e) {\n TestCase.fail(\"Should not throw exception here.\");\n }\n return snc;\n }", "public Object buildNewInstance() throws DescriptorException {\n if (this.isUsingDefaultConstructor()) {\n return this.buildNewInstanceUsingDefaultConstructor();\n } else {\n return this.buildNewInstanceUsingFactory();\n }\n }", "public static void makeBoardChess() {\r\n \r\n white = new AllPiece(\"White\");\r\n black = new AllPiece(\"Black\");\r\n \r\n }", "public void spawnNew() {\n\t\tif (tier> 1) {\n\t\t\ttier--;\n\t\t\thealth = tier;\n\t\t\tdamage = tier;\n\t\t\tspeed = 5;\n\t\t\timg = getImage(updateImage(tier)); // converted getImage to protected b/c it wasn't accessible by Balloon class (child class)\n\t\t}\n\t\telse {\n\t\t\tisAlive = false;\n\t\t\tdeletePath();\t\t\t\n\t\t}\n\t}", "public static BacSi createEntity() {\n BacSi bacSi = new BacSi()\n .mabacsi(DEFAULT_MABACSI)\n .hoten(DEFAULT_HOTEN)\n .gioitinh(DEFAULT_GIOITINH)\n .ngaysinh(DEFAULT_NGAYSINH)\n .noilamviec(DEFAULT_NOILAMVIEC)\n .chuyenkhoa(DEFAULT_CHUYENKHOA)\n .giayphephanhnghe(DEFAULT_GIAYPHEPHANHNGHE);\n return bacSi;\n }", "public Shoe makeShoe() {\n\treturn new Shoe();\r\n}", "@Override\n public LocalGame createLocalGame() {\n return new LocalGameActual();\n }", "MainBoard createMainBoard();", "Container createContainer();", "@Override\n\tpublic TileEntity createNewTileEntity(World world) {\n\t\treturn new TileEntityGrinder();\n\t}", "@Override\n\tpublic TileEntity createNewTileEntity(World var1, int var2) {\n\t\treturn new TileEntityCobexChest();\n\t}", "private void generateNewCards()\n {\n // Set the card sets to be drafted from.\n setsForDraft = new ArrayList<>();\n setsForDraft.add(M19_CARD_TABLE);\n\n // Generates sealed pool and places in openedCardPool.\n drawPacksFromSets();\n\n // Initialize a selectedCardPool that is empty, for the user to move cards into when desired.\n selectedCardPool = new ArrayList<>();\n }", "public Deck makeComputerDeck()\r\n\t{\r\n\t\tDeck computer = new Deck();\r\n\r\n \tfor (int i = 0; i < (DECK_COUNT/2); i++)\r\n \t{\r\n \t computer.addToDeck(deck.remove(0));\r\n \t}\r\n\r\n\t\treturn computer;\r\n\t}", "private void createRecipe(Plugin plugin) {\n\t\tNamespacedKey nk = new NamespacedKey(plugin, \"AC_CHAINMAIL_BOOTS_A\");\n\t\tShapedRecipe recipe = new ShapedRecipe(nk, new ItemStack(Material.CHAINMAIL_BOOTS, 1));\n\n\t\trecipe.shape(\"C C\", \"C C\", \" \");\n\n\t\trecipe.setIngredient('C', Material.CHAIN);\n\t\t\n\t\tBukkit.addRecipe(recipe);\n\t}", "public static FrozenBoxType createEntity(EntityManager em) {\n FrozenBoxType frozenBoxType = new FrozenBoxType()\n .frozenBoxTypeCode(DEFAULT_FROZEN_BOX_TYPE_CODE)\n .frozenBoxTypeName(DEFAULT_FROZEN_BOX_TYPE_NAME)\n .frozenBoxTypeRows(DEFAULT_FROZEN_BOX_TYPE_ROWS)\n .frozenBoxTypeColumns(DEFAULT_FROZEN_BOX_TYPE_COLUMNS)\n .memo(DEFAULT_MEMO)\n .status(DEFAULT_STATUS);\n return frozenBoxType;\n }", "public void create(){}", "public void createNewGame() {\n\t\tfor(int n = 0; n < 8; n++){\n\t\t\tfor(int j = 0; j < 8; j++){\n\t\t\t\tif ( n % 2 == j % BLACK_PAWN ) {\n\t\t\t\t\tif (n < 3)\n\t\t\t\t\t\tarr[n][j] = RED_PAWN;\n\t\t\t\t\telse if (n > 4)\n\t\t\t\t\t\tarr[n][j] = BLACK_PAWN;\n\t\t\t\t\telse\n\t\t\t\t\t\tarr[n][j] = EMPTY;\n\t\t } \n\t\t\t\telse\n\t\t\t\t\tarr[n][j] = EMPTY;\n\t\t\t}\n\t\t}\n\t}", "void newGame() {\n\t\tstate = new model.State () ; \n\t\tif(host != null ) host.show(state) ; \n\t}", "public void createPackageContents() {\n\t\tif (isCreated)\n\t\t\treturn;\n\t\tisCreated = true;\n\n\t\t// Create classes and their features\n\t\tbagTypeEClass = createEClass(BAG_TYPE);\n\n\t\ttupleTypeEClass = createEClass(TUPLE_TYPE);\n\t\tcreateEReference(tupleTypeEClass, TUPLE_TYPE__OCL_LIBRARY);\n\n\t\tcollectionTypeEClass = createEClass(COLLECTION_TYPE);\n\t\tcreateEReference(collectionTypeEClass, COLLECTION_TYPE__ELEMENT_TYPE);\n\t\tcreateEReference(collectionTypeEClass, COLLECTION_TYPE__OCL_LIBRARY);\n\t\tcreateEAttribute(collectionTypeEClass, COLLECTION_TYPE__KIND);\n\n\t\tinvalidTypeEClass = createEClass(INVALID_TYPE);\n\t\tcreateEReference(invalidTypeEClass, INVALID_TYPE__OCL_LIBRARY);\n\n\t\torderedSetTypeEClass = createEClass(ORDERED_SET_TYPE);\n\n\t\tsequenceTypeEClass = createEClass(SEQUENCE_TYPE);\n\n\t\tsetTypeEClass = createEClass(SET_TYPE);\n\n\t\tvoidTypeEClass = createEClass(VOID_TYPE);\n\t\tcreateEReference(voidTypeEClass, VOID_TYPE__OCL_LIBRARY);\n\n\t\ttypeTypeEClass = createEClass(TYPE_TYPE);\n\t\tcreateEReference(typeTypeEClass, TYPE_TYPE__REPRESENTED_TYPE);\n\n\t\toclLibraryEClass = createEClass(OCL_LIBRARY);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_BOOLEAN);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_STRING);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_INTEGER);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_REAL);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_ANY);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_VOID);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_INVALID);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_TYPE);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_COLLECTION);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_SEQUENCE);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_BAG);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_SET);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_ORDERED_SET);\n\t\tcreateEReference(oclLibraryEClass, OCL_LIBRARY__OCL_TUPLE);\n\n\t\tanyTypeEClass = createEClass(ANY_TYPE);\n\t}", "public String createFamily(String name);", "Cloud createCloud();", "public Fish create(){\n\t\tMovementStyle style = new NoMovement();\n\t\treturn new Shark(style);\n\t}", "public void create() {\n\t\t// setup Chess board\n\t\tthis.removeAll();\n\t\tthis.layout = new GridLayout(this.startupBoardSize, this.startupBoardSize);\n\t\tthis.squares = new SquarePanel[this.startupBoardSize][this.startupBoardSize];\n\t\t\n\t\tsetLayout(layout);\n\t\tsetPreferredSize(new Dimension(600, 600));\n\t\tsetBorder(new LineBorder(new Color(0, 0, 0)));\n\n\t\t//paint the chess board\n\n\t\tfor (int i = 0; i < this.startupBoardSize; i++) \n\t\t{\n\t\t\tfor (int j = 0; j < this.startupBoardSize; j++) \n\t\t\t{\n\t\t\t\tsquares[i][j] = new SquarePanel(j, i);\n\t\t\t\tsquares[i][j].setPreferredSize(new Dimension(600 / this.startupBoardSize - 5, 600 / this.startupBoardSize - 5));\n\n\n\t\t\t\tsquares[i][j].setBackground(Color.WHITE);\n\t\t\t\t\n\t\t\t\tif (((i + j) % 2) == 0) \n\t\t\t\t{\n\t\t\t\t\tsquares[i][j].setBackground(Color.DARK_GRAY);\n\t\t\t\t}\n\t\t\t\tadd(squares[i][j]);\n\t\t\t}\n\t\t}\n\t}", "public PersistentObject newPersistentObject() {\r\n return new Chm62edtHabitatSyntaxaPersist();\r\n }", "public void makeNew() {\n\t\towner.switchMode(WindowMode.ITEMCREATE);\n\t}", "@Override\n\tpublic KBase newKB() throws RemoteException {\n\t\treturn BnetDistributedKB.create(this);\n\t}", "public abstract World create(World world);", "PhysicalThing createPhysicalThing();", "Foco createFoco();", "public abstract Piece clone();", "public abstract Piece clone();", "public static GameTile makeNewTile(int tileValue)\n {\n GameTileyul579 GameTile= new GameTileyul579(tileValue);\n return GameTile;\n }", "public de.uni_koblenz.jgralabtest.schemas.gretl.pddsl.Chassis createChassis();", "public TowerDisplayEntity createNewTower() {\n\t\treturn (TowerDisplayEntity) tabBar.getTowersPanel().getEditor().edit(new TowerDisplayEntity());\n\t}", "void create(GameLogic gameLogic);", "public void createChallenger() {\n\n Random random = new Random();\n if(currentTurn.getActivePlayers().size() != 1) {\n currentTurn.setCurrentPlayer(currentTurn.getActivePlayers().get(random.nextInt(currentTurn.getActivePlayers().size() - 1)));\n } else {\n currentTurn.setCurrentPlayer(currentTurn.getActivePlayers().get(0));\n }\n int i = onlinePlayers.indexOf(currentTurn.getCurrentPlayer());\n stateList.set(i, new Initialized(getCurrentTurn().getCurrentPlayer(), this));\n\n }", "public edu.umich.icpsr.ddi.DataChckType addNewDataChck()\n {\n synchronized (monitor())\n {\n check_orphaned();\n edu.umich.icpsr.ddi.DataChckType target = null;\n target = (edu.umich.icpsr.ddi.DataChckType)get_store().add_element_user(DATACHCK$14);\n return target;\n }\n }", "public org.oep.usermgt.model.Citizen create(long citizenId);", "public IntegerGenotype create() \r\n\t{\n\t\tIntegerGenotype genotype = new IntegerGenotype(1,3);\r\n\t\tgenotype.init(new Random(), Data.numeroCuardillas); \r\n\t\t\r\n\t\treturn genotype;\r\n\t}", "public void createPackageContents()\n {\n\t\tif (isCreated) return;\n\t\tisCreated = true;\n\n\t\t// Create classes and their features\n\t\tclarityAbstractObjectEClass = createEClass(CLARITY_ABSTRACT_OBJECT);\n\t\tcreateEAttribute(clarityAbstractObjectEClass, CLARITY_ABSTRACT_OBJECT__CLARITY_CONNECTION);\n\n\t\tclarityAddFilesEClass = createEClass(CLARITY_ADD_FILES);\n\n\t\tclarityGetBatchResultEClass = createEClass(CLARITY_GET_BATCH_RESULT);\n\n\t\tclarityGetKeyEClass = createEClass(CLARITY_GET_KEY);\n\n\t\tclarityQueryBatchEClass = createEClass(CLARITY_QUERY_BATCH);\n\n\t\tclarityReloadFileEClass = createEClass(CLARITY_RELOAD_FILE);\n\n\t\tclarityRemoveFilesEClass = createEClass(CLARITY_REMOVE_FILES);\n\n\t\tstartBatchEClass = createEClass(START_BATCH);\n\t}", "Compleja createCompleja();", "Klassenstufe createKlassenstufe();", "public static void makePieces() {\n\t\tPiece[] pieces = new Piece[35];\n\t\tfor (int i = 0; i < pieces.length; i++) {\n\t\t\tTile t = new Tile(false, true, 0, 0);\n\t\t\tTile f = new Tile(false, false, 0, 0);\n\t\t\tTile[][] tiles = new Tile[6][6];\n\t\t\tswitch (i) {\n\t\t\tcase 0:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, t, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, t, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, f, t, f, f }, { f, f, f, t, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, t, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\ttiles = new Tile[][] { { f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\ttiles = new Tile[][] { { f, f, t, f, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\ttiles = new Tile[][] { { f, f, t, t, f, f }, { f, f, t, f, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\ttiles = new Tile[][] { { f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, t, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, f, f, f, f }, { f, t, t, f, f, f },\n\t\t\t\t\t\t{ f, t, t, t, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 10:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, f, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, t, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 11:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, t, t, f, f }, { f, t, f, f, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 12:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, f, f, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 13:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 14:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, t, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 15:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 16:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, t, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 17:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, f, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 18:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, f, t, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 19:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, t, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 20:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, f, t, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 21:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, f, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 22:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, f, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 23:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, f, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 24:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, t, f, f }, { f, f, f, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 25:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, t, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 26:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, t, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 27:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, t, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 28:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, f, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 29:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, f, t, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 30:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, t, t, t, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 31:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, t, t, t, f, f }, { f, t, f, t, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, f, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 32:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, f, t, f, f }, { f, f, t, t, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 33:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, t, t, f, f, f },\n\t\t\t\t\t\t{ f, t, f, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\tcase 34:\n\t\t\t\ttiles = new Tile[][] { { f, f, f, f, f, f }, { f, f, t, t, f, f }, { f, f, t, f, f, f },\n\t\t\t\t\t\t{ f, t, t, f, f, f }, { f, t, f, f, f, f }, { f, f, f, f, f, f } };\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpieces[i] = new Piece(tiles);\n\t\t}\n\t\ttry {\n\t\t\tFileOutputStream saveFile = new FileOutputStream(\"pieces.data\");\n\t\t\tObjectOutputStream save = new ObjectOutputStream(saveFile);\n\t\t\tsave.reset();\n\t\t\tsave.writeObject(pieces);\n\t\t\tsave.close();\n\t\t} catch (Exception exc) {\n\t\t\texc.printStackTrace(); // If there was an error, print the info.\n\t\t}\n\t}", "private OwnedPuckemon buildOwned(int id, int level,String nickName){\n List<Object> data = excelReader.getExcelData(id);\n return new OwnedPuckemon(id,level,(String)data.get(0), dissectListTypes((String)data.get(1)),(int) data.get(2),(int)data.get(3)\n ,(int)data.get(4),(int)data.get(5),(int)data.get(6),(int)data.get(7), dissectList((String)data.get(8)),nickName);\n }", "Tree createSecurityFeatureType( WorkingCopy workingCopy, TreeMaker make );", "public void generateShape() {\n\n //TODO for tetris game - copy added to Tetris\n Shape newShape = null;\n //if(GAME_TO_TEST==GameEnum.TETRIS){\n //newShape = TetrisShapeFactory.getRandomShape(this.board);\n //} else if (GAME_TO_TEST== GameEnum.DRMARIO){\n //newShape = DrMarioShapeFactory.getRandomShape(this.board);\n //}\n\n //Temporary\n //-------------------------------------//\n Image image = null;\n try {\n image = new Image(new FileInputStream(\"resources/BlockPurple.png\"));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n int spawnColIndex = 0;\n int spawnRowIndex = 0;\n int tileSize = 0;\n boolean setColor = false;\n boolean setTileBorder = false; //toggle to add boarder to tile\n boolean setImage = true;\n spawnColIndex = (board.gridWidth-1)/2; //half of board width\n spawnRowIndex = 0;\n tileSize = board.tileSize;\n\n Tile tile1 = new Tile(tileSize, setColor, Color.VIOLET, setTileBorder, setImage, image, spawnColIndex,spawnRowIndex, 0 , Direction.DOWN); //Center Tile\n Tile tile2 = new Tile(tileSize, setColor, Color.VIOLET, setTileBorder, setImage, image, spawnColIndex,spawnRowIndex,1 , Direction.RIGHT);\n Tile tile3 = new Tile(tileSize, setColor, Color.VIOLET, setTileBorder, setImage, image, spawnColIndex,spawnRowIndex, 1 , Direction.LEFT);\n Tile tile4 = new Tile(tileSize, setColor, Color.VIOLET, setTileBorder, setImage, image, spawnColIndex,spawnRowIndex, 1 , Direction.DOWN);\n\n List<Tile> tiles = new ArrayList<Tile>();\n tiles.add(tile1);\n tiles.add(tile2);\n tiles.add(tile3);\n tiles.add(tile4);\n newShape = new Shape(tiles);\n\n //set newly created shape as the currently active shape\n this.currentActiveShape = newShape;\n\n //check if spawn area is occupied\n boolean isOccupied =false;\n for (Tile newTile : this.currentActiveShape.tiles) {\n if(this.board.getTile(newTile.columnIndex,newTile.rowIndex)!=null){\n isOccupied = true;\n }\n }\n\n //TODO\n //check if shape reaches top\n if(!isOccupied){\n //add tiles to board\n for (Tile newTile : this.currentActiveShape.tiles) {\n this.board.placeTile(newTile);\n }\n } else {\n //TODO later add Game Over JavaFx message\n System.out.println(\"GAME OVER\");\n\n //TODO Finishlater\n //Text gameoverText = new Text(10,20,\"GAME OVER\");\n //gameoverText.setFill(Color.RED);\n //gameoverText.setX( 100/*( ((board.gridWidth-1)*tileSize)/2)*/ );\n //gameoverText.setY( 100/*( ((board.gridHeight-1)*tileSize)/2)*/ );\n //gameoverText.setStyle(\"-fx-font: 70 arial;\");\n //this.group.getChildren().add(gameoverText);\n\n //Text t = new Text();\n //t.setX(20.0f);\n //t.setY(65.0f);\n //t.setX(100);\n //t.setY(200);\n //t.setText(\"Perspective\");\n //t.setFill(Color.YELLOW);\n //t.setFont(Font.font(null, FontWeight.BOLD, 36));\n //this.group.getChildren().add(t);\n //this.pane.getChildren().add(t);\n\n //System.exit(0);\n }\n\n }", "public abstract LivingObject createLife(Cell locat);", "public abstract void createBoard();", "public PiecePenguin layEgg(){\n // if this piece hasn't laid max eggs yet - allow it create new piece\n if( this.numEggs < MAX_EGGS){\n this.incrementNumEggs();\n // this creates a new piece that has not laid any eggs\n // and has not attacked any pieces yet it will belong to this team so pass in Color\n return new PiecePenguin(this.symbol, this.color,0,0);\n }\n else{\n return null;\n }\n }", "@Override\n\tpublic Cup getCup() {\n\t\treturn new IronCup();\n\t}", "public void createCompte(Compte compte);", "ItemStack make();", "public FleetBean generateFleet() {\n\t\tfleet = new FleetBean(new ArrayList<>());\n\t\tpointsOccupiedList.clear(); // Remise à zéro de la liste de points déjà occupés\n\t\tfor (int boatSize : fleetBlueprint) {\n\t\t\tSystem.out.println(\"Debug : Generate a boat in function generateFleet\");\n\t\t\tfleet.addBoat(generateBoat(boatSize));\n\t\t}\n\t\treturn fleet;\n\t}", "EClass createEClass();", "private IWorld worldCreator(){\n if (gameWorld == GameWorld.NORMAL) return\n new Normal();\n else return\n new Nether();\n }", "private IRefinesMachine createRefinesMachine() throws RodinDBException {\n\t\tfinal IMachineRoot mch = createMachine(\"mch\");\n\t\treturn mch.createChild(IRefinesMachine.ELEMENT_TYPE, null, null);\n\t}", "void createNewContinent();", "@Override\n\tprotected CoreEntity createNewEntity() {\n\t\treturn null;\n\t}", "Thing createThing();", "private static EntityManagerFactory createNewEntityManagerFactory()\n\t\t\tthrows NamingException, PersistenceException, UnsupportedUserAttributeException {\n\n\t\tInitialContext ctx = new InitialContext();\n\t\tDataSource ds = (DataSource) ctx.lookup(DATA_SOURCE_NAME);\n\n\t\tMap<String, Object> properties = new HashMap<String, Object>();\n\t\tproperties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, ds);\n\n\t\t// As replication will change the underlying database without\n\t\t// notifying the hub the JPA cache needs to be disabled.\n\t\t// Else the hub might provide outdated data\n\t\tproperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, \"false\");\n\n\t\treturn Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);\n\t}", "public Piece makePiece(int i, char colour) {\n return (new Collection(colour)).getPiece(i);\n }", "public Factory(Cell cell, Player owner, Game game) {\n\t\tsuper(\"Factory\", 300, cost, 200, cell, owner, game);\n\t\tthis.setImageLocation(\"/imgs/buildings/Factory.png\");\n\t}" ]
[ "0.59379363", "0.55060846", "0.5478341", "0.5455734", "0.52867454", "0.5206525", "0.5204842", "0.5141251", "0.5113658", "0.5075081", "0.5000766", "0.49927765", "0.49927765", "0.4978239", "0.49525824", "0.49449813", "0.49337563", "0.49305135", "0.49273604", "0.49263448", "0.49251315", "0.48984042", "0.48904812", "0.48884213", "0.48666462", "0.4864725", "0.48625264", "0.48569623", "0.48480195", "0.48382834", "0.4833721", "0.4824107", "0.47941816", "0.47897398", "0.47861686", "0.47834313", "0.477704", "0.4756536", "0.47564742", "0.47560027", "0.47450513", "0.47444394", "0.4730492", "0.47292545", "0.4725447", "0.47252548", "0.47193378", "0.4703174", "0.4702241", "0.4699502", "0.46986035", "0.468983", "0.4689458", "0.46820426", "0.46772832", "0.46747655", "0.46714014", "0.46635988", "0.4660596", "0.46581975", "0.4653623", "0.46420372", "0.46410006", "0.46405694", "0.46403956", "0.46387106", "0.46280172", "0.46275112", "0.46275112", "0.462744", "0.46258494", "0.46249595", "0.46181458", "0.46152005", "0.46125332", "0.4609975", "0.4597605", "0.45975298", "0.4597346", "0.45961806", "0.45955086", "0.45917594", "0.45852166", "0.45815155", "0.45788994", "0.45757312", "0.45737818", "0.45712584", "0.45711613", "0.45701745", "0.45650226", "0.45596063", "0.45550042", "0.4554541", "0.4552018", "0.45504463", "0.4547938", "0.45469317", "0.45415643", "0.45394102" ]
0.54729205
3
Creates a new managed soldier in the currently set game's universe.
public static Soldat creerSoldat(String nom, int force) { // Retrieves the current universe's controller BaseGestionnaireUnivers gestionnaireUnivers = GestionnaireUnivers.get_gestionnaireUnivers(); // Create a chef of the current universe int personnageID = nextID++; Soldat createdPersonnage = gestionnaireUnivers.creerSoldat(personnageID, nom, force); // Register the character and return it personnages.put(personnageID, createdPersonnage); return createdPersonnage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public LocalGame createLocalGame() {\n return new LocalGameActual();\n }", "@Override\n\tpublic Soldier copy() {\n\t\tSoldier newS = new Soldier(this.getControllingPlayerID(), this.getLocation(), this.getHpMax(), this.getHpCurrent(),\n\t\t\t\t\t\t\t\t\tthis.getOrientation(), this.getFieldOfViewRange(), this.getFieldOfViewAngle(), this.getAttackRange(),\n\t\t\t\t\t\t\t\t\tthis.getAttackDamage(), this.getSpecialAttackCooldown(), this.getSpawnCost(), this.getScoreWorth());\n\t\tnewS.setID(this.getID());\n\t\tnewS.updateFieldOfView(this.getFieldOfView());\n\t\treturn newS;\n\t}", "protected Entity createEntity()\n\t{\n\t\tLane lane = getLane();\n\t\t//sanity check\n\t\tif( lane instanceof PedestrianLane){\n\t\t\tPedestrianLane pLane = (PedestrianLane) lane;\n\t\t\t\n\t\t\t//create the pedestrian\n\t\t\t//Range of values within the lane a Pedestrian can be spawned at\n\t\t\tdouble rangeMin = Pedestrian.PEDESTRIAN_WIDTH/2;\n\t\t\tdouble rangeMax = PedestrianLane.LANE_WIDTH - Pedestrian.PEDESTRIAN_WIDTH/2;\n\t\t\t\n\t\t\tdouble randRange = rangeMin + (rangeMax - rangeMin)*Utils.random();\n\t\t\t\n\t\t\tdouble x = pLane.x() - randRange*Math.sin(pLane.dirRad());\n\t\t\tdouble y = pLane.y() + randRange*Math.cos(pLane.dirRad());\n\t\t\t\n\t\t\tif (x == pLane.x()) {\n\t\t\t\tx -= 7.5*Math.sin(pLane.dirRad());\n\t\t\t} else if (x == pLane.x() -PedestrianLane.LANE_WIDTH*Math.sin(pLane.dirRad())) {\n\t\t\t\tx += 7.5*Math.sin(pLane.dirRad());\n\t\t\t}\n\t\t\tif (y == pLane.y()) {\n\t\t\t\ty += 7.5*Math.cos(pLane.dirRad());\n\t\t\t} else if (y == pLane.y() +PedestrianLane.LANE_WIDTH*Math.cos(pLane.dirRad())) {\n\t\t\t\ty -= 7.5*Math.cos(pLane.dirRad());\n\t\t\t}\n\t\t\t\n\t\t\tPedestrian p = new Pedestrian(x, y, pLane.dirDeg(), pLane);\n\t\t\treturn p;\n\t\t\t} else {\n\t\t\t\tSystem.err.println(\"ERROR: Can't add a pedestrian to a non pedestrian lane\");\n\t\t\t\treturn null;\n\t\t\t}\n\n\t}", "SpaceInvaderTest_test_VaisseauImmobile_DeplacerVaisseauVersLaDroite createSpaceInvaderTest_test_VaisseauImmobile_DeplacerVaisseauVersLaDroite();", "@Override\n\tpublic Airport createNew()\n\t{\n\t\treturn new Airport();\n\t}", "SpaceInvaderTest_test_VaisseauAvance_DeplacerVaisseauVersLaDroite createSpaceInvaderTest_test_VaisseauAvance_DeplacerVaisseauVersLaDroite();", "private IWorld worldCreator(){\n if (gameWorld == GameWorld.NORMAL) return\n new Normal();\n else return\n new Nether();\n }", "public Container newContainer();", "private Inventory createInventory() {\n\n\t\tInventory inv;\n\n\t\tif (guiMetadata.getInvType() == InventoryType.CHEST) {\n\t\t\tinv = Bukkit.createInventory(null, guiMetadata.getSize(), guiMetadata.getGuiName());\n\t\t} else {\n\t\t\tinv = Bukkit.createInventory(null, guiMetadata.getInvType(), guiMetadata.getGuiName());\n\t\t}\n\n\t\treturn inv;\n\t}", "public Universe() {\n for (int x = 0; x < universe.length; x++) {\n Planet p = new Planet();\n universe[x] = p;\n }\n }", "@Override\n public EntityDealer create(String dealerId) {\n EntityDealer entityDealer = new EntityDealerImpl();\n\n entityDealer.setNew(true);\n entityDealer.setPrimaryKey(dealerId);\n\n return entityDealer;\n }", "FuelingStation createFuelingStation();", "SpaceInvaderTest_test_VaisseauAvancePartiellement_DeplacerVaisseauVersLaDroite createSpaceInvaderTest_test_VaisseauAvancePartiellement_DeplacerVaisseauVersLaDroite();", "public static NPC createNPC(){\n\t\treturn new NPC();\n\t}", "public GameDomainFactory() {\r\n\t\t\r\n\t\tCreateGameDomain = new HashMap<String, GameDomainFactory.gameDomainCreator>();\r\n\t\tCreateGameDomain.put(\"TicTacToe\" , new ticTacToeCreator());\r\n\t\tCreateGameDomain.put(\"Reversi\", new CreatorReversi());\r\n\t}", "private Vehicle createNewVehicle() {\n\t\tString make = generateMake();\n\t\tString model = generateModel();\n\t\tdouble weight = generateWeight(model);\n\t\tdouble engineSize = generateEngineSize(model);\n\t\tint numberOfDoors = generateNumberOfDoors(model);\n\t\tboolean isImport = generateIsImport(make);\n\t\t\n\t\tVehicle vehicle = new Vehicle(make, model, weight, engineSize, numberOfDoors, isImport);\n\t\treturn vehicle;\t\t\n\t}", "public suiluppo_equip_allocation create(long equip_allocat_id);", "public FMISComLocal create() throws javax.ejb.CreateException;", "public Idea create() {\n \t\t\tIdea idea = new Idea();\n \n \t\t\treturn idea;\n \t\t}", "public abstract World create(World world);", "GoatInfrastructureFactory getGoatInfrastructureFactory();", "public IGamePadAIDL create() {\n if (HwGameAssistGamePad.mService == null) {\n HwGameAssistGamePad.bindService();\n }\n return HwGameAssistGamePad.mService;\n }", "public Position create() {\n\t\tfinal Actor actorLogged = this.actorService.findActorLogged();\n\t\tAssert.notNull(actorLogged);\n\t\tthis.actorService.checkUserLoginCompany(actorLogged);\n\n\t\tPosition result;\n\n\t\tresult = new Position();\n\t\tfinal Collection<Problem> problems = new HashSet<>();\n\t\tfinal Collection<Application> applications = new HashSet<>();\n\n\t\t// R4\n\t\tfinal String ticker = \"\"; //Será generado en el reconstruct\n\n\t\tresult.setTicker(ticker);\n\t\tresult.setProblems(problems);\n\t\tresult.setApplications(applications);\n\t\tresult.setIsFinalMode(false);\n\t\tresult.setIsCancelled(false);\n\n\t\treturn result;\n\t}", "public PlayerFighter create(GamePlayer player);", "public static EpitrelloDataServerice creator() {\n\t\tif(dataServerice == null) {\n\t\t\tdataServerice = new DataService();\n\t\t}\n\t\treturn dataServerice;\n\t}", "@Override\n public SolarPanel createSolarPanel(final SolarPanel solarPanel) {\n return solarPanelRepository.save(solarPanel);\n }", "public Game getNewInstance() {\n try {\n return classObj.newInstance();\n } catch (Exception e) {\n e.printStackTrace();\n throw new RuntimeException(\"Error generating \" + this + \" game\");\n }\n }", "public static SiegeLesions createEntity(EntityManager em) {\n SiegeLesions siegeLesions = new SiegeLesions().typeSiegeDeLesions(DEFAULT_TYPE_SIEGE_DE_LESIONS);\n return siegeLesions;\n }", "public void createNewFarm(){\n this.mFarm = new Farm();\n this.loaded = false;\n }", "Division createDivision();", "public abstract LivingObject createLife(Cell locat);", "public static SubsystemNodeContainer createSubsystemNodeContainer() {\n Map<String, String> properties = new HashMap<String, String>();\n properties.put(\"String\", \"String\");\n TransferHandler handler = new TransferHandler(\"\");\n SubsystemNodeContainer snc = null;\n try {\n snc = new SubsystemNodeContainer(AccuracyTestHelper.createGraphNodeForSubsystem(), properties, handler);\n } catch (IllegalGraphElementException e) {\n TestCase.fail(\"Should not throw exception here.\");\n }\n return snc;\n }", "protected abstract IStoreLane make_classic();", "Vehicle createVehicle();", "Vehicle createVehicle();", "Schueler createSchueler();", "public void createMainInventor() {\n String name = _plugin.getConfigManager().getGeneralSettingsMap().get(\"Name\");\r\n String colorizedName = _plugin.getUtilsManager().colorizeString(name);\r\n //Size of the Inventory;\r\n int inventorySize = Integer.valueOf(_plugin.getConfigManager().getGeneralSettingsMap().get(\"InventorySize\"));\r\n //Initialize Inventory;\r\n mainInventory = _plugin.getServer().createInventory(null, inventorySize, colorizedName);\r\n //Retrieve the HashMaps for the plugin;\r\n HashMap<Integer, CategoryItem> categoryInformationMap = _plugin.getConfigManager().getCategoryInformationMap();\r\n HashMap<String, String> languageInformation = _plugin.getConfigManager().getLanguageInformationMap();\r\n //Add items to Inventory;\r\n for (Integer i : categoryInformationMap.keySet()) {\r\n CategoryItem categoryItem = categoryInformationMap.get(i);\r\n ItemStack item = categoryItem.getItem();\r\n ItemMeta itemMeta = item.getItemMeta();\r\n itemMeta.setDisplayName(_plugin.getUtilsManager().colorizeString(languageInformation.get(\"CategoryName\").replace(\"%cat%\", categoryItem.getName())));\r\n List<String> lore = new ArrayList<>();\r\n lore.add(_plugin.getUtilsManager().colorizeString(categoryItem.getDescription()));\r\n item.setItemMeta(itemMeta);\r\n mainInventory.addItem(item);\r\n }\r\n }", "@Override\r\n\tpublic AbstractBoxGift createBoxGift() {\n\t\treturn new HardPlastic();\r\n\t}", "SpaceInvaderTest_VaisseauImmobile_DeplacerVaisseauVersLaGauche createSpaceInvaderTest_VaisseauImmobile_DeplacerVaisseauVersLaGauche();", "public Camp newEntity() { return new Camp(); }", "public THLocalGame createLocalGame() {\n\n return null;\n }", "@Override\n\tpublic ModIndexedInstance createNewInstance() {\n\t\tModIndexedInstance newInst = new ModIndexedInstance(); // create the new instance\n\t\tnewInst.setRegComp(this); // set component type of new instance\n\t\taddInstanceOf(newInst); // add instance to list for this comp\n\t\treturn newInst;\n\t}", "void newGame() {\n\t\tstate = new model.State () ; \n\t\tif(host != null ) host.show(state) ; \n\t}", "public void createIsipship() {\r\n\t\tRandom randomGenerator = new Random();\r\n\t\tint posX = 840;\r\n\t\tint randomPosY = randomGenerator.nextInt(480); \r\n\t\tIsipEngineer isipEngineer = new IsipEngineer(posX, randomPosY);\r\n\t\tisipShips.add(isipEngineer);\r\n\t\t//rectangles.add(isipEngineer.r);\r\n\t}", "public void spawnNew() {\n\t\tif (tier> 1) {\n\t\t\ttier--;\n\t\t\thealth = tier;\n\t\t\tdamage = tier;\n\t\t\tspeed = 5;\n\t\t\timg = getImage(updateImage(tier)); // converted getImage to protected b/c it wasn't accessible by Balloon class (child class)\n\t\t}\n\t\telse {\n\t\t\tisAlive = false;\n\t\t\tdeletePath();\t\t\t\n\t\t}\n\t}", "private RepositorySystem newRepositorySystem()\n\t{\n\t\tDefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();\n\t\tlocator.addService( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );\n\t\tlocator.addService( TransporterFactory.class, FileTransporterFactory.class );\n\t\tlocator.addService( TransporterFactory.class, HttpTransporterFactory.class );\n\n\t\tlocator.setErrorHandler( new DefaultServiceLocator.ErrorHandler()\n\t\t{\n\t\t\t@Override\n\t\t\tpublic void serviceCreationFailed( Class<?> type, Class<?> impl, Throwable exception )\n\t\t\t{\n\t\t\t\texception.printStackTrace();\n\t\t\t}\n\t\t} );\n\n\t\treturn locator.getService( RepositorySystem.class );\n\t}", "public void newGame()\n\t{\n\t\tmap = new World(3, viewSize, playerFactions);\n\t\tview = new WorldView(map, viewSize, this);\n\t\tbar = new Sidebar(map, barSize);\n\t}", "public static Unit siege(){\n\t\tUnit unit = new Unit(\"Siege\", \"C_W_Siege\", 15, 5, 12, 14, 4);\n\t\tunit.addWep(new Weapon(\"Warhammer\",10,5));\n\t\tunit.addActive(ActiveType.SLAM);\n\t\tunit.addActive(ActiveType.POWER);\n\t\tunit.addPassive(PassiveType.ALERT);\n\t\treturn unit;\n\t}", "SpaceInvaderTest_VaisseauAvance_DeplacerVaisseauVersLaGauche createSpaceInvaderTest_VaisseauAvance_DeplacerVaisseauVersLaGauche();", "public VistaInicial crearventanaInicial(){\n if(vistaInicial==null){\n vistaInicial = new VistaInicial();\n }\n return vistaInicial;\n }", "@Override\n\tpublic LightTank create() {\n\t\treturn new LightTank(GameContext.getGameContext());\n\t}", "Container createContainer();", "public de.uni_koblenz.jgralabtest.schemas.gretl.pddsl.Chassis createChassis();", "public void createNewCube() {\n CUBE = new Cube();\n }", "AliciaLab createAliciaLab();", "void createNewContinent();", "public Entity newEntity() { return newMyEntity(); }", "public Entity newEntity() { return newMyEntity(); }", "public void create () {\n // TODO random generation of a ~100 x 100 x 100 world\n }", "public void createProbleem() throws InstantiationException,\n\t\t\tIllegalAccessException {\n\n\t\tMapViewer viewer = getViewer();\n\t\tMapContext context = viewer.getConfiguration().getContext();\n\n\t\tif (getMelding().getProbleem() != null) {\n\t\t\tmodelRepository.evictObject(getMelding().getProbleem());\n\t\t}\n\t\tprobleem = null;\n\t\tif (\"bord\".equals(probleemType)) {\n\n\t\t\tif (trajectType.endsWith(\"Route\")) {\n\t\t\t\tprobleem = (Probleem) modelRepository.createObject(\n\t\t\t\t\t\t\"RouteBordProbleem\", null);\n\n\t\t\t} else if (trajectType.contains(\"Netwerk\")) {\n\t\t\t\tprobleem = (Probleem) modelRepository.createObject(\n\t\t\t\t\t\t\"NetwerkBordProbleem\", null);\n\n\t\t\t}\n\n\t\t\t// Itereren over de lagen en de correcte lagen selecteerbaar zetten\n\t\t\tfor (FeatureMapLayer layer : context.getFeatureLayers()) {\n\t\t\t\tlayer.set(\"selectable\", false);\n\n\t\t\t\tif (layer.getLayerId().equalsIgnoreCase(trajectType + \"Bord\")) {\n\t\t\t\t\tlayer.set(\"selectable\", true);\n\t\t\t\t\tlayer.set(\"selectionMode\", FeatureSelectionMode.SINGLE);\n\t\t\t\t\tlayer.setSelection(new ArrayList<String>(1));\n\n\t\t\t\t} else if (layer.getLayerId().equalsIgnoreCase(\n\t\t\t\t\t\ttrajectType.replace(\"Segment\", \"\") + \"Bord\")) {\n\t\t\t\t\tlayer.set(\"selectable\", true);\n\t\t\t\t\tlayer.set(\"selectionMode\", FeatureSelectionMode.SINGLE);\n\t\t\t\t\tlayer.setSelection(new ArrayList<String>(1));\n\n\t\t\t\t} else if (layer.getLayerId().contains(\"Knooppunt\")) {\n\t\t\t\t\tlayer.set(\"selectable\", false);\n\t\t\t\t\tlayer.setSelection(Collections.EMPTY_LIST);\n\t\t\t\t}\n\n\t\t\t\telse if (layer.getLayerId().equalsIgnoreCase(\n\t\t\t\t\t\tGEOMETRY_LAYER_NAME)) {\n\t\t\t\t\tlayer.setHidden(true);\n\t\t\t\t\t((GeometryListFeatureMapLayer) layer)\n\t\t\t\t\t\t\t.setGeometries(Collections.EMPTY_LIST);\n\t\t\t\t} else {\n\t\t\t\t\tlayer.set(\"selectable\", false);\n\t\t\t\t\tlayer.setSelection(Collections.EMPTY_LIST);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\"ander\".equals(probleemType)) {\n\n\t\t\tif (trajectType.endsWith(\"Route\")) {\n\t\t\t\tprobleem = (Probleem) modelRepository.createObject(\n\t\t\t\t\t\t\"RouteAnderProbleem\", null);\n\n\t\t\t} else if (trajectType.contains(\"Netwerk\")) {\n\t\t\t\tprobleem = (Probleem) modelRepository.createObject(\n\t\t\t\t\t\t\"NetwerkAnderProbleem\", null);\n\t\t\t}\n\n\t\t\tfor (FeatureMapLayer layer : context.getFeatureLayers()) {\n\n\t\t\t\t// Geometrie laag\n\t\t\t\tif (layer.getLayerId().equalsIgnoreCase(GEOMETRY_LAYER_NAME)) {\n\t\t\t\t\tlayer.setHidden(false);\n\t\t\t\t\tlayer.set(\"selectable\", true);\n\t\t\t\t\tlayer.set(\"editable\", true);\n\t\t\t\t\t((GeometryListFeatureMapLayer) layer)\n\t\t\t\t\t\t\t.setGeometries(new ArrayList<Geometry>(1));\n\t\t\t\t}\n\n\t\t\t\t// Indien NetwerkSegment laag laag op selecteerbaar zetten\n\t\t\t\telse if (layer.getLayerId().equalsIgnoreCase(trajectType)) {\n\t\t\t\t\tlayer.set(\"selectable\", true);\n\t\t\t\t\tlayer.set(\"selectionMode\", FeatureSelectionMode.SINGLE);\n\t\t\t\t\tlayer.setSelection(new ArrayList<String>(1));\n\n\t\t\t\t} else {\n\t\t\t\t\tlayer.set(\"selectable\", false);\n\t\t\t\t\tlayer.setSelection(Collections.EMPTY_LIST);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tgetMelding().setProbleem(probleem);\n\t\tviewer.updateContext(null);\n\t}", "@Override\r\n\tpublic AbstractWrapGift createWrapGift() {\n\t\treturn new HolidaySurprise();\r\n\t}", "public void newGame() {\n // this.dungeonGenerator = new TowerDungeonGenerator();\n this.dungeonGenerator = cfg.getGenerator();\n\n Dungeon d = dungeonGenerator.generateDungeon(cfg.getDepth());\n Room[] rooms = d.getRooms();\n\n String playername = JOptionPane.showInputDialog(null, \"What's your name ?\");\n if (playername == null) playername = \"anon\";\n System.out.println(playername);\n\n this.player = new Player(playername, rooms[0], 0, 0);\n player.getCurrentCell().setVisible(true);\n rooms[0].getCell(0, 0).setEntity(player);\n\n frame.showGame();\n frame.refresh(player.getCurrentRoom().toString());\n frame.setHUD(player.getGold(), player.getStrength(), player.getCurrentRoom().getLevel());\n }", "@Override\n\tpublic IVoiture newVoiture() {\n\t\treturn new VoitureSport();\n\t}", "Vaisseau createVaisseau();", "void create(GameLogic gameLogic);", "public PersistentShopkeeper newShopkeeper(long idCreateIfLessZero) throws PersistenceException {\n if(idCreateIfLessZero > 0) return (PersistentShopkeeper)PersistentProxi.createProxi(idCreateIfLessZero, 192);\n long id = ConnectionHandler.getTheConnectionHandler().theShopkeeperFacade.getNextId();\n Shopkeeper result = new Shopkeeper(null,null,null,null,null,null,id);\n Cache.getTheCache().put(result);\n return (PersistentShopkeeper)PersistentProxi.createProxi(id, 192);\n }", "Elevage createElevage();", "public IResourceDepot createResourceDepot() {\n\n /*\n * Defining a ResourceDepot \"JackTruckDepot\" that can store DeliverGood and PickupGood.\n *\n */\n\n // We can store a maximum of 10 DeliverGood on our track (assuming that no other load is\n // present)\n // Further, we start with an initial load of 5 DeliverGoods.\n ILoadCapacity deliverGoodCapacity = new SimpleLoadCapacity(\"DeliverGood\", 10, 5);\n\n // We can store a maximum of 5 PickupGood on our track (assuming that no other load is present)\n ILoadCapacity pickupGoodCapacity = new SimpleLoadCapacity(\"PickupGood\", 5, 0);\n\n // Our depot can store a maximum of 10 total items. For example, 7 DeliverGoods\n // and 3 PickupGoods.\n IResourceDepot depot = new SimpleResourceDepot(\"JackTruckDepot\", 10);\n\n // Adding the capacities to our depot\n depot.add(deliverGoodCapacity);\n depot.add(pickupGoodCapacity);\n\n return depot;\n }", "SpacesInvaders_aUnVaisseau createSpacesInvaders_aUnVaisseau();", "@Override\n\tpublic Location newInstance() {\n\t\treturn new Location(this.X,this.Y,0);\n\t}", "public Game newGame( String player ) throws IllegalArgumentException{\n Game game = new Game();\n game.setPlayer( playersRepository.getByLogin( player )\n .orElseThrow( () -> new IllegalArgumentException( \"This player doesn't exists\" ) ) );\n game.setGuessedNumber( new Random( System.currentTimeMillis() ).ints( 0 , 9 )\n .distinct()\n .limit( 4 )\n .boxed()\n .map( String::valueOf )\n .collect( Collectors.joining( \"\" ) ) );\n return gamesRepository.saveAndFlush( game );\n }", "public static SolarSystem load() {\n\t\treturn null;\n\t}", "public interface EnemyShipPartsFactory {\n ESWeapon addESGun();\n ESEngine addESEngine();\n}", "public interface UnitFactory {\n Gui_Unit createUnit(String name, int team);\n Gui_Unit copy(Gui_Unit guiUnit);\n\n static UnitFactory getUnitFactory(UnitClassNames name){\n UnitFactory factory = null;\n\n switch (name){\n case ARTILLERY:{\n factory = new ArtilleryFactory();\n break;\n }\n case VEHICLE:{\n factory = new VehicleFactory();\n break;\n }\n case LIGHT_INFANTRY:{\n factory = new LightInfantryFactory();\n break;\n }\n case MELEE_INFANTRY:{\n factory = new MeleeInfantryFactory();\n break;\n }\n case HEAVY_INFANTRY:{\n factory = new HeavyInfantryFactory();\n break;\n }\n }\n return factory ;\n }\n}", "public void create(){}", "public WOComponent newDirector() {\n EOEditingContext ec = ERXEC.newEditingContext();\n EOEnterpriseObject director = ERXEOControlUtilities.createAndInsertObject(ec, \"Talent\");\n \n // Let's throw to a regular edit page\n EditPageInterface epi = (EditPageInterface)D2W.factory().pageForConfigurationNamed(\"EditTalent\", session());\n epi.setObject(director);\n epi.setNextPageDelegate(new CreateDirectorDelegate(movie(), context().page()));\n return (WOComponent)epi;\n }", "SpacesInvaders_deplacerVaisseauVersLaDroite createSpacesInvaders_deplacerVaisseauVersLaDroite();", "public edu.umich.icpsr.ddi.SoftwareType insertNewSoftware(int i)\n {\n synchronized (monitor())\n {\n check_orphaned();\n edu.umich.icpsr.ddi.SoftwareType target = null;\n target = (edu.umich.icpsr.ddi.SoftwareType)get_store().insert_element_user(SOFTWARE$20, i);\n return target;\n }\n }", "public RegistryCreator() {\n this.vehicleRegistry = new VehicleRegistry();\n this.inspectionResultRegistry = new InspectionResultRegistry();\n }", "public PlayerInterface createPlayer(String godName, PlayerInterface p) {\n God god = find(godName);\n p = addEffects(p, god.getEffects());\n return p;\n }", "public IDetectionAlgorithm createInstance();", "public SolutionResponse run() {\n try {\n Game game = gameApi.getNewGame();\n game.setWeatherReport(weatherApi.getWeather(game.getId()));\n game.setDragon(new Dragon());\n solver.solve(game);\n SolutionResponse solutionResponse = gameApi.putSolution(game);\n LOGGER.info(\"Game: \" + game.getId()\n + \" Result: \" + solutionResponse.getStatus()\n + \" Message: \" + solutionResponse.getMessage());\n return solutionResponse;\n } catch (Exception e) {\n LOGGER.severe(\"Solution failed: \" + e.getMessage());\n }\n return null;\n }", "private void createNewVisualPane(int solverId) {\n }", "@Override\n public Tournament newTournament() {\n String newId = Tournament.randomId();\n while(tournamentCache.containsKey(newId) || tournamentRepository.findById(newId).isPresent()){\n newId = Tournament.randomId();\n }\n Tournament newTournament = new Tournament(newId, fighterService);\n tournamentCache.put(newId, newTournament);\n return newTournament;\n }", "Schulleiter createSchulleiter();", "SpaceInvaderTest_test_AuDebut_JeuSpaceInvaderEstVide createSpaceInvaderTest_test_AuDebut_JeuSpaceInvaderEstVide();", "public Game createGame();", "@Override\n\tpublic Structure createNew() {\n\t\treturn new FloorSwitch();\n\t}", "AbstractWeapon createWeaponController(WeaponCard weaponCard);", "Secuencia createSecuencia();", "private void createInstances()\n {\n Room EnchantedForest, IdyllicGlade, GumdropHill, DenseWoods, VolcanoHell, SecretHotSpring, MagmaChamber, MysteriousCloud, SkyParadise, Cirrostratus, Nimbostratus, Stratocumulus, WaterTemple, Whirlpool, EyeoftheStorm, BossQuarters, Portal;\n \n random = new Random();\n allrooms = new ArrayList<Room>();\n \n // create the rooms providing an ID to be passed into the room constructor\n EnchantedForest = new EnchantedForestRoom();\n allrooms.add(EnchantedForest);\n IdyllicGlade = new IdyllicGladeRoom();\n allrooms.add(IdyllicGlade);\n GumdropHill = new GumdropHillRoom();\n allrooms.add(GumdropHill);\n DenseWoods = new DenseWoodsRoom();\n allrooms.add(DenseWoods);\n VolcanoHell = new VolcanoHellRoom();\n allrooms.add(VolcanoHell);\n SecretHotSpring = new SecretHotSpringRoom();\n allrooms.add(SecretHotSpring);\n MagmaChamber = new MagmaChamberRoom();\n allrooms.add(MagmaChamber);\n MysteriousCloud = new MysteriousCloudRoom();\n allrooms.add(MysteriousCloud);\n SkyParadise = new SkyParadiseRoom();\n allrooms.add(SkyParadise);\n Cirrostratus = new CirrostratusRoom();\n allrooms.add(Cirrostratus);\n Nimbostratus = new NimbostratusRoom();\n allrooms.add(Nimbostratus);\n Stratocumulus = new StratocumulusRoom();\n allrooms.add(Stratocumulus);\n WaterTemple = new WaterTempleRoom();\n allrooms.add(WaterTemple);\n Whirlpool = new WhirlpoolRoom();\n allrooms.add(Whirlpool);\n EyeoftheStorm = new EyeoftheStormRoom();\n allrooms.add(EyeoftheStorm);\n BossQuarters = new BossQuartersRoom(); \n allrooms.add(BossQuarters);\n Portal = new PortalRoom();\n \n \n // initialise room exits, items and creatures\n EnchantedForest.setExit(\"east\", IdyllicGlade);\n EnchantedForest.setExit(\"west\", GumdropHill);\n EnchantedForest.setExit(\"south\", DenseWoods);\n \n IdyllicGlade.setExit(\"west\", EnchantedForest);\n \n GumdropHill.setExit(\"down\", EnchantedForest);\n GumdropHill.setExit(\"up\", MysteriousCloud);\n\n DenseWoods.setExit(\"north\", EnchantedForest);\n DenseWoods.setExit(\"south\", VolcanoHell);\n \n MagmaChamber.setExit(\"north\",VolcanoHell);\n \n VolcanoHell.setExit(\"east\", SecretHotSpring);\n VolcanoHell.setExit(\"north\", DenseWoods);\n VolcanoHell.setExit(\"west\", MysteriousCloud);\n VolcanoHell.setExit(\"south\", MagmaChamber);\n \n SecretHotSpring.setExit(\"west\", VolcanoHell);\n \n MysteriousCloud.setExit(\"west\", VolcanoHell);\n MysteriousCloud.setExit(\"in\", Portal);\n MysteriousCloud.setExit(\"up\", SkyParadise);\n \n SkyParadise.setExit(\"down\", MysteriousCloud);\n SkyParadise.setExit(\"up\", Cirrostratus);\n SkyParadise.setExit(\"east\", Nimbostratus);\n \n Cirrostratus.setExit(\"north\", SkyParadise);\n Cirrostratus.setExit(\"down\", WaterTemple);\n \n Nimbostratus.setExit(\"west\", SkyParadise);\n Nimbostratus.setExit(\"east\", Stratocumulus);\n \n Stratocumulus.setExit(\"west\", Nimbostratus);\n Stratocumulus.setExit(\"down\", WaterTemple);\n \n WaterTemple.setExit(\"up\",Stratocumulus);\n WaterTemple.setExit(\"high\", Cirrostratus);\n WaterTemple.setExit(\"down\", Whirlpool);\n WaterTemple.setExit(\"in\", BossQuarters);\n \n Whirlpool.setExit(\"up\", WaterTemple);\n Whirlpool.setExit(\"down\", EyeoftheStorm);\n \n EyeoftheStorm.setExit(\"up\", Whirlpool);\n EyeoftheStorm.setExit(\"in\", BossQuarters);\n \n BossQuarters.setExit(\"out\", WaterTemple);\n \n currentRoom = EnchantedForest; \n }", "public static SpeciesCarnivorousFactory getInstance() {\n\t\treturn uniqueInstance;\n\t}", "void createPlayer(Player player);", "@Override\n\tpublic AbstractOriental createOrientale() {\n\t\treturn new OrientalSN();\n\t}", "@SuppressWarnings(\"null\")\r\n\t@Override\r\n\tpublic PWPSolution createSolution(InitialisationMode mode) {\n\t\t\r\n\t\tif (mode == InitialisationMode.RANDOM) {\r\n\t\t\r\n\t\tint[] solutions = new int[getNumberOfLocations()];//array of solutions\r\n\t\t\r\n\t\tfor (int i = 0 ; i <= getNumberOfLocations() -1 ; i++) { //enumerate the array, giving each location an integer value\r\n\t\t\t\r\n\t\t\tsolutions[i]= i;\r\n\t\t\t\r\n\t\t}\r\n\r\n\t\tCollections.shuffle(Arrays.asList(solutions)); //shuffle the array\r\n\t\t\r\n\t\tSolutionRepresentation solution = new SolutionRepresentation(solutions); //create a new solution representation using the array of ints\r\n\t\t\r\n\t\tObjectiveFunctionInterface objfunc = getPWPObjectiveFunction(); //get the objective function to be used \r\n\r\n\t\tPWPSolution sol = new PWPSolution(solution, objfunc.getObjectiveFunctionValue(solution)); //create the new PWPSolution using the solution representation and the value of the objective function applied to the solution\r\n\t\t\r\n\t\treturn sol;\r\n\t\t\r\n\t\t}\r\n\t\t\r\n\t\telse {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public Shoe makeShoe() {\n\treturn new Shoe();\r\n}", "Team createTeam();", "Negacion createNegacion();", "protected Container createContainer() {\n\treturn new EditorContainer();\n }", "public synchronized void spawnMe()\n\t{\n\t\t_itemInstance = ItemTable.getInstance().createItem(\"Combat\", _itemId, 1, null, null);\n\t\t_itemInstance.dropMe(null, _location.getX(), _location.getY(), _location.getZ());\n\t}", "protected DissertationStorage newDissertationStorage()\n\t{\n\t\treturn new DbCachedDissertationStorage(new DissertationStorageUser());\n\t}" ]
[ "0.5802541", "0.55415", "0.54170954", "0.54137605", "0.53964597", "0.5365078", "0.53516483", "0.5332904", "0.53123", "0.5311971", "0.52948236", "0.52936035", "0.52891636", "0.5287145", "0.5285555", "0.52789646", "0.5253525", "0.51855737", "0.51794153", "0.5171189", "0.5138658", "0.5121522", "0.508334", "0.5070864", "0.5067641", "0.504048", "0.50332886", "0.50329155", "0.5028641", "0.50216156", "0.5019781", "0.50190055", "0.50169194", "0.50167316", "0.50167316", "0.5015276", "0.49993193", "0.49929664", "0.4989489", "0.49776024", "0.49725232", "0.49474195", "0.49465275", "0.49413967", "0.4932487", "0.49256846", "0.49237338", "0.49216047", "0.49196205", "0.49172908", "0.49096954", "0.489992", "0.48765078", "0.48732138", "0.48706463", "0.48703635", "0.4866159", "0.4866159", "0.48574403", "0.48569378", "0.48489842", "0.48452014", "0.48427033", "0.48388055", "0.48334768", "0.48311666", "0.4828682", "0.48273787", "0.48218185", "0.48152012", "0.48122066", "0.48084417", "0.48011568", "0.47979364", "0.47928765", "0.47923303", "0.4786333", "0.4781752", "0.47817442", "0.47776482", "0.4771883", "0.4766472", "0.47556958", "0.47515303", "0.4748362", "0.4746604", "0.47425872", "0.47415516", "0.4736381", "0.47317213", "0.4724252", "0.47240788", "0.4721515", "0.4717846", "0.47145587", "0.47129074", "0.4709883", "0.47074825", "0.47066525", "0.47054666", "0.4700213" ]
0.0
-1
Larger is more responsive, but also less stable
@Override public void runOpMode() { robot.init(hardwareMap); telemetry.addData("Status", "DogeCV 2018.0 - Gold Align Example"); // Set up our telemetry dashboard composeTelemetry(); detector = new GoldAlignDetector(); detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance()); detector.useDefaults(); // Optional Tuning detector.alignSize = 100; // How wide (in pixels) is the range in which the gold object will be aligned. (Represented by green bars in the preview) detector.alignPosOffset = 0; // How far from center frame to offset this alignment zone. detector.downscale = 0.4; // How much to downscale the input frames detector.areaScoringMethod = DogeCV.AreaScoringMethod.MAX_AREA; // Can also be PERFECT_AREA detector.maxAreaScorer.weight = 0.005; detector.ratioScorer.weight = 5; detector.ratioScorer.perfectRatio = 1.0; detector.enable(); // Ensure the robot it stationary, then reset the encoders and calibrate the gyro. robot.leftDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); robot.rightDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); ; // Wait for the game to start (Display Gyro value), and reset gyro before we move.. while (!isStarted()) { telemetry.update(); } // Wait for the game to start (driver presses PLAY) waitForStart(); //---------------------------------------------------- // analyze the camera image to locate gold //---------------------------------------------------- double goldLocation = detector.getXPosition(); char targetLocation = 'X'; //X = error //L = Left //R = Right //C = Center // Left, Right, And Center Values if ((goldLocation > 5) && (goldLocation < 120)){ telemetry.addLine("Gold is LEFT"); targetLocation = 'L'; } else if ((goldLocation > 350)){ telemetry.addLine("Gold is RIGHT"); targetLocation = 'R'; } else if ((goldLocation > 120) && (goldLocation < 350)){ telemetry.addLine("Gold is Center"); targetLocation = 'C'; } else{ telemetry.addLine("ERROR no location detected"); targetLocation = 'X'; } // Update telemetry telemetry.update(); // turn off DogeCV detector.disable(); //---------------------------------------------------- // Drop down from the Lander //---------------------------------------------------- //---------------------------------------------------- // Based on where the Gold mineral is decide // where to drive //---------------------------------------------------- switch (targetLocation){ case 'R': //code here for gold on right break; case 'C': //code here for gold in the center encoderDrive(0.4, 38, 38, 5.0); encoderDrive(0.4, -11, -11, 5.0); gyroTurn(0.4, 90, 2.0); encoderDrive(0.4, 30, 30, 5.0); gyroTurn(0.4, 45, 2.0); encoderDrive(0.4, 12, 12, 5.0); gyroTurn(0.4, 130, 2.0 ); encoderDrive(0.4, 45, 45, 5.0); //servo dump the marker eTime.reset(); while (opModeIsActive() && (eTime.seconds() < 2.0)) { robot.markerDeploy.setPosition(1); } gyroTurn(0.4, 140, 2.0); encoderDrive(0.4, -78, -78, 5.0); //parked at crater - DONE! robot.markerDeploy.setPosition(0); break; case 'L': //code here for gold on left break; case 'X': default: //code here error case break; } //---------------------------------------------------- // Drive to Depot to Drop off Team Marker //---------------------------------------------------- }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void settings() { size(1200, 800); }", "private final void m126208g() {\n int i;\n int i2;\n int i3;\n int i4;\n int i5;\n if (!this.f102568b.mIsFromDraft || !this.f102568b.hasStickers()) {\n boolean a = C39804em.m127437a(this.f102568b.videoWidth(), this.f102568b.videoHeight());\n if (a) {\n i = this.f102568b.videoWidth();\n } else {\n int[] k = C36964i.m118935k();\n if (k != null) {\n i3 = k[0];\n } else {\n i3 = 720;\n }\n i = m125903a(C7551d.m23567d(this.f102568b.videoWidth(), i3));\n }\n this.f102569c = i;\n if (a) {\n i2 = this.f102568b.videoHeight();\n } else {\n double d = (double) this.f102569c;\n Double.isNaN(d);\n i2 = (int) (Math.ceil(d / 9.0d) * 16.0d);\n }\n this.f102570d = i2;\n return;\n }\n if (this.f102568b.mVideoCanvasWidth > 0) {\n i4 = this.f102568b.mVideoCanvasWidth;\n } else {\n i4 = this.f102568b.videoWidth();\n }\n this.f102569c = i4;\n if (this.f102568b.mVideoCanvasHeight > 0) {\n i5 = this.f102568b.mVideoCanvasHeight;\n } else {\n i5 = this.f102568b.videoHeight();\n }\n this.f102570d = i5;\n }", "protected byte desiredWinScale() { return 9; }", "private static void initUsableDisplaySizes() {\n\t\t// Optimized display dimensions for display resolutions\n\t\tdisplaySizes.add(new Dimension(640, 480)); // Smaller 4:3 (1024x768 and smaller)\n\t\tdisplaySizes.add(new Dimension(800, 600)); // Larger 4:3 (1280x1024)\n\t\tdisplaySizes.add(new Dimension(864, 486)); // Larger 16:9 (1366x768 and larger)\n\t}", "boolean isAdaptive();", "private void m8132a() {\n this.f6227a.setScaleType(ScaleType.FIT_XY);\n addView(this.f6227a, new LayoutParams(-2, -2));\n C2322j.m9044a(this.f6227a, C2322j.INTERNAL_AD_MEDIA);\n }", "@Override\n\tpublic boolean canfitSmall() {\n\t\treturn true;\n\t}", "public void m2259G() {\n try {\n mo61159b().getWindowManager().getDefaultDisplay().getMetrics(this.f2509j);\n C5025c.m3268a(mo61159b(), this.f2509j.widthPixels, this.f2509j.heightPixels, this.f2489d);\n C5025c.m3275b(mo61159b(), this.f2509j.widthPixels, this.f2509j.heightPixels, this.f2489d);\n C5025c.m3267a(mo61159b(), 0, 0, this.f2509j.widthPixels, this.f2509j.heightPixels, this.f2489d);\n C5025c.m3274b(mo61159b(), 0, 0, this.f2509j.widthPixels, this.f2509j.heightPixels, this.f2489d);\n } catch (Exception e) {\n C5017f.m3256a(mo61159b(), C5015d.EXCEPTION, \"MraidMode.updateDisplayMetrics\", e.getMessage(), \"\");\n }\n }", "private void computeRatio() {\n int i;\n int i2;\n int i3;\n boolean z = false;\n if (CameraSettings.getStrictAspectRatio(this.mRenderWidth, this.mRenderHeight) > -1 || !CameraSettings.isNearAspectRatio(this.mCameraWidth, this.mCameraHeight, this.mRenderWidth, this.mRenderHeight)) {\n int i4 = this.mCameraWidth;\n int i5 = this.mCameraHeight;\n switch (this.mTargetRatio) {\n case 0:\n this.mIsFullScreen = false;\n this.mIsRatio16_9 = false;\n if (!CameraSettings.isAspectRatio4_3(i4, i5)) {\n this.mNeedCropped = true;\n if (i4 * 4 > i5 * 3) {\n int i6 = (int) (((float) i5) * 0.75f);\n this.mScaleX = ((float) i6) / ((float) i4);\n i4 = i6;\n } else {\n int i7 = (int) ((((float) i4) * 4.0f) / 3.0f);\n this.mScaleY = ((float) i7) / ((float) i5);\n i5 = i7;\n }\n } else {\n this.mNeedCropped = false;\n this.mScaleX = 1.0f;\n this.mScaleY = 1.0f;\n }\n if (CameraSettings.sCroppedIfNeeded) {\n this.mIsFullScreen = true;\n this.mNeedCropped = true;\n this.mIsRatio16_9 = true;\n i = (int) ((((float) i4) * 16.0f) / 9.0f);\n this.mScaleX *= 0.75f;\n } else {\n i = i5;\n }\n if (b.isPad()) {\n this.mIsFullScreen = true;\n break;\n }\n break;\n case 1:\n this.mIsRatio16_9 = true;\n this.mIsFullScreen = true;\n if (!CameraSettings.isAspectRatio16_9(i4, i5)) {\n this.mNeedCropped = true;\n if (i4 * 16 <= i5 * 9) {\n int i8 = (int) ((((float) i4) * 16.0f) / 9.0f);\n this.mScaleY = ((float) i8) / ((float) i5);\n int i9 = i8;\n i2 = i4;\n i3 = i9;\n if (b.isPad()) {\n this.mIsRatio16_9 = false;\n this.mNeedCropped = true;\n i3 = (int) (((float) i3) * 0.75f);\n this.mScaleY *= 0.75f;\n }\n i = i3;\n i4 = i2;\n break;\n } else {\n i2 = (int) ((((float) i5) * 9.0f) / 16.0f);\n this.mScaleX = ((float) i2) / ((float) i4);\n }\n } else {\n this.mNeedCropped = false;\n this.mScaleX = 1.0f;\n this.mScaleY = 1.0f;\n i2 = i4;\n }\n i3 = i5;\n if (b.isPad()) {\n }\n i = i3;\n i4 = i2;\n case 2:\n this.mIsFullScreen = false;\n this.mIsRatio16_9 = false;\n this.mNeedCropped = true;\n if (i4 != i5) {\n this.mScaleX = 1.0f;\n this.mScaleY = ((float) i4) / ((float) i5);\n i = i4;\n break;\n }\n default:\n i = i5;\n break;\n }\n this.mWidth = i4;\n this.mHeight = i;\n } else if (!(this.mCameraWidth == 0 || this.mCameraHeight == 0)) {\n if (this.mRenderWidth == 0 || this.mRenderHeight == 0 || this.mRenderWidth * this.mCameraHeight == this.mRenderHeight * this.mCameraWidth) {\n this.mNeedCropped = false;\n this.mScaleX = 1.0f;\n this.mScaleY = 1.0f;\n this.mWidth = this.mCameraWidth;\n this.mHeight = this.mCameraHeight;\n } else {\n this.mNeedCropped = true;\n if (this.mCameraWidth * this.mRenderHeight > this.mCameraHeight * this.mRenderWidth) {\n this.mHeight = this.mCameraHeight;\n this.mWidth = (this.mCameraHeight * this.mRenderWidth) / this.mRenderHeight;\n this.mScaleX = ((float) this.mWidth) / ((float) this.mCameraWidth);\n this.mScaleY = 1.0f;\n } else {\n this.mWidth = this.mCameraWidth;\n this.mHeight = (this.mCameraWidth * this.mRenderHeight) / this.mRenderWidth;\n this.mScaleX = 1.0f;\n this.mScaleY = ((float) this.mHeight) / ((float) this.mCameraHeight);\n }\n }\n if ((((float) this.mRenderHeight) / ((float) this.mRenderWidth)) - (((float) Util.sWindowHeight) / ((float) Util.sWindowWidth)) < 0.1f) {\n z = true;\n }\n this.mIsFullScreen = z;\n }\n updateRenderSize();\n updateRenderRect();\n }", "private void m76768f() {\n m76770h();\n m76769g();\n }", "public boolean isResponsive() {\n\t\treturn responsive;\n\t}", "public void resize_screen(){\r\n \tstop_scn_updates();\r\n \tscn_font_size = min_font_size+1;\r\n \twhile (scn_font_size < max_font_size){\r\n \t\tscn_font = new Font(tz390.z390_font,Font.BOLD,scn_font_size);\r\n \t\tcalc_screen_size();\r\n \t\tif (scn_image.getWidth() < main_panel_width\r\n \t\t\t&& scn_image.getHeight() < main_panel_height){\r\n \t\t\tscn_font_size++;\r\n \t\t} else {\r\n \t\t scn_font_size--;\r\n \t\t break;\r\n \t\t}\r\n \t} \t\r\n \tscn_font = new Font(tz390.z390_font,Font.BOLD,scn_font_size);\r\n \tcalc_screen_size();\r\n start_scn_updates();\r\n }", "public void onMeasure(int r12, int r13) {\n /*\n r11 = this;\n super.onMeasure(r12, r13);\n r12 = r11.videoAspectRatio;\n r13 = 0;\n r12 = (r12 > r13 ? 1 : (r12 == r13 ? 0 : -1));\n if (r12 > 0) goto L_0x000b;\n L_0x000a:\n return;\n L_0x000b:\n r12 = r11.getMeasuredWidth();\n r0 = r11.getMeasuredHeight();\n r1 = (float) r12;\n r2 = (float) r0;\n r3 = r1 / r2;\n r4 = r11.videoAspectRatio;\n r4 = r4 / r3;\n r5 = 1065353216; // 0x3f800000 float:1.0 double:5.263544247E-315;\n r4 = r4 - r5;\n r6 = java.lang.Math.abs(r4);\n r7 = 1008981770; // 0x3c23d70a float:0.01 double:4.9850323E-315;\n r8 = 0;\n r6 = (r6 > r7 ? 1 : (r6 == r7 ? 0 : -1));\n if (r6 > 0) goto L_0x0031;\n L_0x0029:\n r12 = r11.aspectRatioUpdateDispatcher;\n r13 = r11.videoAspectRatio;\n r12.scheduleUpdate(r13, r3, r8);\n return;\n L_0x0031:\n r6 = r11.resizeMode;\n r7 = 2;\n r9 = 1;\n if (r6 == 0) goto L_0x0061;\n L_0x0037:\n if (r6 == r9) goto L_0x005c;\n L_0x0039:\n if (r6 == r7) goto L_0x0056;\n L_0x003b:\n r10 = 3;\n if (r6 == r10) goto L_0x004c;\n L_0x003e:\n r10 = 4;\n if (r6 == r10) goto L_0x0042;\n L_0x0041:\n goto L_0x006b;\n L_0x0042:\n r13 = (r4 > r13 ? 1 : (r4 == r13 ? 0 : -1));\n if (r13 <= 0) goto L_0x0049;\n L_0x0046:\n r12 = r11.videoAspectRatio;\n goto L_0x0058;\n L_0x0049:\n r13 = r11.videoAspectRatio;\n goto L_0x005e;\n L_0x004c:\n r13 = (r4 > r13 ? 1 : (r4 == r13 ? 0 : -1));\n if (r13 > 0) goto L_0x0053;\n L_0x0050:\n r13 = r11.videoAspectRatio;\n goto L_0x005e;\n L_0x0053:\n r12 = r11.videoAspectRatio;\n goto L_0x0058;\n L_0x0056:\n r12 = r11.videoAspectRatio;\n L_0x0058:\n r2 = r2 * r12;\n r12 = (int) r2;\n goto L_0x006b;\n L_0x005c:\n r13 = r11.videoAspectRatio;\n L_0x005e:\n r1 = r1 / r13;\n r0 = (int) r1;\n goto L_0x006b;\n L_0x0061:\n r13 = (r4 > r13 ? 1 : (r4 == r13 ? 0 : -1));\n if (r13 <= 0) goto L_0x0068;\n L_0x0065:\n r13 = r11.videoAspectRatio;\n goto L_0x005e;\n L_0x0068:\n r12 = r11.videoAspectRatio;\n goto L_0x0058;\n L_0x006b:\n r13 = r11.aspectRatioUpdateDispatcher;\n r1 = r11.videoAspectRatio;\n r13.scheduleUpdate(r1, r3, r9);\n r13 = 1073741824; // 0x40000000 float:2.0 double:5.304989477E-315;\n r12 = android.view.View.MeasureSpec.makeMeasureSpec(r12, r13);\n r13 = android.view.View.MeasureSpec.makeMeasureSpec(r0, r13);\n super.onMeasure(r12, r13);\n r12 = r11.getChildCount();\n L_0x0083:\n if (r8 >= r12) goto L_0x00cc;\n L_0x0085:\n r13 = r11.getChildAt(r8);\n r0 = r13 instanceof android.view.TextureView;\n if (r0 == 0) goto L_0x00c9;\n L_0x008d:\n r12 = r11.matrix;\n r12.reset();\n r12 = r11.getWidth();\n r12 = r12 / r7;\n r0 = r11.getHeight();\n r0 = r0 / r7;\n r1 = r11.matrix;\n r2 = r11.rotation;\n r2 = (float) r2;\n r12 = (float) r12;\n r0 = (float) r0;\n r1.postRotate(r2, r12, r0);\n r1 = r11.rotation;\n r2 = 90;\n if (r1 == r2) goto L_0x00b0;\n L_0x00ac:\n r2 = 270; // 0x10e float:3.78E-43 double:1.334E-321;\n if (r1 != r2) goto L_0x00c1;\n L_0x00b0:\n r1 = r11.getHeight();\n r1 = (float) r1;\n r2 = r11.getWidth();\n r2 = (float) r2;\n r1 = r1 / r2;\n r2 = r11.matrix;\n r5 = r5 / r1;\n r2.postScale(r5, r1, r12, r0);\n L_0x00c1:\n r13 = (android.view.TextureView) r13;\n r12 = r11.matrix;\n r13.setTransform(r12);\n goto L_0x00cc;\n L_0x00c9:\n r8 = r8 + 1;\n goto L_0x0083;\n L_0x00cc:\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.exoplayer2.p003ui.AspectRatioFrameLayout.onMeasure(int, int):void\");\n }", "@Override\n protected float getDownScaleFactor() {\n return (float) 5.0;\n }", "private void m14909j() {\n getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {\n public void onGlobalLayout() {\n if (VERSION.SDK_INT < 16) {\n C3243f.this.getViewTreeObserver().removeGlobalOnLayoutListener(this);\n } else {\n C3243f.this.getViewTreeObserver().removeOnGlobalLayoutListener(this);\n }\n int hypot = (int) Math.hypot((double) C3243f.this.getWidth(), (double) C3243f.this.getHeight());\n int i = 0;\n if (C3243f.this.f8718g != null) {\n i = C3243f.this.f8718g.getWidth() / 2;\n } else if (C3243f.this.f8707K > 0 || C3243f.this.f8708L > 0 || C3243f.this.f8709M > 0) {\n C3243f.this.f8700D = C3243f.this.f8705I;\n C3243f.this.f8701E = C3243f.this.f8706J;\n }\n Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(C3243f.this, C3243f.this.f8700D, C3243f.this.f8701E, (float) i, (float) hypot);\n createCircularReveal.setDuration((long) C3243f.this.f8697A);\n if (C3243f.this.f8731t != null) {\n createCircularReveal.addListener(new AnimatorListenerAdapter() {\n public void onAnimationEnd(Animator animator) {\n C3243f.this.f8731t.mo10411a();\n }\n });\n }\n createCircularReveal.setInterpolator(AnimationUtils.loadInterpolator(C3243f.this.f8713b, 17563650));\n createCircularReveal.start();\n }\n });\n }", "@Override\n public void settings(){\n size(500, 500);\n }", "public void a() {\n int i = f5624a.getResources().getDisplayMetrics().densityDpi;\n q.l = i;\n if (i <= 320) {\n q.j = 256;\n } else if (i <= 480) {\n q.j = 384;\n } else {\n q.j = 512;\n }\n if (i <= 120) {\n q.f6266a = 0.5f;\n } else if (i <= 160) {\n q.f6266a = 0.6f;\n q.a(18);\n } else if (i <= 240) {\n q.f6266a = 0.87f;\n } else if (i <= 320) {\n q.f6266a = 1.0f;\n } else if (i <= 480) {\n q.f6266a = 1.5f;\n } else {\n q.f6266a = 1.8f;\n }\n if (q.f6266a <= 0.6f) {\n q.f6268c = 18;\n }\n }", "@Override\n\tpublic boolean canfitLarge() {\n\t\treturn true;\n\t}", "private void m4813i() {\n if (this.f6596d == 0.0f) {\n for (int i = 0; i < this.f6594b.getChildCount(); i++) {\n float f = this.f6596d;\n if (f == 0.0f) {\n f = (float) this.f6594b.getChildAt(i).getMeasuredWidth();\n }\n this.f6596d = f;\n this.f6596d = Math.min(f, (float) this.f6594b.getChildAt(i).getMeasuredWidth());\n }\n }\n }", "private void m51190e(View view) {\n int i;\n boolean z = true;\n if (view instanceof RecyclerView) {\n RecyclerView recyclerView = (RecyclerView) view;\n C1638g adapter = recyclerView.getAdapter();\n if (adapter != null && adapter.mo7325b() != this.f31668w) {\n this.f31667v = false;\n this.f31668w = adapter.mo7325b();\n C1651o layoutManager = recyclerView.getLayoutManager();\n if (layoutManager != null) {\n if (layoutManager instanceof LinearLayoutManager) {\n i = Math.abs(((LinearLayoutManager) layoutManager).mo6960O());\n } else if (layoutManager instanceof StaggeredGridLayoutManager) {\n StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;\n int[] c = staggeredGridLayoutManager.mo7604c(new int[staggeredGridLayoutManager.mo7594T()]);\n i = Math.abs(c[c.length - 1]);\n } else {\n i = 0;\n }\n if (i >= this.f31668w - 1) {\n z = false;\n }\n this.f31667v = z;\n return;\n }\n return;\n }\n return;\n }\n this.f31667v = true;\n }", "public MyBmpInfo getThumbnail(Uri uri) {\n int w = 1280;\n int h = 960;\n double TARGETTED_WIDTH = 1920.0;\n\n try {\n InputStream input = this.getContentResolver().openInputStream(uri);\n\n BitmapFactory.Options onlyBoundsOptions = new BitmapFactory.Options();\n onlyBoundsOptions.inJustDecodeBounds = true;\n onlyBoundsOptions.inDither = true;//optional\n onlyBoundsOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;//optional\n BitmapFactory.decodeStream(input, null, onlyBoundsOptions);\n input.close();\n\n if ((onlyBoundsOptions.outWidth == -1) || (onlyBoundsOptions.outHeight == -1)) {\n return null;\n }\n\n int originalWidth = onlyBoundsOptions.outWidth;\n\n double ratio = 1.0;\n if (originalWidth > TARGETTED_WIDTH){\n\n /*\n * Ratio Sample Size:\n * if 1 , means bitmap is exactly stay as orginal.\n * if 2 or above, means 1/2 or smaller from the ori image.*/\n ratio = originalWidth / TARGETTED_WIDTH;\n }\n\n BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();\n bitmapOptions.inSampleSize = (int)Math.round(ratio);\n\n Log.d(\"bitmap scaled info\", \"ratio = \"+ratio+\" , poweredRatio = \"+bitmapOptions.inSampleSize+\", originalWidth = \"+originalWidth+\" , TARGETTED_WIDTH = \"+TARGETTED_WIDTH);\n\n bitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;//\n input = this.getContentResolver().openInputStream(uri);\n Bitmap bitmap = BitmapFactory.decodeStream(input, null, bitmapOptions);\n// bitmap.compress(Bitmap.CompressFormat.JPEG, 100, )\n input.close();\n Log.d(\"elliot\", \"bitmap before resize: SIZE = \" + bitmap.getWidth() + \" x \" + bitmap.getHeight());\n if (bitmap.getWidth() < w || bitmap.getHeight() < h) {\n return new MyBmpInfo(bitmap, \"Image is too small\", true);\n } else {\n return new MyBmpInfo(Bitmap.createScaledBitmap(bitmap, w, h, true), \"\", false);\n }\n\n } catch (Exception e) {\n return null;\n }\n }", "@Override\n protected float calculateSpeedPerPixel\n (DisplayMetrics displayMetrics) {\n return MILLISECONDS_PER_INCH/displayMetrics.densityDpi;\n }", "private static void getRealSize(Display Pdisplay,Point Ppoint) //~vam6I~//~1am3I~//~va54I~\r\n { //~vam6I~//~1am3I~//~va54I~\r\n\t\tif (Dump.Y) Dump.println(\"Utils.getRealSize apiLevel=\"+Build.VERSION.SDK_INT);//~vam6I~//~1am3I~//~va54I~//~va56R~\r\n\t\tif (Build.VERSION.SDK_INT>=31) //Navigationbar can be hidden//~vam6I~//~1am3I~//~va54I~\r\n\t\t getRealSize_from31(Pdisplay,Ppoint); //~vam6I~//~1am3I~//~va54I~\r\n else //~vam6I~//~1am3I~//~va54I~\r\n\t\t getRealSize_19To30(Pdisplay,Ppoint); //~vam6I~//~1am3I~//~va54I~\r\n\t\tif (Dump.Y) Dump.println(\"Utils.getRealSize exit point=\"+Ppoint);//~vam6I~//~1am3I~//~va54I~//~va56R~\r\n }", "private float ScreenWidth() {\n RelativeLayout linBoardGame = (RelativeLayout) ((Activity) context).findViewById(R.id.gridContainer);\n Resources r = linBoardGame.getResources();\n DisplayMetrics d = r.getDisplayMetrics();\n return d.widthPixels;\n }", "public void mo60894a() {\n int i;\n this.f61656f = new SmartAvatarImageView(getContext());\n if (C6399b.m19946v()) {\n ((C13438a) this.f61656f.getHierarchy()).mo32891a((int) R.color.a5q, C13423b.f35599g);\n }\n addView(this.f61656f, getAvatarLayoutParams());\n LayoutParams a = m76775a(getVerifyIconSize());\n this.f61651a = new ImageView(getContext());\n int i2 = R.drawable.amq;\n try {\n this.f61651a.setImageDrawable(getResources().getDrawable(R.drawable.amq));\n } catch (NotFoundException unused) {\n }\n this.f61651a.setVisibility(8);\n LayoutParams a2 = m76775a(getVerifyIconSize());\n this.f61652b = new ImageView(getContext());\n try {\n this.f61652b.setImageDrawable(getResources().getDrawable(R.drawable.amq));\n } catch (NotFoundException unused2) {\n }\n this.f61652b.setVisibility(8);\n this.f61653c = new ImageView(getContext());\n try {\n ImageView imageView = this.f61653c;\n Resources resources = getResources();\n if (C6399b.m19944t()) {\n i = R.drawable.amp;\n } else {\n i = R.drawable.amq;\n }\n imageView.setImageDrawable(resources.getDrawable(i));\n } catch (NotFoundException unused3) {\n }\n this.f61653c.setVisibility(8);\n this.f61654d = new ImageView(getContext());\n try {\n this.f61654d.setImageDrawable(getResources().getDrawable(R.drawable.amm));\n } catch (NotFoundException unused4) {\n }\n this.f61654d.setVisibility(8);\n this.f61655e = new ImageView(getContext());\n try {\n ImageView imageView2 = this.f61655e;\n Resources resources2 = getResources();\n if (C6399b.m19944t()) {\n i2 = R.drawable.amp;\n }\n imageView2.setImageDrawable(resources2.getDrawable(i2));\n } catch (NotFoundException unused5) {\n }\n this.f61655e.setVisibility(8);\n addView(this.f61651a, a);\n addView(this.f61652b, a2);\n addView(this.f61653c, a2);\n addView(this.f61654d, a2);\n addView(this.f61655e, a2);\n }", "private boolean isXLargeTablet() {\n if (((WindowManager) this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation() % 180 != 0)\n return true;\n return false;\n }", "public int getLargeur() {\n return getWidth();\n }", "private boolean isSmallTablet(DisplayMetrics metrics) {\n float dpWidth = metrics.widthPixels / metrics.density;\n return (dpWidth >= 600 && dpWidth < 720);\n }", "private static float m590o(Context context) {\r\n DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();\r\n Point point = new Point(displayMetrics.widthPixels, displayMetrics.heightPixels);\r\n return ((float) point.y) / ((float) point.x);\r\n }", "private void scaleBatteryMeterViews() {\n Resources res = getContext().getResources();\n TypedValue typedValue = new TypedValue();\n\n res.getValue(R.dimen.status_bar_icon_scale_factor, typedValue, true);\n float iconScaleFactor = typedValue.getFloat();\n\n int batteryHeight = res.getDimensionPixelSize(R.dimen.status_bar_battery_icon_height);\n int batteryWidth = res.getDimensionPixelSize(R.dimen.status_bar_battery_icon_width);\n int marginBottom = res.getDimensionPixelSize(R.dimen.battery_margin_bottom);\n\n LinearLayout.LayoutParams scaledLayoutParams = new LinearLayout.LayoutParams(\n (int) (batteryWidth * iconScaleFactor), (int) (batteryHeight * iconScaleFactor));\n scaledLayoutParams.setMargins(0, 0, 0, marginBottom);\n\n mBatteryIconView.setLayoutParams(scaledLayoutParams);\n FontSizeUtils.updateFontSize(mBatteryPercentView, R.dimen.qs_time_expanded_size);\n }", "private void calc_screen_size(){\r\n \tscn_grid.setFont(scn_font);\r\n \tscn_context = scn_grid.getFontRenderContext();\r\n \t scn_layout = new TextLayout(\"X\",scn_font,scn_context);\r\n scn_char_rect = scn_layout.getBlackBoxBounds(0,1).getBounds();\r\n scn_char_height = (int) (scn_char_rect.getHeight()); // RPI 630 was Width in err, 6 to *1.5\r\n \tscn_char_base = scn_char_height/2+1;\r\n \tscn_char_height = scn_char_height + scn_char_base+2;\r\n scn_char_width = (int) (scn_char_rect.getWidth()); // RPI 630 was Height in err\r\n \tscn_height = scn_rows * scn_char_height; // RPI 408 + 5 \r\n \tscn_width = scn_cols * scn_char_width + 3; // RPI 408 + 5 \r\n \tscn_size = new Dimension(scn_width,scn_height);\r\n \tscn_image = new BufferedImage(scn_width,scn_height,BufferedImage.TYPE_INT_ARGB);\r\n \tscn_grid = scn_image.createGraphics();\r\n \tscn_grid.setFont(scn_font); \r\n scn_grid.setColor(scn_text_color);\r\n \t scn_context = scn_grid.getFontRenderContext();\r\n scn_grid.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r\n RenderingHints.VALUE_ANTIALIAS_ON);\r\n }", "private static DisplayMetrics m36216l(View view) {\n if (VERSION.SDK_INT >= 17) {\n WeakReference<Activity> weakReference = C10929a.f33413a;\n if (weakReference != null) {\n Activity activity = (Activity) weakReference.get();\n if (activity != null) {\n DisplayMetrics displayMetrics = new DisplayMetrics();\n activity.getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);\n return displayMetrics;\n }\n }\n }\n return view.getContext().getResources().getDisplayMetrics();\n }", "public float getEqualizationScale() {\n return Gdx.graphics.getWidth() / WE.getCurrentConfig().getRenderResolutionWidth();\n }", "private static boolean isXLargeTablet(Context context) {\n return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "private static boolean isXLargeTablet(Context context)\n {\n return (context.getResources().getConfiguration().screenLayout\n & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "private int m23822a() {\n int min = Math.min(this.f25314a.getMemoryClass() * 1048576, Integer.MAX_VALUE);\n if (min < 33554432) {\n return 4194304;\n }\n if (min < 67108864) {\n return 6291456;\n }\n if (VERSION.SDK_INT < 11) {\n return 8388608;\n }\n return min / 4;\n }", "private void m11878c() {\n if (!((Boolean) LiveConfigSettingKeys.LIVE_ENABLE_SMALL_ITEM_BEAUTY.mo10240a()).booleanValue()) {\n if (this.f9682k == null) {\n this.f9682k = LiveBeautyDialogFragment.m10555a(new C2576a() {\n /* renamed from: a */\n public final void mo9187a(float f) {\n if (C3135v.this.f9672a != null) {\n C3135v.this.f9672a.mo9582a(((C7853a) LiveSettingKeys.LIVE_BEAUTY_PARAM.mo10240a()).f21217a.f21222a * f);\n }\n }\n\n /* renamed from: b */\n public final void mo9188b(float f) {\n if (C3135v.this.f9672a != null) {\n C3135v.this.f9672a.mo9586b(((C7853a) LiveSettingKeys.LIVE_BEAUTY_PARAM.mo10240a()).f21218b.f21222a * f);\n }\n }\n\n /* renamed from: c */\n public final void mo9189c(float f) {\n if (C3135v.this.f9672a != null) {\n C3135v.this.f9672a.mo9588c(((C7853a) LiveSettingKeys.LIVE_BEAUTY_PARAM.mo10240a()).f21219c.f21222a * f);\n }\n }\n\n /* renamed from: d */\n public final void mo9190d(float f) {\n if (C3135v.this.f9672a != null) {\n C3135v.this.f9672a.mo9589d(((C7853a) LiveSettingKeys.LIVE_BEAUTY_PARAM.mo10240a()).f21220d.f21222a * f);\n }\n }\n }, this.f9689r, true, 0, false);\n ((LiveBeautyDialogFragment) this.f9682k).f8243a = new C3082aa(this);\n }\n this.f9682k.show(this.f9684m.getChildFragmentManager(), \"beauty_filter_dialog_tag\");\n } else if (!C3091aj.m11784a(C3358ac.m12528e())) {\n C9049ap.m27022a((int) R.string.fcw);\n return;\n } else if (this.f9684m != null) {\n this.f9682k = C2515f.m10417f().mo9075b().mo9213a(this.f9684m.getActivity(), Boolean.valueOf(false));\n ((LiveSmallItemBeautyDialogFragment) this.f9682k).mo9224a((OnDismissListener) new C3137w(this));\n }\n m11874a(8);\n }", "public void settings() {\r\n size(750, 550);\r\n }", "public void smallerRocks() {\n\t\t// make the asteroid smaller\n\t\t// by dividing the width by SIZE_INC\n\t\twidth = width / SIZE_INC;\n\n\t\t// set the end points with new location being the first line's start\n\t\tmakeEndPoints(width, outLine[0].getStart().getX(), outLine[0]\n\t\t\t\t.getStart().getY());\n\n\t\t// and make it a little faster\n\t\txSpeed = INC * xSpeed;\n\t\tySpeed = INC * ySpeed;\n\n\t}", "@Override\n protected void onMeasure(int w, int h) {\n w = MeasureSpec.getSize(w);\n h = MeasureSpec.getSize(h);\n// Log.d(\"surfMeasure\", w + \" \" + h);\n\n int oldH = h, oldW = w;\n\n if (w >= 0 && h >= 0) {\n\n if (h == 0 || !fullScreenDisplay || w / ((double) h) <= 16 / 9.0) {\n h = (int) (w * 9 / 16.0);\n } else {\n w = (int) (h * 16 / 9.0);\n }\n if (fullScreen) {\n setX((oldW - w) / 2);\n setY((oldH - h) / 2);\n }\n// Display.this.setLayoutParams(new LinearLayout.LayoutParams(w, h));\n }\n\n updateSizes(w, h);\n\n// Log.d(\"si\", w + \" \" + h);\n\n\n setMeasuredDimension(w, h);\n Display.this.setMeasuredDimension(w, h);\n\n// super.onMeasure(w, h);\n// ViewGroup.LayoutParams lp = getLayoutParams();\n// lp.width = w;\n// lp.height = h;\n// this.setLayoutParams(lp);\n// setMinimumWidth(w);\n// setMinimumHeight(h);\n\n }", "public Point relativePoint(Point p){\n System.out.println(\"DENSITY:\"+getResources().getDisplayMetrics().density);\n DisplayMetrics dm = getResources().getDisplayMetrics();\n System.out.println(dm);\n\n //--good for MOUNTAIN_SIZE==1.5\n// float scale = 1 * getResources().getDisplayMetrics().density /( dm.xdpi/dm.densityDpi) ;\n// float y_move = mountain_max;\n//\n// System.out.println(\"POOOINT: \"+p+\" => \"+new Point((int)(p.x*scale/MOUNTAIN_SIZE), (int)((p.y)*scale/MOUNTAIN_SIZE-y_move)));\n// return new Point((int)(p.x*scale/MOUNTAIN_SIZE), (int)((p.y)*scale/MOUNTAIN_SIZE-y_move));\n\n\n //a bit too big when increasing mountine_size\n// float scale = 1 /( dm.xdpi/dm.densityDpi) ;\n// float y_move = mountain_max;\n//\n// Point ret = new Point((int)(p.x*MOUNTAIN_SIZE/scale), (int)((p.y)*MOUNTAIN_SIZE/scale-y_move));\n// System.out.println(\"POOOINT: \"+p+\" => \"+ret);\n// System.out.println(\"POOOINT: \"+icons.getLayoutParams().width+\", \"+ icons.getLayoutParams().height);\n\n float scale = 1 /( dm.xdpi/dm.densityDpi) ;\n float y_move = mountain_max;\n\n\n\n Point ret = new Point((int)(p.x*MOUNTAIN_SIZE/scale/mountain.getLayoutParams().width*icons.getLayoutParams().width),\n (int)((p.y)*MOUNTAIN_SIZE/scale/mountain.getLayoutParams().height*icons.getLayoutParams().height)-mountain_max);\n //Point ret = new Point((int)((float)p.x/(float)mountain.getLayoutParams().width*icons.getLayoutParams().width),\n // (int)((float)p.y/(float)mountain.getLayoutParams().height*icons.getLayoutParams().height)-(int)(mountain_max));\n System.out.println(\"POOOINT: \"+p+\" => \"+ret);\n System.out.println(\"POOOINT: \"+(float)p.x/(float)mountain.getLayoutParams().width+\", \"+ (float)p.y/(float)mountain.getLayoutParams().height);\n\n\n return ret;\n\n\n }", "private void m13085a() {\n DisplayMetrics displayMetrics = getResources().getDisplayMetrics();\n this.f12281d = new Paint();\n this.f12281d.setColor(this.f12278a);\n this.f12281d.setAntiAlias(true);\n this.f12281d.setTextSize(displayMetrics.scaledDensity * ((float) this.f12279b));\n }", "public void onSurfaceChanged(GL10 glUnused, int width, int height) {\n\t\tGLES20.glViewport(0, 0, width, height);\n\t\tLog.d(\"ShelXle.Droid Screen Size\", width + \" \" + height);\n\t\tpixh = height;\n\t\tpixw = width;\n\t\tfpsscal = 350.0f / Math.min(width, height);\n\t\tfpsMat[0] = -fpsscal;\n\t\tfpsMat[12] = 1.0f - fpsscal;\n\t\tfpsMat3[0] = -fpsscal*1.24f;\n\t\tfpsMat3[12] = 1.0f - fpsscal*1.24f;\n\n\t\tfpsMat4[0] = -fpsscal*1.26f;\n\t\tfpsMat4[12] = 1.0f - fpsscal*1.26f;\n\t\tfpsMat2[0] = -0.25f * fpsscal;\n\t\tLog.d(\"ShelXle.Droid FPS text scaling \", fpsscal + \" \");\n\t\tfloat ratio = (float) width / height;\n\t\tfloat fh = (float) Math.tan(29.0 / 360.0 * 3.14159265358979) * 5.0f;\n\t\tfloat fw = fh * ratio;\n\t\tMatrix.frustumM(proj, 0, -fw, fw, -fh, fh, 5.0f, 800.0f);\n\t\tMatrix.setLookAtM(mv, 0, 0.0f, 200f, 0f, 0f, 0.0f, 0.0f, 0.0f, 00f, 1f);\n\t\tMatrix.multiplyMM(pmv1, 0, proj, 0, mv, 0);\n\t\tSystem.arraycopy(pmv1, 0, proj, 0, 16);\n\n\t\tMatrix.setIdentityM(mv, 0);\n\t\tMatrix.scaleM(mv, 0, 9.0f, 9.0f, 9.0f);\n\n\t\t/*\n\t\t * if (f!=null){ f.write(proj); f.write(proj);\n\t\t * \n\t\t * }\n\t\t */\n\t\t// Matrix.setIdentityM(proj,0);\n\t\t// Matrix.perspectiveM(proj, 0, 29.0f,ratio,5.0f,800.0f);\n\n\t}", "public boolean isSmallScreen() {\n \t\treturn m_smallScreenMode;\n \t}", "public void mo7192B() {\n View m = mo23948m();\n if (m != null) {\n this.f15664t0.onEnterDiscoverMode();\n boolean z = this.f15653i0 > 0;\n int i = this.f15653i0;\n m.performHapticFeedback(0);\n ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.f15643Y, View.TRANSLATION_Y, new float[]{0.0f, (float) (-C3200e0.m10183a((Context) mo23920b(), -100))});\n ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.f15643Y, View.ALPHA, new float[]{1.0f, 0.0f});\n ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this.f15637S, View.TRANSLATION_X, new float[]{0.0f, (float) C3200e0.m10183a((Context) mo23920b(), -100)});\n ObjectAnimator ofFloat4 = ObjectAnimator.ofFloat(this.f15637S, View.ALPHA, new float[]{1.0f, 0.0f});\n ObjectAnimator ofFloat5 = ObjectAnimator.ofFloat(this.f15641W, View.TRANSLATION_X, new float[]{0.0f, (float) C3200e0.m10183a((Context) mo23920b(), 100)});\n ObjectAnimator ofFloat6 = ObjectAnimator.ofFloat(this.f15641W, View.ALPHA, new float[]{1.0f, 0.0f});\n ofFloat6.addListener(new C6250b());\n float scaleX = this.f15639U.getScaleX();\n ObjectAnimator ofFloat7 = ObjectAnimator.ofFloat(this.f15639U, View.SCALE_X, new float[]{1.0f, 0.0f});\n ofFloat7.setDuration(200);\n ofFloat7.setInterpolator(C7657c.m18641a());\n float scaleY = this.f15639U.getScaleY();\n ObjectAnimator ofFloat8 = ObjectAnimator.ofFloat(this.f15639U, View.SCALE_Y, new float[]{1.0f, 0.0f});\n ofFloat8.setDuration(200);\n ofFloat8.setInterpolator(C7657c.m18641a());\n ofFloat8.addListener(new C6251c(scaleX, scaleY));\n ObjectAnimator ofFloat9 = ObjectAnimator.ofFloat(this.f15646b0, View.SCALE_X, new float[]{0.0f, 1.0f});\n ofFloat9.setStartDelay(200);\n ofFloat9.setInterpolator(C7657c.m18650f());\n ObjectAnimator ofFloat10 = ObjectAnimator.ofFloat(this.f15646b0, View.SCALE_Y, new float[]{0.0f, 1.0f});\n ofFloat10.setStartDelay(200);\n ofFloat10.setInterpolator(C7657c.m18650f());\n ofFloat10.addListener(new C6252d(z, i));\n AnimatorSet animatorSet = new AnimatorSet();\n animatorSet.playTogether(new Animator[]{ofFloat, ofFloat2, ofFloat3, ofFloat4, ofFloat5, ofFloat6, ofFloat7, ofFloat8, ofFloat9, ofFloat10});\n animatorSet.start();\n this.f15651g0 = true;\n ((MeUserManager) this.f15668x0.get()).mo8754a(true);\n if (this.f15648d0.getComposition() == null) {\n C8507d.m19679a((Context) mo9304A(), (int) R.raw.lottie_discover_globe).mo23032b(new C6210h(this));\n }\n }\n }", "public int winSize() { return winSize; }", "public void onMeasure(int r26, int r27) {\n /*\n r25 = this;\n r0 = r25\n r1 = r26\n r2 = r27\n java.lang.System.currentTimeMillis()\n int r3 = android.view.View.MeasureSpec.getMode(r26)\n int r4 = android.view.View.MeasureSpec.getSize(r26)\n int r5 = android.view.View.MeasureSpec.getMode(r27)\n int r6 = android.view.View.MeasureSpec.getSize(r27)\n int r7 = r25.getPaddingLeft()\n int r8 = r25.getPaddingTop()\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget\n r9.c(r7)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget\n r9.d(r8)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget\n int r10 = r0.mMaxWidth\n int[] r9 = r9.u\n r11 = 0\n r9[r11] = r10\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget\n int r10 = r0.mMaxHeight\n int[] r9 = r9.u\n r12 = 1\n r9[r12] = r10\n int r9 = android.os.Build.VERSION.SDK_INT\n r10 = 17\n if (r9 < r10) goto L_0x0050\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget\n int r10 = r25.getLayoutDirection()\n if (r10 != r12) goto L_0x004d\n r10 = 1\n goto L_0x004e\n L_0x004d:\n r10 = 0\n L_0x004e:\n r9.a = r10\n L_0x0050:\n r25.setSelfDimensionBehaviour(r26, r27)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget\n int r9 = r9.n()\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r10 = r0.mLayoutWidget\n int r10 = r10.o()\n boolean r13 = r0.mDirtyHierarchy\n if (r13 == 0) goto L_0x006a\n r0.mDirtyHierarchy = r11\n r25.updateHierarchy()\n r13 = 1\n goto L_0x006b\n L_0x006a:\n r13 = 0\n L_0x006b:\n int r14 = r0.mOptimizationLevel\n r15 = 8\n r14 = r14 & r15\n if (r14 != r15) goto L_0x0074\n r14 = 1\n goto L_0x0075\n L_0x0074:\n r14 = 0\n L_0x0075:\n if (r14 == 0) goto L_0x008a\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r15 = r0.mLayoutWidget\n r15.D()\n int r12 = r15.aG\n r15.a(r12)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n r12.f(r9, r10)\n r25.internalMeasureDimensions(r26, r27)\n goto L_0x008d\n L_0x008a:\n r25.internalMeasureChildren(r26, r27)\n L_0x008d:\n r25.updatePostMeasures()\n int r12 = r25.getChildCount()\n if (r12 <= 0) goto L_0x009d\n if (r13 == 0) goto L_0x009d\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.Analyzer.a(r12)\n L_0x009d:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n boolean r12 = r12.aB\n if (r12 == 0) goto L_0x00e1\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n boolean r12 = r12.aC\n r13 = -2147483648(0xffffffff80000000, float:-0.0)\n if (r12 == 0) goto L_0x00c3\n if (r3 != r13) goto L_0x00c3\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n int r12 = r12.aE\n if (r12 >= r4) goto L_0x00bc\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r15 = r0.mLayoutWidget\n int r15 = r15.aE\n r12.e(r15)\n L_0x00bc:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.ConstraintWidget$DimensionBehaviour r15 = android.support.constraint.solver.widgets.ConstraintWidget.DimensionBehaviour.FIXED\n r12.a(r15)\n L_0x00c3:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n boolean r12 = r12.aD\n if (r12 == 0) goto L_0x00e1\n if (r5 != r13) goto L_0x00e1\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n int r12 = r12.aF\n if (r12 >= r6) goto L_0x00da\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget\n int r13 = r13.aF\n r12.f(r13)\n L_0x00da:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = android.support.constraint.solver.widgets.ConstraintWidget.DimensionBehaviour.FIXED\n r12.b(r13)\n L_0x00e1:\n int r12 = r0.mOptimizationLevel\n r13 = 32\n r12 = r12 & r13\n r15 = 1073741824(0x40000000, float:2.0)\n if (r12 != r13) goto L_0x013d\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n int r12 = r12.n()\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget\n int r13 = r13.o()\n int r11 = r0.mLastMeasureWidth\n if (r11 == r12) goto L_0x0104\n if (r3 != r15) goto L_0x0104\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n java.util.List<android.support.constraint.solver.widgets.ConstraintWidgetGroup> r3 = r3.aA\n r11 = 0\n android.support.constraint.solver.widgets.Analyzer.a(r3, r11, r12)\n L_0x0104:\n int r3 = r0.mLastMeasureHeight\n if (r3 == r13) goto L_0x0112\n if (r5 != r15) goto L_0x0112\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n java.util.List<android.support.constraint.solver.widgets.ConstraintWidgetGroup> r3 = r3.aA\n r5 = 1\n android.support.constraint.solver.widgets.Analyzer.a(r3, r5, r13)\n L_0x0112:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n boolean r3 = r3.aC\n if (r3 == 0) goto L_0x0127\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n int r3 = r3.aE\n if (r3 <= r4) goto L_0x0127\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n java.util.List<android.support.constraint.solver.widgets.ConstraintWidgetGroup> r3 = r3.aA\n r11 = 0\n android.support.constraint.solver.widgets.Analyzer.a(r3, r11, r4)\n goto L_0x0128\n L_0x0127:\n r11 = 0\n L_0x0128:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n boolean r3 = r3.aD\n if (r3 == 0) goto L_0x013d\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n int r3 = r3.aF\n if (r3 <= r6) goto L_0x013d\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n java.util.List<android.support.constraint.solver.widgets.ConstraintWidgetGroup> r3 = r3.aA\n r4 = 1\n android.support.constraint.solver.widgets.Analyzer.a(r3, r4, r6)\n goto L_0x013e\n L_0x013d:\n r4 = 1\n L_0x013e:\n int r3 = r25.getChildCount()\n if (r3 <= 0) goto L_0x0149\n java.lang.String r3 = \"First pass\"\n r0.solveLinearSystem(r3)\n L_0x0149:\n java.util.ArrayList<android.support.constraint.solver.widgets.ConstraintWidget> r3 = r0.mVariableDimensionsWidgets\n int r3 = r3.size()\n int r5 = r25.getPaddingBottom()\n int r8 = r8 + r5\n int r5 = r25.getPaddingRight()\n int r7 = r7 + r5\n if (r3 <= 0) goto L_0x0379\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r6 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = r6.z()\n android.support.constraint.solver.widgets.ConstraintWidget$DimensionBehaviour r12 = android.support.constraint.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT\n if (r6 != r12) goto L_0x0167\n r6 = 1\n goto L_0x0168\n L_0x0167:\n r6 = 0\n L_0x0168:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget\n android.support.constraint.solver.widgets.ConstraintWidget$DimensionBehaviour r12 = r12.A()\n android.support.constraint.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = android.support.constraint.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT\n if (r12 != r13) goto L_0x0174\n r12 = 1\n goto L_0x0175\n L_0x0174:\n r12 = 0\n L_0x0175:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget\n int r13 = r13.n()\n int r4 = r0.mMinWidth\n int r4 = java.lang.Math.max(r13, r4)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget\n int r13 = r13.o()\n int r11 = r0.mMinHeight\n int r11 = java.lang.Math.max(r13, r11)\n r13 = r4\n r5 = r11\n r4 = 0\n r11 = 0\n r18 = 0\n L_0x0193:\n r16 = 1\n if (r4 >= r3) goto L_0x02d6\n java.util.ArrayList<android.support.constraint.solver.widgets.ConstraintWidget> r15 = r0.mVariableDimensionsWidgets\n java.lang.Object r15 = r15.get(r4)\n android.support.constraint.solver.widgets.ConstraintWidget r15 = (android.support.constraint.solver.widgets.ConstraintWidget) r15\n r19 = r3\n java.lang.Object r3 = r15.aa\n android.view.View r3 = (android.view.View) r3\n if (r3 == 0) goto L_0x02b8\n android.view.ViewGroup$LayoutParams r20 = r3.getLayoutParams()\n r21 = r10\n r10 = r20\n android.support.constraint.ConstraintLayout$LayoutParams r10 = (android.support.constraint.ConstraintLayout.LayoutParams) r10\n r22 = r9\n boolean r9 = r10.Z\n if (r9 != 0) goto L_0x02b5\n boolean r9 = r10.Y\n if (r9 != 0) goto L_0x02b5\n int r9 = r3.getVisibility()\n r23 = r11\n r11 = 8\n if (r9 == r11) goto L_0x02b2\n if (r14 == 0) goto L_0x01db\n android.support.constraint.solver.widgets.ResolutionDimension r9 = r15.j()\n boolean r9 = r9.e()\n if (r9 == 0) goto L_0x01db\n android.support.constraint.solver.widgets.ResolutionDimension r9 = r15.k()\n boolean r9 = r9.e()\n if (r9 != 0) goto L_0x02b2\n L_0x01db:\n int r9 = r10.width\n r11 = -2\n if (r9 != r11) goto L_0x01eb\n boolean r9 = r10.V\n if (r9 == 0) goto L_0x01eb\n int r9 = r10.width\n int r9 = getChildMeasureSpec(r1, r7, r9)\n goto L_0x01f5\n L_0x01eb:\n int r9 = r15.n()\n r11 = 1073741824(0x40000000, float:2.0)\n int r9 = android.view.View.MeasureSpec.makeMeasureSpec(r9, r11)\n L_0x01f5:\n int r11 = r10.height\n r1 = -2\n if (r11 != r1) goto L_0x0205\n boolean r1 = r10.W\n if (r1 == 0) goto L_0x0205\n int r1 = r10.height\n int r1 = getChildMeasureSpec(r2, r8, r1)\n goto L_0x020f\n L_0x0205:\n int r1 = r15.o()\n r11 = 1073741824(0x40000000, float:2.0)\n int r1 = android.view.View.MeasureSpec.makeMeasureSpec(r1, r11)\n L_0x020f:\n r3.measure(r9, r1)\n android.support.constraint.solver.Metrics r1 = r0.mMetrics\n if (r1 == 0) goto L_0x0221\n android.support.constraint.solver.Metrics r1 = r0.mMetrics\n r24 = r8\n long r8 = r1.b\n long r8 = r8 + r16\n r1.b = r8\n goto L_0x0223\n L_0x0221:\n r24 = r8\n L_0x0223:\n int r1 = r3.getMeasuredWidth()\n int r8 = r3.getMeasuredHeight()\n int r9 = r15.n()\n if (r1 == r9) goto L_0x025b\n r15.e(r1)\n if (r14 == 0) goto L_0x023d\n android.support.constraint.solver.widgets.ResolutionDimension r9 = r15.j()\n r9.a(r1)\n L_0x023d:\n if (r6 == 0) goto L_0x0259\n int r1 = r15.t()\n if (r1 <= r13) goto L_0x0259\n int r1 = r15.t()\n android.support.constraint.solver.widgets.ConstraintAnchor$Type r9 = android.support.constraint.solver.widgets.ConstraintAnchor.Type.RIGHT\n android.support.constraint.solver.widgets.ConstraintAnchor r9 = r15.a(r9)\n int r9 = r9.b()\n int r1 = r1 + r9\n int r1 = java.lang.Math.max(r13, r1)\n r13 = r1\n L_0x0259:\n r23 = 1\n L_0x025b:\n int r1 = r15.o()\n if (r8 == r1) goto L_0x028b\n r15.f(r8)\n if (r14 == 0) goto L_0x026d\n android.support.constraint.solver.widgets.ResolutionDimension r1 = r15.k()\n r1.a(r8)\n L_0x026d:\n if (r12 == 0) goto L_0x0289\n int r1 = r15.u()\n if (r1 <= r5) goto L_0x0289\n int r1 = r15.u()\n android.support.constraint.solver.widgets.ConstraintAnchor$Type r8 = android.support.constraint.solver.widgets.ConstraintAnchor.Type.BOTTOM\n android.support.constraint.solver.widgets.ConstraintAnchor r8 = r15.a(r8)\n int r8 = r8.b()\n int r1 = r1 + r8\n int r1 = java.lang.Math.max(r5, r1)\n r5 = r1\n L_0x0289:\n r23 = 1\n L_0x028b:\n boolean r1 = r10.X\n if (r1 == 0) goto L_0x029e\n int r1 = r3.getBaseline()\n r8 = -1\n if (r1 == r8) goto L_0x029e\n int r8 = r15.S\n if (r1 == r8) goto L_0x029e\n r15.S = r1\n r23 = 1\n L_0x029e:\n int r1 = android.os.Build.VERSION.SDK_INT\n r8 = 11\n if (r1 < r8) goto L_0x02af\n int r1 = r3.getMeasuredState()\n r3 = r18\n int r18 = combineMeasuredStates(r3, r1)\n goto L_0x02c4\n L_0x02af:\n r3 = r18\n goto L_0x02c4\n L_0x02b2:\n r24 = r8\n goto L_0x02c0\n L_0x02b5:\n r24 = r8\n goto L_0x02be\n L_0x02b8:\n r24 = r8\n r22 = r9\n r21 = r10\n L_0x02be:\n r23 = r11\n L_0x02c0:\n r3 = r18\n r18 = r3\n L_0x02c4:\n r11 = r23\n int r4 = r4 + 1\n r3 = r19\n r10 = r21\n r9 = r22\n r8 = r24\n r1 = r26\n r15 = 1073741824(0x40000000, float:2.0)\n goto L_0x0193\n L_0x02d6:\n r19 = r3\n r24 = r8\n r22 = r9\n r21 = r10\n r23 = r11\n r3 = r18\n if (r23 == 0) goto L_0x0323\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n r4 = r22\n r1.e(r4)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n r4 = r21\n r1.f(r4)\n if (r14 == 0) goto L_0x02f9\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n r1.C()\n L_0x02f9:\n java.lang.String r1 = \"2nd pass\"\n r0.solveLinearSystem(r1)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n int r1 = r1.n()\n if (r1 >= r13) goto L_0x030d\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n r1.e(r13)\n r12 = 1\n goto L_0x030e\n L_0x030d:\n r12 = 0\n L_0x030e:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n int r1 = r1.o()\n if (r1 >= r5) goto L_0x031c\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n r1.f(r5)\n r12 = 1\n L_0x031c:\n if (r12 == 0) goto L_0x0323\n java.lang.String r1 = \"3rd pass\"\n r0.solveLinearSystem(r1)\n L_0x0323:\n r1 = r19\n r4 = 0\n L_0x0326:\n if (r4 >= r1) goto L_0x037c\n java.util.ArrayList<android.support.constraint.solver.widgets.ConstraintWidget> r5 = r0.mVariableDimensionsWidgets\n java.lang.Object r5 = r5.get(r4)\n android.support.constraint.solver.widgets.ConstraintWidget r5 = (android.support.constraint.solver.widgets.ConstraintWidget) r5\n java.lang.Object r6 = r5.aa\n android.view.View r6 = (android.view.View) r6\n if (r6 == 0) goto L_0x0372\n int r8 = r6.getMeasuredWidth()\n int r9 = r5.n()\n if (r8 != r9) goto L_0x034a\n int r8 = r6.getMeasuredHeight()\n int r9 = r5.o()\n if (r8 == r9) goto L_0x0372\n L_0x034a:\n int r8 = r5.ac\n r9 = 8\n if (r8 == r9) goto L_0x0374\n int r8 = r5.n()\n r10 = 1073741824(0x40000000, float:2.0)\n int r8 = android.view.View.MeasureSpec.makeMeasureSpec(r8, r10)\n int r5 = r5.o()\n int r5 = android.view.View.MeasureSpec.makeMeasureSpec(r5, r10)\n r6.measure(r8, r5)\n android.support.constraint.solver.Metrics r5 = r0.mMetrics\n if (r5 == 0) goto L_0x0376\n android.support.constraint.solver.Metrics r5 = r0.mMetrics\n long r11 = r5.b\n long r11 = r11 + r16\n r5.b = r11\n goto L_0x0376\n L_0x0372:\n r9 = 8\n L_0x0374:\n r10 = 1073741824(0x40000000, float:2.0)\n L_0x0376:\n int r4 = r4 + 1\n goto L_0x0326\n L_0x0379:\n r24 = r8\n r3 = 0\n L_0x037c:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget\n int r1 = r1.n()\n int r1 = r1 + r7\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r4 = r0.mLayoutWidget\n int r4 = r4.o()\n int r4 = r4 + r24\n int r5 = android.os.Build.VERSION.SDK_INT\n r6 = 11\n if (r5 < r6) goto L_0x03c6\n r5 = r26\n int r1 = resolveSizeAndState(r1, r5, r3)\n int r3 = r3 << 16\n int r2 = resolveSizeAndState(r4, r2, r3)\n r3 = 16777215(0xffffff, float:2.3509886E-38)\n r1 = r1 & r3\n r2 = r2 & r3\n int r3 = r0.mMaxWidth\n int r1 = java.lang.Math.min(r3, r1)\n int r3 = r0.mMaxHeight\n int r2 = java.lang.Math.min(r3, r2)\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n boolean r3 = r3.aI\n r4 = 16777216(0x1000000, float:2.3509887E-38)\n if (r3 == 0) goto L_0x03b7\n r1 = r1 | r4\n L_0x03b7:\n android.support.constraint.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget\n boolean r3 = r3.aJ\n if (r3 == 0) goto L_0x03be\n r2 = r2 | r4\n L_0x03be:\n r0.setMeasuredDimension(r1, r2)\n r0.mLastMeasureWidth = r1\n r0.mLastMeasureHeight = r2\n return\n L_0x03c6:\n r0.setMeasuredDimension(r1, r4)\n r0.mLastMeasureWidth = r1\n r0.mLastMeasureHeight = r4\n return\n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.support.constraint.ConstraintLayout.onMeasure(int, int):void\");\n }", "boolean onPhone() {\n\t\treturn ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)\n\t\t\t\t< Configuration.SCREENLAYOUT_SIZE_LARGE);\n\t}", "private void updateDimensions() {\r\n width = gui.getWidth();\r\n height = gui.getHeight();\r\n yLabelsMargin = (int) gui.getLabelWidth(Integer.toString(((int) maximumDB / 10) * 10), true) + 2;\r\n if (track != null)\r\n scaleXpx = ((float) width - yLabelsMargin) / track.getBufferCapacity();\r\n else\r\n scaleXpx = 1;\r\n scaleYpx = (float) ((height - 1) / (maximumDB - minimumDB));\r\n if (scaleYpx == 0)\r\n scaleYpx = 1;\r\n }", "@Override\n public void resize(int width, int height) {game.screenPort.update(width, height, true);}", "private Bitmap m14718q() {\n Bitmap a = this.f10962q.mo12204a(this.f10968w, this.f10967v, this.f10969x ? Config.ARGB_8888 : Config.RGB_565);\n m14714a(a);\n return a;\n }", "private Dimension tailleEcranAdapté(){\n GraphicsEnvironment graphicsEnvironment =GraphicsEnvironment.getLocalGraphicsEnvironment();\n //get maximum window bounds\n Rectangle rectangle =graphicsEnvironment.getMaximumWindowBounds();\n //Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();\n Dimension dim = new Dimension((int)rectangle.getWidth(),(int)rectangle.getHeight());\n return dim;\n }", "private void resize() {\n }", "public int getDisplayWidth() {\n return isHiRes() ? 640 : 320;\n }", "@Override\n public boolean workaroundBySurfaceProcessing() {\n return isHuaweiMate20() || isHuaweiMate20Pro() || isHuaweiP40Lite();\n }", "public int getWidthScreen(){\n return widthScreen ;\n }", "@Override\n protected boolean isDimmingEnable() {\n return true;\n }", "private void refreshDimensions() {\n //tamano del canvas\n targetWidth = canvasWidth;\n targetHeight = canvasHeight;\n//de las imagenes\n sourceWidth = bitmap.getWidth();\n sourceHeight = bitmap.getHeight();\n\n double targetRatio = (double) targetWidth / (double) targetHeight;\n double sourceRatio = (double) sourceWidth / (double) sourceHeight;\n\n targetOffsetX = 0;\n targetOffsetY = 0;\n\n if(sourceRatio > targetRatio)\n {\n int newTargetHeight = (int) (targetWidth / sourceRatio);\n int delta = targetHeight - newTargetHeight;\n targetOffsetY = delta / 2;\n targetHeight = newTargetHeight;\n }\n else if(sourceRatio < targetRatio)\n {\n int newTargetWidth = (int) (targetHeight * sourceRatio);\n int delta = targetWidth - newTargetWidth;\n targetOffsetX = delta / 2;\n targetWidth = newTargetWidth;\n }\n\n puzzleWidth = slidePuzzle.getWidth();\n puzzleHeight = slidePuzzle.getHeight();\n\n targetColumnWidth = targetWidth / puzzleWidth;\n targetRowHeight = targetHeight / puzzleHeight;\n sourceColumnWidth = sourceWidth / puzzleWidth;\n sourceRowHeight = sourceHeight / puzzleHeight;\n }", "private void m7219a(Canvas canvas) {\n int i = this.f5599u - this.f5595q;\n int i2 = this.f5586f - (this.f5585e / 2);\n this.f5581a.setBounds(0, 0, this.f5595q, this.f5585e);\n this.f5582b.setBounds(0, 0, this.f5596r, this.f5600v);\n if (m7228d()) {\n this.f5582b.draw(canvas);\n canvas.translate((float) this.f5595q, (float) i2);\n canvas.scale(-1.0f, 1.0f);\n this.f5581a.draw(canvas);\n canvas.scale(1.0f, 1.0f);\n canvas.translate((float) (-this.f5595q), (float) (-i2));\n return;\n }\n canvas.translate((float) i, 0.0f);\n this.f5582b.draw(canvas);\n canvas.translate(0.0f, (float) i2);\n this.f5581a.draw(canvas);\n canvas.translate((float) (-i), (float) (-i2));\n }", "private final void m5314a() {\n this.f6561e = getContext().getResources().getDimensionPixelOffset(R.dimen.channel_items_list_fade_width);\n this.f6563g = new Rect();\n }", "public void switchWindowSizeToMobileLandscape(WebDriver driver) throws InterruptedException, IOException {\n\tdriver.manage().window().setSize(new Dimension(857,430));\n\tfileWriterPrinter(\"\\n\" + \"CONVERTED TO WINDOW SIZE: MOBILE (LANDSCAPE) = 857 x 430\");\n\tThread.sleep(1000);\n\t}", "private static boolean isXLargeTablet(Context context) {\n return (context.getResources().getConfiguration().screenLayout\n & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "private static boolean isXLargeTablet(Context context) {\n return (context.getResources().getConfiguration().screenLayout\n & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "private static boolean isXLargeTablet(Context context) {\n return (context.getResources().getConfiguration().screenLayout\n & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "private static boolean isXLargeTablet(Context context) {\n return (context.getResources().getConfiguration().screenLayout\n & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "private static boolean isXLargeTablet(Context context) {\n return (context.getResources().getConfiguration().screenLayout\n & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;\n }", "public void switchWindowSizeToMobilePortrait(WebDriver driver) throws InterruptedException, IOException {\n driver.manage().window().setSize(new Dimension(430,857));\n fileWriterPrinter(\"\\n\" + \"CONVERTED TO WINDOW SIZE: MOBILE (PORTRAIT) = 430 x 857\");\n Thread.sleep(1000);\n\t}", "@Override\r\n\tpublic void resize() {\n\t\t\r\n\t}", "private final void m110459at() {\n float b = ((float) C23482j.m77098b(mo75261ab())) / ((float) C23486n.m77122a(375.0d));\n if (mo86957ao()) {\n this.f89205aX = (LinearLayout) this.itemView.findViewById(R.id.e_w);\n this.f89206aY = (LinearLayout) this.itemView.findViewById(R.id.e_u);\n this.f89216bj = (DmtTextView) this.itemView.findViewById(R.id.cl);\n this.f89207aZ = (AdRatingView) this.itemView.findViewById(R.id.d5);\n this.f89209ba = this.itemView.findViewById(R.id.ce);\n this.f89210bb = (DmtTextView) this.itemView.findViewById(R.id.b_);\n this.f89217bk = (LinearLayout) this.itemView.findViewById(R.id.ch);\n this.f89218bl = (DescTextView) this.itemView.findViewById(R.id.bo);\n this.f89219bm = (RemoteImageView) this.itemView.findViewById(R.id.c5);\n this.f89211bc = (DmtTextView) this.itemView.findViewById(R.id.aj6);\n this.f89220bn = (DmtTextView) this.itemView.findViewById(R.id.aj_);\n LinearLayout linearLayout = this.f89206aY;\n if (linearLayout != null) {\n LayoutParams layoutParams = linearLayout.getLayoutParams();\n if (layoutParams != null) {\n layoutParams.width = (int) (((float) C23486n.m77122a(183.0d)) * b);\n }\n }\n DmtTextView dmtTextView = this.f89220bn;\n if (dmtTextView != null) {\n LayoutParams layoutParams2 = dmtTextView.getLayoutParams();\n if (layoutParams2 != null) {\n layoutParams2.width = (int) (((float) C23486n.m77122a(86.5d)) * b);\n }\n }\n DmtTextView dmtTextView2 = this.f89211bc;\n if (dmtTextView2 != null) {\n LayoutParams layoutParams3 = dmtTextView2.getLayoutParams();\n if (layoutParams3 != null) {\n layoutParams3.width = (int) (((float) C23486n.m77122a(86.5d)) * b);\n if (layoutParams3 != null) {\n if (layoutParams3 != null) {\n ((MarginLayoutParams) layoutParams3).setMarginStart((int) (((float) C23486n.m77122a(10.0d)) * b));\n } else {\n throw new TypeCastException(\"null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams\");\n }\n }\n }\n }\n } else {\n this.f89205aX = (LinearLayout) this.itemView.findViewById(R.id.aw_);\n this.f89206aY = (LinearLayout) this.itemView.findViewById(R.id.aw8);\n this.f89216bj = (DmtTextView) this.itemView.findViewById(R.id.ck);\n this.f89207aZ = (AdRatingView) this.itemView.findViewById(R.id.d4);\n this.f89209ba = this.itemView.findViewById(R.id.cd);\n this.f89210bb = (DmtTextView) this.itemView.findViewById(R.id.b9);\n this.f89217bk = (LinearLayout) this.itemView.findViewById(R.id.cg);\n this.f89218bl = (DescTextView) this.itemView.findViewById(R.id.bn);\n this.f89219bm = (RemoteImageView) this.itemView.findViewById(R.id.c4);\n this.f89211bc = (DmtTextView) this.itemView.findViewById(R.id.aj5);\n this.f89220bn = (DmtTextView) this.itemView.findViewById(R.id.aj9);\n LinearLayout linearLayout2 = this.f89206aY;\n if (linearLayout2 != null) {\n LayoutParams layoutParams4 = linearLayout2.getLayoutParams();\n if (layoutParams4 != null) {\n layoutParams4.width = (int) (((float) C23486n.m77122a(223.0d)) * b);\n }\n }\n DmtTextView dmtTextView3 = this.f89220bn;\n if (dmtTextView3 != null) {\n LayoutParams layoutParams5 = dmtTextView3.getLayoutParams();\n if (layoutParams5 != null) {\n layoutParams5.width = (int) (((float) C23486n.m77122a(106.5d)) * b);\n }\n }\n DmtTextView dmtTextView4 = this.f89211bc;\n if (dmtTextView4 != null) {\n LayoutParams layoutParams6 = dmtTextView4.getLayoutParams();\n if (layoutParams6 != null) {\n layoutParams6.width = (int) (((float) C23486n.m77122a(106.5d)) * b);\n if (layoutParams6 != null) {\n if (layoutParams6 != null) {\n ((MarginLayoutParams) layoutParams6).setMarginStart((int) (((float) C23486n.m77122a(10.0d)) * b));\n } else {\n throw new TypeCastException(\"null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams\");\n }\n }\n }\n }\n }\n DescTextView descTextView = this.f89218bl;\n if (descTextView != null) {\n descTextView.setDescLightDrawable(R.drawable.z2);\n }\n DescTextView descTextView2 = this.f89218bl;\n if (descTextView2 != null) {\n descTextView2.mo1061a();\n }\n LinearLayout linearLayout3 = this.f89205aX;\n if (linearLayout3 != null) {\n linearLayout3.setOnClickListener(new C34215i(this));\n }\n DmtTextView dmtTextView5 = this.f89216bj;\n if (dmtTextView5 != null) {\n dmtTextView5.setOnClickListener(new C34207c(this));\n }\n LinearLayout linearLayout4 = this.f89217bk;\n if (linearLayout4 != null) {\n linearLayout4.setOnClickListener(new C34208d(this));\n }\n DescTextView descTextView3 = this.f89218bl;\n if (descTextView3 != null) {\n descTextView3.setOnClickListener(new C34209e(this));\n }\n RemoteImageView remoteImageView = this.f89219bm;\n if (remoteImageView != null) {\n remoteImageView.setOnClickListener(new C34210f(this));\n }\n DmtTextView dmtTextView6 = this.f89211bc;\n if (dmtTextView6 != null) {\n dmtTextView6.setOnClickListener(new C34211g(this));\n }\n DmtTextView dmtTextView7 = this.f89220bn;\n if (dmtTextView7 != null) {\n dmtTextView7.setOnClickListener(new C34214h(this));\n }\n C43081e.m136671a((View) this.f89211bc, 0.75f);\n C43081e.m136670a(this.f89220bn);\n C43081e.m136671a((View) this.f89218bl, 0.75f);\n C43081e.m136671a((View) this.f89219bm, 0.75f);\n C43081e.m136671a((View) this.f89217bk, 0.75f);\n C43081e.m136671a((View) this.f89216bj, 0.75f);\n if (C25352e.m83221d(this.f77546j)) {\n DmtTextView dmtTextView8 = this.f89211bc;\n if (dmtTextView8 != null) {\n dmtTextView8.setText(C25384x.m83526a(mo75261ab(), this.f77546j, true));\n }\n float a = (float) C23486n.m77122a(2.0d);\n Context ab = mo75261ab();\n C7573i.m23582a((Object) ab, \"context\");\n Drawable bVar = new C24510b(a, ab.getResources().getColor(R.color.w0));\n if (C25352e.m83199A(this.f77546j)) {\n bVar = C43081e.m136669a(bVar.mutate(), C0683b.m2912c(mo75261ab(), R.color.a5q));\n C7573i.m23582a((Object) bVar, \"AdAnimationUtils.tintDra…or(context, R.color.s14))\");\n }\n DmtTextView dmtTextView9 = this.f89211bc;\n if (dmtTextView9 != null) {\n dmtTextView9.setBackground(bVar);\n }\n }\n if (SymphonyAdManager.m82664a().mo65651b(mo75261ab(), this.f77546j) || SymphonyAdManager.m82664a().mo65654c(mo75261ab(), this.f77546j)) {\n int i = 0;\n if (C25352e.m83221d(this.f77546j)) {\n Aweme aweme = this.f77546j;\n C7573i.m23582a((Object) aweme, \"mAweme\");\n AwemeRawAd awemeRawAd = aweme.getAwemeRawAd();\n if (awemeRawAd == null) {\n C7573i.m23580a();\n }\n C7573i.m23582a((Object) awemeRawAd, \"mAweme.awemeRawAd!!\");\n i = awemeRawAd.getNativeCardType();\n }\n switch (i) {\n case 1:\n m110460au();\n return;\n case 2:\n m110461av();\n return;\n default:\n m110460au();\n break;\n }\n }\n }", "@Override\n\t\t\tpublic void doMyThings() {\n\t\t\t\tsetVideoScale(SCREEN_DEFAULT);\n\t\t\t}", "private void m76764b() {\n this.f61647d = this.f61646c.getStreamMaxVolume(3);\n this.f61648e = this.f61647d / 15;\n if (this.f61648e == 0) {\n this.f61648e = 1;\n }\n m76765c();\n }", "private void m7226c() {\n this.f5601w.mo5542b((C1272h) this);\n this.f5601w.mo5544b((C1280l) this);\n this.f5601w.mo5545b(this.f5580E);\n m7230f();\n }", "private void getClosestSupportedQuality(Camera.Parameters parameters) {\n\n\t\t// Resolutions\n\t\tString supportedSizesStr = \"Supported resolutions: \";\n\t\tList<Size> supportedSizes = parameters.getSupportedPreviewSizes();\n\t\tfor (Iterator<Size> it = supportedSizes.iterator(); it.hasNext();) {\n\t\t\tSize size = it.next();\n\t\t\tsupportedSizesStr += size.width+\"x\"+size.height+(it.hasNext()?\", \":\"\");\n\t\t}\n\t\tLog.v(TAG,supportedSizesStr);\n\n\t\t// Frame rates\n\t\tString supportedFrameRatesStr = \"Supported frame rates: \";\n\t\tList<Integer> supportedFrameRates = parameters.getSupportedPreviewFrameRates();\n\t\tfor (Iterator<Integer> it = supportedFrameRates.iterator(); it.hasNext();) {\n\t\t\tsupportedFrameRatesStr += it.next()+\"fps\"+(it.hasNext()?\", \":\"\");\n\t\t}\n\t\t//Log.v(TAG,supportedFrameRatesStr);\n\n\t\tint minDist = Integer.MAX_VALUE, newFps = mQuality.framerate;\n\t\tif (!supportedFrameRates.contains(mQuality.framerate)) {\n\t\t\tfor (Iterator<Integer> it = supportedFrameRates.iterator(); it.hasNext();) {\n\t\t\t\tint fps = it.next();\n\t\t\t\tint dist = Math.abs(fps - mQuality.framerate);\n\t\t\t\tif (dist<minDist) {\n\t\t\t\t\tminDist = dist;\n\t\t\t\t\tnewFps = fps;\n\t\t\t\t}\n\t\t\t}\n\t\t\tLog.v(TAG,\"Frame rate modified: \"+mQuality.framerate+\"->\"+newFps);\n\t\t\t//mQuality.framerate = newFps;\n\t\t}\n\n\t}", "public final void m5407c() {\n Point point = new Point();\n WindowManager windowManager = this.f4261e.getWindowManager();\n C3250h.m9053a((Object) windowManager, \"activity.windowManager\");\n windowManager.getDefaultDisplay().getSize(point);\n Rect rect = new Rect();\n this.f4257a.getWindowVisibleDisplayFrame(rect);\n Resources resources = this.f4261e.getResources();\n C3250h.m9053a((Object) resources, \"activity.resources\");\n int i = resources.getConfiguration().orientation;\n int d = (point.y + m5408d()) - rect.bottom;\n C1426b.f4264a.mo6892b(d > 0 ? 1 : 0);\n if (d > 0) {\n C1426b.f4264a.mo6891a(d);\n }\n if (d != this.f4259c) {\n m5403a(d, i);\n }\n this.f4259c = d;\n }", "private void m7633a(ProfileDTO profileDTO) {\n LayoutParams layoutParams = this.f6405b.getLayoutParams();\n int dimensionPixelSize = getResources().getDimensionPixelSize(C1373R.dimen.grid_explore_avatar_width);\n LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(dimensionPixelSize, dimensionPixelSize);\n DisplayMetrics displayMetrics = new DisplayMetrics();\n ((WindowManager) getSystemService(\"window\")).getDefaultDisplay().getMetrics(displayMetrics);\n int i = displayMetrics.widthPixels;\n layoutParams.width = i;\n layoutParams.height = i;\n layoutParams2.setMargins((i - dimensionPixelSize) / 2, displayMetrics.widthPixels - (dimensionPixelSize / 2), 0, 0);\n this.f6408e.setLayoutParams(layoutParams2);\n this.f6405b.setLayoutParams(layoutParams);\n if (TextUtils.isEmpty(profileDTO.getAvatar())) {\n this.f6408e.setImageResource(C1373R.drawable.ic_avatar);\n } else {\n Picasso.with(this).load(profileDTO.getAvatar()).fit().centerCrop().error((int) C1373R.drawable.ic_avatar).placeholder((int) C1373R.drawable.ic_avatar).into(this.f6408e);\n }\n this.f6409f.setText(profileDTO.getNickname());\n this.f6410g.setText(String.format(Locale.getDefault(), \"%.2f\", new Object[]{Double.valueOf(profileDTO.getTotalDistance() / 1000.0d)}));\n this.f6411h.setText(String.valueOf(profileDTO.getGridNum()));\n if (profileDTO.getTotalElapsedTime() > 0) {\n if (profileDTO.getTotalElapsedTime() <= 0) {\n this.f6412i.setText(\"0\");\n return;\n }\n float totalElapsedTime = (((float) profileDTO.getTotalElapsedTime()) * 1.0f) / 3600.0f;\n this.f6412i.setText(String.format(Locale.getDefault(), \"%.1f\", new Object[]{Float.valueOf(totalElapsedTime)}));\n } else if (profileDTO.getTotalDistance() > 0.0d) {\n m7636b(m5331p());\n } else {\n this.f6412i.setText(\"0\");\n }\n }", "public static void speedup(){\n\t\tif(bossair.periodairinit > Framework.nanosecond){\n\t\t\t\tbossair.periodair-=Framework.nanosecond/18; \n\t\t\t\tbossair.xmoving-=0.03; \n\t\t}\n\t\t\t\n\t}", "public void updateScale()\n {\n // get scale from world presenter\n s2 = (cam.getScale());\n //Convert to English Miles if appropriate\n if( !SettingsScreen.getUnits() ) s2 *= 0.60934;\n s1 = s2/2;\n repaint();\n }", "public void setupRatio(int width) {\n\t\t//reset SpriteCurrentEdge to fix value every level\n\t\tSpriteCurrentEdge = ResourceManager.FixSizeSpriteEdge;\n\t\t\n\t\tSpriteScaleFactor = ResourceManager.getInstance().cameraWidth / (width * SpriteCurrentEdge);\n\t\t\n\t\t//update resize currentEdge\n\t\tSpriteCurrentEdge = (int)Math.ceil(SpriteCurrentEdge * SpriteScaleFactor);\n\t\t\n\t\t/*\n\t\tLog.i(TAG, String.format(\"width:%1$d edge:%2$d scale:%3$f\", width, \n\t\t\t\tGameManager.getInstance().SpriteCurrentEdge,\n\t\t\t\tGameManager.getInstance().SpriteScaleFactor));\n\t\t*/\n\t}", "void fixScreenSize(int nLocations) {\n dotSize = (width - 2 * margin) / sqrt(nLocations);\n if (dotSize < 1) {\n dotSize = 2;\n }\n }", "default int getSquareSize() {\n return java.awt.Toolkit.getDefaultToolkit().getScreenSize().width / 20;\n }", "public abstract int getDisplayWidth();", "private int testItemWidth(ArrayList<Object> arrayInfo){\n\t\tlong time=System.currentTimeMillis();\n\t\tint minLeft=mContext.getResources().getDimensionPixelSize(R.dimen.default_start_position_x);\n\t\tfor(Object info:arrayInfo){\n\t\t\tView view = null;\n\t\t\tif(info instanceof EcgInfo){\n\t\t\t\tEcgInfo ecgInfo=(EcgInfo)info;\n\t\t\t\tif(ecgInfo.measureType==EcgTable.TYPE_HEARTRATE){\n\t\t\t\t\tview=mInflater.inflate(R.layout.daily_info_heart_rate_layout, null);\n\t\t\t\t\tTextView tv=(TextView)view.findViewById(R.id.heart_rate_bpm);\n\t\t\t\t\tTextView tvLevel=(TextView)view.findViewById(R.id.heart_rate_level);\n\t\t\t\t\ttvLevel.setText(Utility.getIntensityLevel(mContext, ecgInfo.measureValue));\n\t\t\t\t\tString value = Utility.getFormatStr(String.valueOf(ecgInfo.measureValue), mContext.getString(R.string.daily_info_heart_rate_unit), mContext).toString();\n\t\t\t\t\ttv.setText(value);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tview=mInflater.inflate(R.layout.daily_info_stress_energy_layout, null);\n\t\t\t\t\tTextView titleText=(TextView)view.findViewById(R.id.measure_energy_title);\n\t\t\t\t\tTextView valueText=(TextView)view.findViewById(R.id.measure_energy_value);\n\t\t\t\t\tImageView image=(ImageView)view.findViewById(R.id.energy_or_stress_icon);\n\t\t\t\t\tif(ecgInfo.measureType==EcgTable.TYPE_RELAX){\n\t\t\t\t\t\ttitleText.setText(mContext.getString(R.string.daily_info_energy_title));\n\t\t\t\t\t\tvalueText.setText(Utility.intToStr(ecgInfo.measureValue));\n\t\t\t\t\t\timage.setImageResource(Utility.getRelaxDrawableId(ecgInfo.measureValue));\n\t\t\t\t\t}\n\t\t\t\t\telse if(ecgInfo.measureType==EcgTable.TYPE_STRESS){\n\t\t\t\t\t\ttitleText.setText(mContext.getString(R.string.daily_info_stress_title));\n\t\t\t\t\t\tvalueText.setText(Utility.intToStr(ecgInfo.measureValue));\n\t\t\t\t\t\tvalueText.setTextColor(0xffc14343);\n\t\t\t\t\t\timage.setImageResource(Utility.getStressDrawableId(ecgInfo.measureValue));\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t\telse if(info instanceof ActivityInfo){\n\t\t\t\tActivityInfo activityInfo=(ActivityInfo)info;\n\t\t\t\tview=mInflater.inflate(R.layout.daily_info_walk_bike_layout, null);\n\t\t\t\tTextView tvDistance=(TextView) view.findViewById(R.id.tv_step_or_bike_distance);\n\t\t\t\tTextView tvType=(TextView) view.findViewById(R.id.tv_step_or_bike_type);\n\t\t\t\tTextView tvTime=(TextView) view.findViewById(R.id.tv_step_or_bike_time);\n\t\t\t\tTextView tvUnit=(TextView) view.findViewById(R.id.tv_step_or_bike_unit);\n\t\t\t\tImageView img=(ImageView)view.findViewById(R.id.img_step_or_bike_icon);\n\t\t\t\tif(activityInfo.activityType==ActivityStateTable.TYPE_WALK){\n\t\t\t\t\ttvDistance.setText(String.valueOf(activityInfo.stepCounts));\n\t\t\t\t\ttvType.setText(R.string.daily_info_walk_type);\n\t\t\t\t\t\n\t\t\t\t\ttvTime.setText(calculateTimeInterval(activityInfo.startTime, activityInfo.endTime));\n\t\t\t\t\ttvUnit.setText(R.string.daily_info_walk_unit);\n\t\t\t\t\timg.setImageResource(R.drawable.asus_wellness_ic_walk);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttvDistance.setText(Utility.getOneDigitFloatString((float)activityInfo.distance/1000));\n\t\t\t\t\ttvDistance.setTextColor(0xff327abd);\n\t\t\t\t\ttvType.setText(R.string.daily_info_transport_type);\n\t\t\t\t\ttvTime.setText(calculateTimeInterval(activityInfo.startTime, activityInfo.endTime));\n\t\t\t\t\ttvUnit.setText(R.string.distance_unit);\n\t\t\t\t\timg.setImageResource(R.drawable.asus_wellness_ic_traffic);\n\t\t\t\t}\n\t\t\t}\n\t\t\tview.measure(MeasureSpec.makeMeasureSpec(LayoutParams.WRAP_CONTENT, MeasureSpec.UNSPECIFIED), \n\t\t\t\t\tMeasureSpec.makeMeasureSpec(LayoutParams.WRAP_CONTENT, MeasureSpec.UNSPECIFIED));\n\t\t\tint left=minLeft-view.getMeasuredWidth()-15;\n\t\t\tif(left<0){\n\t\t\t\tminLeft=minLeft-left;\n\t\t\t}\n\t\t}\n\t\tLog.e(\"circle\",\"testItemWidth time:\"+(System.currentTimeMillis()-time));\n\t\treturn minLeft;\n\t}", "public void updateBaseDisplayMetrics(int baseWidth, int baseHeight, int baseDensity) {\n int i;\n if (baseDensity == 0) {\n Slog.e(TAG, \"density is 0\", new Exception());\n }\n if (HwActivityTaskManager.isCastDisplay(getDisplay().getUniqueId(), \"padCast\")) {\n DisplayContent defaultDisplayContent = this.mWmService.getDefaultDisplayContentLocked();\n int defaultDisplayWidth = 0;\n int defaultDisplayHeight = 0;\n if (defaultDisplayContent != null) {\n defaultDisplayWidth = defaultDisplayContent.mBaseDisplayWidth;\n defaultDisplayHeight = defaultDisplayContent.mBaseDisplayHeight;\n }\n float defaultRatio2 = 0.0f;\n float baseRatio = baseWidth != 0 ? ((float) baseHeight) / ((float) baseWidth) : 0.0f;\n float defaultRatio1 = defaultDisplayWidth != 0 ? ((float) defaultDisplayHeight) / ((float) defaultDisplayWidth) : 0.0f;\n if (defaultDisplayHeight != 0) {\n defaultRatio2 = ((float) defaultDisplayWidth) / ((float) defaultDisplayHeight);\n }\n if (Math.abs(baseRatio - defaultRatio1) <= 0.001f || Math.abs(baseRatio - defaultRatio2) <= 0.001f) {\n this.mRotation = 0;\n } else {\n baseWidth = baseHeight;\n baseHeight = baseWidth;\n this.mRotation = 1;\n }\n }\n this.mBaseDisplayWidth = baseWidth;\n this.mBaseDisplayHeight = baseHeight;\n this.mBaseDisplayDensity = baseDensity;\n int i2 = this.mMaxUiWidth;\n if (i2 > 0 && (i = this.mBaseDisplayWidth) > i2) {\n this.mBaseDisplayHeight = (this.mBaseDisplayHeight * i2) / i;\n this.mBaseDisplayDensity = (this.mBaseDisplayDensity * i2) / i;\n this.mBaseDisplayWidth = i2;\n if (WindowManagerDebugConfig.DEBUG_DISPLAY) {\n Slog.v(TAG, \"Applying config restraints:\" + this.mBaseDisplayWidth + \"x\" + this.mBaseDisplayHeight + \" at density:\" + this.mBaseDisplayDensity + \" on display:\" + getDisplayId());\n }\n }\n this.mBaseDisplayRect.set(0, 0, this.mBaseDisplayWidth, this.mBaseDisplayHeight);\n updateBounds();\n this.mDisplayCutoutCache.clearCacheTable();\n }", "private static byte[] m17790a(Bitmap bitmap) {\n int i;\n int i2;\n int i3;\n int width = bitmap.getWidth();\n int height = bitmap.getHeight();\n OutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n for (i = 0; i < 32; i++) {\n byteArrayOutputStream.write(0);\n }\n int[] iArr = new int[(width - 2)];\n bitmap.getPixels(iArr, 0, width, 1, 0, width - 2, 1);\n Object obj = iArr[0] == -16777216 ? 1 : null;\n Object obj2 = iArr[iArr.length + -1] == -16777216 ? 1 : null;\n int length = iArr.length;\n width = 0;\n int i4 = 0;\n for (i2 = 0; i2 < length; i2++) {\n if (width != iArr[i2]) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, i2);\n width = iArr[i2];\n }\n }\n if (obj2 != null) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, length);\n }\n int i5 = i4;\n int i6 = i5 + 1;\n if (obj != null) {\n i = i6 - 1;\n } else {\n i = i6;\n }\n if (obj2 != null) {\n i3 = i - 1;\n } else {\n i3 = i;\n }\n iArr = new int[(height - 2)];\n bitmap.getPixels(iArr, 0, 1, 0, 1, 1, height - 2);\n obj = iArr[0] == -16777216 ? 1 : null;\n obj2 = iArr[iArr.length + -1] == -16777216 ? 1 : null;\n length = iArr.length;\n width = 0;\n i4 = 0;\n for (i2 = 0; i2 < length; i2++) {\n if (width != iArr[i2]) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, i2);\n width = iArr[i2];\n }\n }\n if (obj2 != null) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, length);\n }\n i6 = i4 + 1;\n if (obj != null) {\n i = i6 - 1;\n } else {\n i = i6;\n }\n if (obj2 != null) {\n i--;\n }\n for (i6 = 0; i6 < i3 * i; i6++) {\n C5225r.m17788a(byteArrayOutputStream, 1);\n }\n byte[] toByteArray = byteArrayOutputStream.toByteArray();\n toByteArray[0] = (byte) 1;\n toByteArray[1] = (byte) i5;\n toByteArray[2] = (byte) i4;\n toByteArray[3] = (byte) (i * i3);\n C5225r.m17787a(bitmap, toByteArray);\n return toByteArray;\n }", "public void screenMath(){\r\n\t\t//10.9375 H\r\n\t\t//12.037037037037036 W\r\n\t\tDouble test1 = 0.12 * screenWidth / 2.2;\r\n\t\tDouble test2 = 0.807 * screenHight;\r\n\t\tDouble test3 = screenHight - test2;\r\n\t\tDouble test4 = test3 / 10;\r\n\t\tfor(int i = 0; i < 10; i++){\r\n\r\n\t\t\tArrayList<Double> tempArray = new ArrayList<Double>();\r\n\t\t\t\r\n\t\t\ttempArray.add(screenHight - test3 + (test4 * i));\r\n\t\t\ttempArray.add(test1);\r\n\t\t\tint[] RGBArray = getScreenColor(test1, screenHight - test3 + (test4 * i));\r\n\t\t\t\r\n\t\t\tfor(int x = 0; x < RGBArray.length; x++){\r\n\t\t\t\ttempArray.add((double) (RGBArray[x]));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tlifeGlobe.addPosition(tempArray);\r\n\t\t}\r\n\t}", "public void setBestSize() { setSize(getBestWidth(), getBestHeight()); }", "void measure_small_object() {\n down_angle=Math.abs(down_angle);\n up_angle=Math.abs(up_angle);\n double distance_angle=90-down_angle;\n distance_from_object = human_length*Math.tan(Math.toRadians(distance_angle));\n double part_of_my_tall=distance_from_object*Math.tan(Math.toRadians(up_angle));\n length_of_object=human_length-part_of_my_tall;\n if(length_of_object/100>0) {\n ORI.setText(\"length_of_object :\\n\" + String.valueOf(String.format(\"%.2f\", (length_of_object / 100)) + \" M\" +\n \"\\n\" + \"distance_from_object :\\n\" + String.valueOf(String.format(\"%.2f\", (distance_from_object / 100))) + \" M\"));\n ORI.setVisibility(View.VISIBLE);\n }\n else {\n Toast.makeText(Online.this, \"Move Forward\", Toast.LENGTH_LONG).show();\n down_angle = 0;\n up_angle = 0;\n touch_ground_switch.setVisibility(View.VISIBLE);\n }\n\n }", "private void toggleResizeMode() {\n\n CURRENT_RESIZE_MODE = CURRENT_RESIZE_MODE + 1;\n if (CURRENT_RESIZE_MODE >= RESIZE_MODE.size()) {\n CURRENT_RESIZE_MODE = 0;\n }\n AppPref.getInstance().setResizeMode(CURRENT_RESIZE_MODE);\n simpleExoPlayerView.setResizeMode((Integer) RESIZE_MODE.keySet().toArray()[CURRENT_RESIZE_MODE]);\n btn_screen.setImageResource(RESIZE_MODE.get(CURRENT_RESIZE_MODE));\n }", "@Override\n\tpublic void resize(int w, int h) {\n\t\tthis.leveys = w;\n\t\tthis.korkeus = h;\n\t\tthis.batch = new SpriteBatch();\n\t\tthis.ylaPalkinKorkeus = (int) (0.0931 * leveys);\n\n//\t\tskaala = Math.min((float) (w - 50) / 640,\n//\t\t\t\t(float) (h - 50 - ylaPalkinKorkeus) / 370f);\n\t\tskaala = Math.min((float) (w - 50) / 590,\n\t\t\t\t(float) (h - 50 - ylaPalkinKorkeus) / 354f);\n\n\t\t//System.out.println(\"(w - 50) / 640 = \" + w + \" - 50) / 640 = \" + (float) (w - 50) / 640);\n\t\t//System.out.println(\"(h - 50 - ylaPalkinKorkeus) / 370f) = \" + h + \"- 50 - \" + ylaPalkinKorkeus + \") / 370f = \" + (float) (h - 50 - ylaPalkinKorkeus) / 370f);\n\t\tSystem.out.println(\"Fontin skaala: \" + skaala);\n\t\tfont2.setScale(skaala);\n\t\t//font2.setScale(skaala*0.2f);\n\t\t// leveysSkaala = w / 640;\n\t\t// korkeusSkaala = h / 480;\n\n\t}", "public static int size_quality() {\n return (16 / 8);\n }", "public final int mo81946a(MediaModel mediaModel) {\n int i;\n if (this.f82196d < 0) {\n RecyclerView recyclerView = this.f82188b;\n if (recyclerView != null) {\n i = recyclerView.getMeasuredHeight();\n } else {\n i = -1;\n }\n this.f82196d = i;\n }\n if (this.f82196d < 0) {\n this.f82196d = f82195h;\n }\n if (this.f82196d <= 0 || mediaModel.getWidth() <= 0 || mediaModel.getHeight() <= 0) {\n return f82194g;\n }\n float width = ((float) mediaModel.getWidth()) / ((float) mediaModel.getHeight());\n double d = (double) width;\n if (d < 0.5625d) {\n double d2 = (double) this.f82196d;\n Double.isNaN(d2);\n return (int) (d2 * 0.5625d);\n } else if (d <= 1.7777777777777777d) {\n return (int) (((float) this.f82196d) * width);\n } else {\n double d3 = (double) this.f82196d;\n Double.isNaN(d3);\n return (int) (d3 * 1.7777777777777777d);\n }\n }", "@Override\n public void setContentScaleFactor(double v) {\n super.setContentScaleFactor(1);\n }", "public void rescale()\r\n\t{\n\t}", "public synchronized void mo24424Qv() {\n char c;\n try {\n Context applicationContext = VivaBaseApplication.m8749FZ().getApplicationContext();\n int i = 3 >> 1;\n if (applicationContext == null) {\n String str = \"ort_ebionof_kfcyepr_\";\n if (!AppPreferencesSetting.getInstance().getAppSettingBoolean(\"pref_root_config_key\", false)) {\n C5523b.logException(new C5526d(\" rootconfig firstrun state not work aa!\"));\n }\n this.bEA = true;\n return;\n }\n C4059d.m10105cr(applicationContext);\n if (!ApplicationBase.biq) {\n new C8150d().mo33232R(applicationContext, false);\n }\n String str2 = \"_mhdshbaswesop_o\";\n DataRefreshValidateUtil.recordDataRefreshTime(\"splash_show_mode\");\n if (!this.bEC) {\n C4386g.m11041QJ();\n C4386g.m11042QK();\n if (!TextUtils.isEmpty(BaseSocialNotify.getActiveNetworkName(applicationContext))) {\n DiskLruCache.clearCache(applicationContext, null, 43200000);\n }\n m10993cR(applicationContext);\n m10990a(applicationContext, C4681i.m12184Gp().mo25016Gr());\n if (C3569a.m8772FK()) {\n m10992cQ(applicationContext);\n }\n m10994cS(applicationContext);\n if (C3869e.m9526Hj()) {\n C3869e.m9528by(applicationContext);\n }\n C3742b.m9111II().mo23180K(applicationContext, C8113b.aES());\n m10991bR(C3742b.m9111II().mo23153JU());\n if (C3569a.m8773FL()) {\n String str3 = \"fptli_gtt_ayurponpaye_te_ytkes\";\n if (AppPreferencesSetting.getInstance().getAppSettingInt(\"pref_key_setting_autoplay_type\", -1) == -1) {\n AppPreferencesSetting.getInstance().setAppSettingInt(\"pref_key_setting_autoplay_type\", AppPreferencesSetting.getInstance().getAppSettingBoolean(\"pref_auto_play\", true) ? 1 : 0);\n }\n }\n C8049f.aBf().mo33076A(Boolean.valueOf(C3742b.m9111II().mo23167Jn()));\n }\n this.bEC = true;\n this.bEA = true;\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n }\n }", "private void m6587D() {\n if (C1413m.m6841c(this.f5389I)) {\n setTheme(R.style.notitleBarStyle_nightmode);\n if (C1413m.m6844f()) {\n setContentView(R.layout.mainiqoo_night);\n } else if (!m6595L()) {\n setContentView(R.layout.mainline_night);\n } else if (C1413m.m6838b() <= 4.0f || C1384A.m6754a()) {\n setContentView(R.layout.main_nightmode_low_rom_version);\n } else {\n setContentView(R.layout.main_nightmode);\n }\n } else {\n setTheme(R.style.notitleBarStyle);\n if (C1413m.m6844f()) {\n setContentView(R.layout.mainiqoo);\n } else if (!m6595L()) {\n setContentView(R.layout.mainline);\n } else if (C1413m.m6838b() <= 4.0f || C1384A.m6754a()) {\n setContentView(R.layout.main_low_rom_version);\n } else {\n setContentView(R.layout.main);\n }\n }\n this.f5410ca = (ImageView) findViewById(R.id.iv_aec);\n this.f5434oa = findViewById(R.id.center_flag);\n if (AppFeature.f5611g) {\n this.f5410ca.setVisibility(0);\n this.f5410ca.setOnClickListener(this);\n m6584A();\n }\n if (m6595L()) {\n this.f5412da = (TextView) findViewById(R.id.tv_record_name);\n }\n this.f5424ja = (RecyclerView) findViewById(R.id.rv_mark);\n m6586C();\n this.f5384D = (TwoStateLayout) findViewById(R.id.record_control);\n this.f5385E = (TwoStateLayout) findViewById(R.id.done_or_filelist);\n this.f5386F = (TwoStateLayout) findViewById(R.id.mark_control);\n this.f5416fa = (ImageView) findViewById(R.id.mask);\n this.f5436pa = (RelativeLayout) findViewById(R.id.background_view);\n this.f5438qa = (LinearLayout) findViewById(R.id.bottom_layout);\n if (!C1413m.m6844f()) {\n C1413m.m6834a((View) this.f5384D, 10);\n }\n if (C1413m.f5711i != null) {\n mo5957a();\n } else {\n m6622a(false);\n }\n }", "public int[] determineScreenSize()\n {\n int heightInPixels, widthInPixels;\n int horizontal, vertical;\n\n // Determine initial values from CRTC registers (ensure dimensions are positive by casting byte to int)\n horizontal = ((((int) videocard.crtControllerRegister.regArray[1]) & 0xFF) + 1) * 8;\n vertical = ((((int) videocard.crtControllerRegister.regArray[18]) & 0xFF) | \n (((((int) videocard.crtControllerRegister.regArray[7]) & 0xFF) & 0x02) << 7) | (((((int) videocard.crtControllerRegister.regArray[7]) & 0xFF) & 0x40) << 3)) + 1;\n\n if (videocard.graphicsController.shift256Reg == 0)\n {\n widthInPixels = 640;\n heightInPixels = 480;\n\n if (videocard.crtControllerRegister.regArray[0x06] == (byte) 0xBF)\n {\n if (videocard.crtControllerRegister.regArray[0x17] == (byte) 0xA3 && videocard.crtControllerRegister.regArray[0x14] == (byte) 0x40 && videocard.crtControllerRegister.regArray[0x09] == (byte) 0x41)\n {\n widthInPixels = 320;\n heightInPixels = 240;\n }\n else\n {\n if (videocard.sequencer.dotClockRate != 0)\n {\n horizontal <<= 1;\n }\n widthInPixels = horizontal;\n heightInPixels = vertical;\n }\n }\n else if ((horizontal >= 640) && (vertical >= 480))\n {\n widthInPixels = horizontal;\n heightInPixels = vertical;\n }\n }\n else if (videocard.graphicsController.shift256Reg == 2)\n {\n\n if (videocard.sequencer.chainFourEnable != 0)\n {\n widthInPixels = horizontal;\n heightInPixels = vertical;\n }\n else\n {\n widthInPixels = horizontal;\n heightInPixels = vertical;\n }\n }\n else\n {\n if (videocard.sequencer.dotClockRate != 0)\n horizontal <<= 1;\n widthInPixels = horizontal;\n heightInPixels = vertical;\n }\n return new int[] {heightInPixels, widthInPixels};\n }", "private void m7222b() {\n this.f5601w.mo5525a((C1272h) this);\n this.f5601w.mo5527a((C1280l) this);\n this.f5601w.mo5528a(this.f5580E);\n }", "private void calculateMatrices() {\n viewMatrix = new Matrix();\n clipRect = null;\n\n float actualWidth = gameModel.actualWidth = getWidth();\n float actualHeight = gameModel.actualHeight = getHeight();\n float virtualWidth = gameModel.getWidth();\n float virtualHeight = gameModel.getHeight();\n\n float scale = Math.max(virtualWidth / actualWidth, virtualHeight / actualHeight);\n if (scale < 0.99 || scale > 1.01) {\n viewMatrix.postScale(1f / scale, 1f / scale);\n\n float extraW = actualWidth * scale - virtualWidth;\n float extraH = actualHeight * scale - virtualHeight;\n\n if (extraW > 1f || extraH > 1f) {\n viewMatrix.postTranslate(extraW / scale / 2f, extraH / scale / 2f);\n clipRect = new RectF(0, 0, virtualWidth, virtualHeight);\n }\n }\n\n // Invert the view matrix, to obtain a matrix that can be used for translating\n // touch events back to virtual coordinates.\n touchMatrix = new Matrix(viewMatrix);\n touchMatrix.invert(touchMatrix);\n }", "public int[] getSuggestedScreenSize();", "void mo33732Px();", "@Override\n\tpublic void resize() {\n\t\t\n\t}" ]
[ "0.58250487", "0.5686547", "0.56424296", "0.5640904", "0.5623846", "0.5605469", "0.55792606", "0.55045074", "0.54732037", "0.5439883", "0.54010856", "0.53978574", "0.5340799", "0.5333581", "0.53309584", "0.5295634", "0.5257591", "0.5208839", "0.5207419", "0.51900417", "0.5131381", "0.5128575", "0.51136464", "0.5105277", "0.51000315", "0.50999933", "0.5069047", "0.5066547", "0.5059011", "0.5045312", "0.5045206", "0.5030034", "0.5029038", "0.5028288", "0.50219536", "0.50165206", "0.500846", "0.5006337", "0.50063175", "0.5005281", "0.49902064", "0.49867016", "0.4982889", "0.49781764", "0.49741167", "0.4970198", "0.4965891", "0.49627703", "0.4960087", "0.49549", "0.49537855", "0.49536455", "0.49454513", "0.4942226", "0.49396628", "0.49340558", "0.49335724", "0.49335033", "0.4926596", "0.4924857", "0.4919962", "0.4918061", "0.4918061", "0.4918061", "0.4918061", "0.4918061", "0.49171847", "0.49075678", "0.49005723", "0.48962492", "0.4896206", "0.48959154", "0.4889525", "0.48868254", "0.48848194", "0.48841262", "0.4882018", "0.4875988", "0.48752126", "0.48651108", "0.48636323", "0.48578256", "0.48536873", "0.48522022", "0.48499316", "0.4829575", "0.4826306", "0.48205507", "0.48196796", "0.48187616", "0.48138243", "0.4812281", "0.4808911", "0.4808777", "0.48058122", "0.48056692", "0.4805202", "0.47991005", "0.479501", "0.47931126", "0.4793098" ]
0.0
-1
Acquiring the angles is relatively expensive; we don't want to do that in each of the three items that need that info, as that's three times the necessary expense.
@Override public void run() { robot.angles = robot.imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); robot.gravity = robot.imu.getGravity(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void getAngles(double[] values);", "private float calculateAngles(){\n\t\t// First we will move the current angle heading into the previous angle heading slot.\n\t\tdata.PID.headings[0] = data.PID.headings[1];\n\t\t// Then, we assign the new angle heading.\n\t\tdata.PID.headings[1] = data.imu.getAngularOrientation().firstAngle;\n\n\t\t// Finally we calculate a computedTarget from the current angle heading.\n\t\tdata.PID.computedTarget = data.PID.headings[1] + (data.PID.IMURotations * 360);\n\n\t\t// Now we determine if we need to re-calculate the angles.\n\t\tif(data.PID.headings[0] > 300 && data.PID.headings[1] < 60) {\n\t\t\tdata.PID.IMURotations++; //rotations of 360 degrees\n\t\t\tcalculateAngles();\n\t\t} else if(data.PID.headings[0] < 60 && data.PID.headings[1] > 300) {\n\t\t\tdata.PID.IMURotations--;\n\t\t\tcalculateAngles();\n\t\t}\n\t\treturn data.PID.headings[1];\n\t}", "private double getAngle(){\n //Get a new angle measurement\n angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n //Get the difference between current angle measurement and last angle measurement\n double deltaAngle = angles.firstAngle - lastAngles.firstAngle;\n\n //Process the angle to keep it within (-180,180)\n //(Once angle passes +180, it will rollback to -179, and vice versa)\n if (deltaAngle < -180)\n deltaAngle += 360;\n else if (deltaAngle > 180)\n deltaAngle -= 360;\n\n //Add the change in angle since last measurement (deltaAngle)\n //to the change in angle since last reset (globalAngle)\n globalAngle += deltaAngle;\n //Set last angle measurement to current angle measurement\n lastAngles = angles;\n\n return globalAngle;\n }", "double getAngle();", "double getAngle();", "public int getAngle(){\n\t\tif(!resetCoordinates()&&robot.imu1.isGyroCalibrated()){\n\t\t\trobot.angles=robot.imu1.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n\t\t\tdouble currentAngle=robot.angles.firstAngle;\n\t\t\tint finalAngle= robot.startingAngle+(int)Math.round(currentAngle);\n\t\t\tif(finalAngle<0){\n\t\t\t\treturn 360+finalAngle;\n\t\t\t}\n\t\t\treturn finalAngle;\n\n\t\t}\n\t\telse if(!resetCoordinates()&&robot.imu.isGyroCalibrated()){\n\t\t\trobot.angles=robot.imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.YZX, AngleUnit.DEGREES);\n\t\t\tdouble currentAngle=robot.angles.firstAngle;\n\t\t\tint finalAngle= robot.startingAngle+(int)Math.round(currentAngle);\n\t\t\tif(finalAngle<0){\n\t\t\t\treturn 360+finalAngle;\n\t\t\t}\n\t\t\treturn finalAngle;\n\n\t\t}\n\t\telse if(resetCoordinates()){\n\t\t\tdouble oldAngle = robot.rotation.thirdAngle;\n\t\t\tdouble posAngle = oldAngle;\n\t\t\tint finalAngle;\n\t\t\tif (oldAngle < 0) posAngle = 360 - Math.abs(oldAngle);\n\t\t\tif((int) (Math.round(posAngle)) - 45 < 0){\n\t\t\t\tfinalAngle = 360-(int)Math.round(posAngle);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfinalAngle = (int) (Math.round(posAngle)) - 45;\n\t\t\t}\n\t\t\treturn finalAngle;\n\t\t}\n\t\telse{\n\t\t\treturn 10000;\n\t\t}\n\t}", "double getAngle(int id);", "public double getAngle();", "public double getAngle() { return angle; }", "private float calculateAngle() {\r\n\r\n\t\tdouble angleTemp = Math.atan2(Target.getY() - y, Target.getX() - x);\r\n\t\t// I needed to use wikipedia to get this i\r\n\t\t// did not learn this in math and needed\r\n\t\t// to use a couplle youtube tutorials to\r\n\t\t// find out how to do the math in java\r\n\t\t// aswell thank fully one had the exact\r\n\t\t// way of doing this\r\n\t\treturn (float) Math.toDegrees(angleTemp) + 90;\r\n\t}", "private double getAngle()\n {\n Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n return angles.firstAngle;\n }", "private double getAngle() {\n double normal= Math.sqrt(((getgAxis(ADXL345_I2C.Axes.kX))*(getgAxis(ADXL345_I2C.Axes.kX)))+((getgAxis(ADXL345_I2C.Axes.kY))*(getgAxis(ADXL345_I2C.Axes.kY))));\n\n return MathUtils.atan(normal / getgAxis(ADXL345_I2C.Axes.kZ));\n }", "EDataType getAngleDegrees();", "public void calculateAngleAndRotate(){\n\t\tdouble cumarea = 0;\n\t\tdouble sina = 0;\n\t\tdouble cosa = 0;\n\t\tdouble area, angle;\n\t\tfor (int n = 0; n < rt.size();n++) {\n\t\t\tarea = rt.getValueAsDouble(rt.getColumnIndex(\"Area\"),n);\n\t\t\tangle = 2*rt.getValueAsDouble(rt.getColumnIndex(\"Angle\"),n);\n\t\t\tsina = sina + area*Math.sin(angle*Math.PI/180);\n\t\t\tcosa = cosa + area*Math.cos(angle*Math.PI/180);\n\t\t\tcumarea = cumarea+area;\n\t\t}\n\t\taverageangle = Math.abs(0.5*(180/Math.PI)*Math.atan2(sina/cumarea,cosa/cumarea)); // this is the area weighted average angle\n\t\t// rotate the data \n\t\tIJ.run(ActiveImage,\"Select All\",\"\");\n\t\tActiveImageConverter.convertToGray32();\n\t\tIJ.run(ActiveImage,\"Macro...\", \"code=[v= x*sin(PI/180*\"+averageangle+\")+y*cos(PI/180*\"+averageangle+\")]\");\n\t\treturn;\n\t}", "private double getAngle()\n {\n // We experimentally determined the Z axis is the axis we want to use for heading angle.\n // We have to process the angle because the imu works in euler angles so the Z axis is\n // returned as 0 to +180 or 0 to -180 rolling back to -179 or +179 when rotation passes\n // 180 degrees. We detect this transition and track the total cumulative angle of rotation.\n\n Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n\n double deltaAngle = angles.firstAngle - lastAngles.firstAngle;\n\n if (deltaAngle < -180)\n deltaAngle += 360;\n else if (deltaAngle > 180)\n deltaAngle -= 360;\n\n globalAngle += deltaAngle;\n\n lastAngles = angles;\n\n return globalAngle;\n }", "@Override\n\tpublic float calculateCelestialAngle(long par1, float par3) {\n\t\treturn 2.0F;\n\t}", "public double getAngle() {\n if (r == 0) {\n if (i == 0)\n return 0;// error?\n if (i > 0)\n return p2;\n else\n return -p2;\n }\n double d = Math.atan(i / r);\n if (r >= 0) {\n return d;\n }\n if (i >= 0)\n return Math.PI + d;\n return d + Math.PI;\n }", "private double getAngle() {\n // We experimentally determined the Z axis is the axis we want to use for\n // heading angle. We have to process the angle because the imu works in\n // euler angles so the Z axis is returned as 0 to +180 or 0 to -180\n // rolling back to -179 or +179 when rotation passes 180 degrees. We\n // detect this transition and track the total cumulative angle of rotation.\n\n Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC,\n AxesOrder.ZYX, AngleUnit.DEGREES);\n\n double deltaAngle = angles.firstAngle - lastAngles.firstAngle;\n\n if (deltaAngle < -180)\n deltaAngle += 360;\n else if (deltaAngle > 180)\n deltaAngle -= 360;\n\n globalAngle += deltaAngle;\n\n lastAngles = angles;\n\n return globalAngle;\n }", "public float calculateCelestialAngle(long par1, float par3)\n {\n return 0.5F;\n }", "public double getAngle() {\n\t\treturn 180 * (this.N - 2) / this.N;\n\t}", "public double[] angles()\n {\n double[] res = new double[3];\n PdVector.angle(res, p1, p2, p3);\n return res;\n }", "private void calculateAngle(){\n for (Point point : points) {\n double d = Math.abs(point.x)+Math.abs(point.z);\n double angle = 0;\n\n if (point.x >= 0 && point.z >= 0){\n angle = point.z/d;\n } else if (point.x < 0 && point.z >= 0){\n angle = 2 - point.z/d;\n } else if (point.x < 0 && point.z <0){\n angle = 2 + Math.abs(point.z)/d;\n } else if (point.x >=0 && point.z < 0){\n angle = 4 - Math.abs(point.z)/d;\n }\n point.setAngle(angle);\n }\n Collections.sort(points);\n }", "private void generateAngles( boolean constrained ) {\n System.out.println( dataset_name + \" \" + constrained );\n\n CartesianPoint[] eucs_array = new CartesianPoint[0];\n eucs_array = getData().toArray( eucs_array ); // count * count + count\n int len = eucs_array.length;\n\n Metric<CartesianPoint> metric = getMetric();\n\n for (int i = 0; i < count; i++) {\n\n double d_viewpoint_q = getMetric().distance(viewpoint, eucs_array[i]);\n for (int j = count + (count * i); j < ( 2 * count ) + (count * i); j++ ) {\n\n CartesianPoint query = eucs_array[i];\n CartesianPoint some_point;\n if( constrained ) {\n some_point = new CartesianPoint(getRandomVolumePoint(query.getPoint(), thresh));\n while( ! insideSpace( query ) ) {\n some_point = new CartesianPoint(getRandomVolumePoint(query.getPoint(), thresh));\n }\n } else {\n some_point = eucs_array[j];\n }\n\n double dqpi = metric.distance( query,some_point );\n double p1pi = metric.distance( viewpoint,some_point );\n\n double theta = Math.acos( ( square(dqpi) + square(d_viewpoint_q) - square(p1pi) ) / (2 * dqpi * d_viewpoint_q ) );\n\n System.out.println(theta);\n }\n }\n }", "public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)\n {\n float f = par3 * (float)Math.PI * -0.1F;\n\n for (int i = 0; i < 4; i++)\n {\n field_78106_a[i].rotationPointY = -2F + MathHelper.cos(((float)(i * 2) + par3) * 0.25F);\n field_78106_a[i].rotationPointX = MathHelper.cos(f) * 9F;\n field_78106_a[i].rotationPointZ = MathHelper.sin(f) * 9F;\n f += ((float)Math.PI / 2F);\n }\n\n f = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F;\n\n for (int j = 4; j < 8; j++)\n {\n field_78106_a[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + par3) * 0.25F);\n field_78106_a[j].rotationPointX = MathHelper.cos(f) * 7F;\n field_78106_a[j].rotationPointZ = MathHelper.sin(f) * 7F;\n f += ((float)Math.PI / 2F);\n }\n\n f = 0.4712389F + par3 * (float)Math.PI * -0.05F;\n\n for (int k = 8; k < 12; k++)\n {\n field_78106_a[k].rotationPointY = 11F + MathHelper.cos(((float)k * 1.5F + par3) * 0.5F);\n field_78106_a[k].rotationPointX = MathHelper.cos(f) * 5F;\n field_78106_a[k].rotationPointZ = MathHelper.sin(f) * 5F;\n f += ((float)Math.PI / 2F);\n }\n\n field_78105_b.rotateAngleY = par4 / (180F / (float)Math.PI);\n field_78105_b.rotateAngleX = par5 / (180F / (float)Math.PI);\n }", "public AngleIF() {\n \t\t//_navx = new navx();\n \t\t//roboAccel = new RoboRioAccelerometers();\n \t}", "public double getAngle()\n {\n return (AngleAverage);\n }", "public float getXAngle(){\n Point project=new Point(0,accel.y,accel.z);\n\n float angl=(float)Math.asin(project.y / project.module())* PreferenceHelper.sensetivity;\n //float angl=(float)Math.acos(accel.z/accel.module())*100f;\n if(Float.isNaN(angl)) angl=0.5f;\n return (float)(Math.rint( toFlowX(angl)/1.0) * 1.0);\n }", "public AccOrientation calculateAngle(SensorEvent event) {\t\t\n\t final int _DATA_X = 0;\n\t final int _DATA_Y = 1;\n\t final int _DATA_Z = 2;\n\t // Angle around x-axis thats considered almost perfect vertical to hold\n\t // the device\n\t final int PIVOT = 20;\n\t // Angle around x-asis that's considered almost too vertical. Beyond\n\t // this angle will not result in any orientation changes. f phone faces uses,\n\t // the device is leaning backward.\n\t final int PIVOT_UPPER = 65;\n\t // Angle about x-axis that's considered negative vertical. Beyond this\n\t // angle will not result in any orientation changes. If phone faces uses,\n\t // the device is leaning forward.\n\t final int PIVOT_LOWER = -10;\n\t // Upper threshold limit for switching from portrait to landscape\n\t final int PL_UPPER = 295;\n\t // Lower threshold limit for switching from landscape to portrait\n\t final int LP_LOWER = 320;\n\t // Lower threshold limt for switching from portrait to landscape\n\t final int PL_LOWER = 270;\n\t // Upper threshold limit for switching from landscape to portrait\n\t final int LP_UPPER = 359;\n\t // Minimum angle which is considered landscape\n\t final int LANDSCAPE_LOWER = 235;\n\t // Minimum angle which is considered portrait\n\t final int PORTRAIT_LOWER = 60;\n\t \n\t // Internal value used for calculating linear variant\n\t final float PL_LF_UPPER =\n\t ((float)(PL_UPPER-PL_LOWER))/((float)(PIVOT_UPPER-PIVOT));\n\t final float PL_LF_LOWER =\n\t ((float)(PL_UPPER-PL_LOWER))/((float)(PIVOT-PIVOT_LOWER));\n\t // Internal value used for calculating linear variant\n\t final float LP_LF_UPPER =\n\t ((float)(LP_UPPER - LP_LOWER))/((float)(PIVOT_UPPER-PIVOT));\n\t final float LP_LF_LOWER =\n\t ((float)(LP_UPPER - LP_LOWER))/((float)(PIVOT-PIVOT_LOWER));\n\t \n\t int mSensorRotation = -1; \n\t \n\t\t\tfinal boolean VERBOSE = true;\n float[] values = event.values;\n float X = values[_DATA_X];\n float Y = values[_DATA_Y];\n float Z = values[_DATA_Z];\n float OneEightyOverPi = 57.29577957855f;\n float gravity = (float) Math.sqrt(X*X+Y*Y+Z*Z);\n float zyangle = (float)Math.asin(Z/gravity)*OneEightyOverPi;\n int rotation = -1;\n float angle = (float)Math.atan2(Y, -X) * OneEightyOverPi;\n int orientation = 90 - (int)Math.round(angle);\n AccOrientation result = new AccOrientation();\n \n while (orientation >= 360) {\n orientation -= 360;\n } \n while (orientation < 0) {\n orientation += 360;\n }\n result.orientation = orientation;\n result.angle = zyangle; \n result.threshold = 0;\n if ((zyangle <= PIVOT_UPPER) && (zyangle >= PIVOT_LOWER)) {\n // Check orientation only if the phone is flat enough\n // Don't trust the angle if the magnitude is small compared to the y value\n \t/*\n float angle = (float)Math.atan2(Y, -X) * OneEightyOverPi;\n int orientation = 90 - (int)Math.round(angle);\n normalize to 0 - 359 range\n while (orientation >= 360) {\n orientation -= 360;\n } \n while (orientation < 0) {\n orientation += 360;\n }\n mOrientation.setText(String.format(\"Orientation: %d\", orientation));\n */ \n // Orientation values between LANDSCAPE_LOWER and PL_LOWER\n // are considered landscape.\n // Ignore orientation values between 0 and LANDSCAPE_LOWER\n // For orientation values between LP_UPPER and PL_LOWER,\n // the threshold gets set linearly around PIVOT.\n if ((orientation >= PL_LOWER) && (orientation <= LP_UPPER)) {\n float threshold;\n float delta = zyangle - PIVOT;\n if (mSensorRotation == ROTATION_090) {\n if (delta < 0) {\n // Delta is negative\n threshold = LP_LOWER - (LP_LF_LOWER * delta);\n } else {\n threshold = LP_LOWER + (LP_LF_UPPER * delta);\n }\n rotation = (orientation >= threshold) ? ROTATION_000 : ROTATION_090;\n if (mShowLog) \n \tLog.v(TAG, String.format(\"CASE1. %2.4f %d %2.4f %d\", delta, orientation, threshold, rotation));\n } else {\n if (delta < 0) {\n // Delta is negative\n threshold = PL_UPPER+(PL_LF_LOWER * delta);\n } else {\n threshold = PL_UPPER-(PL_LF_UPPER * delta);\n }\n rotation = (orientation <= threshold) ? ROTATION_090: ROTATION_000;\n if (mShowLog)\n \tLog.v(TAG, String.format(\"CASE2. %2.4f %d %2.4f %d\", delta, orientation, threshold, rotation));\n }\n result.threshold = threshold;\n } else if ((orientation >= LANDSCAPE_LOWER) && (orientation < LP_LOWER)) {\n rotation = ROTATION_090;\n if (mShowLog)\n \tLog.v(TAG, String.format(\"CASE3. 90 (%d)\", orientation));\n } else if ((orientation >= PL_UPPER) || (orientation <= PORTRAIT_LOWER)) {\n rotation = ROTATION_000;\n if (mShowLog)\n \tLog.v(TAG, String.format(\"CASE4. 00 (%d)\", orientation)); \n } else {\n \tif (mShowLog)\n \t\tLog.v(TAG, \"CASE5. \"+orientation);\n }\n if ((rotation != -1) && (rotation != mSensorRotation)) {\n mSensorRotation = rotation;\n if (mSensorRotation == ROTATION_000) {\n \t\t//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n \tif (mShowLog)\n \t\tLog.w(TAG, \"Rotation: 00\");\n }\n else if (mSensorRotation == ROTATION_090) \n {\n \t\t//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);\n \tif (mShowLog)\n \t\tLog.w(TAG, \"Rotation: 90\");\n } \n }\n result.rotation = rotation;\n } else {\n \t//Log.v(TAG, String.format(\"Invalid Z-Angle: %2.4f (%d %d)\", zyangle, PIVOT_LOWER, PIVOT_UPPER));\n }\t\n return result;\n\t\t}", "public float calculateCelestialAngle(long par1, float par3) {\n\t\treturn 0.0F;\n\t}", "public double getAngle2() {\n\n // We experimentally determined the Z axis is the axis we want to use for heading angle.\n // We have to process the angle because the imu works in euler angles so the Z axis is\n // returned as 0 to +180 or 0 to -180 rolling back to -179 or +179 when rotation passes\n // 180 degrees. We detect this transition and track the total cumulative angle of rotation.\n\n Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n\n\n\n double deltaAngle = angles.firstAngle - lastAngles.firstAngle;\n\n if (deltaAngle < -180)\n deltaAngle += 360;\n else if (deltaAngle > 180)\n deltaAngle -= 360;\n\n\n globalAngle += deltaAngle;\n\n lastAngles = angles;\n\n return (globalAngle);\n\n }", "private double getPolarAngle(double refX, double refY, double px, double py) {\n\t\tdouble tethaRadian = -1;\n\t\tif ((px - refX) > 0 && (refY - py) >= 0) {\n\t\t\ttethaRadian = Math.atan((refY - py) / (px - refX));\n\t\t} else if ((px - refX) > 0 && (refY - py) < 0) {\n\t\t\ttethaRadian = Math.atan((refY - py) / (px - refX)) + 2 * Math.PI;\n\t\t} else if ((px - refX) < 0) {\n\t\t\ttethaRadian = Math.atan((refY - py) / (px - refX)) + Math.PI;\n\t\t} else if ((px - refX) == 0 && (refY - py) > 0) {\n\t\t\ttethaRadian = Math.PI / 2;\n\t\t} else if ((px - refX) == 0 && (refY - py) < 0) {\n\t\t\ttethaRadian = 3 * Math.PI / 2;\n\t\t}\n\t\treturn tethaRadian;\n\t}", "@Test\r\n public void testCalculateAngle3() {\r\n System.out.println(\"calculateAngle3\");\r\n DialDraw instance = new TachometerDraw();\r\n instance.setValue(100);\r\n double expResult = Math.toRadians(0);\r\n double result = instance.calculateAngle();\r\n assertEquals(result, expResult, 0.0001);\r\n }", "public double getAngle ()\n {\n return angle_;\n }", "public int getAngle() {\r\n return angle;\r\n }", "void take_angles() {\n\n rolls+=String.valueOf((Math.toDegrees(orientation[2]))%360+90)+\"\\n\";\n if(!touch_ground_switch.isChecked()&&angle_with_ground==0)\n angle_with_ground=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n else if (down_angle == 0)\n down_angle=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n else if(up_angle==0)\n {\n up_angle=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n touch_ground_switch.setVisibility(View.INVISIBLE);\n if(!touch_ground_switch.isChecked())\n object_calculations_doesnt_touch_ground();\n else\n object_calculations_touch_ground();\n }\n}", "public int getCurrentAngle(){\n return flatbed.currentAngle;\n }", "protected float getGyroscopeAngle() {\n if (doGyro) {\n Orientation exangles = bosch.getAngularOrientation(AxesReference.EXTRINSIC, AxesOrder.XYZ, AngleUnit.DEGREES);\n float gyroAngle = exangles.thirdAngle;\n //exangles.\n //telemetry.addData(\"angle\", \"angle: \" + exangles.thirdAngle);\n float calculated = normalizeAngle(reverseAngle(gyroAngle));\n //telemetry.addData(\"angle2\",\"calculated:\" + calculated);\n return calculated;\n } else {\n return 0.0f;\n }\n }", "public void drawAngleInfo(){\n\t\tfont2.draw(batch, (\"The angle of Projection is \" + angle),(float)(screenWidth * .45), 20);\n\t}", "private int getAngle(int amountOfCars) {\n\t\tint total = model.getNumberOfFloors() * model.getNumberOfRows() * model.getNumberOfPlaces();\n\t\tdouble angle = 1.0 * (double) amountOfCars / (double) total * 360.0;\n\t\treturn (int) angle;\n\t}", "AngleResource inclination();", "public double getAngle()\n {\n // We experimentally determined the Z axis is the axis we want to use for heading angle.\n // We have to process the angle because the imu works in euler angles so the Z axis is\n // returned as 0 to +180 or 0 to -180 rolling back to -179 or +179 when rotation passes\n // 180 degrees. We detect this transition and track the total cumulative angle of rotation.\n\n Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n\n double deltaAngle = angles.firstAngle - lastAngles.firstAngle;\n\n if (deltaAngle < -180)\n deltaAngle += 360;\n else if (deltaAngle > 180)\n deltaAngle -= 360;\n\n globalAngle += deltaAngle;\n\n lastAngles = angles;\n\n return globalAngle;\n }", "private boolean checkAngle() {\n\t\tint bornes = FILTER_BORNES;\n\t\treturn checkAngleBornes(angle, 0d, bornes) || checkAngleBornes(angle, 90d, bornes) || checkAngleBornes(angle, 180d, bornes);\n\t}", "private void composeAngleTelemetry(){\n telemetry.addData(\"Start Angle\", startAngles.firstAngle);\n telemetry.addData(\"Current Angle\", angles.firstAngle);\n telemetry.addData(\"Global Angle\", globalAngle);\n }", "private double getRawAngle() {\n return (m_pot.getVoltage() / Constants.AIO_MAX_VOLTAGE) * Constants.Hood.POT_SCALE;\n }", "public double getAngle() {\n\t\treturn this.position[2];\n\t}", "public double getAngle() {\n try {\n switch(Coordinates.angleUnit()) {\n case Coordinates.RADIAN:\n\treturn Double.parseDouble(deg.getText().trim());\n case Coordinates.DEGRE:\n\treturn Math.PI * Double.parseDouble(deg.getText().trim()) / 180.0;\n case Coordinates.DEGMN:\n\tString d = deg.getText().trim();\n\tif(d.length() == 0)\n\t d = \"0\";\n\tString m = mn.getText().trim();\n\tif(m.length() == 0)\n\t m = \"0\";\n\treturn Coordinates.parseAngle(d + \"11\" + m + \"'\");\n case Coordinates.DEGMNSEC:\n\td = deg.getText().trim();\n\tif(d.length() == 0)\n\t d = \"0\";\n\tm = mn.getText().trim();\n\tif(m.length() == 0)\n\t m = \"0\";\n\tString s = sec.getText().trim();\n\tif(s.length() == 0)\n\t s = \"0\";\n\treturn Coordinates.parseAngle(d + \"11\" + m + \"'\" + s + \"\\\"\");\n }\n }\n catch(NumberFormatException e) {\n }\n return 0.0;\n }", "public static float getAngle(float x1, float y1, float x2, float y2, float x3, float y3){\n\t\tfloat a2 = Vector2.len2(x3 - x2, y3 - y2);\n\t\tfloat b2 = Vector2.len2(x1 - x2, y1 - y2);\n\t\tfloat c2 = Vector2.len2(x3 - x1, y3 - y1);\n\t\tdouble aLen = Math.sqrt(a2);\n\t\tdouble bLen = Math.sqrt(b2);\n\t\t//c2 == a2 + b2 - (2 * aLen * bLen * x);\n\t\tdouble x = (a2 + b2 - c2) / (2 * aLen * bLen);\n\t\treturn (float) Math.acos(x) * MathUtils.radDeg;\n\t}", "public double getAngle(){\n\t\treturn this.angle;\n\t}", "public void setAngle( double a ) { angle = a; }", "public double getAngle() {\n return angle;\n }", "public double getAngle() {\n return angle;\n }", "public int getAngle(){\n\t\treturn (int)angle;\n\t}", "public double findAngle() {\n return 0d;\n }", "@Test\r\n public void testCalculateAngle4() {\r\n System.out.println(\"calculateAngle4\");\r\n DialDraw instance = new TachometerDraw();\r\n instance.setValue(90);\r\n double expResult = Math.toRadians(18);\r\n double result = instance.calculateAngle();\r\n assertEquals(result, expResult, 0.0001);\r\n }", "public int getAngle() {\r\n\t\treturn angle;\r\n\t}", "@Test\r\n public void testCalculateAngle1() {\r\n System.out.println(\"calculateAngle1\");\r\n DialDraw instance = new TachometerDraw();\r\n instance.setValue(36);\r\n double expResult = Math.toRadians(115.2);\r\n double result = instance.calculateAngle();\r\n assertEquals(result, expResult, 0.0001);\r\n }", "@Test\n\tpublic void testGetInnerAngle() {\n\t\tdouble ang1 = 168.7810;\n\t\tdouble ang2 = 64.0945;\n\t\tdouble ang3 = 268.5473;\n\t\t\n\t\t// Set the angles for testing\n\t\tTriangulate test = new Triangulate();\n\t\ttest.setAngles(ang1, ang2, ang3);\n\t\tdouble err = 1e-4; \n\t\t\n\t\tdouble[] innerAng = test.getInnerAngle();\n\t\tdouble actual1 = Math.toRadians(104.6865);\n\t\tdouble actual2 = Math.toRadians(155.5472);\n\t\tdouble actual3 = Math.toRadians(99.7663);\n\t\t\n\t\tdouble sum = 0;\n\t\tfor(int i = 0; i < innerAng.length; i++) sum += innerAng[i];\n\t\t\n\t\tassertEquals(actual1, innerAng[0], err);\n\t\tassertEquals(actual2, innerAng[1], err);\n\t\tassertEquals(actual3, innerAng[2], err);\n\t\tassertEquals(2*Math.PI, sum, err);\n\t\t\n\t}", "public double getTargetAngle(){\n return lastKnownAngle;\n }", "public double nextAngle()\n {\n return nextAngle();\n }", "public float getAngle() {\n return angle;\n }", "@Override\n public void reAngle() {\n }", "public double getAngleInDegrees() {\n return intakeAngle;\n }", "@Test\n public void testCondition4()\n {\n Double[] angles = {75.0, 75.0, 71.0};\n _renderable.orientation(angles);\n Double testVal[] = _renderable.orientation();\n assertEquals(\"x angle did not get set,\", angles[0], testVal[0], 2);\n assertEquals(\"y angle did not get set,\", angles[1], testVal[1], 2);\n assertEquals(\"z angle did not get set,\", angles[2], testVal[2], 2);\n }", "void setAngles(double[] values);", "public static native void OpenMM_AmoebaAngleForce_getAngleParameters(PointerByReference target, int index, IntBuffer particle1, IntBuffer particle2, IntBuffer particle3, DoubleBuffer length, DoubleBuffer quadraticK);", "public double getMyAngle() {\n return myAngle- STARTING_ANGLE;\n }", "@Override\n\tpublic void setRotationAngles(float p_78087_1_, float p_78087_2_,\n\t\t\tfloat p_78087_3_, float p_78087_4_, float p_78087_5_,\n\t\t\tfloat p_78087_6_, Entity p_78087_7_) {\n\t\thead.rotateAngleX = p_78087_5_ / (180F / (float) Math.PI);\n\t\thead.rotateAngleY = p_78087_4_ / (180F / (float) Math.PI);\n\t\tbody.rotateAngleX = (float) Math.PI / 2F;\n\t\tleg1.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F\n\t\t\t\t* p_78087_2_;\n\t\tleg2.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F\n\t\t\t\t+ (float) Math.PI)\n\t\t\t\t* 1.4F * p_78087_2_;\n\t\tleg3.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F\n\t\t\t\t+ (float) Math.PI)\n\t\t\t\t* 1.4F * p_78087_2_;\n\t\tleg4.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F\n\t\t\t\t* p_78087_2_;\n\t}", "public float getAngle() {\n return angle;\n }", "double getCalibratedLevelAngle();", "Angle createAngle();", "public double getAngle () {\n return super.getAngle() % 360D;\n }", "@Test\r\n public void testCalculateAngle2() {\r\n System.out.println(\"calculateAngle2\");\r\n DialDraw instance = new TachometerDraw();\r\n instance.setValue(0);\r\n double expResult = Math.toRadians(180);\r\n double result = instance.calculateAngle();\r\n assertEquals(result, expResult, 0.0001);\r\n }", "public double getAngle() {\n\t\treturn navx.getAngle();\n\t}", "public double getAngle() {\n\t\treturn angle;\n\t}", "public double getAngle() {\n\t\treturn angle;\n\t}", "AngleSmaller createAngleSmaller();", "public void setRotationAngles(float parTime, float parSwingSuppress, float par3, float parHeadAngleY, float parHeadAngleX, float par6, EntityElephant parEntity)\n {\n \t// return rotation point in case there was previous rearing animation\n \thead.setRotationPoint(headRotPointXDefault, headRotPointYDefault, headRotPointZDefault);\n body.setRotationPoint(bodyRotPointXDefault, bodyRotPointYDefault, bodyRotPointZDefault);\n legFrontRight.setRotationPoint(legFrontRightRotPointXDefault, legFrontRightRotPointYDefault, legFrontRightRotPointZDefault);\n legFrontLeft.setRotationPoint(legFrontLeftRotPointXDefault, legFrontLeftRotPointYDefault, legFrontLeftRotPointZDefault);\n childHead.setRotationPoint(childHeadRotPointXDefault, childHeadRotPointYDefault, childHeadRotPointZDefault);\n\n head.rotateAngleX = degToRad(parHeadAngleX);\n head.rotateAngleY = degToRad(parHeadAngleY);\n childHead.rotateAngleX = degToRad(parHeadAngleX);\n childHead.rotateAngleY = degToRad(parHeadAngleY);\n body.rotateAngleX = ((float)Math.PI / 2F);\n // swingSuppress goes to 0 when still so gates the movement\n legRearRight.rotateAngleX = MathHelper.cos(parTime * 0.6662F) * 1.4F * parSwingSuppress;\n legRearLeft.rotateAngleX = MathHelper.cos(parTime * 0.6662F + (float)Math.PI) * 1.4F * parSwingSuppress;\n legFrontRight.rotateAngleX = MathHelper.cos(parTime * 0.6662F + (float)Math.PI) * 1.4F * parSwingSuppress;\n legFrontLeft.rotateAngleX = MathHelper.cos(parTime * 0.6662F) * 1.4F * parSwingSuppress;\n trunk1.rotateAngleX = MathHelper.cos(degToRad(parEntity.ticksExisted*7)) * degToRad(15);\n childTrunk1.rotateAngleX = MathHelper.cos(degToRad(parEntity.ticksExisted*7)) * degToRad(15);\n trunk2.rotateAngleX = trunk1.rotateAngleX * 3;\n\n // flick ears\n ear1.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(15);\n ear2.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(-15);\n childEar1.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(15);\n childEar2.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(-15);\n\n // raise trunk if in water \n if (parEntity.isInWater())\n {\n \ttrunk1.rotateAngleX = degToRad(-150);\n \ttrunk2.rotateAngleX = degToRad(-20);\n \tchildTrunk1.rotateAngleX = degToRad(-150);\n }\n \n // perform rearing animation if appropriate\n if (parEntity.isRearing())\n {\n \tint rearingCounter = parEntity.getRearingCounter();\n// \t// DEBUG\n// \tSystem.out.println(\"ModelElephant entity is rearing with rearing counter = \"+rearingCounter);\n \t\n \t// move retain connection between body parts, hind legs stay where they were\n \thead.setRotationPoint(headRotPointXDefault, headRotPointYDefault+rearingOffsetCycle[rearingCounter][0], headRotPointZDefault+rearingOffsetCycle[rearingCounter][1]);\n body.setRotationPoint(bodyRotPointXDefault, bodyRotPointYDefault+rearingOffsetCycle[rearingCounter][2], bodyRotPointZDefault+rearingOffsetCycle[rearingCounter][3]);\n legFrontRight.setRotationPoint(legFrontRightRotPointXDefault, legFrontRightRotPointYDefault+rearingOffsetCycle[rearingCounter][4], legFrontRightRotPointZDefault+rearingOffsetCycle[rearingCounter][5]);\n legFrontLeft.setRotationPoint(legFrontLeftRotPointXDefault, legFrontLeftRotPointYDefault+rearingOffsetCycle[rearingCounter][6], legFrontLeftRotPointZDefault+rearingOffsetCycle[rearingCounter][7]);\n childHead.setRotationPoint(childHeadRotPointXDefault, childHeadRotPointYDefault+rearingOffsetCycle[rearingCounter][8], childHeadRotPointZDefault+rearingOffsetCycle[rearingCounter][9]);\n \n // rotate for rearing\n \tbody.rotateAngleX += degToRad(rearingAngleCycle[rearingCounter][0]);\n head.rotateAngleX += degToRad(rearingAngleCycle[rearingCounter][0]);\n \tchildHead.rotateAngleX += degToRad(rearingAngleCycle[rearingCounter][0]);\n \ttrunk1.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][1]);\n \ttrunk2.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][2]);\n \tchildTrunk1.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][1]);\n \tlegFrontRight.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][0]);\n \tlegFrontLeft.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][0]);\n }\n }", "public static native int OpenMM_AmoebaAngleForce_getNumAngles(PointerByReference target);", "public static double getAngle( GameObject one, GameObject two )\n {\n return Math.atan2( getDeltaY( one, two ), +getDeltaX( one, two ) );\n }", "private double getAngle(double y, double x) {\n\t\tdouble angle = Math.atan2(y, x);\n\t\tif (angle < 0)\n\t\t\tangle += 2 * Math.PI;\n\t\treturn angle;\n\t}", "public static double getAngle() {\n return NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"ts\").getDouble(0);\n }", "public double getFirstAngle(){\r\n\t\treturn Math.atan( \r\n\t\t\t\t(\r\n\t\t\t\t\t\tthis.getFirstObject().getCenterY()\r\n\t\t\t\t\t\t- this.getSecondObject().getCenterY()\r\n\t\t\t\t)\r\n\t\t\t\t/ (\r\n\t\t\t\t\t\tthis.getFirstObject().getCenterX()\r\n\t\t\t\t\t\t- this.getSecondObject().getCenterX()\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t}", "private double degToRadian(double angle)\n\t{\n\t\treturn angle/180*Math.PI;\n\t}", "public float getAngle() {\n return mAngle;\n }", "@Test\r\n public void testCalculateAngle5() {\r\n System.out.println(\"calculateAngle5\");\r\n DialDraw instance = new TachometerDraw();\r\n instance.setValue(50);\r\n double expResult = Math.toRadians(90);\r\n double result = instance.calculateAngle();\r\n assertEquals(result, expResult, 0.0001);\r\n }", "boolean needToAim(double angle);", "public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)\n {\n ModelRenderer[] var8 = this.squidTentacles;\n int var9 = var8.length;\n\n for (int var10 = 0; var10 < var9; ++var10)\n {\n ModelRenderer var11 = var8[var10];\n var11.rotateAngleX = par3;\n }\n }", "public double betweenAngle(Coordinates a, Coordinates b, Coordinates origin);", "public void updateOrientationAngles() {\n SensorManager.getRotationMatrix(rotationMatrix, null,\n accelerometerReading, magnetometerReading);\n\n // \"mRotationMatrix\" now has up-to-date information.\n\n float[] angles = SensorManager.getOrientation(rotationMatrix, orientationAngles);\n azimuth = (float) Math.toDegrees(angles[0]);\n // \"mOrientationAngles\" now has up-to-date information.\n TextView az = findViewById(R.id.az);\n rotateDriver(azimuth);\n\n az.setText(Float.toString(azimuth));\n }", "@Override\npublic void setAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){\n}", "public static native void OpenMM_AmoebaAngleForce_getAngleParameters(PointerByReference target, int index, IntByReference particle1, IntByReference particle2, IntByReference particle3, DoubleByReference length, DoubleByReference quadraticK);", "public double getGyroAngle() {\n double[] ypr = new double[3];\n gyro.GetYawPitchRoll(ypr);\n return ypr[0];\n }", "public float getAngle() {\n if(vectorAngle < 0 )\n return (float) Math.toDegrees(Math.atan(longComponent / latComponent));\n else\n return vectorAngle;\n\n }", "public double getAngle() {\n return Math.atan2(sinTheta, cosTheta);\n }", "public double currentAngle() {\n return imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).firstAngle;\r\n }", "static double calculateAngle(Line2D line, ArrowEnd end) {\n \t\t// Translate the line to 0,0\n \t\tdouble x1 = line.getX1();\n \t\tdouble y1 = line.getY1();\n \t\tdouble x2 = line.getX2();\n \t\tdouble y2 = line.getY2();\n \t\tdouble opposite = y2-y1;\n \t\tdouble adjacent = x2-x1;\n \n \t\tdouble radians = Math.atan(opposite/adjacent);\n \n \t\tif (adjacent < 0) radians += Math.PI;\n \n \t\t// TODO: Flip for other end\n \t\treturn radians;\n \t}", "public static native int OpenMM_AmoebaInPlaneAngleForce_getNumAngles(PointerByReference target);", "@Override\n public int getSteeringAngle(int[] pixels) {\n leftLine.clearPoints();\n rightLine.clearPoints();\n findLaneLines(pixels, getCameraHeight() - START_SEARCH, getCameraWidth() / 2, getCameraWidth() / 2);\n setMidPoints(calculateMidPoints());\n setSteerPoint(calculateSteerPoint());\n setLeftPoints(leftLine.getLanePoints());\n setRightPoints(rightLine.getLanePoints());\n return getDegreeOffset(getOrigin(), getSteerPoint());\n }", "public static native void OpenMM_AmoebaInPlaneAngleForce_getAngleParameters(PointerByReference target, int index, IntBuffer particle1, IntBuffer particle2, IntBuffer particle3, IntBuffer particle4, DoubleBuffer length, DoubleBuffer quadraticK);", "@Override\n // float limbSwing(par1), float limbSwingAmount(par2), float ageInTicks(par3), float netHeadYaw(par4), float headPitch(par5), float scaleFactor(par6), Entity entityIn(par7):\n public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)\n {\n EntityFamiliar entityFamiliar = (EntityFamiliar)entityIn;\n\n if (entityFamiliar.isCharging())\n {\n if (entityFamiliar.getPrimaryHand() == EnumHandSide.RIGHT)\n {\n this.armRight.rotateAngleX = 3.7699115F;\n }\n else\n {\n this.armLeft.rotateAngleX = 3.7699115F;\n }\n }\n \n // RightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F;\n this.armRight.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 2.0F * limbSwingAmount * 0.5F;\n\n // LeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;\n this.armLeft.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F;\n \n // RightArm.rotateAngleZ = 0.0F;\n this.armRight.rotateAngleZ = 0.0F;\n \n // LeftArm.rotateAngleZ = 0.0F;\n this.armLeft.rotateAngleZ = 0.0F;\n \n // Wings (from EntityVex):\n this.wingRight.rotationPointZ = 2.0F;\n this.wingLeft.rotationPointZ = 2.0F;\n this.wingRight.rotationPointY = 1.0F;\n this.wingLeft.rotationPointY = 1.0F;\n this.wingRight.rotateAngleY = 0.47123894F + MathHelper.cos(ageInTicks * 0.8F) * (float)Math.PI * 0.05F;\n this.wingLeft.rotateAngleY = -this.wingRight.rotateAngleY;\n this.wingLeft.rotateAngleZ = -0.47123894F;\n this.wingLeft.rotateAngleX = 0.47123894F;\n this.wingRight.rotateAngleX = 0.47123894F;\n this.wingRight.rotateAngleZ = 0.47123894F;\n\n // Head.rotateAngleY = par5 (headPitch) / (180F / (float)Math.PI);\n this.head.rotateAngleX = headPitch / (180F / (float)Math.PI);\n\n // Head.rotateAngleY = par4 (netHeadYaw) / (180F / (float)Math.PI);\n this.head.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);\n\n // Tentacles (using spider model):\n //float f = ((float)Math.PI / 4F);\n this.tentacleFrontLeft.rotateAngleZ = -((float)Math.PI / 4F);\n this.tentacleFrontRight.rotateAngleZ = ((float)Math.PI / 4F);\n this.tentacleFrontMid.rotateAngleZ = -0.58119464F;\n this.tentacleBackMid.rotateAngleZ = 0.58119464F;\n this.tentacleBackLeft.rotateAngleZ = -((float)Math.PI / 4F);\n this.tentacleBackRight.rotateAngleZ = ((float)Math.PI / 4F);\n //float f1 = -0.0F;\n //float f2 = 0.3926991F;\n this.tentacleFrontLeft.rotateAngleY = ((float)Math.PI / 4F);\n this.tentacleFrontRight.rotateAngleY = -((float)Math.PI / 4F);\n this.tentacleFrontMid.rotateAngleY = 0.3926991F;\n this.tentacleBackMid.rotateAngleY = -0.3926991F;\n this.tentacleBackLeft.rotateAngleY = -((float)Math.PI / 4F);\n this.tentacleBackRight.rotateAngleY = ((float)Math.PI / 4F);\n float f3 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + 0.0F) * 0.4F) * limbSwingAmount;\n float f4 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * limbSwingAmount;\n float f5 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * limbSwingAmount;\n float f6 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + 0.0F) * 0.4F) * limbSwingAmount;\n float f7 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + (float)Math.PI) * 0.4F) * limbSwingAmount;\n float f8 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * limbSwingAmount;\n this.tentacleFrontLeft.rotateAngleY += f3;\n this.tentacleFrontRight.rotateAngleY += -f3;\n this.tentacleFrontMid.rotateAngleY += f4;\n this.tentacleBackMid.rotateAngleY += -f4;\n this.tentacleBackLeft.rotateAngleY += f5;\n this.tentacleBackRight.rotateAngleY += -f5;\n this.tentacleFrontLeft.rotateAngleZ += f6;\n this.tentacleFrontRight.rotateAngleZ += -f6;\n this.tentacleFrontMid.rotateAngleZ += f7;\n this.tentacleBackMid.rotateAngleZ += -f7;\n this.tentacleBackLeft.rotateAngleZ += f8;\n this.tentacleBackRight.rotateAngleZ += -f8;\n }", "public double angle(int i)\n {\n return PdVector.angle(get(i), get((i + 1) % 3), get((i + 2) % 3)) * (Math.PI / 180);\n }" ]
[ "0.65661407", "0.6503521", "0.64638746", "0.6416871", "0.6416871", "0.6357336", "0.63313216", "0.63169885", "0.62049997", "0.62037235", "0.6188525", "0.61638415", "0.6149002", "0.61174476", "0.6115471", "0.6090669", "0.60745347", "0.6055904", "0.60541934", "0.60480636", "0.6042801", "0.60423565", "0.6029037", "0.6024243", "0.60094464", "0.59765494", "0.5957738", "0.59448963", "0.5944758", "0.5912843", "0.5882332", "0.5879973", "0.58690965", "0.5867701", "0.5846976", "0.5844898", "0.5820681", "0.5813976", "0.58065027", "0.5805211", "0.57965153", "0.57859737", "0.5785552", "0.57769364", "0.57700706", "0.5767932", "0.5757409", "0.5735937", "0.57340515", "0.5721521", "0.5721521", "0.5715351", "0.57104415", "0.57044303", "0.56990707", "0.5695631", "0.56869286", "0.56863844", "0.5686265", "0.5683048", "0.5676128", "0.56755006", "0.5670218", "0.5664763", "0.5656769", "0.5651934", "0.56458986", "0.5639594", "0.5625566", "0.5612361", "0.5605732", "0.5592265", "0.5588539", "0.55811644", "0.55811644", "0.55679774", "0.555807", "0.555528", "0.55499446", "0.55475396", "0.55442864", "0.5543123", "0.5540858", "0.55407643", "0.55379575", "0.5531909", "0.5528427", "0.5525128", "0.5512885", "0.55109704", "0.5503247", "0.5489112", "0.5479434", "0.54776156", "0.54716367", "0.5457096", "0.54453355", "0.5439904", "0.5435833", "0.54278564", "0.54251224" ]
0.0
-1
Method to drive on a fixed compass bearing (angle), based on encoder counts. Move will stop if either of these conditions occur: 1) Move gets to the desired position 2) Driver stops the opmode running.
public void gyroDrive ( double speed, double distance, double angle) { int newLeftTarget; int newRightTarget; int moveCounts; double max; double error; double steer; double leftSpeed; double rightSpeed; // Ensure that the opmode is still active if (opModeIsActive()) { // Determine new target position, and pass to motor controller moveCounts = (int)(distance * COUNTS_PER_INCH); newLeftTarget = robot.leftDrive.getCurrentPosition() + moveCounts; newRightTarget = robot.rightDrive.getCurrentPosition() + moveCounts; // Set Target and Turn On RUN_TO_POSITION robot.leftDrive.setTargetPosition(newLeftTarget); robot.rightDrive.setTargetPosition(newRightTarget); robot.leftDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION); robot.rightDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION); // start motion. speed = Range.clip(Math.abs(speed), 0.0, 1.0); robot.leftDrive.setPower(speed); robot.rightDrive.setPower(speed); // keep looping while we are still active, and BOTH motors are running. while (opModeIsActive() && (robot.leftDrive.isBusy() && robot.rightDrive.isBusy())) { // adjust relative speed based on heading error. error = getError(angle); steer = getSteer(error, P_DRIVE_COEFF); // if driving in reverse, the motor correction also needs to be reversed if (distance < 0) steer *= -1.0; leftSpeed = speed - steer; rightSpeed = speed + steer; // Normalize speeds if either one exceeds +/- 1.0; max = Math.max(Math.abs(leftSpeed), Math.abs(rightSpeed)); if (max > 1.0) { leftSpeed /= max; rightSpeed /= max; } robot.leftDrive.setPower(leftSpeed); robot.rightDrive.setPower(rightSpeed); // Display drive status for the driver. telemetry.addData("Err/St", "%5.1f/%5.1f", error, steer); telemetry.addData("Target", "%7d:%7d", newLeftTarget, newRightTarget); telemetry.addData("Actual", "%7d:%7d", robot.leftDrive.getCurrentPosition(), robot.rightDrive.getCurrentPosition()); telemetry.addData("Speed", "%5.2f:%5.2f", leftSpeed, rightSpeed); telemetry.update(); } // Stop all motion; robot.leftDrive.setPower(0); robot.rightDrive.setPower(0); // Turn off RUN_TO_POSITION robot.leftDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); robot.rightDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void encoderDrive(double leftInches, double rightInches, double speed, double desiredAngle) {\n if (!doMotors)\n return;\n\n if (desiredAngle >= 0.0f) {\n motorPid.reset();\n motorPid.setSetpoint(0);\n motorPid.setOutputRange(0, speed);\n motorPid.setInputRange(-90, 90);\n motorPid.enable();\n }\n\n float startAngle = getGyroscopeAngle();\n double countsPerInch = COUNTS_PER_MOTOR / (WHEEL_DIAMETER * Math.PI);\n int softStartDuration = 2000; // in milliseconds\n int brakeOffsetOne = (int) (18.0f * countsPerInch);\n int brakeOffsetTwo = (int) (8.0f * countsPerInch);\n\n // Get the starting position of the encoders.\n isDriving = true;\n driveLeftStart = leftDrive.getCurrentPosition();\n driveRightStart = rightDrive.getCurrentPosition();\n\n int leftNew = (int) (leftInches * countsPerInch * RAT_FUDGE);\n int rightNew = (int) (rightInches * countsPerInch * RAT_FUDGE);\n driveLeftTarget = driveLeftStart + leftNew;\n driveRightTarget = driveRightStart + rightNew;\n leftDrive.setTargetPosition(driveLeftTarget);\n rightDrive.setTargetPosition(driveRightTarget);\n\n // Turn On RUN_TO_POSITION\n leftDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n rightDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // Compute the braking zones.\n int leftBrakeOne = driveLeftStart + brakeOffsetOne; // how many remaining will trigger it\n int rightBrakeOne = driveRightStart + brakeOffsetOne;\n int leftBrakeTwo = driveLeftStart + brakeOffsetTwo;\n int rightBrakeTwo = driveRightStart + brakeOffsetTwo;\n\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n ElapsedTime motorOnTime = new ElapsedTime();\n boolean keepGoing = true;\n while (opModeIsActive() && keepGoing && (motorOnTime.seconds() < 30)) {\n printStatus();\n\n int leftPos = leftDrive.getCurrentPosition();\n int rightPos = rightDrive.getCurrentPosition();\n\n // soft start\n double currSpeed = speed;\n double elapsed = motorOnTime.milliseconds();\n if (elapsed < softStartDuration) {\n double ratio = elapsed / softStartDuration;\n currSpeed *= ratio;\n }\n\n // Throttle speed down as we approach our target\n int remainingLeft = driveLeftTarget - leftPos;\n int remainingRight = driveRightTarget - rightPos;\n if ((Math.abs(remainingLeft) < brakeOffsetTwo) || (Math.abs(remainingRight) < brakeOffsetTwo)) {\n currSpeed *= 0.25;\n } else if ((Math.abs(remainingLeft) < brakeOffsetOne) || (Math.abs(remainingRight) < brakeOffsetOne)) {\n currSpeed *= 0.5;\n }\n\n // Calculate PID correction = straighten out the line!\n if (desiredAngle >= 0.0f) {\n float currentAngle = getGyroscopeAngle();\n driveAngleOffset = getAngleDifference(currentAngle, (float)desiredAngle);\n driveAngleCorrection = (float) motorPid.performPID(driveAngleOffset);\n if ((leftInches < 0) && (rightInches < 0)) {\n driveAngleCorrection = -driveAngleCorrection;\n }\n }\n\n // Record and apply the desired power level.\n driveLeftSpeed = currSpeed - driveAngleCorrection;\n driveRightSpeed = currSpeed + driveAngleCorrection;\n leftDrive.setPower(Math.abs(driveLeftSpeed));\n rightDrive.setPower(Math.abs(driveRightSpeed));\n\n keepGoing = rightDrive.isBusy() && leftDrive.isBusy();\n }\n\n // Turn off RUN_TO_POSITION\n printStatus();\n leftDrive.setPower(0);\n rightDrive.setPower(0);\n leftDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rightDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n driveLeftStart = 0;\n driveRightStart = 0;\n driveLeftTarget = 0;\n driveRightTarget = 0;\n driveLeftSpeed = 0.0f;\n driveRightSpeed = 0.0f;\n driveAngleOffset = 0.0f;\n driveAngleCorrection = 0.0f;\n isDriving = false;\n }", "private void encoderDrive(double speed,\n double leftInches, double rightInches,\n double timeoutS) {\n int newLeftFrontTarget;\n int newLeftBackTarget;\n int newRightFrontTarget;\n int newRightBackTarget;\n\n // Ensure that the opmode is still active\n if (opModeIsActive()) {\n\n robot.resetWheelEncoders();\n\n // Determine new target position, and pass to motor controller\n newLeftFrontTarget = robot.leftFront.getCurrentPosition() + (int) (leftInches * TICKS_PER_INCH);\n newLeftBackTarget = robot.leftBack.getCurrentPosition() + (int) (leftInches * TICKS_PER_INCH);\n newRightFrontTarget = robot.rightFront.getCurrentPosition() + (int) (rightInches * TICKS_PER_INCH);\n newRightBackTarget = robot.rightBack.getCurrentPosition() + (int) (rightInches * TICKS_PER_INCH);\n robot.leftFront.setTargetPosition(newLeftFrontTarget);\n robot.leftBack.setTargetPosition(newLeftBackTarget);\n robot.rightFront.setTargetPosition(newRightFrontTarget);\n robot.rightBack.setTargetPosition(newRightBackTarget);\n\n // Turn On RUN_TO_POSITION\n robot.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n\n // reset the timeout time and start motion.\n encoderTime.reset();\n robot.driveForward(Math.abs(speed));\n\n // wait for motors to not be busy\n while (opModeIsActive() &&\n (encoderTime.seconds() < timeoutS) &&\n (robot.leftFront.isBusy() && robot.leftBack.isBusy() && robot.rightFront.isBusy() && robot.rightBack.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Goal Position\", \"%7d :%7d :%7d :%7d\", newLeftFrontTarget, newLeftBackTarget, newRightFrontTarget, newRightBackTarget);\n telemetry.addData(\"Current Position\", \"%7d :%7d :%7d :%7d\",\n robot.leftFront.getCurrentPosition(),\n robot.leftBack.getCurrentPosition(),\n robot.rightFront.getCurrentPosition(),\n robot.rightBack.getCurrentPosition());\n telemetry.update();\n }\n\n // Stop all motion;\n robot.stopDriving();\n\n // Turn off RUN_TO_POSITION\n robot.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n sleep(100); // optional pause after each move\n }\n }", "public void operatorControl() {\n \tdouble ctrlThresh = .2; \n \tdouble minPower = .05; \n \tdouble maxPower = .75; \n \tdouble recip = (1 - ctrlThresh); \n \tdouble mult = (maxPower - minPower); \n \tdouble right; \n \tdouble strafe; \n \tdouble rotate; \n \tdouble rightAxis; \n \tdouble strafeAxis; \n \tdouble rotateAxis; \n \t// \tboolean leftLeft; \n \t// \tboolean leftRight; \n \tdouble rightDir; \n \tdouble strafeDir; \n \tdouble rotateDir; \n \tdouble rightPower; \n \tdouble rotatePower; \n \tdouble strafePower; \n \t\n \tint winchCount;\n \tboolean winchDirection;\n \n \t// \tdouble frontLeftPower; \n \t// \tdouble frontRightPower; \n \t// \tdouble backLeftPower; \n \t// \tdouble backRightPower; \n \n \t//myRobot.setSafetyEnabled(true); \n \t\n \tAccelerometer test = new BuiltInAccelerometer();\n \t\n \twhile (isOperatorControl() && isEnabled()) { \n \t\t// ACCEL TEST CODE\n// \t\tSystem.out.println(test.getX() + \", \" + test.getY() + \", \" + test.getZ());\n \t\t// END ACCEL TEST CODE\n \n \t\t// ********** BEGIN DRIVING CODE ********** \n \t\t// Code for driving using omniwheels and two wheels for strafing \n \t\t// Diagram for the wheels of the robot below. \n \n \t\t// L S R \n \t\t// /--------------------------\\ \n \t\t//\t ||------------------------|| \n \t\t// || [][] || \n \t\t// || [] [] || \n \t\t// || [] [] || \n \t\t// || || \n \t\t// || || \n \t\t// || || \n \t\t// || || \n \t\t// || || \n \t\t// || [] [] || \n \t\t// || [] [] || \n \t\t// || [][] || \n \t\t// ||------------------------|| \n \t\t// \\--------------------------/ \n \t\t// \n \t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ \n \n \t\tctrlThresh = .2; // the point at which we want to sense joystick action \n \t\trecip = 1-ctrlThresh; \t\t // = 0.8 \n \n \t\trightAxis = rightStick.getRawAxis(1);\t\t\t\t// right joystick, y (up/down) axis\n \t\t\n \t\t//System.out.println(\"\"+rightAxis);\n \t\tstrafeAxis = rightStick.getRawAxis(0);\t\t\t\t// right joystick, x (left/right) axis; this is \n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// arbitrary and could have been the left stick\n \t\trotateAxis = rightStick.getRawAxis(4);\t\t\t\t\t// left joystick, y axis\n \n \t\trightDir = rightAxis/Math.abs(rightAxis);\t\t\t// forward or backward (+1 or -1)\n \t\tstrafeDir = strafeAxis/Math.abs(strafeAxis); \t// \t\t\t'' \n \t\trotateDir = rotateAxis/Math.abs(rotateAxis); // \t\t\t'' \n \n \t\tright = 0; // right input formatted for range of detected values [0.2,1] \n \t\trotate = 0; // left input formatted \n \t\tstrafe = 0; // strafe input formatted \n \n \t\tif(Math.abs(rightAxis) > ctrlThresh) \t// user moved stick beyond threshold \n \t\t{right = (rightAxis-ctrlThresh*rightDir)/recip;} // format right: scale back, set direction, proportion it \n \t\tif(Math.abs(strafeAxis) > ctrlThresh) \n \t\t{strafe = (strafeAxis-ctrlThresh*strafeDir)/recip;} // format left... \n \t\tif(Math.abs(rotateAxis) > ctrlThresh) \n \t\t{rotate = (rotateAxis-ctrlThresh*rotateDir)/recip;}\t\t// format strafe... \n \n \n \t\trightDir = right/Math.abs(right); \n \t\trightPower = (Math.abs(right*mult) + minPower) * rightDir; \t\t// re-proportion for power's range, strip direction,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// and then add back threshold and direction. \n \t\trotateDir = rotate/Math.abs(rotate); \n \t\trotatePower = (Math.abs(rotate*mult) + minPower) * rotateDir;\t\t\t// \t\t'' \n \n \t\tstrafeDir = strafe/Math.abs(strafe); \n \t\tstrafePower = (Math.abs(strafe*mult) + minPower) * strafeDir;\t// \t\t'' \n \n \t\tif(Math.abs(rightPower)>0.2){\n \t\t\tfrontRight.set(rightPower);\t\t\t\t\t\t// set all the motors with the powers we \n \t\t\tbackRight.set(rightPower);\t\t\t\t\t\t/// calculated above : drive! \n \t\t\tfrontLeft.set(-1*rightPower); \n \t\t\tbackLeft.set(-1*rightPower);\n \t\t}\n \t\telse{\n \t\t\tfrontRight.set(rotatePower);\n \t\t\tbackRight.set(rotatePower);\n \t\t\tfrontLeft.set(rotatePower);\n \t\t\tbackLeft.set(rotatePower);\n \t\t}\n \t\t\n// \t\tfrontStrafe.set(strafePower); \n// \t\tbackStrafe.set(-1*strafePower); \n \n// \t\tmyRobot.tankDrive(leftStick, rightStick); \n \t\t \n \t\t// ********** END OF DRIVING CODE ********** \n \t\t//======================================================================= \n \t\t// ************ BEGIN WINCH CODE *********** \n \t\t// We need to code the winch to help raise and lower the elevator \n \t\t// This is just one option between the winch and the lead screw. \n \t\t \n \t\t\n \t\t//second winch test\n \t\t/*\n \t\twinchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n \t \tSystem.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n \t \tif(winchCount<240){\n \t \t\t\n \t \t\twinchCim1.set(.1);\n \t \t\twinchCim2.set(.1);\n \t \t}\n \t \telse{\n \t \t\twinchCim1.set(0);\n \t \t\twinchCim2.set(0);\n \t \t\t\n \t \t}\n \t if(rightStick.getRawButton(5)) \n { \n\t\t\t winchEncoder.reset();// reset the pulse count\n\t\t\t winchCount = 0;\n\t\t\t winchCim1.set(0);\n\t\t\t winchCim2.set(0);\n\t\t\t \n } */ //end of second winch test \n \t \t\n \t\t\n \t\t if(rightStick.getRawButton(5)) \n { \n \t\t\t //winchEncoder.reset();// reset the pulse count\n \tSystem.out.println(\"A\");\n \t winchCim1.set(.5); \t// set winchCim1 to 0.5 power (upwards) \n \t winchCim2.set(.5); \t\t\t\t\t\t\t// set winchCim2 to 0.5 power\n \t\t\t \n } \n \t\telse if(rightStick.getRawButton(4))\n \t\t{\n \t\t\tSystem.out.println(\"B\");\n \t\t\t//winchEncoder.reset();\t\t\t\t\t\t\t// reset the pulse count\n \t \twinchCim1.set(-.3); // set winchCim1 to -0.5 power (downwards) \n \t \twinchCim2.set(-.3);\t \t\t\t\t\t\t\t// set winchCim2 to -0.5 power\n \t\t}\n \n \t \telse// if(rightStick.getRawButton(2)) \n { \n \t winchCim1.set(0); \t\t\t\t\t\t\t// set winchCim1 to 0 power (off/stop) \n \t winchCim2.set(0);\t\t\t\t\t\t\t\t// set winchCim2 to 0 pwoer (off/stop)\n// \t winchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n// \t System.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n } \n \n \t\t// ********** END OF WINCH CODE ********** \n \t\t//======================================================================= \n \t\t \n \t\t \n \t\tTimer.delay(0.005);\t\t// wait for a motor update time \n } \n }", "public boolean encoderDrive(int encoderDelta, driveStyle drive, double motorPower, double timeout, DcMotor[] motors)\n {\n\n\n switch(drive)\n {\n case FORWARD:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, -motorPower, 0)[0]);\n motors[1].setPower(setPower(0, -motorPower, 0)[1]);\n motors[2].setPower(setPower(0, -motorPower, 0)[2]);\n motors[3].setPower(setPower(0, -motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n\n\n }\n\n case BACKWARD:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, motorPower, 0)[0]);\n motors[1].setPower(setPower(0, motorPower, 0)[1]);\n motors[2].setPower(setPower(0, motorPower, 0)[2]);\n motors[3].setPower(setPower(0, motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() <= (encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case STRAFE_LEFT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (encoderReadingLB - encoderDelta))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case STRAFE_RIGHT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(motorPower, 0, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case FORWARD_LEFT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(-motorPower, -motorPower, 0)[0]);\n motors[1].setPower(setPower(-motorPower, -motorPower, 0)[1]);\n motors[2].setPower(setPower(-motorPower, -motorPower, 0)[2]);\n motors[3].setPower(setPower(-motorPower, -motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() <= (encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case FORWARD_RIGHT:\n {\n double encoderReadingRB = motors[1].getCurrentPosition();\n motors[0].setPower(setPower(motorPower, -motorPower, 0)[0]);\n motors[1].setPower(setPower(motorPower, -motorPower, 0)[1]);\n motors[2].setPower(setPower(motorPower, -motorPower, 0)[2]);\n motors[3].setPower(setPower(motorPower, -motorPower, 0)[3]);\n\n while (motors[1].getCurrentPosition() >= (-encoderDelta + encoderReadingRB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case BACKWARD_LEFT:\n {\n double encoderReadingRB = motors[1].getCurrentPosition();\n motors[0].setPower(setPower(-motorPower, motorPower, 0)[0]);\n motors[1].setPower(setPower(-motorPower, motorPower, 0)[1]);\n motors[2].setPower(setPower(-motorPower, motorPower, 0)[2]);\n motors[3].setPower(setPower(-motorPower, motorPower, 0)[3]);\n\n while (motors[1].getCurrentPosition() <= (encoderDelta + encoderReadingRB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case BACKWARD_RIGHT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(motorPower, motorPower, 0)[0]);\n motors[1].setPower(setPower(motorPower, motorPower, 0)[1]);\n motors[2].setPower(setPower(motorPower, motorPower, 0)[2]);\n motors[3].setPower(setPower(motorPower, motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case PIVOT_LEFT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, 0, -motorPower)[0]);\n motors[1].setPower(setPower(0, 0, -motorPower)[1]);\n motors[2].setPower(setPower(0, 0, -motorPower)[2]);\n motors[3].setPower(setPower(0, 0, -motorPower)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case PIVOT_RIGHT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, 0, motorPower)[0]);\n motors[1].setPower(setPower(0, 0, motorPower)[1]);\n motors[2].setPower(setPower(0, 0, motorPower)[2]);\n motors[3].setPower(setPower(0, 0, motorPower)[3]);\n\n while (motors[2].getCurrentPosition() <= (encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n\n }\n\n return true;\n }", "public void gyroDrive ( double speed,\n double distance,\n double angle) {\n\n\n // Ensure that the opmode is still activ\n\n // Determine new target position, and pass to motor controller\n moveCounts = (int)(distance * COUNTS_PER_INCH);\n newLeftTarget = leftmotor.getCurrentPosition() + moveCounts;\n newRightTarget = rightmotor.getCurrentPosition() + moveCounts;\n\n // Set Target and Turn On RUN_TO_POSITION\n leftmotor.setTargetPosition(newLeftTarget);\n rightmotor.setTargetPosition(newRightTarget);\n\n leftmotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n rightmotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // start motion.\n speed = Range.clip(Math.abs(speed), 0.0, 1.0);\n\n maxSpeed = speed;\n speed = INCREMENT;\n rampUp = true;\n\n leftmotor.setPower(speed);\n rightmotor.setPower(speed);\n\n // keep looping while we are still active, and BOTH motors are running.\n while ((leftmotor.isBusy() && rightmotor.isBusy())) {\n if (rampUp){\n speed += INCREMENT ;\n if (speed >= maxSpeed ) {\n speed = maxSpeed;\n }\n }\n\n // adjust relative speed based on heading error.\n error = getError(angle);\n steer = getSteer(error, P_DRIVE_COEFF);\n\n // if driving in reverse, the motor correction also needs to be reversed\n if (distance < 0)\n steer *= -1.0;\n\n leftSpeed = speed - steer;\n rightSpeed = speed + steer;\n\n // Normalize speeds if either one exceeds +/- 1.0;\n max = Math.max(Math.abs(leftSpeed), Math.abs(rightSpeed));\n if (max > 1.0)\n {\n leftSpeed /= max;\n rightSpeed /= max;\n }\n\n leftmotor.setPower(leftSpeed);\n rightmotor.setPower(rightSpeed);\n }\n\n // Stop all motion;\n leftmotor.setPower(0);\n rightmotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n leftmotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightmotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n gyroHold(TURN_SPEED,angle,0.166);\n\n }", "public void gyroDrive ( double speed,\n double distance,\n double angle) {\n\n int newLeftTarget;\n int newRightTarget;\n int moveCounts;\n double max;\n double error;\n double steer;\n double leftSpeed;\n double rightSpeed;\n\n // Ensure that the opmode is still active\n if (opModeIsActive()) {\n\n // Determine new target position, and pass to motor controller\n moveCounts = (int)(distance * COUNTS_PER_INCH);\n newLeftTarget = leftMotor.getCurrentPosition() + moveCounts;\n newRightTarget = rightMotor.getCurrentPosition() + moveCounts;\n\n // Set Target and Turn On RUN_TO_POSITION\n leftMotor.setTargetPosition(newLeftTarget);\n rightMotor.setTargetPosition(newRightTarget);\n\n leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // start motion.\n speed = Range.clip(Math.abs(speed), 0.0, 1.0);\n leftMotor.setPower(speed);\n rightMotor.setPower(speed);\n\n // keep looping while we are still active, and BOTH motors are running.\n while (opModeIsActive() &&\n (leftMotor.isBusy() && rightMotor.isBusy())) {\n\n // adjust relative speed based on heading error.\n error = getError(angle);\n steer = getSteer(error, P_DRIVE_COEFF);\n\n // if driving in reverse, the motor correction also needs to be reversed\n if (distance < 0)\n steer *= -1.0;\n\n leftSpeed = speed - steer;\n rightSpeed = speed + steer;\n\n // Normalize speeds if any one exceeds +/- 1.0;\n max = Math.max(Math.abs(leftSpeed), Math.abs(rightSpeed));\n if (max > 1.0)\n {\n leftSpeed /= max;\n rightSpeed /= max;\n }\n\n leftMotor.setPower(leftSpeed);\n rightMotor.setPower(rightSpeed);\n\n // Display drive status for the driver.\n telemetry.addData(\"Err/St\", \"%5.1f/%5.1f\", error, steer);\n telemetry.addData(\"Target\", \"%7d:%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Actual\", \"%7d:%7d\", leftMotor.getCurrentPosition(),\n rightMotor.getCurrentPosition());\n telemetry.addData(\"Speed\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n telemetry.update();\n }\n\n // Stop all motion;\n\n rightMotor.setPower(0);\n leftMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "public void update() {\n if (!hasStarted) {\n //drive.setAutonStraightDrive();\n hasStarted = true;\n } else {\n if (Math.abs((Math.abs(rotations) - (Math.abs(drive.getRightSensorValue() / 4096)))) <= TOLERANCE) {\n drive.setBrakeMode(true);\n setFinished(true);\n }\n }\n\n }", "public void encoderDrive(double speed,\r\n double leftInches, \r\n double rightInches,\r\n String name) \r\n {\n int newLeftTarget = robot.leftDrive.getCurrentPosition() + (int)(leftInches * COUNTS_PER_INCH);\r\n int newRightTarget = robot.rightDrive.getCurrentPosition() + (int)(rightInches * COUNTS_PER_INCH);\r\n robot.leftDrive.setTargetPosition(newLeftTarget);\r\n robot.rightDrive.setTargetPosition(newRightTarget);\r\n\r\n // Turn On RUN_TO_POSITION\r\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n\r\n // reset the timeout time and start motion.\r\n ElapsedTime localTimer = new ElapsedTime();\r\n localTimer.reset();\r\n robot.leftDrive.setPower(Math.abs(speed));\r\n robot.rightDrive.setPower(Math.abs(speed));\r\n\r\n // keep looping while we are still active, and there is time left, and both motors are running.\r\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\r\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\r\n // always end the motion as soon as possible.\r\n // However, if you require that BOTH motors have finished their moves before the robot continues\r\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\r\n while (localTimer.seconds() < EncoderDrive_Timeout_Second \r\n && (robot.leftDrive.isBusy() || robot.rightDrive.isBusy())) {\r\n\r\n // Display it for the driver.\r\n telemetry.addData(\"\", \"%s @ %s\", name, localTimer.toString());\r\n telemetry.addData(\"To\", \"%7d :%7d\", newLeftTarget, newRightTarget);\r\n telemetry.addData(\"At\", \"%7d :%7d\",\r\n robot.leftDrive.getCurrentPosition(),\r\n robot.rightDrive.getCurrentPosition());\r\n telemetry.update();\r\n idle();\r\n }\r\n\r\n // Stop all motion;\r\n robot.leftDrive.setPower(0);\r\n robot.rightDrive.setPower(0);\r\n\r\n // Turn off RUN_TO_POSITION\r\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\r\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\r\n }", "public void operatorDrive() {\n\n changeMode();\n checkForGearShift();\n\n if (Robot.rightJoystick.getRawButton(1)) {\n currentMode = DriveMode.AUTO;\n\n } else if (Robot.rightJoystick.getRawButton(2)) {\n currentMode = DriveMode.CLIMB;\n } else {\n currentMode = DEFAULT_MODE;\n }\n\n isDeploying = false;\n\n if (currentMode == DriveMode.AUTO) {\n currentMode_s = \"Auto\";\n } else if (currentMode == DriveMode.ARCADE) {\n currentMode_s = \"Arcade\";\n } else {\n currentMode_s = \"Tank\";\n }\n\n double leftY = 0;\n double rightY = 0;\n\n switch (currentMode) {\n\n case AUTO:\n rotateCam(4, Robot.visionTargetInfo.visionPixelX);\n\n // driveFwd(4, .25);\n\n break;\n\n case CLIMB:\n\n climb();\n\n break;\n\n case ARCADE:\n resetAuto();\n double linear = 0;\n double turn = 0;\n\n if (Math.abs(Robot.rightJoystick.getY()) > deadband) {\n linear = -Robot.rightJoystick.getY();\n }\n if (Math.abs(Robot.leftJoystick.getX()) > deadband) {\n turn = Math.pow(Robot.leftJoystick.getX(), 3);\n }\n\n leftY = -linear - turn;\n rightY = linear - turn;\n if (!isShifting) {\n assignMotorPower(rightY, leftY);\n } else {\n\n assignMotorPower(0, 0);\n }\n\n break;\n\n case TANK:\n\n resetAuto();\n if (Math.abs(Robot.rightJoystick.getY()) > deadband) {\n rightY = -Math.pow(Robot.rightJoystick.getY(), 3 / 2);\n }\n if (Math.abs(Robot.leftJoystick.getY()) > deadband) {\n leftY = Math.pow(Robot.leftJoystick.getY(), 3 / 2);\n }\n if (!isShifting) {\n assignMotorPower(rightY, leftY);\n } else {\n\n assignMotorPower(0, 0);\n }\n break;\n\n default:\n break;\n }\n\n updateTelemetry();\n }", "protected void execute() {\n \t\n \tcurrentAngle = Robot.gyroSubsystem.gyroPosition();\n\t\tpercentComplete = Math.abs((targetAngle-currentAngle)/goal)*speedFactor;\n\t\t\n\t\tif (percentComplete < minSpeed) \n\t\t{\n\t\t\tpercentComplete = minSpeed;\n\t\t}\n\n\t\t\n\t\tif (targetAngle - error > currentAngle)\n\t\t{\n\t\t\tRobot.driveSubsystem.arcadeDrive(0, percentComplete);\n\t\t}\n\t\telse if (targetAngle + error < currentAngle)\n\t\t{\n\t\t\tRobot.driveSubsystem.arcadeDrive(0, -percentComplete);\n\t\t}\n\t\telse \n\t\t{\n\t\t\tRobot.driveSubsystem.arcadeDrive(0, 0);\n\t\t}\n }", "public void encoderDrive(double speed,\n double leftInches, double rightInches,\n double timeoutS) {\n int newLeftTarget;\n int newRightTarget;\n\n // Ensure that the opmode is still active\n if (opModeIsActive()) {\n\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftDrive.getCurrentPosition() + (int)(leftInches * COUNTS_PER_INCH);\n newRightTarget = robot.rightDrive.getCurrentPosition() + (int)(rightInches * COUNTS_PER_INCH);\n robot.leftDrive.setTargetPosition(newLeftTarget);\n robot.rightDrive.setTargetPosition(newRightTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftDrive.setPower(Math.abs(speed));\n robot.rightDrive.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n while (opModeIsActive() &&\n (runtime.seconds() < timeoutS) &&\n (robot.leftDrive.isBusy() && robot.rightDrive.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftDrive.getCurrentPosition(),\n robot.rightDrive.getCurrentPosition());\n telemetry.update();\n }\n\n // Stop all motion;\n robot.leftDrive.setPower(0);\n robot.rightDrive.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "@Override\n\tprotected void execute() {\n \tif (timer + waitTime < Timer.getFPGATimestamp()) {\n \t\tcheckEnc = true;\n \t\tSmartDashboard.putString(\"WARNING\", \"checking\");\n \t}\n \t\n \tif(checkEnc){\n \t\tif(Math.abs(Robot.driveTrain.leftEnc.getDistance()) < badEncTolerance){\n \t\t\terrorDistance = Math.abs((distance - Robot.driveTrain.rightEnc.getDistance()));\n \t\t} else if(Math.abs(Robot.driveTrain.rightEnc.getDistance()) < badEncTolerance){\n \t\t\terrorDistance = Math.abs((distance - Robot.driveTrain.leftEnc.getDistance()));\n \t\t} else {\n \t\t\terrorDistance = Math.abs(distance - Robot.driveTrain.getEncDistance());\n \t\t}\n \t} else {\n \t\terrorDistance = Math.abs((distance - Robot.driveTrain.getEncDistance()));\n \t}\n\t\t\n\t\terrorAngle = Robot.driveTrain.getTurnAngle(currentAngle, Robot.driveTrain.imu.getAngleZ() / 4);\n\t\t\n\t\tif(incSpeed){\n\t\t\t\n\t\t\t//increase the speed applied to the motors to prevent initial jolting of robot\n\t\t\tincSpeedStep += .035;\n\t\t\t\n\t\t\t//if the speeding up speed applied to the motors is close to what we want\n\t\t\t//jump out ofthe loop\n\t\t\tif(incSpeedStep > minSpeed)\n\t\t\t\tincSpeed = false;\n\t\t\t\n\t\t\t//applies speed to motor\n\t\t\tRobot.driveTrain.leftDrive.set(incSpeedStep);\n \t\tRobot.driveTrain.leftDrive2.set(incSpeedStep);\n Robot.driveTrain.rightDrive.set(-incSpeedStep);\n Robot.driveTrain.rightDrive2.set(-incSpeedStep);\n\t\t}\n\t\t\n\t\t//if the robot drives out of the angle tolerance to drive \n\t\t//forward, a motor speed up or cool down is applied\n\t\tif(Math.abs(errorAngle) < angleTolerance){\n\t\t\t//apply a motor change based upon how far off angle\n\t\t\t//motorChange = Math.abs(errorAngle) * .001;\n\t\t\t//turning too far right\n\t\t\t\n\t\t\tdouble average = (leftSpeed + rightSpeed) / 2;\n\t\t\tleftSpeed = average;\n\t\t\trightSpeed = average;\n\t\t\t\n\t\t\tif(errorAngle < 0){\n\t\t\t\tif(rightSpeed < maxSpeed){\n\t\t\t\t\trightSpeed += (motorChange);\n\t\t\t\t} else {\n\t\t\t\t\tleftSpeed -= (motorChange / 3);\n\t\t\t\t}\n\t\t\t//turning too far left\n\t\t\t} else if(errorAngle > 0){\n\t\t\t\tif(leftSpeed < maxSpeed){\n\t\t\t\t\tleftSpeed += (motorChange);\n\t\t\t\t} else {\n\t\t\t\t\trightSpeed -= (motorChange / 3);\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t} else {\n\t\t\t\n\t\t\tif(errorAngle < 0){\n\t\t\t\tif(rightSpeed < maxSpeed){\n\t\t\t\t\trightSpeed += (motorChange * 1.4 * Math.abs(errorAngle));\n\t\t\t\t} else {\n\t\t\t\t\tleftSpeed -= (motorChange * 1.4 * Math.abs(errorAngle));\n\t\t\t\t}\n\t\t\t//turning too far left\n\t\t\t} else if(errorAngle > 0){\n\t\t\t\tif(leftSpeed < maxSpeed){\n\t\t\t\t\tleftSpeed += (motorChange * 1.4 * Math.abs(errorAngle));\n\t\t\t\t} else {\n\t\t\t\t\trightSpeed -= (motorChange * 1.4 * Math.abs(errorAngle));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSmartDashboard.putDouble(\"Auto Angle Error\", errorAngle);\n\t\tSmartDashboard.putNumber(\"Auto Distance Error\", errorDistance);\n\n\t\t\t\t\n\t\t//clamp set speeds so they can be applied to the \n\t\t//motors without errors or exceptions\n\t\tleftSpeed = Robot.ktMath.clamp(leftSpeed, minSpeed, maxSpeed);\n\t\trightSpeed = Robot.ktMath.clamp(rightSpeed, minSpeed, maxSpeed);\n\t\t\n\t\tif(refinedDistance == false && incSpeed == false){\n\t\t\t//Update driving speeds on both sides of the driveTrain\n\t\t\tif (leftSpeed * kP * errorDistance * flip >= leftSpeed * flip) {\n\t\t\t\tRobot.driveTrain.leftDrive.set(leftSpeed * flip);\n\t\t\t\tRobot.driveTrain.leftDrive2.set(leftSpeed * flip);\n\t\t\t} else {\n\t\t\t\tRobot.driveTrain.leftDrive.set(leftSpeed * kP * errorDistance * flip);\n\t\t\t\tRobot.driveTrain.leftDrive2.set(leftSpeed * kP * errorDistance * flip);\n\t\t\t}\n\t\t\t\n\t\t\tif (rightSpeed * kP * errorDistance * flip >= rightSpeed * flip) {\n\t\t\t\tRobot.driveTrain.rightDrive.set(-rightSpeed * flip);\n\t\t\t\tRobot.driveTrain.rightDrive2.set(-rightSpeed * flip);\n\t\t\t} else {\n\t\t\t\tRobot.driveTrain.rightDrive.set(-rightSpeed * kP * errorDistance * flip);\n\t\t\t\tRobot.driveTrain.rightDrive2.set(-rightSpeed * kP * errorDistance * flip);\n\t\t\t}\n\t\t\t\n\t\t\tif(Math.abs(errorDistance) < tolerance){\n\t\t\t\trefinedDistance = true;\n\t\t\t}\n\t\t} else if(incSpeed == false){\n\t\t\tif(errorDistance > 0){\n \t\t\tRobot.driveTrain.leftDrive.set(refiningMotorSpeed * flip);\n\t \t\tRobot.driveTrain.leftDrive2.set(refiningMotorSpeed * flip);\n\t Robot.driveTrain.rightDrive.set(-refiningMotorSpeed * flip);\n\t Robot.driveTrain.rightDrive2.set(-refiningMotorSpeed * flip);\n \t\t} else {\n \t\t\tRobot.driveTrain.leftDrive.set(-refiningMotorSpeed * flip);\n\t \t\tRobot.driveTrain.leftDrive2.set(-refiningMotorSpeed * flip);\n\t Robot.driveTrain.rightDrive.set(refiningMotorSpeed * flip);\n\t Robot.driveTrain.rightDrive2.set(refiningMotorSpeed * flip);\n \t\t}\n \t\t\n \t\t/*if(Math.abs(errorDistance) < refinedTolerance){\n \t\t\tRobot.driveTrain.leftDrive.set(0);\n \t\t\tRobot.driveTrain.rightDrive.set(0);\n \t\t\tfinished = true;\n \t\t}*/\n\t\t}\n\t\t\n\t\tif(Math.abs(errorDistance) < refinedTolerance){\n\t\t\tRobot.driveTrain.leftDrive.set(0);\n\t\t\tRobot.driveTrain.rightDrive.set(0);\n\t\t\tfinished = true;\n\t\t}\n\t\t\n\t\tSmartDashboard.putNumber(\"Auto Left Enc\", Robot.driveTrain.leftEnc.getDistance());\n\t\tSmartDashboard.putNumber(\"Auto Right Enc\", Robot.driveTrain.rightEnc.getDistance());\n\t\tSmartDashboard.putNumber(\"Auto Enc Dist Combined\", errorDistance);\n\t}", "public void operatorControl() {\n \tmyRobot.setSafetyEnabled(true);\n while (isOperatorControl() && isEnabled()) {\n \tdouble x = stick2.getRawAxis(0);\n \tdouble y = stick2.getRawAxis(1);\n \tdouble rot = stick.getRawAxis(0);\n \tSmartDashboard.putNumber(\"x1\", x);\n SmartDashboard.putNumber(\"y1\", y);\n SmartDashboard.putNumber(\"rot1\", rot);\n \tif(Math.abs(x) < .2)\n \t\tx = 0;\n \tif(Math.abs(y) < .2)\n \t\ty = 0;\n \tif(Math.abs(rot) < .2)\n \t\trot = 0;\n \tmyRobot.mecanumDrive_Cartesian(x*-1, y*-1,rot*-1, gyro.getAngle());\n double current1 = pdp.getCurrent(0);\n double current2 = pdp.getCurrent(13);\n double current3 = pdp.getCurrent(15);\n double current4 = pdp.getCurrent(12);\n SmartDashboard.putNumber(\"Front Left current\", current1);\n SmartDashboard.putNumber(\"back Left current\", current2);\n SmartDashboard.putNumber(\"Front right current\", current3);\n SmartDashboard.putNumber(\"back right current\", current4);\n SmartDashboard.putNumber(\"x\", x);\n SmartDashboard.putNumber(\"y\", y);\n SmartDashboard.putNumber(\"rot\", rot);\n SmartDashboard.putNumber(\"Gyro\", gyro.getAngle());\n \tTimer.delay(0.005);\t\t// wait for a motor update time\n }\n }", "private void driveForwardEnc()\r\n\t{\r\n\t\t//drive.setPos(0, 0, Config.Auto.encDriveForwardDistance, Config.Auto.encDriveForwardDistance);\r\n\t}", "@Override\n\tpublic boolean takeControl() {\n\t\treturn (Math.abs(Motor.A.getTachoCount() - Settings.motorAAngle) > 5 || (Motor.A.getTachoCount() == 0 && Settings.motorAAngle == -90));\n\t}", "@Override\n public void loop() {\n\n double drive = gamepad1.left_stick_y;\n double strafe = gamepad1.left_stick_x;\n double rotate = -gamepad1.right_stick_x;\n\n findRobotPosition(); // Call Vuforia routines, get robot position\n\n // Intake Operator Actions\n if (gamepad1.a || gamepad1.b || gamepad1.x){ // Operator wants to control the intake\n if (gamepad1.a){ // A turns the intake on for bringing in rings\n intakeMotor.setPower(1);\n }\n else if (gamepad1.b) { // B reverses the intake\n intakeMotor.setPower(-1);\n\n } else if (gamepad1.x){ // X stops the intake\n intakeMotor.setPower(0);\n }\n }\n\n // Ring Shooter Operator Actions\n /*if (gamepad1.dpad_up || gamepad1.dpad_down){\n if (gamepad1.dpad_up) {\n if (ringVel <= 170000) {\n ringVel = ringVel + 10000;\n }\n } else if (gamepad1.dpad_down){\n if (ringVel >= 10000){\n ringVel = ringVel - 10000;\n } else{\n ringVel = 0;\n }\n }\n }\n */\n\n if (gamepad1.right_bumper){\n fireServo.setPosition(FIRE_SERVO);\n } else{\n fireServo.setPosition(STANDBY_SERVO);\n }\n if (gamepad1.left_trigger > 0.5){\n ringShooterMotor.setVelocity(ringVel);\n }else {\n ringShooterMotor.setPower(0);\n }\n\n // Wobble Goal acions here\n if (gamepad1.dpad_left || gamepad1.dpad_right || gamepad1.left_bumper){\n if(gamepad1.dpad_left){\n wobbleMotor.setTargetPosition(WOBBLE_GRAB);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n } else if (gamepad1.dpad_right){\n wobbleMotor.setTargetPosition(WOBBLE_CARRY);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n } else if (gamepad1.left_bumper) {\n wobbleMotor.setTargetPosition(WOBBLE_OVER_WALL);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n }\n }\n // Insert operator driving actions here\n if ((targetVisible) && (gamepad1.y)) {\n // Allow the operator to position the robot to shoot a ring if a target is visible\n alignRobotToShoot();\n }\n else {\n moveBot(drive, rotate, strafe, power); //Basic Robot-centric Frame Driving\n }\n\n // Telemetry Section\n //telemetry.addData(\"Ring Velocity\", ringVel);\n //telemetry.addData(\"Actual Velocity\", ringShooterMotor.getVelocity());\n telemetry.addData(\"Ring Motor Encoder\", ringShooterMotor.getCurrentPosition());\n telemetry.addData(\"Wobble Goal Encoder\", wobbleMotor.getCurrentPosition());\n telemetry.update();\n }", "public void angleTurn(float angle, int timeout){\n\t\tcalculateAngles();\n\n\t\t// Get the current program time and starting encoder position before we start our drive loop\n\t\tfloat StartTime = data.time.currentTime();\n\t\tfloat StartPosition = data.drive.leftDrive.getCurrentPosition();\n\n\t\t// Reset our Integral and Derivative data.\n\t\tdata.PID.integralData.clear();\n\t\tdata.PID.derivativeData.clear();\n\n\n\t\t// Manually calculate our first target\n\t\tdata.PID.target = (calculateAngles() + (data.PID.IMURotations * 360)) + angle;\n\n\t\t// We need to keep track of how much time passes between a loop.\n\t\tfloat LoopTime = data.time.currentTime();\n\n\t\t// This is the main loop of our straight drive.\n\t\t// We use encoders to form a loop that corrects rotation until we reach our target.\n\t\twhile(StartTime + timeout > data.time.currentTime()){\n\n\t\t\t// Record the time since the previous loop.\n\t\t\tLoopTime = data.time.timeFrom(LoopTime);\n\t\t\t// Calculate our angles. This method may modify the input Rotations.\n\t\t\t//IMURotations =\n\t\t\tcalculateAngles();\n\t\t\t// Calculate our PID\n\t\t\tcalculatePID(LoopTime);\n\n\t\t\t// Calculate the Direction to travel to correct any rotational errors.\n\t\t\tfloat Direction = ((data.PID.I * data.PID.ITuning) / 2000) + ((data.PID.P * data.PID.PTuning) / 2000) + ((data.PID.D * data.PID.DTuning) / 2000);;\n\n\t\t\tif(Math.abs(Direction) <= 0.03f) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdata.drive.rightDrive.setPower(data.drive.POWER_CONSTANT - (Direction));\n\t\t\tdata.drive.leftDrive.setPower(data.drive.POWER_CONSTANT + (Direction));\n\t\t}\n\t\t// Our drive loop has completed! Stop the motors.\n\t\tdata.drive.rightDrive.setPower(0);\n\t\tdata.drive.leftDrive.setPower(0);\n\t}", "public void encoderDrive(double speed, double aInches, double bInches, double cInches, double dInches) {\n double ad = 720 * (aInches / 12.57);\n int aDistance = (int) ad;\n double bd = 720 * (bInches / 12.57);\n int bDistance = (int) bd;\n double cd = 720 * (cInches / 12.57);\n int cDistance = (int) cd;\n double dd = 720 * (dInches / 12.57);\n int dDistance = (int) dd;\n\n aDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n aDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n bDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n bDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n cDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n cDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n dDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n dDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n aDrive.setTargetPosition(aDistance);\n bDrive.setTargetPosition(bDistance);\n cDrive.setTargetPosition(cDistance);\n dDrive.setTargetPosition(dDistance);\n aDrive.setPower(speed);\n bDrive.setPower(speed);\n cDrive.setPower(speed);\n dDrive.setPower(speed);\n\n while (aDrive.isBusy() && bDrive.isBusy() && cDrive.isBusy() && dDrive.isBusy() && opModeIsActive()) {\n idle();\n }\n aDrive.setPower(0);\n bDrive.setPower(0);\n cDrive.setPower(0);\n dDrive.setPower(0);\n }", "protected void execute() {\n \t\n \tdouble angleDifference;\n \t\n \tif (useTargetAngle) {\n \t\tangleDifference = Math.abs(Gyroscope.simplifyAngle(Robot.gyroscope.getGlobalRotation()) - Gyroscope.simplifyAngle(targetAngle));\n \t}\n \telse {\n \t\tangleDifference = Math.abs(Robot.gyroscope.getRotation());\n \t}\n \t\n \tif (angleDifference > ROTATION_THRESHOLD) {\n \t\tif (Robot.gyroscope.getRotation() > 0) {\n \t\t\tadjustPercentRight = ROTATION_PERCENT;\n \t\t\tadjustPercentLeft = 1;\n \t\t}\n \t\telse {\n \t\t\tadjustPercentRight = 1;\n \t\t\tadjustPercentLeft = ROTATION_PERCENT;\n \t\t}\n \t}\n \t\n \trightEncoderPID.setSetpoint(getVelocity() * adjustPercentRight);\n \tleftEncoderPID.setSetpoint(getVelocity() * adjustPercentLeft);\n \t\n \t//print out debug data to smartdash\n \tSmartDashboard.putNumber(\"Left Encoder Vel:\", Robot.drive.leftEncoder.getRate());\n \tSmartDashboard.putNumber(\"Right Encoder Vel\", Robot.drive.rightEncoder.getRate());\n \t\n \tSmartDashboard.putNumber(\"Left Encoder Dist\", Robot.drive.leftEncoder.getDistance());\n \tSmartDashboard.putNumber(\"Right Encoder Dist\", Robot.drive.leftEncoder.getDistance());\n \t\n \tupdateState();\n \t\n \t//keep at low speed if decelerating period is up\n \tif (currentState == DriveState.decelerating && (timer.get() > tAccelerating)) {\n \trightEncoderPID.setSetpoint(FINAL_ADJUST_SPEED);\n \tleftEncoderPID.setSetpoint(FINAL_ADJUST_SPEED);\n \t}\n }", "private void drive(int e) {\r\n if (endx[e] + 120 >= width - radius[e] && directionend[e] == 0) {\r\n endx[e] += 20;\r\n endy[e] -= 20;\r\n directionend[e]++;\r\n radius[e] -= 60;\r\n directionchanged[e] = true;\r\n } else if (endy[e] + 120 >= height - radius[e] && directionend[e] == 1) {\r\n\r\n endx[e] += 20;\r\n endy[e] += 20;\r\n directionend[e]++;\r\n radius[e] -= 60;\r\n directionchanged[e] = true;\r\n } else if (endx[e] - 120 <= radius[e] && directionend[e] == 2) {\r\n endx[e] -= 20;\r\n endy[e] += 20;\r\n radius[e] -= 60;\r\n directionend[e]++;\r\n directionchanged[e] = true;\r\n } else if (endy[e] - 80 <= radius[e] && directionend[e] == 3) {\r\n endx[e] -= 20;\r\n endy[e] -= 20;\r\n radius[e] -= 60;\r\n directionend[e] = 0;\r\n directionchanged[e] = true;\r\n } else {\r\n directionchanged[e] = false;\r\n }\r\n }", "private void turnBearing(int bearing) {\n int heading = gyro.getHeadingBasic();\n int cw = (bearing - heading + FULL_CIRCLE) % FULL_CIRCLE;\n int ccw = (heading - bearing + FULL_CIRCLE) % FULL_CIRCLE;\n\n // Turn the short way\n if (Math.abs(cw) <= Math.abs(ccw)) {\n turnAngle(cw);\n } else {\n turnAngle(-ccw);\n }\n }", "@Override\n\tpublic void action() {\n\t\tsuppressed = false;\n\t\t//if (Settings.motorAAngle == -90) Settings.motorAAngle = -95;\n\n\t\tMotor.A.rotateTo(Settings.motorAAngle, true);\n\n\t\twhile (Motor.A.isMoving() && !Motor.A.isStalled() && !suppressed);\t\t\t\n\t\t\n\t\tMotor.A.stop();\n\t}", "protected void execute() {\n \tif(degrees > 0)\n \t{\n \t\tRobot.driveBase.set(ControlMode.PercentOutput, -speed, speed);\n \t}\n \telse if(degrees < 0)\n \t{\n \t\tRobot.driveBase.set(ControlMode.PercentOutput, speed, -speed);\n \t}\n \t\n }", "@Override\n public void runOpMode() {\n try {\n leftfrontDrive = hardwareMap.get(DcMotor.class, \"frontLeft\");\n leftfrontDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n rightfrontDrive = hardwareMap.get(DcMotor.class, \"frontRight\");\n rightfrontDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n leftbackDrive = hardwareMap.get(DcMotor.class, \"backLeft\");\n leftbackDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n leftbackDrive.setDirection(DcMotor.Direction.REVERSE);\n\n rightbackDrive = hardwareMap.get(DcMotor.class, \"backRight\");\n rightbackDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n lift = hardwareMap.get(DcMotor.class, \"Lift\");\n lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lift.setDirection(DcMotor.Direction.REVERSE);\n\n markerArm = hardwareMap.get(Servo.class, \"markerArm\");\n\n armActivator = hardwareMap.get(DcMotor.class, \"armActivator\");\n armActivator.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n } catch (IllegalArgumentException iax) {\n bDebug = true;\n }\n\n BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();\n parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;\n parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;\n parameters.calibrationDataFile = \"BNO055IMUCalibration.json\";\n parameters.loggingEnabled = true;\n parameters.loggingTag = \"IMU\";\n parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();\n\n imu = hardwareMap.get(BNO055IMU.class, \"imu\");\n imu.initialize(parameters);\n\n waitForStart(); //the rest of the code begins after the play button is pressed\n\n sleep(3000);\n\n drive(0.35, 0.5);\n\n turn(90.0f);\n\n drive(1.8, 0.5);\n\n turn(45.0f);\n\n drive(2.5, -0.5);\n\n sleep(1000);\n\n markerArm.setPosition(1);\n\n sleep(1000);\n\n markerArm.setPosition(0);\n\n sleep(1000);\n\n drive(2.5,.75);\n\n turn(179.0f);\n\n drive(1.5, 1.0);\n\n requestOpModeStop(); //end of autonomous\n }", "@Override\n\tprotected void execute() {\n\t\t\n\t\tif (RobotMap.hookEncoder.getRaw() < Robot.climbingEncoderPos1) {\n\t\t\t// already reach the highest position, stop all the motors\n\t\t\thookMotor1.set(ControlMode.PercentOutput, 0);\n\t\t\thookMotor2.set(ControlMode.PercentOutput, 0);\n\t\t\tSystem.out.println(\"Stop climbing\");\n\t\t}else if((RobotMap.hookEncoder.getRaw() > Robot.climbingEncoderPos2)) {\n\t\t\thookMotor1.set(ControlMode.PercentOutput, -1);\n\t\t\thookMotor2.set(ControlMode.PercentOutput, -1);\n\t\t\tSystem.out.println(\"Climbing again\");\n\t\t}\n\n\t\t\n\t\t\n\t\t\n\t}", "public void activateUncontrolledMoves() {\n new Thread(new Runnable() {\n @Override\n public void run() {\n actualPoint = new Point();\n actualPoint.x = 0;\n actualPoint.y = 0;\n final int maxX = wheel.getBounds().width(); //This represent the max X possible coord on the wheel\n final int maxY = wheel.getBounds().height();\n int timeBtwnMvmnts = 5000; //Time between each new movement\n while (true) {\n\n try {\n Thread.sleep(timeBtwnMvmnts);//Waiting for the next movement\n } catch (InterruptedException e) {\n\n }\n if (isUncontrolledActivated) { //If is activated continue\n double userCurrentSnap = USER_CURRENT_BREATH_RATE; //Snapshot to the current BR\n\n //Getting the percent of excess according to the max ideal breathing rate and the max posible rate (20)\n //Consider 6-8, MAX_IDEAL_BREATH_RATE (8) will be the max\n double referenceDistance = MAX_BREATH_RATE - MAX_IDEAL_BREATH_RATE;\n double myRateExcess = userCurrentSnap - MAX_IDEAL_BREATH_RATE;\n double relationPreferedActual = myRateExcess / referenceDistance;\n double percentOfExcess = relationPreferedActual * 100;\n\n Random r = new Random();\n\n //Probability of appearance of each special move\n if (percentOfExcess <= 40 && percentOfExcess > 10) { //A little error margin to make it easier. Nets to be 10% excess\n //Boost, stop, roll , inverted. probabilities (70,16,10,4)\n int diceRolled = r.nextInt(100); //This works as the \"probability\"\n if (diceRolled < 4) {// 4% inverted\n /*Enable inverted controlling. Determine how much time is this going to last.\n Not more than the time between each movement.*/\n final int duration = new Random().nextInt(timeBtwnMvmnts - 1000) + 1000;\n invertControls(duration);\n } else if (diceRolled >= 4 && diceRolled < 14) { // 10% roll\n uncRoll(maxX, maxY);\n } else if (diceRolled >= 14 && diceRolled < 30) { // 16% stop\n uncStop();\n } else if (diceRolled >= 30 && diceRolled < 100) { // 70% boost\n int whichBoost = new Random().nextInt(1);\n if (whichBoost == 0)\n uncBackwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n else\n uncForwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n }\n timeBtwnMvmnts = 8000;\n } else if (percentOfExcess <= 60 && percentOfExcess > 10) {\n //Boost, stop, roll , inverted. probabilities (45,30,15,10)\n int diceRolled = r.nextInt(100);\n if (diceRolled < 10) {// 10% inverted\n final int duration = new Random().nextInt(timeBtwnMvmnts - 1000) + 1000;\n invertControls(duration);\n } else if (diceRolled >= 10 && diceRolled < 25) { // 15% roll\n uncRoll(maxX, maxY);\n } else if (diceRolled >= 25 && diceRolled < 55) { // 30% stop\n uncStop();\n } else if (diceRolled >= 55 && diceRolled < 100) { // 45% boost\n int whichBoost = new Random().nextInt(1);\n if (whichBoost == 0)\n uncBackwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n else\n uncForwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n }\n timeBtwnMvmnts = 6700;\n } else if (percentOfExcess > 10) {//Percent > 60\n //Boost, stop, roll , inverted. probabilities (5,10,25,60)\n int diceRolled = r.nextInt(100);\n if (diceRolled < 60) {// 60% inverted\n final int duration = new Random().nextInt(timeBtwnMvmnts - 1000) + 1000;\n invertControls(duration);\n } else if (diceRolled >= 60 && diceRolled < 85) { // 25% roll\n uncRoll(maxX, maxY);\n } else if (diceRolled >= 85 && diceRolled < 95) { // 10% stop\n uncStop();\n } else if (diceRolled >= 95 && diceRolled < 100) { // 5% boost\n int whichBoost = new Random().nextInt(1);\n if (whichBoost == 0)\n uncBackwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n else\n uncForwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n }\n timeBtwnMvmnts = 5000;\n }\n\n } else {\n break;\n }\n }\n }\n }).start();\n }", "public void adjustShooterAngleManual() {\n\n // If the driver pushes the Square Button on the PS4 Controller,\n // set the worm drive motors to go backwards (lower it).\n if (PS4.getRawButton(PS4_X_BUTTON) == true) {\n\n wormDriveMotors.set(-0.2);\n\n // If the driver pushes the Triangle Button on the PS4 Controller,\n // set the worm drive motors to go forwards (raise it up).\n } else if (PS4.getRawButton(PS4_SQUARE_BUTTON) == true) {\n\n wormDriveMotors.set(0.4);\n }\n\n // If the driver is an idiot and is pressing BOTH the Square Button AND the\n // Triangle Button at the same time, OR (||) if the driver is pushing neither\n // button, set the motor speed to 0.\n else if (((PS4.getRawButton(PS4_X_BUTTON) == true) && (PS4.getRawButton(PS4_SQUARE_BUTTON) == true))\n || ((PS4.getRawButton(PS4_X_BUTTON) == false) && (PS4.getRawButton(PS4_SQUARE_BUTTON) == false))) {\n\n wormDriveMotors.set(0);\n }\n\n }", "public static void IAmFalconBot() {\n // How many encoder clicks per revolution (change to 2048 for falcon 500\n // encoders)\n encoderUnitsPerShaftRotation = 2048;\n // with 6 in wheels estimate 10 feet = 13038 encoder ticks\n\n // The difference between the left and right side encoder values when the robot\n // is rotated 180 degrees\n encoderUnitsPerRobotRotation = 3925;// thats the SUM of the two (this is just a rough guess)\n //these values are just guesses at the moment\n cruiseVelocity = 2250;\n acceleration = 2250;\n // Allowable error to exit movement methods\n defaultAcceptableError = 250;\n\n shooterPanMotorEncoderTicksPerRotation = 3977;\n //TODO: may need to be negative if turns the wrong way\n shooterPanSpeed = 1;\n System.out.println(\"I AM FALCONBOT! CACAW! CACAAAAAWWWWW!\");\n }", "@Override\npublic void teleopPeriodic() {\nm_robotDrive.arcadeDrive(m_stick.getRawAxis(5)* (-0.5), m_stick.getRawAxis(4)*0.5);\n}", "public void strafe(double speed, boolean angle, double inches, double timeout){\n int newLeftTarget;\n int newRightTarget;\n int newLeftBottomTarget;\n int newRightBottomTarget;\n if (opModeIsActive()) {\n if (angle) {\n //strafe right\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftFrontMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newLeftBottomTarget = robot.leftBackMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newRightTarget = robot.rightFrontMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newRightBottomTarget = robot.rightBackMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n robot.leftFrontMotor.setTargetPosition(newLeftTarget);\n robot.leftBackMotor.setTargetPosition(newLeftBottomTarget);\n robot.rightFrontMotor.setTargetPosition(newRightTarget);\n robot.rightBackMotor.setTargetPosition(newRightBottomTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftFrontMotor.setPower(Math.abs(speed));\n robot.rightFrontMotor.setPower(Math.abs(speed));\n robot.leftBackMotor.setPower(Math.abs(speed));\n robot.rightBackMotor.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n\n while (opModeIsActive() &&\n (runtime.seconds() < timeout) &&\n (robot.leftFrontMotor.isBusy() && robot.rightFrontMotor.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftFrontMotor.getCurrentPosition(),\n robot.rightFrontMotor.getCurrentPosition(), robot.leftBackMotor.getCurrentPosition(), robot.rightBackMotor.getCurrentPosition());\n telemetry.update();\n }\n // Stop all motion;\n robot.rightFrontMotor.setPower(0);\n robot.rightBackMotor.setPower(0);\n robot.leftFrontMotor.setPower(0);\n robot.leftBackMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n } else if (!angle) {\n //strafe left\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftFrontMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newLeftBottomTarget = robot.leftBackMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newRightTarget = robot.rightFrontMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newRightBottomTarget = robot.rightBackMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n robot.leftFrontMotor.setTargetPosition(newLeftTarget);\n robot.leftBackMotor.setTargetPosition(newLeftBottomTarget);\n robot.rightFrontMotor.setTargetPosition(newRightTarget);\n robot.rightBackMotor.setTargetPosition(newRightBottomTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftFrontMotor.setPower(Math.abs(speed));\n robot.rightFrontMotor.setPower(Math.abs(speed));\n robot.leftBackMotor.setPower(Math.abs(speed));\n robot.rightBackMotor.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n\n while (opModeIsActive() &&\n (runtime.seconds() < timeout) &&\n (robot.leftFrontMotor.isBusy() && robot.rightFrontMotor.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftFrontMotor.getCurrentPosition(),\n robot.rightFrontMotor.getCurrentPosition(), robot.leftBackMotor.getCurrentPosition(), robot.rightBackMotor.getCurrentPosition());\n telemetry.update();\n }\n // Stop all motion;\n robot.rightFrontMotor.setPower(0);\n robot.rightBackMotor.setPower(0);\n robot.leftFrontMotor.setPower(0);\n robot.leftBackMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }\n }", "public void driveCorrection(double presetAngle, double throttle){\n\t\tif (RobotMap.ahrs.getAngle()-presetAngle > 1){\n\t\t\tRobotMap.talonLeft.set(throttle*.60);\n\t\t\tRobotMap.talonRight.set(throttle);\n\t\t}else if(RobotMap.ahrs.getAngle()-presetAngle<-1){\n\t\t\tRobotMap.talonLeft.set(throttle);\n\t\t\tRobotMap.talonRight.set(throttle*.60);\n\t\t}else{\n\t\t\tRobotMap.talonLeft.set(throttle);\n\t\t\tRobotMap.talonRight.set(throttle);\n\t\t}\n\t}", "public void moveForward(boolean endWithBrake){\r\n \r\n Motor.B.rotate(DEGREES_PER_TILE, true);//Accesses Motor thread\r\n Motor.C.rotate(DEGREES_PER_TILE, true);\r\n while(Motor.B.isMoving() || Motor.C.isMoving())\r\n ;//wait for motors to be done\r\n return;\r\n }", "public void RotateRight(double speed, int distance) {\n // Reset Encoders\n robot2.DriveRightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveRightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n sleep(500);\n\n robot2.DriveRightFront.setTargetPosition(0);\n robot2.DriveRightRear.setTargetPosition(0);\n robot2.DriveLeftFront.setTargetPosition(0);\n robot2.DriveLeftRear.setTargetPosition(0);\n\n // Set RUN_TO_POSITION\n\n robot2.DriveRightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot2.DriveLeftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot2.DriveRightRear.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot2.DriveLeftRear.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // Set Motor Power to 0\n robot2.DriveRightFront.setPower(0);\n robot2.DriveRightRear.setPower(0);\n robot2.DriveLeftFront.setPower(0);\n robot2.DriveLeftRear.setPower(0);\n\n\n double InchesMoving = (distance * COUNTS_PER_INCH);\n\n // Set Target to RotateRight\n robot2.DriveRightFront.setTargetPosition((int) -InchesMoving);\n robot2.DriveRightRear.setTargetPosition((int) -InchesMoving);\n robot2.DriveLeftRear.setTargetPosition((int) InchesMoving);\n robot2.DriveLeftFront.setTargetPosition((int) InchesMoving);\n\n while (robot2.DriveRightFront.isBusy() && robot2.DriveRightRear.isBusy() && robot2.DriveLeftRear.isBusy() && robot2.DriveLeftFront.isBusy()) {\n\n // wait for robot to move to RUN_TO_POSITION setting\n\n double MoveSpeed = speed;\n\n // Set Motor Power\n robot2.DriveRightFront.setPower(MoveSpeed);\n robot2.DriveRightRear.setPower(MoveSpeed);\n robot2.DriveLeftFront.setPower(MoveSpeed);\n robot2.DriveLeftRear.setPower(MoveSpeed);\n\n } // THis brace close out the while Loop\n\n //Reset Encoders\n robot2.DriveRightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveRightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n\n\n robot2.DriveRightFront.setPower(0);\n robot2.DriveRightRear.setPower(0);\n robot2.DriveLeftFront.setPower(0);\n robot2.DriveLeftRear.setPower(0);\n }", "void drive(double power, double leftInches, double rightInches, double seconds) {\n\n //Make new integer to set left and right motor targets\n int leftTarget;\n int rightTarget;\n\n if (opModeIsActive()) {\n\n //Determine left and right target to move to\n leftTarget = robot.leftMotor.getCurrentPosition() + (int) (leftInches * COUNTS_PER_INCH);\n rightTarget = robot.rightMotor.getCurrentPosition() + (int) (rightInches * COUNTS_PER_INCH);\n\n //Set target and move to position\n robot.leftMotor.setTargetPosition(leftTarget);\n robot.rightMotor.setTargetPosition(rightTarget);\n robot.leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n //Reset runtime and start motion\n robot.leftMotor.setPower(Math.abs(power));\n robot.rightMotor.setPower(Math.abs(power));\n\n //Test if motors are busy, runtime is less than timeout and motors are busy and then run code\n while (opModeIsActive() && (runtime.seconds() < seconds) && (robot.leftMotor.isBusy() && robot.rightMotor.isBusy())) {\n\n //Tell path to driver\n telemetry.addData(\"Path1\", \"Running to: \", leftTarget, rightTarget);\n telemetry.addData(\"Path2\", \"Running at: \", robot.leftMotor.getCurrentPosition(), robot.rightMotor.getCurrentPosition());\n telemetry.update();\n }\n\n //Stop motors after moved to position\n robot.leftMotor.setPower(0);\n robot.rightMotor.setPower(0);\n\n //Set motors back to using run using encoder\n robot.leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "private void send_controlsignal(int speed,int angle){\t\t\r\n\t\tif (controller_computer.network.send_controllsignal(speed+\";\"+up+\";\"+angle+\";\"+right)){\r\n\t\t feedback_output();\r\n\t\t controller_computer.camera_picture.UpdateDirection(up, down, left, right);\r\n\t\t}else{\r\n\t\t\tcontroller_computer.camera_picture.UpdateDirection(false,false,false,false);\r\n\t\t}\r\n\t}", "public void runOpMode(){\n JAWLDrive3796 drive = new JAWLDrive3796(hardwareMap.dcMotor.get(\"left_drive\"), hardwareMap.dcMotor.get(\"right_drive\"));\n //Set the drive motors to run without encoders\n drive.setEncoders(false);\n //Create Grabber object\n JAWLGrabber3796 grabber = new JAWLGrabber3796(hardwareMap.servo.get(\"left_arm\"), hardwareMap.servo.get(\"right_arm\"));\n //Create Lift object\n JAWLLift3796 lift = new JAWLLift3796(hardwareMap.dcMotor.get(\"lift_motor\"));\n //Create color arm object\n JAWLColorArm3796 colorArm = new JAWLColorArm3796(hardwareMap.servo.get(\"color_arm\"));\n //Creates color sensor name\n ColorSensor colorSensorTemp = hardwareMap.get(ColorSensor.class, \"color_distance\");\n //Creates distance sensor name\n DistanceSensor distanceSensorTemp = hardwareMap.get(DistanceSensor.class, \"color_distance\");\n //Creates the color-distance sensor object\n JAWLColorSensor3796 colorDistanceSensor = new JAWLColorSensor3796(colorSensorTemp, distanceSensorTemp);\n //Creates the variable that will hold the color of the jewel\n String colorOfBall;\n //Creates relic arm objects\n //TTTTRelicArm3796 relicArm = new TTTTRelicArm3796(hardwareMap.dcMotor.get(\"relic_up_down\"), hardwareMap.dcMotor.get(\"relic_out_in\"), hardwareMap.dcMotor.get(\"relic_grab\"));\n //We never ended up having a relic arm!\n //The lift helper will set the idle power of the motor to a small double, keeping the lift from idly falling down\n boolean liftHelper = false;\n int i = 0;\n\n waitForStart();\n\n colorArm.armUp();\n\n while (opModeIsActive()) {\n //Here is where we define how the controllers should work\n //In theory, no logic retaining to controlling the components should be in here\n\n /*\n * Drive\n */\n\n //The left drive wheel is controlled by the opposite value of the left stick's y value on the first gamepad\n //The right drive is the same way except with the right drive wheel\n drive.leftDrive(-gamepad1.left_stick_y);\n drive.rightDrive(-gamepad1.right_stick_y);\n\n /*\n * Lift\n */\n telemetry.addData(\"Gamepad2 Right Stick Y\", -gamepad2.right_stick_y);\n\n if (-gamepad2.right_stick_y > 0) {\n //First checks to see if the right stick's negative y value is greater then zero.\n lift.moveMotor(-gamepad2.right_stick_y);\n //If it is, it sets the power for the motor to 1, and adds telemetry\n telemetry.addData(\"Lift Power\", 1);\n } else if (-gamepad2.right_stick_y < 0) {\n //Checks if the negative value of the right right stick's y position is less than zero\n lift.moveMotor(-0.1);\n //Sets the power for the motor to -0.1, and adds telemetry\n telemetry.addData(\"Lift Power\", -0.1);\n } else {\n //We check to see if the liftHelper is enabled\n if(liftHelper) {\n lift.moveMotor(0.1466 );\n } else {\n lift.moveMotor(0);\n }\n }\n\n\n\n /*\n * Lift helper control\n */\n\n if(gamepad2.a) {\n if(i == 0) {\n liftHelper = !liftHelper;\n }\n i = 5;\n }\n\n if(i != 0) {\n i--;\n }\n\n telemetry.addData(\"Lift Helper Enabled\", liftHelper);\n\n\n\n /*\n * Grabbers\n */\n if (gamepad2.left_trigger > 0) {\n //Closes the left arm, then displays the position in telemetry\n grabber.leftArmClose();\n double a = grabber.leftPosition();\n //Adds telemetry to display positions of grabbers, mostly for testing, but can be useful later on\n telemetry.addData(\"Left\", a);\n }\n\n if (gamepad2.left_bumper) {\n //Opens the left arm, then displays the position in telemetry\n grabber.leftArmOpen();\n double b = grabber.leftPosition();\n //We made the variables different as to avoid any and all possible errors\n telemetry.addData(\"Left\", b);\n }\n\n if (gamepad2.right_trigger > 0) {\n //Opens the right arm, then displays the position in telemetry\n grabber.rightArmClose();\n double c = grabber.rightPosition();\n telemetry.addData(\"Right\", c);\n }\n\n if (gamepad2.right_bumper) {\n //Closes the right arm, then displays the position in telemetry\n grabber.rightArmOpen();\n double d = grabber.rightPosition();\n telemetry.addData(\"Right\", d);\n }\n\n if (gamepad2.dpad_left){\n //Closes the left arm to a shorter distance\n grabber.leftArmShort();\n }\n\n if(gamepad2.dpad_right){\n //Closes the right arm to a shorter distance\n grabber.rightArmShort();\n\n }\n\n //Update all of our telemetries at once so we can see all of it at the same time\n telemetry.update();\n }\n }", "@Override\n public void runOpMode() throws InterruptedException{\n\n LeftWheel = hardwareMap.dcMotor.get(\"LeftWheel\");\n RightWheel = hardwareMap.dcMotor.get(\"RightWheel\");\n LLAMA = hardwareMap.dcMotor.get(\"LLAMA\");\n RightWheel.setDirection(DcMotor.Direction.REVERSE);\n beaconFlagSensor = hardwareMap.i2cDevice.get(\"color sensor\");\n LeftWheel.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n RightWheel.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n buttonPusher = hardwareMap.servo.get(\"Button Pusher\");\n buttonPusher.setDirection(Servo.Direction.REVERSE);\n\n LeftWheel.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n RightWheel.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n LLAMA.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n beaconFlagReader= new I2cDeviceSynchImpl(beaconFlagSensor, I2cAddr.create8bit(0x3c), false);\n beaconFlagReader.engage();\n\n double PUSHER_MIN = 0;\n double PUSHER_MAX = 1;\n buttonPusher.scaleRange(PUSHER_MIN,PUSHER_MAX);\n\n if(beaconFlagLEDState){\n beaconFlagReader.write8(3, 0); //Set the mode of the color sensor using LEDState\n }\n else{\n beaconFlagReader.write8(3, 1); //Set the mode of the color sensor using LEDState\n }\n\n\n waitForStart();\n //Go forward to position to shoot\n long iniForward = 0;\n //Shoot LLAMA\n long shootLLAMA=0 ;\n //Turn towards Wall\n long turnToWall= 0;\n //Approach Wall\n long wallApproach= 0;\n //Correct to prepare for button\n long correctForButton= 0;\n long correctForButton2=0 ;\n //Use sensors to press button\n /** This is sensor*/\n //Go forward\n long toSecondButton= 0;\n //Use Sensors to press button\n /** This is sensor*/\n //turn to center\n\n //charge\n long chargeTime= 0;\n\n //Go forward to position to shoot\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(iniForward);\n\n STOP();\n\n //Shoot LLAMA\n LLAMA.setPower(1);\n\n sleep(shootLLAMA);\nSTOP();\n //Turn towards Wall\n LeftWheel.setPower(-1);\n RightWheel.setPower(1);\n\n sleep(turnToWall);\n\n STOP();\n //Approach Wall\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(wallApproach);\n\n STOP();\n //Correct to prepare for button\n\n LeftWheel.setPower(1);\n RightWheel.setPower(-1);\n\n sleep(correctForButton);\n\n STOP();\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(correctForButton2);\n\n STOP();\n topCache = beaconFlagReader.read(0x04, 1);\n //Use sensors to press button\n if ((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&(topCache[0] & 0xFF) <16) {\n while (((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&\n (topCache[0] & 0xFF) <16) && opModeIsActive()) {\n\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n sleep(100);\n LeftWheel.setPower(0);\n RightWheel.setPower(0);\n topCache = beaconFlagReader.read(0x04, 1);\n\n if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0){\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n break;\n }\n }\n\n }\n\n else if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0) {\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n }\n\n //Go forward\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(toSecondButton);\n\n STOP();\n //Use Sensors to press button\n topCache = beaconFlagReader.read(0x04, 1);\n //Use sensors to press button\n if ((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&(topCache[0] & 0xFF) <16) {\n while (((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&\n (topCache[0] & 0xFF) <16) && opModeIsActive()) {\n\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n sleep(100);\n LeftWheel.setPower(0);\n RightWheel.setPower(0);\n topCache = beaconFlagReader.read(0x04, 1);\n\n if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0){\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n break;\n }\n }\n\n }\n\n else if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0) {\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n }\n\n //turn to center\n\n\n //charge\n }", "@Override\n public void loop(){\n speedBT.ifPress(gamepad1.x);\n speedMode = speedBT.getMode() ? 0.8 : 0.5;\n speedBT.update(gamepad1.x);\n\n // Gets the speed, strafe, and turn of the robot and accounts for stick drifting\n double speed = gamepad1.left_stick_y;\n double strafe = -gamepad1.left_stick_x;\n double turn = gamepad1.right_stick_x;\n if (Math.abs(turn) < 0.2) {\n turn = 0;\n }\n if (Math.abs(strafe) < 0.2) {\n strafe = 0;\n }\n if (Math.abs(speed) < 0.2) {\n speed = 0;\n }\n\n // Drives in the inputted direction.\n MecanumDrive.Motor.Vector2D vector = new MecanumDrive.Motor.Vector2D(strafe, speed);\n drive.move(speedMode, vector, turn);\n\n // If not driving, check for turning in place or pure strafing\n if (turn == 0 && strafe == 0 && speed == 0) {\n if (gamepad1.left_bumper) {\n drive.strafeLeftWithPower(speedMode);\n } else if (gamepad1.right_bumper) {\n drive.strafeRightWithPower(speedMode);\n } else if (gamepad1.left_trigger > 0.2f) {\n drive.turnInPlace(gamepad1.left_trigger, false);\n } else if (gamepad1.right_trigger > 0.2f) {\n drive.turnInPlace(gamepad1.right_trigger, true);\n }\n }\n\n // Activate and deactivate pivot flywheels (toggles)\n flywheelBT.ifRelease(gamepad1.y);\n flywheelBT.update(gamepad1.y);\n\n // Determines if the flywheels spin, spin in reverse, or freeze\n if (flywheelBT.getMode()) {\n intake.spin();\n } else if (gamepad1.b) {\n intake.spinReverse();\n } else {\n intake.stopSpinning();\n }\n\n // Gets the elevator's movement inputs and accounts for stick drifting\n double elevatorHeight = -gamepad2.left_stick_y;\n double clawDistance = gamepad2.right_stick_y;\n if (Math.abs(elevatorHeight) < 0.2) {\n elevatorHeight = 0;\n }\n if (Math.abs(clawDistance) < 0.2) {\n clawDistance = 0;\n }\n\n // Moves the elevators and controls the claw and tray pullers\n elevatorOuttake.moveElevators(elevatorHeight, clawDistance);\n try {\n if (gamepad2.dpad_up) {\n elevatorOuttake2.grab();\n telemetry.addData(\"gamepad 2-up Pressed \", true);\n //elevatorOuttake.grabClamp();\n } else if (gamepad2.dpad_down) {\n elevatorOuttake2.release();\n telemetry.addData(\"gamepad2-down Pressed\", true);\n Thread.sleep(250);\n elevatorOuttake2.stop();\n }\n }\n catch (InterruptedException e){\n throw new RuntimeException(e);\n }\n\n // Raise or lower the tray pullers\n if(gamepad1.dpad_down){\n trayPuller.down();\n }\n if(gamepad1.dpad_up){\n trayPuller.up();\n }\n\n // Telemetry data\n telemetry.addData(\"Speed Mode\", speedBT.getMode() ? \"Fast\" : \"Slow\");\n telemetry.addData(\"Speed\", speed);\n telemetry.addData(\"Strafe\", strafe);\n telemetry.addData(\"Turn\", turn);\n telemetry.addData(\"Elevator Height\", elevatorHeight);\n telemetry.addData(\"Claw Distance\", clawDistance);\n telemetry.addData(\"Vertical Elevator Encoder\", elevatorOuttake.getVerticalEncoder());\n telemetry.addData(\"Horizontal Elevator Encoder\", elevatorOuttake.getHorizontalEncoder());\n }", "protected void execute() {\n \tRobot.m_oi.messageDriverStation(\"COMMAND AutoTurnRight reported angle is = \" + Robot.driveBase.getGyroAngle());\n \tdouble angle = Robot.driveBase.getGyroAngle();\n \tdouble increment = (requiredAngle - angle) * kP * -0.08;\n \tRobot.driveBase.autoDrive(0.1,0.5);\n }", "@Override\n public void loop() {\n\n //double armRot = robot.Pivot.getPosition();\n\n double deadzone = 0.2;\n\n double trnSpdMod = 0.5;\n\n float xValueRight = gamepad1.right_stick_x;\n float yValueLeft = -gamepad1.left_stick_y;\n\n xValueRight = Range.clip(xValueRight, -1, 1);\n yValueLeft = Range.clip(yValueLeft, -1, 1);\n\n // Pressing \"A\" opens and closes the claw\n if (gamepad1.a) {\n\n if (robot.Claw.getPosition() < 0.7)\n while(gamepad1.a){\n robot.Claw.setPosition(1);}\n else if (robot.Claw.getPosition() > 0.7)\n while(gamepad1.a){\n robot.Claw.setPosition(0.4);}\n else\n while(gamepad1.a)\n robot.Claw.setPosition(1);\n }\n\n // Pressing \"B\" changes the wrist position\n if (gamepad1.b) {\n\n if (robot.Wrist.getPosition() == 1)\n while(gamepad1.b)\n robot.Wrist.setPosition(0.5);\n else if (robot.Wrist.getPosition() == 0.5)\n while(gamepad1.b)\n robot.Wrist.setPosition(1);\n else\n while(gamepad1.b)\n robot.Wrist.setPosition(1);\n }\n\n // Turn left/right, overrides forward/back\n if (Math.abs(xValueRight) > deadzone) {\n\n robot.FL.setPower(xValueRight * trnSpdMod);\n robot.FR.setPower(-xValueRight * trnSpdMod);\n robot.BL.setPower(xValueRight * trnSpdMod);\n robot.BR.setPower(-xValueRight * trnSpdMod);\n\n\n } else {//Forward/Back On Solely Left Stick\n if (Math.abs(yValueLeft) > deadzone) {\n robot.FL.setPower(yValueLeft);\n robot.FR.setPower(yValueLeft);\n robot.BL.setPower(yValueLeft);\n robot.BR.setPower(yValueLeft);\n }\n robot.FL.setPower(0);\n robot.FR.setPower(0);\n robot.BL.setPower(0);\n robot.BR.setPower(0);\n }\n\n\n telemetry.addData(\"Drive Encoder Ticks\", robot.FL.getCurrentPosition());\n telemetry.addData(\"Winch Encoder Ticks\", robot.Winch.getCurrentPosition());\n telemetry.addData(\"ColorArm Position\", robot.ColorArm.getPosition());\n telemetry.addData(\"Wrist Position\", robot.Wrist.getPosition());\n telemetry.addData(\"Claw Position\", robot.Claw.getPosition());\n telemetry.addData(\"Grip Position\", robot.Grip.getPosition());\n telemetry.addData(\"Color Sensor Data Red\", robot.Color.red());\n telemetry.addData(\"Color Sensor Data Blue\", robot.Color.blue());\n\n /*\n\n // This is used for an Omniwheel base\n\n // Group a is Front Left and Rear Right, Group b is Front Right and Rear Left\n float a;\n float b;\n float turnPower;\n if(!gamepad1.x) {\n if (Math.abs(xValueRight) <= deadzone && Math.abs(yValueRight) <= deadzone) {\n // And is used here because both the y and x values of the right stick should be less than the deadzone\n\n a = Range.clip(yValueLeft + xValueLeft, -1, 1);\n b = Range.clip(yValueLeft - xValueLeft, -1, 1);\n\n\n robot.FL.setPower(a);\n robot.FR.setPower(b);\n robot.BL.setPower(b);\n robot.BR.setPower(a);\n\n telemetry.addData(\"a\", \"%.2f\", a);\n telemetry.addData(\"b\", \"%.2f\", b);\n\n } else if (Math.abs(xValueRight) > deadzone || Math.abs(yValueRight) > deadzone) {\n\n // Or is used here because only one of the y and x values of the right stick needs to be greater than the deadzone\n turnPower = Range.clip(xValueRight, -1, 1);\n\n robot.FL.setPower(-turnPower);\n robot.FR.setPower(turnPower);\n robot.BL.setPower(-turnPower);\n robot.BR.setPower(turnPower);\n\n } else {\n\n robot.FL.setPower(0);\n robot.FR.setPower(0);\n robot.BL.setPower(0);\n robot.BR.setPower(0);\n }\n\n } else {\n\n if (Math.abs(xValueRight) <= deadzone && Math.abs(yValueRight) <= deadzone) {\n\n // And is used here because both the y and x values of the right stick should be less than the deadzone\n a = Range.clip(yValueLeft + xValueLeft, -0.6f, 0.6f);\n b = Range.clip(yValueLeft - xValueLeft, -0.6f, 0.6f);\n\n\n robot.FL.setPower(a);\n robot.FR.setPower(b);\n robot.BL.setPower(b);\n robot.BR.setPower(a);\n\n telemetry.addData(\"a\", \"%.2f\", a);\n telemetry.addData(\"b\", \"%.2f\", b);\n\n } else if (Math.abs(xValueRight) > deadzone || Math.abs(yValueRight) > deadzone) {\n\n // Or is used here because only one of the y and x values of the right stick needs to be greater than the deadzone\n turnPower = Range.clip(xValueRight, -1, 1);\n\n robot.FL.setPower(-turnPower);\n robot.FR.setPower(turnPower);\n robot.BL.setPower(-turnPower);\n robot.BR.setPower(turnPower);\n\n } else {\n\n robot.FL.setPower(0);\n robot.FR.setPower(0);\n robot.BL.setPower(0);\n robot.BR.setPower(0);\n }\n }\n\n\n if (gamepad1.dpad_up) {\n\n robot.Swing.setPower(.6);\n\n } else if (gamepad1.dpad_down) {\n\n robot.Swing.setPower(-.6);\n\n } else {\n\n robot.Swing.setPower(0);\n }\n\n if(gamepad1.a){\n\n robot.Claw.setPosition(.4);\n\n } else if(gamepad1.b){\n\n robot.Claw.setPosition(0);\n }\n\n if(gamepad1.left_bumper) {\n\n robot.Pivot.setPosition(armRot+0.0005);\n\n } else if(gamepad1.right_bumper) {\n\n robot.Pivot.setPosition(armRot-0.0005);\n\n } else{\n\n robot.Pivot.setPosition(armRot);\n }\n\n telemetry.addData(\"position\", position);\n\n */\n\n /*\n * Code to run ONCE after the driver hits STOP\n */\n }", "@Override\n protected void execute() {\n /*\n * Keep the angle read from the gyro constantly converted as long as currentAngle is \n * referenced compared to always reading raw values from the getGyroYaw.\n */\n if (Robot.drivetrain.getGyroYaw() < 0.0f) {\n currentAngle = Robot.drivetrain.getGyroYaw() + 360.0f;\n } else {\n currentAngle = Robot.drivetrain.getGyroYaw();\n\n }\n if (!clockwise) {\n /* Counterclockwise turning */\n Robot.drivetrain.arcadeDrive(speedY, -speedZ);\n } else if (clockwise) {\n /* Clockwise turning */\n Robot.drivetrain.arcadeDrive(speedY, speedZ);\n }\n }", "public void move(boolean up, boolean down, boolean left, boolean right){\t\n\t\tif (up) {\n\t\t\tframesAccelerated++;\n\t\t\tspeed -= ACCELERATION;\n\t\t\tif (speed < MAX_SPEED)\n\t\t\t\tspeed = MAX_SPEED;\n\t\t} else {\n\t\t\tframesAccelerated = 0;\n\t\t}\n\t\tif (down) {\n\t\t\tspeed += BACKING_ACCELERATION;\n\t\t\tif (speed > MAX_BACKING_SPEED)\n\t\t\t\tspeed = MAX_BACKING_SPEED;\n\t\t}\n\t\t// Simulate turning the driving wheel by adding \"acceleration\" to\n\t\t// turning speed. We use ints for this since integer math is exact.\n\t\tif ((left && speed < 0) || (speed > 0 && right)) {\n\t\t\tturningFrame ++;\n\t\t\tif (turningFrame > FRAMES_FOR_TURNING){\n\t\t\t\tturningFrame = FRAMES_FOR_TURNING;\n\t\t\t}\n\t\t}\n\t\tif ((right && speed < 0) || (speed > 0 && left)) {\n\t\t\tturningFrame --;\n\t\t\tif (turningFrame < -FRAMES_FOR_TURNING) {\n\t\t\t\tturningFrame = -FRAMES_FOR_TURNING;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (Math.abs(turningFrame) == FRAMES_FOR_TURNING) {\n\t\t\tframesAtMaxTurning++;\n\t\t} else framesAtMaxTurning = 0;\n\t\t\n\t\t// Turn the wheels back if not turning.\n\t\tif (!left && !right) {\n\t\t\tif (turningFrame > 0) turningFrame --;\n\t\t\telse if (turningFrame < 0) turningFrame++;\n\t\t}\n\t\t\n\t\t// Slow down if not accelerating or reversing.\n\t\tif (!up && !down) {\n\t\t\tspeed *= FRICTION;\n\t\t}\n\t\t// Break\n\t\tif (speed > 0 && up) {\n\t\t\tspeed *= BACK_BREAK_FRICTION;\n\t\t} else if (speed < 0 && down) {\n\t\t\tspeed *= BREAK_FRICTION;\n\t\t}\n\t\t\n\t\t// Lower max turning speed if velocity is low.\n\t\tdouble maxTurnSpeed = vel.len2() / 0.01 * TURN_SPEED;\n\t\tif (maxTurnSpeed > TURN_SPEED)\n\t\t\tmaxTurnSpeed = TURN_SPEED;\n\t\tdouble angleChange = ((float)turningFrame / FRAMES_FOR_TURNING) * maxTurnSpeed;\n\t\t\n\t\t\n\t\t// Calculate front and back wheel positions.\n\t\tVector2 fWheel = temp;\n\t\tVector2 bWheel = temp2;\n\t\tfWheel.set((float)Math.cos(angle), (float)Math.sin(angle)).scl(WHEEL_DIST/2).add(pos);\n\t\tbWheel.set((float)Math.cos(angle), (float)Math.sin(angle)).scl(-WHEEL_DIST/2).add(pos);\n\t\t\n\t\t// Move the wheels forward in the car's direction. angleChange is added\n\t\t// to the front wheels since they are doing the turning.\n\t\tbWheel.add((float)Math.cos(angle)*speed, (float)Math.sin(angle)*speed);\n\t\tfWheel.add((float)Math.cos(angle+angleChange)*speed, (float)Math.sin(angle+angleChange)*speed);\n\t\t\n\t\tangle -= angleChange;\n\t\t\n\t\t// Scale down the velocity from previous frame.\n\t\tvel.scl(0.95f);\n\t\tif (vel.len2() > MAX_VEL) {\n\t\t\tvel.setLength2(MAX_VEL);\n\t\t}\n\t\t\n\t\t// Add this frames movement to the velocity.\n\t\tif (!locked) {\n\t\t\tvel.add(fWheel.add(bWheel).scl(0.5f).sub(pos));\n\t\t}\n\t\t\n\t\t// Add velocity to car and update position\n\t\toldPos.set(pos);\n\t\tpos.add(vel);\n\t\tcar.setPosition(pos.x, posAboveGround, pos.y);\n\t\t\n\t\ttestForWallCollision();\n\t}", "void driveStick(float x, float y) {\n speed = (Math.abs(x) > Math.abs(y) ? Math.abs(x) : Math.abs(y)) / 1.5;\n\n telemetry.addData(\"y\", y);\n telemetry.addData(\"x\", x);\n\n //One program to combine 8 directions of motion on one joystick using ranges of x and y values\n if (y > .10) {\n drive(\"left\");\n } else if (y < -.10) {\n drive(\"right\");\n } else if (x > .10) {\n drive(\"down\");\n } else if (x < -.10) {\n drive(\"up\");\n } else {\n drive(\"stop\");\n }\n\n\n }", "@Override\n public void loop() {\n// double left;\n robot.colorDrop.setPosition(0.45);\n\n double Righty, Lefty, sideRight, sideLeft;\n double phaseUp;\n double phaseDown;\n boolean straffeL,straffeR,straffeL2,straffeR2;\n double turnR,turnL;\n double Righty2, Lefty2, sideRight2, sideLeft2;\n double phaseUp2;\n double phaseDown2;\n\n // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n Lefty = gamepad1.right_stick_y;\n Righty = gamepad1.left_stick_y;\n sideRight= gamepad1.left_stick_x;\n sideLeft=gamepad1.right_stick_x;\n phaseUp = gamepad2.right_trigger;\n phaseDown = gamepad2.left_trigger;\n straffeL = gamepad1.right_bumper;\n straffeR = gamepad1.left_bumper;\n straffeL2 = gamepad2.right_bumper;\n straffeR2 = gamepad2.left_bumper;\n //turnL = gamepad1.left_trigger;\n //turnR= gamepad1.left_trigger;\n\n Lefty2 = gamepad1.right_stick_y;\n Righty2 = gamepad1.left_stick_y;\n sideRight2= gamepad1.left_stick_x;\n sideLeft2=gamepad1.right_stick_x;\n //phaseUp2 = gamepad1.right_trigger;\n //phaseDown2 = gamepad1.left_trigger;\n\n\n\n\n if(sideRight!=0&&sideLeft<0) {\n robot.leftFrontDrive.setPower(sideLeft);\n robot.rightFrontDrive.setPower(sideLeft);\n robot.leftRearDrive.setPower(sideLeft * -1);\n robot.rightRearDrive.setPower(sideLeft);\n }\n else if(sideRight!=0&&sideLeft>0)\n {\n robot.leftFrontDrive.setPower(sideLeft);\n robot.rightFrontDrive.setPower(sideLeft*-1);\n robot.leftRearDrive.setPower(sideLeft);\n robot.rightRearDrive.setPower(sideLeft);\n }\n else if(sideLeft!=0)\n {\n robot.leftFrontDrive.setPower(sideLeft);\n robot.rightFrontDrive.setPower(sideLeft*-1);\n robot.leftRearDrive.setPower(sideLeft*-1);\n robot.rightRearDrive.setPower(sideLeft);\n\n }\n else if(Righty<0&&sideRight<0)\n {\n robot.leftFrontDrive.setPower(-.5);\n robot.rightFrontDrive.setPower(-.9);\n robot.leftRearDrive.setPower(-.5);\n robot.rightRearDrive.setPower(-.9);\n }\n else if(Righty<0&&sideRight>0) {\n robot.leftFrontDrive.setPower(-.9);\n robot.rightFrontDrive.setPower(-.5);\n robot.leftRearDrive.setPower(-.9);\n robot.rightRearDrive.setPower(-.5);\n }\n else if(Righty==0&&sideRight!=0)\n {\n robot.leftFrontDrive.setPower(sideRight*-.7);\n robot.rightFrontDrive.setPower(sideRight*.7);\n robot.leftRearDrive.setPower(sideRight*-.7);\n robot.rightRearDrive.setPower(sideRight*.7);\n }\n else if(Righty<0&&sideRight==0)\n {\n robot.leftFrontDrive.setPower(Righty);\n robot.rightFrontDrive.setPower(Righty);\n robot.leftRearDrive.setPower(Righty);\n robot.rightRearDrive.setPower(Righty);\n\n }\n else if(Righty>0)\n {\n robot.leftFrontDrive.setPower(Righty);\n robot.rightFrontDrive.setPower(Righty);\n robot.leftRearDrive.setPower(Righty);\n robot.rightRearDrive.setPower(Righty);\n\n }\n else if(Lefty!=0&&sideLeft==0)\n {\n robot.leftFrontDrive.setPower(Lefty);\n robot.rightFrontDrive.setPower(Lefty);\n robot.leftRearDrive.setPower(Lefty);\n robot.rightRearDrive.setPower(Lefty);\n }\n else if(straffeL==true||straffeL2==true)\n {\n robot.leftFrontDrive.setPower(.2);\n robot.rightFrontDrive.setPower(-.2);\n robot.leftRearDrive.setPower(-.2);\n robot.rightRearDrive.setPower(.2);\n }\n\n else if(straffeR==true||straffeR2==true)\n {\n robot.leftFrontDrive.setPower(-.2);\n robot.rightFrontDrive.setPower(.2);\n robot.leftRearDrive.setPower(.2);\n robot.rightRearDrive.setPower(-.2);\n }\n else\n {\n robot.leftFrontDrive.setPower(0);\n robot.rightFrontDrive.setPower(0);\n robot.leftRearDrive.setPower(0);\n robot.rightRearDrive.setPower(0);\n\n }\n\n\n ///player 1\n if ((phaseDown >0)) {\n robot.leftStageOne.setPower(1);\n robot.rightStageOne.setPower(1);\n }\n\n else if ((phaseUp >0)) {\n robot.leftStageOne.setPower(-1);\n robot.rightStageOne.setPower(-1);\n }\n\n else {\n robot.rightStageOne.setPower(0);\n robot.leftStageOne.setPower(0);\n }\n\n/*\n if (gamepad1.y){\n robot.leftStageTwo.setPosition(1);\n robot.rightStageTwo.setPosition(0.1);\n }\n if(gamepad1.x)\n {\n robot.leftStageTwo.setPosition(.4);\n robot.rightStageTwo.setPosition(.7);\n }\n if (gamepad1.a){\n robot.leftStageTwo.setPosition(0.12);\n robot.rightStageTwo.setPosition(.98);\n }\n */\n if(gamepad1.a) {\n robot.align.setPosition(.57);\n }\n if(gamepad1.x)\n {\n robot.align.setPosition(0.95);\n }\n if (gamepad1.b){\n robot.colorDrop.setPosition(.35);\n }\n\n\n\n\n if (gamepad2.a){\n // robot.leftStageTwo.setPosition(1);\n // robot.rightStageTwo.setPosition(0.1);\n }\n if(gamepad2.x)\n {\n // robot.leftStageTwo.setPosition(.4);\n // robot.rightStageTwo.setPosition(.7);\n }\n if (gamepad2.y){//lift up\n // robot.leftStageTwo.setPosition(0.12);\n //robot.rightStageTwo.setPosition(.98);\n }\n if (gamepad2.b){\n robot.colorDrop.setPosition(.35);\n }\n\n\n\n\n\n\n /*\n if (gamepad1.right_bumper == true){\n // robot.leftBumper.setPosition(robot.leftBumper.getPosition()+.05);\n sleep(2000);\n }\n else if (gamepad1.left_bumper == true){\n /// robot.leftBumper.setPosition(robot.leftBumper.getPosition()-.05);\n\n }\n else{\n ///robot.leftBumper.setPosition(robot.leftBumper.getPosition());\n }\n */\n /*\n\n */\n // if (gamepad2.dpad_down){\n // robot.relicServo.setPosition(robot.relicServo.getPosition()+.025);\n // }\n //else if(gamepad2.dpad_up){\n // robot.relicServo.setPosition(robot.relicServo.getPosition()-.025);\n // }\n // else{\n // robot.relicServo.setPosition(robot.relicServo.getPosition());\n //}\n\n// if (gamepad2.dpad_left){\n // robot.relicDropperServo.setPosition(robot.relicDropperServo.getPosition()+.025);\n // }\n // else if (gamepad2.dpad_right){\n // robot.relicDropperServo.setPosition(robot.relicDropperServo.getPosition()-.025);\n // }\n // else {\n // robot.relicDropperServo.setPosition(robot.relicDropperServo.getPosition());\n //}\n // if (gamepad2.left_trigger>5){\n // robot.relicMotor.setPower(.5);\n // }\n //else if (gamepad2.left_bumper){\n // robot.relicMotor.setPower(-.5);\n //}\n //else{\n // robot.relicMotor.setPower(0);\n // }\n\n // Send telemetry message to signify robot running;\n // telemetry.addData(\"claw\", \"Offset = %.2f\", clawOffset);\n // telemetry.addData(\"sideright\", \"%.2f\", sideRight);\n // telemetry.addData(\"right\", \"%.2f\", Left);\n // telemetry.addData(\"sideright\", \"%.2f\", sideRight);\n // telemetry.addData(\"left\", \"%.2f\", sideLeft);\n/*\n //distance = robot.sensorDistance.getDistance(DistanceUnit.CM);\n // send the info back to driver station using telemetry function.\n telemetry.addData(\"Distance (cm)\",\n String.format(Locale.US, \"%.02f\", robot.sensorDistance.getDistance(DistanceUnit.CM)));\n telemetry.addData(\"Alpha\", robot.sensorColor.alpha());\n telemetry.addData(\"Red \", robot.sensorColor.red());\n telemetry.addData(\"Green\", robot.sensorColor.green());\n telemetry.addData(\"Blue \", robot.sensorColor.blue());\n */\n telemetry.addData(\"phaseUp \", phaseUp);\n telemetry.addData(\"sideRight \", sideRight);\n // telemetry.addData(\"right bumper: \", robot.rightBumper.getPosition());\n // telemetry.addData(\"left bumper: \", robot.leftBumper.getPosition());\n telemetry.update();\n }", "private void testEncoder() {\n\n flMotor.setPower(0.50);\n frMotor.setPower(0.50);\n blMotor.setPower(0.50);\n brMotor.setPower(0.50);\n\n // wait while opmode is active and left motor is busy running to position.\n\n while (opModeIsActive() && flMotor.isBusy()) {\n telemetry.addData(\"encoder-fwd-left\", flMotor.getCurrentPosition() + \" busy=\" + flMotor.isBusy());\n telemetry.addData(\"encoder-fwd-right\", frMotor.getCurrentPosition() + \" busy=\" + frMotor.isBusy());\n telemetry.addData(\"encoder-bck-left\", blMotor.getCurrentPosition() + \" busy=\" + blMotor.isBusy());\n telemetry.addData(\"encoder-bck-right\", brMotor.getCurrentPosition() + \" busy=\" + brMotor.isBusy());\n telemetry.update();\n idle();\n }\n\n // set motor power to zero to turn off motors. The motors stop on their own but\n // power is still applied so we turn off the power.\n\n flMotor.setPower(0.0);\n frMotor.setPower(0.0);\n blMotor.setPower(0.0);\n brMotor.setPower(0.0);\n\n // wait 5 sec to you can observe the final encoder position.\n\n resetStartTime();\n\n while (opModeIsActive() && getRuntime() < 5) {\n telemetry.addData(\"encoder-fwd-left-end\", flMotor.getCurrentPosition());\n telemetry.addData(\"encoder-fwd-right-end\", frMotor.getCurrentPosition());\n telemetry.addData(\"encoder-bck-left-end\", blMotor.getCurrentPosition());\n telemetry.addData(\"encoder-bck-right-end\", brMotor.getCurrentPosition());\n telemetry.update();\n idle();\n }\n\n // From current position back up to starting point. In this example instead of\n // having the motor monitor the encoder we will monitor the encoder ourselves.\n\n flMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n frMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n blMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n brMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n flMotor.setTargetPosition(0);\n frMotor.setTargetPosition(0);\n blMotor.setTargetPosition(0);\n brMotor.setTargetPosition(0);\n\n // Power sign matters again as we are running without encoder.\n flMotor.setPower(-0.50);\n frMotor.setPower(-0.50);\n blMotor.setPower(-0.50);\n brMotor.setPower(-0.50);\n\n while (opModeIsActive() && flMotor.getCurrentPosition() > flMotor.getTargetPosition()) {\n telemetry.addData(\"encoder-back-left\", flMotor.getCurrentPosition());\n telemetry.addData(\"encoder-back-right\", frMotor.getCurrentPosition());\n telemetry.addData(\"encoder-back-left\", blMotor.getCurrentPosition());\n telemetry.addData(\"encoder-back-right\", brMotor.getCurrentPosition());\n telemetry.update();\n idle();\n }\n\n // set motor power to zero to stop motors.\n flMotor.setPower(0.0);\n frMotor.setPower(0.0);\n blMotor.setPower(0.0);\n brMotor.setPower(0.0);\n\n resetStartTime();\n\n while (opModeIsActive() && getRuntime() < 5) {\n telemetry.addData(\"encoder-back-left-end\", flMotor.getCurrentPosition());\n telemetry.addData(\"encoder-back-right-end\", frMotor.getCurrentPosition());\n telemetry.addData(\"encoder-back-left-end\", blMotor.getCurrentPosition());\n telemetry.addData(\"encoder-back-right-end\", brMotor.getCurrentPosition());\n telemetry.update();\n idle();\n }\n }", "public void move() {\n\t\t// tolerance of angle at which the Base starts moving\n\t\tint tolerance = 10;\n\t\tif(Math.abs(angle) < Math.abs(angleDesired)+tolerance && Math.abs(angleDesired)-tolerance < Math.abs(angle)) {\n\t\t\tdouble vX = Math.cos(Math.toRadians(this.angle + 90)) * v;\n\t\t\tdouble vY = Math.sin(Math.toRadians(this.angle + 90)) * v;\n\t\t\t\n\t\t\tthis.x += vX;\n\t\t\tthis.y += vY;\t\n\t\t\tthis.rectHitbox = new Rectangle((int)(x-rectHitbox.width/2),(int)(y-rectHitbox.height/2),rectHitbox.width,rectHitbox.height);\n\t\t}\n\t\t// curTargetPathBoardRectangle\n\t\tRectangle curTPBR = pathBoardRectangles.get(curTargetPathCellIndex).rect;\n\t\tRectangle rectSmallerBR = new Rectangle((int)curTPBR.getCenterX()-5,(int)curTPBR.getCenterY()-5,10,10);\n\t\t// updates the index when it crosses a pathCell so it counts down from pathCell to pathCell,\n\t\t// always having the next pathCell in the array as the target until the end is reached then it stops\n\t\tif(rectSmallerBR.contains(new Point((int)x,(int)y))) {\n\t\t\tif(curTargetPathCellIndex < pathBoardRectangles.size()-1) {\n\t\t\t\tcurTargetPathCellIndex++;\n\t\t\t\tparentGP.boardRect = pathBoardRectangles.get(curTargetPathCellIndex-1);\n\t\t\t\ttAutoDirectionCorrection.restart();\n\t\t\t}else {\n\t\t\t\tparentGP.isMoving = false;\n\t\t\t\tparentGP.boardRect = pathBoardRectangles.get(curTargetPathCellIndex);\n\t\t\t\tpathBoardRectangles.clear();\n\t\t\t\ttAutoDirectionCorrection.stop();\n\t\t\t\tStagePanel.tryCaptureGoldMine(parentGP);\n\t\t\t}\n\t\t}\n\t}", "public void arcadeDrive() {\n\t\tif (fastBool) {\n\t\t\tmotorRB.set((joystickLYAxis + joystickLXAxis/2));\n\t\t\tmotorRF.set((joystickLYAxis + joystickLXAxis/2));\n\t\t\tmotorLB.set(-(joystickLYAxis - joystickLXAxis/2));\n\t\t\tmotorLF.set(-(joystickLYAxis - joystickLXAxis/2));\n\t\t} else {\n\t\t\tmotorRB.set((joystickLYAxis + joystickLXAxis/2)/2);\n\t\t\tmotorRF.set((joystickLYAxis + joystickLXAxis/2)/2);\n\t\t\tmotorLB.set(-(joystickLYAxis - joystickLXAxis/2)/2);\n\t\t\tmotorLF.set(-(joystickLYAxis - joystickLXAxis/2)/2);\n\t\t}\n\t}", "@Override\n public void teleopPeriodic() {\n double triggerVal = \n (m_driverController.getTriggerAxis(Hand.kRight)\n - m_driverController.getTriggerAxis(Hand.kLeft))\n * RobotMap.DRIVING_SPEED;\n\n double stick = \n (m_driverController.getX(Hand.kLeft))\n * RobotMap.TURNING_RATE;\n \n m_driveTrain.tankDrive(triggerVal + stick, triggerVal - stick);\n\n if(m_driverController.getAButton()){\n m_shooter.arcadeDrive(RobotMap.SHOOTER_SPEED, 0.0);\n }\n \n else{\n m_shooter.arcadeDrive(0.0, 0.0);\n }\n \n }", "protected void execute() \n {\n if(Robot.isClimbEnabled)\n if(Math.abs(Robot.oi.driverJoystick.getLeftStickRaw_Y())>0.1) //we only want to drive fwd, never reverse\n Robot.monkeyBarIntakeWheels.driveIntakeAll((Math.abs(Robot.oi.driverJoystick.getLeftStickRaw_Y()+.2)) + 0.15);\n else\n Robot.monkeyBarIntakeWheels.driveIntakeAll(0.07); //always drive wheels in climb mode\n else\n Robot.monkeyBarIntakeWheels.driveIntakeAll(0.6*Robot.oi.getMonkeyBarIntakeJoystickValue());\n }", "private void driveRight() {\n setSpeed(MAX_SPEED, MIN_SPEED);\n }", "public void moveToEncoder(TurnType dir,\n int tick,\n float maxPower,\n int timeoutMillis,\n boolean isAccelerate,\n boolean isAdjust,\n boolean isBreak,\n MoveAction[] actions)\n throws InterruptedException\n {\n final float MOVE_TIMEOUT_FACTOR = 2f;\n final int MOVE_STALL_TIME = 500;\n\n maxPower = Math.abs(maxPower);\n maxPower = Range.clip(maxPower, 0f, 1f);\n\n if (timeoutMillis < 0) {\n timeoutMillis = Math.abs((int) (tick * Drive.AM20_MILLISECOND_PER_TICK * MOVE_TIMEOUT_FACTOR)) + 2000;\n }\n\n // turn wheels\n setTurnWait(dir);\n\n resetPosition();\n // is RUN_TO_POSITION\n setMode2(RunMode.RUN_TO_POSITION);\n if (dir == TurnType.STRAFE) {\n setTargetPosition2(tick,\n new HwDevice[]{driveRightBack, driveLeftFront});\n setTargetPosition2(-tick,\n new HwDevice[]{driveRightFront, driveLeftBack});\n } else {\n setTargetPosition2(tick);\n }\n\n long startTimestamp = System.currentTimeMillis();\n long timeStamp = startTimestamp;\n\n Stalled stalled = new Stalled();\n while (op.opModeIsActive() &&\n // is RUN_TO_POSITION\n isBusy() &&\n (timeStamp - startTimestamp < timeoutMillis)) {\n\n int average = ((int)Math.signum(tick))*getEncoder(dir);\n int delta = tick - average;\n if (Math.abs(delta) < 50)\n {\n // done\n break;\n }\n\n float basePower;\n if (!isAccelerate)\n {\n basePower = Math.signum(delta) * maxPower;\n }\n else\n {\n if (Math.abs(average) < Math.abs(tick / 3))\n {\n // ramp up for 1/3 of distance\n // minimum power is START_POWER\n // base is 1600\n basePower = (average/1600f) + Math.signum(tick) * POWER_START;\n }\n else\n {\n // ramp down for 2/3 of distance\n // minimum power is START_POWER\n // base is 3200\n basePower = (delta/3200f) + Math.signum(delta) * POWER_STOP;\n }\n basePower = Range.clip(basePower, -maxPower, maxPower);\n\n /*if (dir == TurnType.STRAFE) {\n long timeStamp1 = System.currentTimeMillis();\n if (timeStamp1 - logTimeStamp > 25) {\n RobotLog.i(\"Avg:\" + average + \" Delta:\" + delta + \" Power:\" + basePower);\n logTimeStamp = timeStamp1;\n }\n }*/\n } // if\n\n //op.telemetry.addData(\"power\", Float.toString(basePower));\n //op.telemetry.addData(\"travel\", Integer.toString(tickToInch(average)));\n //op.telemetry.addData(\"delta\", Integer.toString(tickToInch(delta)));\n\n if (stalled.isStalled(average, timeStamp)) {\n WaitLinear w = new WaitLinear(op);\n stop2();\n w.waitMillis(MOVE_STALL_TIME);\n timeoutMillis += MOVE_STALL_TIME;\n stalled.reset();\n }\n else {\n if (isAdjust) {\n adjustPower(dir,\n basePower);\n }\n else {\n setPower(basePower,\n basePower,\n dir);\n }\n } // else\n\n if (actions != null) {\n for (MoveAction action : actions) {\n if (action == null) {\n continue;\n }\n\n if (Math.abs(average) > Math.abs(action.distanceInTick())) {\n action.perform();\n }\n }\n }\n\n //op.telemetry.addData(\"driveLeftFront\", driveLeftFront.getCurrentPosition());\n //op.telemetry.addData(\"driveRightBack\", driveRightBack.getCurrentPosition());\n //op.telemetry.addData(\"driveRightFront\", driveRightFront.getCurrentPosition());\n //op.telemetry.addData(\"driveLeftBack\", driveLeftBack.getCurrentPosition());\n\n //op.telemetry.update();\n op.idle();\n timeStamp = System.currentTimeMillis();\n } // while\n\n if (isBreak) {\n stop2();\n }\n\n if (Thread.currentThread().isInterrupted()) {\n RobotLog.e(\"Overcharged Thread interrupted\");\n }\n else if (op.isStopRequested()) {\n RobotLog.e(\"Overcharged Stop requested\");\n }\n\n // is RUN_TO_POSITION\n setMode2(RunMode.RUN_USING_ENCODER);\n\n // stop actions\n if (actions != null) {\n for (MoveAction action : actions) {\n if (action == null) {\n continue;\n }\n\n action.stop();\n RobotLog.i(\"Actions \" + action + \" stopped\");\n }\n op.idle();\n }\n\n int inches = tickToInch(getEncoder(dir));\n RobotLog.i(\"Moved \" + inches + \" inches\");\n RobotLog.i(\"Move took \" + (System.currentTimeMillis() - startTimestamp) + \" milliseconds\");\n //op.telemetry.addData(\"travel\", inches);\n op.idle();\n }", "@Override\r\n public int run() {\n if (robot.rightDrive.isBusy() && robot.leftDrive.isBusy()) {\r\n robot.leftDrive.setPower(leftSpeed);\r\n robot.rightDrive.setPower(rightSpeed);\r\n\r\n /*telemetry.addData(\"MoveByEncoder To\", \"Left: (%2f), Right (%2f)\",\r\n leftTarget, rightTarget);\r\n telemetry.addData(\"MoveByEncoder At\", \"Left: (%2f), Right (%2f)\",\r\n robot.leftDrive.getCurrentPosition(), robot.rightDrive.getCurrentPosition());\r\n telemetry.update();*/\r\n\r\n telemetry.addData(\"Left Pos\", robot.leftDrive.getCurrentPosition());\r\n telemetry.addData(\"Right Pos\", robot.rightDrive.getCurrentPosition());\r\n telemetry.update();\r\n\r\n return 0;\r\n\r\n }\r\n\r\n return nextPos;\r\n }", "public void arcDrive (double inches, float degreesToTurn, double basePower, boolean clockwise, double p_coeff) throws InterruptedException {\n\n int target = (int) (inches * ticksPerInch);\n double correction;\n double leftPower = basePower;\n double rightPower = basePower;\n double max;\n int lastEncoder;\n int currentEncoder = 0;\n int deltaEncoder;\n double proportionEncoder;\n float lastHeading;\n float currentHeading = zRotation;\n float deltaHeading;\n double proportionHeading;\n double proportionArc;\n long loops = 0;\n\n if(basePower<0){\n clockwise = !clockwise;\n degreesToTurn *= -1;\n }\n\n double P_ARC_COEFF = p_coeff;\n\n setEncoderBase();\n\n frontRight.setPower(basePower);\n backRight.setPower(basePower);\n frontLeft.setPower(basePower);\n backLeft.setPower(basePower);\n\n Thread.sleep(10);\n\n while (((LinearOpMode) callingOpMode).opModeIsActive()) {\n\n lastEncoder = currentEncoder;\n currentEncoder = getCurrentAveragePosition();\n\n deltaEncoder = currentEncoder - lastEncoder;\n\n lastHeading = currentHeading;\n currentHeading = zRotation;\n\n deltaHeading = currentHeading - lastHeading;\n deltaHeading = normalize360two(deltaHeading);\n\n proportionEncoder = (double) deltaEncoder / target;\n proportionHeading = (double) deltaHeading / degreesToTurn;\n\n proportionArc = proportionEncoder - proportionHeading;\n\n correction = proportionArc * P_ARC_COEFF;\n\n if(clockwise) {\n leftPower += correction;\n rightPower -= correction;\n } else {\n leftPower -= correction;\n rightPower += correction;\n }\n\n max = Math.max(Math.abs(leftPower), Math.abs(rightPower));\n if (max > 1.0) {\n leftPower /= max;\n rightPower /= max;\n }\n frontRight.setPower(rightPower);\n backRight.setPower(rightPower);\n frontLeft.setPower(leftPower);\n backLeft.setPower(leftPower);\n\n if (((loops + 10) % 10) == 0) {\n callingOpMode.telemetry.addData(\"TARGET\", target);\n callingOpMode.telemetry.addData(\"gyro\", zRotation);\n callingOpMode.telemetry.addData(\"encoder\", currentEncoder);\n callingOpMode.telemetry.addData(\"heading\", currentHeading);\n callingOpMode.telemetry.addData(\"dEncoder\", deltaEncoder);\n callingOpMode.telemetry.addData(\"dHeading\", deltaHeading);\n callingOpMode.telemetry.addData(\"pEncoder\", proportionEncoder);\n callingOpMode.telemetry.addData(\"pHeading\", proportionHeading);\n callingOpMode.telemetry.addData(\"arc\", proportionArc);\n callingOpMode.telemetry.addData(\"correction\", correction);\n callingOpMode.telemetry.addData(\"leftPower\", leftPower);\n callingOpMode.telemetry.addData(\"rightPower\", rightPower);\n callingOpMode.telemetry.addData(\"loops\", loops);\n callingOpMode.telemetry.update();\n }\n\n loops++;\n\n updateGlobalPosition();\n\n Thread.sleep(10);\n\n if(Math.abs(target) <= Math.abs(getCurrentAveragePosition())) {\n callingOpMode.telemetry.addData(\"TARGET\", target);\n callingOpMode.telemetry.addData(\"gyro\", zRotation);\n callingOpMode.telemetry.addData(\"encoder\", currentEncoder);\n callingOpMode.telemetry.addData(\"heading\", currentHeading);\n callingOpMode.telemetry.addData(\"dEncoder\", deltaEncoder);\n callingOpMode.telemetry.addData(\"dHeading\", deltaHeading);\n callingOpMode.telemetry.addData(\"pEncoder\", proportionEncoder);\n callingOpMode.telemetry.addData(\"pHeading\", proportionHeading);\n callingOpMode.telemetry.addData(\"arc\", proportionArc);\n callingOpMode.telemetry.addData(\"correction\", correction);\n callingOpMode.telemetry.addData(\"leftPower\", leftPower);\n callingOpMode.telemetry.addData(\"rightPower\", rightPower);\n callingOpMode.telemetry.addData(\"loops\", loops);\n callingOpMode.telemetry.update();\n break;\n }\n }\n }", "public void driveTo(double targetX, double targetY, float heading, double speedLimit) throws InterruptedException {\n float error = heading - zRotation; //The number of degrees between the true heading and desired heading\n double correction; //Modifies power to account for error\n double max;\n double Y_P_COEFF = 0.17825353626292278; //0.002\n double Y_I_COEFF = 0.2852056580206765; //0.0035\n double Y_D_COEFF = 0.0003; //0.00042\n double X_P_COEFF = 0.17825353626292278; //0.002\n double X_I_COEFF = 0.2852056580206765; //0.0035\n double X_D_COEFF = 0.0003; //0.00042\n double T_P_COEFF = 0.0084;\n double T_I_COEFF = 0.0168;\n double T_D_COEFF = 0.0028;\n double driveY, driveX;\n double distanceY;\n double distanceX;\n long loops = 0;\n heading = (int) normalize360(heading);\n\n double frontLeft;\n double frontRight;\n double backLeft;\n double backRight;\n\n setEncoderBase();\n int lastEncoderY = 0;\n int lastEncoderX = 0;\n float lastHeading = zRotation;\n\n speedLimit = Range.clip(speedLimit, 0.0, 1.0);\n\n if (speedLimit==0){\n return;\n }\n\n double power;\n double deltaT;\n double derivativeY = 0;\n double derivativeX = 0;\n double derivativeT = 0;\n double integralY = 0;\n double integralX = 0;\n double integralT = 0;\n int deltaDY;\n int deltaDX;\n float deltaDT;\n\n double theta;\n double theta2;\n double gamma;\n double h;\n double local_globalX;\n double local_globalY;\n\n double lastTime = callingOpMode.getRuntime();\n\n while ((((((Math.abs(targetY)-1) > Math.abs(globalY)) || ((Math.abs(targetY)+1) < Math.abs(globalY))) ||\n (((Math.abs(targetX)-1) > Math.abs(globalX)) || ((Math.abs(targetX)+1) < Math.abs(globalX)))) ||\n (Math.abs(error)>=5.0f)) && ((LinearOpMode) callingOpMode).opModeIsActive()) {\n\n error = heading - zRotation;\n\n while (error > 180) error = (error - 360);\n while (error <= -180) error = (error + 360);\n\n local_globalX = globalX;\n local_globalY = globalY;\n\n theta = zRotation * Math.PI / 180.0;\n\n // these represent the current x and y translations still to do, in global coordinates ... in inches\n driveY = targetY - local_globalY;\n driveX = targetX - local_globalX;\n\n theta2 = Math.atan2(driveY, driveX);\n gamma = theta+theta2;\n h = Math.sqrt((driveX*driveX)+(driveY*driveY));\n\n // in robot coordinates,\n distanceY = Math.sin(gamma)*h;\n distanceX = Math.cos(gamma)*h;\n\n deltaT = callingOpMode.getRuntime()-lastTime;\n lastTime = callingOpMode.getRuntime();\n deltaDY = getEncoderWheelYPosition()-lastEncoderY;\n lastEncoderY = getEncoderWheelYPosition();\n deltaDX = getEncoderWheelXPosition()-lastEncoderX;\n lastEncoderX = getEncoderWheelXPosition();\n deltaDT = zRotation-lastHeading;\n lastHeading = zRotation;\n\n derivativeY = ((double) deltaDY)/deltaT;\n derivativeX = ((double) deltaDX)/deltaT;\n derivativeT = ((double) deltaDT/deltaT);\n\n if(Math.abs(distanceY*Y_P_COEFF)<1 && Math.abs(distanceY)>1){\n integralY += distanceY*deltaT;\n } else {\n integralY = 0;\n }\n if(Math.abs(distanceX*X_P_COEFF)<1 && Math.abs(distanceX)>1){\n integralX += distanceX*deltaT;\n } else {\n integralX = 0;\n }\n if(Math.abs(error*T_P_COEFF)<1 && Math.abs(error)>5){\n integralT += error*deltaT;\n } else {\n integralT = 0;\n }\n\n power = (distanceY*Y_P_COEFF) + (integralY*Y_I_COEFF) - (derivativeY*Y_D_COEFF);\n\n frontLeft = power;\n frontRight = power;\n backLeft = power;\n backRight = power;\n\n power = (distanceX*X_P_COEFF) + (integralX*X_I_COEFF) - (derivativeX*X_D_COEFF);\n\n frontLeft += power;\n frontRight -= power;\n backLeft -= power;\n backRight += power;\n\n max = Math.max(Math.max(Math.abs(frontLeft), Math.abs(frontRight)), Math.max(Math.abs(backLeft), Math.abs(backRight)));\n if (max > Math.abs(speedLimit)) {\n frontLeft /= max;\n frontRight /= max;\n backLeft /= max;\n backRight /= max;\n frontLeft *= Math.abs(speedLimit);\n frontRight *= Math.abs(speedLimit);\n backLeft *= Math.abs(speedLimit);\n backRight *= Math.abs(speedLimit);\n }\n\n correction = (error*T_P_COEFF) + (integralT*T_I_COEFF) - (derivativeT*T_D_COEFF);\n\n frontLeft -= correction;\n frontRight += correction;\n backLeft -= correction;\n backRight += correction;\n\n max = Math.max(Math.max(Math.abs(frontLeft), Math.abs(frontRight)), Math.max(Math.abs(backLeft), Math.abs(backRight)));\n if (max > 1.0) {\n frontLeft /= max;\n frontRight /= max;\n backLeft /= max;\n backRight /= max;\n }\n\n updateDriveMotors(frontLeft, frontRight, backLeft, backRight);\n\n if (((loops+10) % 10) == 0) {\n callingOpMode.telemetry.addData(\"zRotation\" , zRotation);\n callingOpMode.telemetry.addData(\"globalY\" , local_globalY);\n callingOpMode.telemetry.addData(\"globalX\" , local_globalX);\n callingOpMode.telemetry.addData(\"distanceY\", distanceY);\n callingOpMode.telemetry.addData(\"distanceX\", distanceX);\n callingOpMode.telemetry.addData(\"theta\", theta);\n callingOpMode.telemetry.addData(\"theta2\",theta2);\n callingOpMode.telemetry.addData(\"gamma\",gamma);\n callingOpMode.telemetry.addData(\"driveY\",driveY);\n callingOpMode.telemetry.addData(\"driveX\",driveX);\n callingOpMode.telemetry.addData(\"error\", error);\n callingOpMode.telemetry.addData(\"loops\", loops);\n callingOpMode.telemetry.update();\n }\n\n loops++;\n\n updateGlobalPosition();\n\n ((LinearOpMode) callingOpMode).sleep(10);\n }\n }", "private void driveLeft() {\n setSpeed(MIN_SPEED, MAX_SPEED);\n }", "protected void execute() {\n \tSystem.out.println(\"Gyro: \" + Drivetrain.gyro.getAngle());\n\t\tif (degrees > 0) {\n\t\t\twhile (Drivetrain.gyro.getAngle() < degrees) {\n\t\t\t\tDrivetrain.frontRight.set(ControlMode.PercentOutput, 0.25);\n\t\t\t\tDrivetrain.rearRight.set(ControlMode.PercentOutput, 0.25);\n\t\t\t\tDrivetrain.frontLeft.set(ControlMode.PercentOutput, 0.25);\n\t\t\t\tDrivetrain.rearLeft.set(ControlMode.PercentOutput, 0.25);\n\t\t\t}\n\t\t} \n\t\telse {\n\t\t\twhile (Drivetrain.gyro.getAngle() > degrees) {\n\t\t\t\tDrivetrain.frontRight.set(ControlMode.PercentOutput, -0.25);\n\t\t\t\tDrivetrain.rearRight.set(ControlMode.PercentOutput, -0.25);\n\t\t\t\tDrivetrain.frontLeft.set(ControlMode.PercentOutput, -0.25);\n\t\t\t\tDrivetrain.rearLeft.set(ControlMode.PercentOutput, -0.25);\n\t\t\t}\n\t\t}\n }", "public void strafeRightEnc()\r\n\t{\r\n//\t\tdrive.setPos(0, 0, Config.Auto.encStrafeDistance, Config.Auto.encStrafeDistance);\r\n//\t\tif(Math.abs(drive.getFrontEncDist() - Config.Auto.encStrafeDistance) < Config.Auto.encTolerance && Math.abs(drive.getBackEncDist() - Config.Auto.encStrafeDistance) < Config.Auto.encTolerance)\r\n//\t\t{\r\n//\t\t\tdrive.setPos(Config.Auto.encDistanceBetweenTotes, Config.Auto.encDistanceBetweenTotes, Config.Auto.encStrafeDistance, Config.Auto.encStrafeDistance);\r\n//\t\t\t\r\n//\t\t\tif(Math.abs(drive.getLeftEncDist() - Config.Auto.encDistanceBetweenTotes) < Config.Auto.encTolerance && Math.abs(drive.getRightEncDist() - Config.Auto.encDistanceBetweenTotes) < Config.Auto.encTolerance)\r\n//\t\t\t{\r\n//\t\t\t\tdrive.setPos(Config.Auto.encDistanceBetweenTotes, Config.Auto.encDistanceBetweenTotes, 0, 0);\r\n//\t\t\t\t\r\n//\t\t\t\tif((Math.abs(drive.getFrontEncDist()) < Config.Auto.encTolerance && Math.abs(drive.getBackEncDist()) < Config.Auto.encTolerance))\r\n//\t\t\t\t\tendRoutine();\t\t\t\t\r\n//\t\t\t}\r\n//\t\t}\r\n\t}", "@Override\n public void driveToRun(DriveToParams param) {\n switch ((SENSOR_TYPE) param.reference) {\n case GYRO:\n // Turn faster if we're outside the threshold\n float speed = SPEED_TURN;\n if (Math.abs(param.error1) > SPEED_TURN_THRESHOLD) {\n speed = SPEED_TURN_FAST;\n }\n\n // Turning clockwise increases heading\n if (param.comparator.equals(DriveToComp.GREATER)) {\n tank.setSpeed(-speed, MotorSide.LEFT);\n tank.setSpeed(speed, MotorSide.RIGHT);\n } else {\n tank.setSpeed(speed, MotorSide.LEFT);\n tank.setSpeed(-speed, MotorSide.RIGHT);\n }\n break;\n case ENCODER:\n // Always drive forward\n tank.setSpeed(-SPEED_DRIVE);\n break;\n }\n }", "public void tankDrive() {\n\t\tif (fastBool) {\n\t\t\tmotorRB.set(joystickRYAxis);\n\t\t\tmotorRF.set(joystickRYAxis);\n\t\t\tmotorLB.set(-joystickLYAxis);\n\t\t\tmotorLF.set(-joystickLYAxis);\n\n\t\t} else {\n\t\t\tmotorRB.set(joystickRYAxis/2);\n\t\t\tmotorRF.set(joystickRYAxis/2);\n\t\t\tmotorLB.set(-joystickLYAxis/2);\n\t\t\tmotorLF.set(-joystickLYAxis/2);\n\t\t\t//System.out.println(strongBad.motorMultiplier);\n\t\t\t//SmartDashboard.putNumber(\"MM2\", strongBad.motorMultiplier);\n\n\t\t}\n\t}", "public static void trackCheck() {\n\t\t// reset the motor\n\t\tfor (EV3LargeRegulatedMotor motor : new EV3LargeRegulatedMotor[] { leftMotor, rightMotor }) {\n\t\t\tmotor.stop();\n\t\t\tmotor.setAcceleration(3000);\n\t\t}\n\t\ttry {\n\t\t\tThread.sleep(200);\n\t\t} catch (InterruptedException e) {\n\t\t\t// There is nothing to be done here\n\t\t}\n\t\t\n\t\t//move the robot forward until the Y asis is detected\n\t\tleftMotor.setSpeed(400);\n\t\trightMotor.setSpeed(400);\n\t\tleftMotor.rotate(Navigation_Test.convertAngle(Project_Test.WHEEL_RAD, Project_Test.TRACK, 720), true);\n\t\trightMotor.rotate(-Navigation_Test.convertAngle(Project_Test.WHEEL_RAD, Project_Test.TRACK, 720), false);\n\t}", "@Override\n public void teleopPeriodic() {\n\n double l = left.calculate((int)rightEnc.get());\n double r = right.calculate((int)rightEnc.get());\n\n double gyro_heading = gyro.getYaw(); // Assuming the gyro is giving a value in degrees\n double desired_heading = Pathfinder.r2d(left.getHeading()); // Should also be in degrees\n\n double angleDifference = Pathfinder.boundHalfDegrees(desired_heading - gyro_heading);\n double turn = 0.8 * (-1.0/80.0) * angleDifference;\n\n //left1.set(l + turn);\n //right1.set(r - turn);\n left1.set(0);\n right1.set(0);\n System.out.println(\"Get: \" + rightEnc.get() + \" Raw: \" + rightEnc.getRaw());\n\n }", "protected void execute() {\n if (oi.getButton(1,3).get()){\n speedModifier = 0.6;\n }\n else if(oi.getButton(2,3).get()){\n speedModifier = 1;\n }\n else if(oi.getButton(1,2).get()&&oi.getButton(2, 2).get()){\n speedModifier = 0.75;\n }\n chassis.tankDrive((oi.getJoystick(1).getAxis(Joystick.AxisType.kY)*speedModifier), (oi.getJoystick(2).getAxis(Joystick.AxisType.kY)*speedModifier));\n //While no triggers are pressed the robot moves at .75 the joystick input\n }", "@Override\n protected void execute() {\n\n float roll = Robot.driveBase.getRoll();\n\n // if robot is balance, continue climb\n if (roll < 0.2 && roll > -0.2) {\n Robot.climber.frontDown();\n Robot.climber.rearDown();\n } else {\n if (roll > 0.2) {\n // front is too fast -- slow front down\n Robot.climber.frontStop();\n Robot.climber.rearDown();\n }\n if (roll < -0.2) {\n Robot.climber.rearStop();\n Robot.climber.frontDown();\n // rear is too fast -- slow rear down\n }\n\n }\n }", "public static void driveMode(){\n\n\t\tSmartDashboard.putBoolean(\"Is Climbing:\", TalonDio.climbEncodDio(Actuators.getClimbMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Driving:\", TalonDio.driveEncodDio(Actuators.getLeftDriveMotor(), Actuators.getRightDriveMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Intake Disabled:\", Intake.intakeDisabled);\n\t\tSmartDashboard.putNumber(\"motorSpeed\", Intake.intakeMotorSpeed);\n\t\tSmartDashboard.putNumber(\"conveyorMotorSpeed\", Score.conveyorMotorSpeed);\n\t\tSmartDashboard.putBoolean(\"Intake Motor Inverted?:\", Actuators.getFuelIntakeMotor().getInverted());\n\t\tSmartDashboard.putBoolean(\"Is Climbing Motor Stalling:\", TalonDio.CIMStall(Actuators.getClimbMotor()));\n\n\t\t\n\n\t\tSmartDashboard.putBoolean(\"Is Climbing:\", TalonDio.climbEncodDio(Actuators.getClimbMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Driving:\", TalonDio.driveEncodDio(Actuators.getLeftDriveMotor(), Actuators.getRightDriveMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Climbing Motor Stalling:\", TalonDio.CIMStall(Actuators.getClimbMotor()));\n\t\tSmartDashboard.putNumber(\"Total Current Draw:\", SensorsDio.PDPCurrent(Sensors.getPowerDistro()));\n\n\t\n\t//TODO: Add Gear Vibrations for both controllers\n\t//Vibration Feedback\n\t\t//Sets the Secondary to vibrate if climbing motor is going to stall\n\t\tVibrations.climbStallVibrate(Constants.MAX_RUMBLE);\t\n\t\t//If within the second of TIME_RUMBLE then both controllers are set to HALF_RUMBLE\n\t\tVibrations.timeLeftVibrate(Constants.HALF_RUMBLE, Constants.TIME_RUMBLE);\t\n\t\t\n\t}", "@Override\n public void loop() {\n double left;\n double right;\n\n // // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n left = -gamepad1.left_stick_y;\n right = -gamepad1.right_stick_y;\n \n // double Target = 0;\n // robot.rightBack.setTargetPosition((int)Target);\n // robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n rightFront.setPower(left);\n rightBack.setPower(right);\n // robot.rightDrive.setPower(right);\n\n // // Use gamepad left & right Bumpers to open and close the claw\n // if (gamepad1.right_bumper)\n // clawOffset += CLAW_SPEED;\n // else if (gamepad1.left_bumper)\n // clawOffset -= CLAW_SPEED;\n\n // // Move both servos to new position. Assume servos are mirror image of each other.\n // clawOffset = Range.clip(clawOffset, -0.5, 0.5);\n // robot.leftClaw.setPosition(robot.MID_SERVO + clawOffset);\n // robot.rightClaw.setPosition(robot.MID_SERVO - clawOffset);\n\n // Use gamepad buttons to move the arm up (Y) and down (A)\n // if (gamepad1.y)\n // armPosition += ARM_SPEED;\n \n // if (gamepad1.a)\n // armPosition -= ARM_SPEED;\n \n // armPosition = Range.clip(armPosition, robot.ARM_MIN_RANGE, robot.ARM_MAX_RANGE); \n \n\n // // Send telemetry message to signify robot running;\n // telemetry.addData(\"arm\", \"%.2f\", armPosition);\n // telemetry.addData(\"left\", \"%.2f\", left);\n // telemetry.addData(\"right\", \"%.2f\", right);\n }", "protected void execute() {\n\n\t\tspeed = oi.getLeftY();\n\n\t\tleftTicks = drive.getLeftRotation();\n\t\trightTicks = drive.getRightRotation();\n\n\t\t/*\n\t\t * if (startAngle == drive.getAngle()) { drive.setBoth(oi.getLeftY()); }\n\t\t * else if (startAngle < drive.getAngle()) { if (oi.getLeftY() > 0)\n\t\t * drive.setBoth(oi.getLeftY(), .9 * oi.getLeftY()); else drive.setBoth(\n\t\t * .9 * oi.getLeftY(),oi.getLeftY()); } else if (startAngle >\n\t\t * drive.getAngle()) { if (oi.getLeftY() > 0)\n\t\t * drive.setBoth(oi.getLeftY(), .9 * oi.getLeftY()); else\n\t\t * drive.setBoth(.9 * oi.getLeftY(), oi.getLeftY()); }\n\t\t */\n\t\tif (leftTicks == 0 || rightTicks == 0)\n\t\t\tdrive.setBoth(speed);\n\t\telse\n\t\t\tdrive.setBoth(MathUtil.setLimits((rightTicks / leftTicks) * speed, -1.0, 1.0),\n\t\t\t\t\tMathUtil.setLimits((leftTicks / rightTicks) * speed, -1.0, 1.0));\n\n\t}", "@Override\n public void loop() {\n double left;\n double right;\n\n // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n if(!reverseMode)\n {\n left = -gamepad1.left_stick_y;\n right = -gamepad1.right_stick_y;\n }\n else\n {\n left = gamepad1.right_stick_y;\n right = gamepad1.left_stick_y;\n }\n\n targetSpeedLeft = left * driveSpeed;\n targetSpeedRight = right * driveSpeed;\n\n currentLiftSpeed = 0.0;\n if(gamepad1.left_trigger >= 0.1) {\n currentLiftSpeed = -LIFT_MAX_DOWN_SPEED;\n }\n if(gamepad1.right_trigger >= 0.1) {\n currentLiftSpeed = LIFT_MAX_DOWN_SPEED;\n }\n //if(gamepad2.left_trigger) {\n // currentLiftSpeed = -gamepad2.left_bumper * LIFT_MAX_DOWN_SPEED;\n //}\n //if(gamepad2.right_trigger) {\n // currentLiftSpeed = gamepad2.right_bumper * LIFT_MAX_UP_SPEED;\n //}\n/*\n currentSpeedArm = 0.0;\n if(gamepad1.left_trigger) {\n currentSpeedArm = -gamepad1.left_bumper * ARM_MAX_DOWN_SPEED;\n }\n if(gamepad1.right_trigger) {\n currentSpeedArm = gamepad1.right_bumper * ARM_MAX_UP_SPEED;\n }\n\n /*\n // limit acceleration by only allowing MAX_ACCEL power change per UPDATE_TIME\n if(runtime.seconds() > UPDATE_TIME)\n {\n runtime.reset();\n \n if( ((currentSpeedLeft >= 0.0) && (targetSpeedLeft >= 0.0)) ||\n ((currentSpeedLeft <= 0.0) && (targetSpeedLeft <= 0.0)))\n {\n if(Math.abs(currentSpeedLeft) > Math.abs(targetSpeedLeft)) \n {\n currentSpeedLeft = targetSpeedLeft;\n }\n else \n {\n if (currentSpeedLeft != targetSpeedLeft) {\n if (Math.abs(targetSpeedLeft - currentSpeedLeft) <= MAX_ACCEL)\n currentSpeedLeft = targetSpeedLeft;\n else {\n if (currentSpeedLeft < targetSpeedLeft)\n currentSpeedLeft += MAX_ACCEL;\n else\n currentSpeedLeft -= MAX_ACCEL;\n }\n }\n }\n\n }\n else \n {\n currentSpeedLeft = 0.0;\n }\n\n if( ((currentSpeedRight >= 0.0) && (targetSpeedRight >= 0.0)) ||\n ((currentSpeedRight <= 0.0) && (targetSpeedRight <= 0.0)))\n {\n if(Math.abs(currentSpeedRight) > Math.abs(targetSpeedRight))\n {\n currentSpeedRight = targetSpeedRight;\n }\n else\n {\n if (currentSpeedRight != targetSpeedRight) {\n if (Math.abs(targetSpeedRight - currentSpeedRight) <= MAX_ACCEL)\n currentSpeedRight = targetSpeedRight;\n else {\n if (currentSpeedRight < targetSpeedRight)\n currentSpeedRight += MAX_ACCEL;\n else\n currentSpeedRight -= MAX_ACCEL;\n }\n }\n }\n\n }\n else\n {\n currentSpeedRight = 0.0;\n }\n\n }\n */\n\n // replace acceleration limit because no longer needed\n currentSpeedLeft = targetSpeedLeft;\n currentSpeedRight = targetSpeedRight;\n\n robot.leftDriveMotor.setPower(currentSpeedLeft);\n robot.rightDriveMotor.setPower(currentSpeedRight);\n // robot.armMotor.setPower(currentSpeedArm);\n robot.liftMotor.setPower(currentLiftSpeed);\n\n\n if(gamepad1.a)\n {\n if (!aButtonHeld)\n {\n aButtonHeld = true;\n if (servoOpen) {\n servoOpen = false;\n robot.leftGrabServo.setPosition(LEFT_SERVO_CLOSED);\n robot.rightGrabServo.setPosition(RIGHT_SERVO_CLOSED);\n }\n else {\n servoOpen = true;\n robot.leftGrabServo.setPosition(LEFT_SERVO_OPEN);\n robot.rightGrabServo.setPosition(RIGHT_SERVO_OPEN);\n }\n }\n }\n else {\n aButtonHeld = false;\n }\n/*\n if(gamepad1.b)\n {\n if (!bButtonHeld)\n {\n bButtonHeld = true;\n reverseMode = !reverseMode;\n }\n }\n else\n {\n bButtonHeld = false;\n }\n\n*/\n if(gamepad1.y)\n {\n if (!yButtonHeld)\n {\n yButtonHeld = true;\n\n if(driveSpeed == MAX_SPEED) {\n driveSpeed = 0.3 * MAX_SPEED;\n slowMode = true;\n }\n else\n {\n driveSpeed = MAX_SPEED;\n slowMode = false;\n }\n }\n }\n else\n {\n yButtonHeld = false;\n }\n\n\n if(gamepad1.x)\n {\n if(!xButtonHeld)\n {\n xButtonHeld = true;\n\n if(servoUp){\n servoUp=false;\n robot.leftDragServo.setPosition(LEFT_DOWN);\n }\n else\n {\n servoUp=true;\n robot.leftDragServo.setPosition(LEFT_UP);\n }\n }\n }\n else\n {\n xButtonHeld = false;\n }\n\n telemetry.addData(\"reverse\", reverseMode);\n\n // telemetry.addData(\"currentLeft\", currentSpeedLeft);\n // telemetry.addData(\"currentRight\", currentSpeedRight);\n // telemetry.addData(\"currentArm\", currentSpeedArm);\n // telemetry.addData(\"currentLift\", currentLiftSpeed);\n telemetry.addData(\"encoderLeft\", robot.leftDriveMotor.getCurrentPosition());\n telemetry.addData(\"encoderRight\", robot.rightDriveMotor.getCurrentPosition());\n // telemetry.addData(\"reverseMode\", reverseMode);\n telemetry.addData(\"slowMode\", slowMode);\n telemetry.addData(\"Drag Servo\", robot.leftDragServo.getPosition());\n telemetry.addData(\"Touch Sensor\", robot.rearTouch.getState());\n }", "@Override\n public void teleopPeriodic() {\n double x = xcontroller2.getX(Hand.kLeft);\n //double y = xcontroller1.getTriggerAxis(Hand.kRight) - xcontroller1.getTriggerAxis(Hand.kLeft);\n // For testing just use left joystick. Use trigger axis code for GTA Drive/\n double y = -xcontroller2.getY(Hand.kLeft);\n double z = xcontroller2.getX(Hand.kRight);\n double yaw = imu.getAngleZ();\n RobotDT.driveCartesian(x, y, 0, 0);\n \n\n // After you spin joystick R3 press A button to reset gyro angle\n if (xcontroller1.getAButtonPressed()) {\n imu.reset();\n }\n \n if (xcontroller2.getBButtonPressed()){\n mGPM.goSpongeHatch();\n }\n\n if (xcontroller2.getXButtonPressed()){\n mGPM.goPineHome();\n \n }\n\n\n /** \n * If Bumpers are pressed then Cargo Intake Motor = -1 for Intake \n *if Triggers are pressed set value to 1 for Outtake\n *If triggers are released set value to 0*/\n if(xcontroller2.getBumperPressed(Hand.kLeft) && xcontroller2.getBumperPressed(Hand.kRight)) {\n mGPM.setCargoMotor(-1);\n } else if((xcontroller2.getTriggerAxis(Hand.kLeft) >0.75) && (xcontroller2.getTriggerAxis(Hand.kRight) >0.75)) {\n mGPM.setCargoMotor(1);\n } else{\n mGPM.setCargoMotor(0);\n }\n }", "public void execute(){\n drivetrain.tankDrive(0.6 * direction, 0.6 * direction);\n // slower than full speed so that we actually bring down the bridge,\n // not just slam it and push balls the wrong way\n }", "public void drive(double xSpeed, double ySpeed, double rot, boolean fieldRelative, boolean rateLimit) {\n \n double xSpeedCommanded;\n double ySpeedCommanded;\n\n if (rateLimit) {\n // Convert XY to polar for rate limiting\n double inputTranslationDir = Math.atan2(ySpeed, xSpeed);\n double inputTranslationMag = Math.sqrt(Math.pow(xSpeed, 2) + Math.pow(ySpeed, 2));\n\n // Calculate the direction slew rate based on an estimate of the lateral acceleration\n double directionSlewRate;\n if (m_currentTranslationMag != 0.0) {\n directionSlewRate = Math.abs(DriveConstants.kDirectionSlewRate / m_currentTranslationMag);\n } else {\n directionSlewRate = 500.0; //some high number that means the slew rate is effectively instantaneous\n }\n \n\n double currentTime = WPIUtilJNI.now() * 1e-6;\n double elapsedTime = currentTime - m_prevTime;\n double angleDif = SwerveUtils.AngleDifference(inputTranslationDir, m_currentTranslationDir);\n if (angleDif < 0.45*Math.PI) {\n m_currentTranslationDir = SwerveUtils.StepTowardsCircular(m_currentTranslationDir, inputTranslationDir, directionSlewRate * elapsedTime);\n m_currentTranslationMag = m_magLimiter.calculate(inputTranslationMag);\n }\n else if (angleDif > 0.85*Math.PI) {\n if (m_currentTranslationMag > 1e-4) { //some small number to avoid floating-point errors with equality checking\n // keep currentTranslationDir unchanged\n m_currentTranslationMag = m_magLimiter.calculate(0.0);\n }\n else {\n m_currentTranslationDir = SwerveUtils.WrapAngle(m_currentTranslationDir + Math.PI);\n m_currentTranslationMag = m_magLimiter.calculate(inputTranslationMag);\n }\n }\n else {\n m_currentTranslationDir = SwerveUtils.StepTowardsCircular(m_currentTranslationDir, inputTranslationDir, directionSlewRate * elapsedTime);\n m_currentTranslationMag = m_magLimiter.calculate(0.0);\n }\n m_prevTime = currentTime;\n \n xSpeedCommanded = m_currentTranslationMag * Math.cos(m_currentTranslationDir);\n ySpeedCommanded = m_currentTranslationMag * Math.sin(m_currentTranslationDir);\n m_currentRotation = m_rotLimiter.calculate(rot);\n\n\n } else {\n xSpeedCommanded = xSpeed;\n ySpeedCommanded = ySpeed;\n m_currentRotation = rot;\n }\n\n // Convert the commanded speeds into the correct units for the drivetrain\n double xSpeedDelivered = xSpeedCommanded * DriveConstants.kMaxSpeedMetersPerSecond;\n double ySpeedDelivered = ySpeedCommanded * DriveConstants.kMaxSpeedMetersPerSecond;\n double rotDelivered = m_currentRotation * DriveConstants.kMaxAngularSpeed;\n\n var swerveModuleStates = DriveConstants.kDriveKinematics.toSwerveModuleStates(\n fieldRelative\n ? ChassisSpeeds.fromFieldRelativeSpeeds(xSpeedDelivered, ySpeedDelivered, rotDelivered, Rotation2d.fromDegrees(m_gyro.getAngle()))\n : new ChassisSpeeds(xSpeedDelivered, ySpeedDelivered, rotDelivered));\n SwerveDriveKinematics.desaturateWheelSpeeds(\n swerveModuleStates, DriveConstants.kMaxSpeedMetersPerSecond);\n m_frontLeft.setDesiredState(swerveModuleStates[0]);\n m_frontRight.setDesiredState(swerveModuleStates[1]);\n m_rearLeft.setDesiredState(swerveModuleStates[2]);\n m_rearRight.setDesiredState(swerveModuleStates[3]);\n }", "protected void execute() {\n\n \n\n\n\n if (Robot.drive.gyroGetAngle() > m_autorotateangle) { // turn left\n if ( Math.abs(m_autorotateangle - Robot.drive.gyroGetAngle()) < rampthreshold ) {\n Robot.drive.setLeftSide(m_minspeed);\n Robot.drive.setRightSide(m_minspeed);\n } else {\n Robot.drive.setLeftSide(m_leftpower);\n Robot.drive.setRightSide(m_leftpower);\n }\n } else { // turn right\n if ( Math.abs(m_autorotateangle - Robot.drive.gyroGetAngle()) < rampthreshold ) {\n Robot.drive.setLeftSide(-m_minspeed);\n Robot.drive.setRightSide(-m_minspeed);\n } else {\n Robot.drive.setLeftSide(-m_leftpower);\n Robot.drive.setRightSide(-m_leftpower);\n }\n\n }\n\n \n\n \t//SmartDashboard.putNumber(\"NavX getYaw\", Robot.navX.getYaw());\n }", "public abstract void drive(double leftSpeed, double rightSpeed);", "@Override\n public TimeMeasure onContinueTask() throws InterruptedException\n {\n // If we aren't going to be driving anywhere, don't try to align.\n if (targetVector.magnitude < .00001 && !enablePassiveAlignmentCorrection)\n {\n turnMotor.setPosition(0.5);\n currentTurnSpeed = 0;\n\n // Could be passively turning\n currentAbsoluteEncoderReading = swerveEncoder.position();\n double currentAngle = Vector2D.clampAngle(currentAbsoluteEncoderReading - physicalEncoderOffset);\n displacementVector = displacementVector.add(Vector2D.polar(driveMotor.currentDistanceMoved() - lastDriveMotorPosition, currentAngle));\n lastDriveMotorPosition = driveMotor.currentDistanceMoved();\n\n if (errorResponder instanceof PIDController)\n ((PIDController) errorResponder).pauseController();\n\n if (driveMotor != null)\n driveMotor.setVelocity(0);\n\n if (wheelConsole != null)\n // Add console information.\n wheelConsole.write(\n \"Num skips: \" + numAbsoluteEncoderSkips,\n \"Angle to turn: \" + angleLeftToTurn,\n errorResponder instanceof PIDController ? ((PIDController) errorResponder).summary() : \"Using constant method\",\n \"Displacement Vector: \" + displacementVector.toString(Vector2D.VectorCoordinates.POLAR));\n }\n else\n {\n // Whether or not we should check whether the current module position is different from the last one.\n if (ABSOLUTE_ENCODER_UPDATE_CHECK)\n {\n // currentAbsoluteEncoderReading currently represents old swivel orientation.\n double newSwivelOrientation = swerveEncoder.position();\n\n // If we're turning but the absolute encoder hasn't registered the turn position change (latency).\n if (Math.abs(currentTurnSpeed) > .15 && Math.abs(newSwivelOrientation - currentAbsoluteEncoderReading) < .5)\n {\n // Record that this happened\n numAbsoluteEncoderSkips++;\n\n if (DAMP_TURN_SPEED_IF_SO)\n {\n // Slightly damp the power of the turning\n currentTurnSpeed *= .95;\n turnMotor.setPosition(0.5 + currentTurnSpeed);\n }\n\n // Try to immediately update.\n return TimeMeasure.IMMEDIATE;\n }\n\n currentAbsoluteEncoderReading = newSwivelOrientation;\n }\n else\n // Update position.\n currentAbsoluteEncoderReading = swerveEncoder.position();\n\n // Shortest angle from current heading to desired heading.\n double desiredAngle = targetVector.angle;\n double currentAngle = Vector2D.clampAngle(currentAbsoluteEncoderReading - physicalEncoderOffset);\n\n // Apply this movement to the cumulative displacement vector.\n displacementVector = displacementVector.add(Vector2D.polar(driveMotor.currentDistanceMoved() - lastDriveMotorPosition, currentAngle));\n lastDriveMotorPosition = driveMotor.currentDistanceMoved();\n\n // Calculate how to turn\n double angleFromDesired = (Vector2D.clampAngle(desiredAngle - currentAngle) + 180) % 360 - 180;\n angleFromDesired = angleFromDesired < -180 ? angleFromDesired + 360 : angleFromDesired;\n\n // Clip this angle to 90 degree maximum turns.\n if (angleFromDesired > 90)\n angleLeftToTurn = -angleFromDesired + 180;\n else if (angleFromDesired < -90)\n angleLeftToTurn = -angleFromDesired - 180;\n else\n angleLeftToTurn = angleFromDesired;\n\n // Set turn power.\n double turnPower = 0.5;\n\n // Use PID to calculate the correction factor (error bars contained within PID). angle left ^ 1.2\n currentTurnSpeed = errorResponder.value(angleLeftToTurn);\n\n // Change the turn factor depending on our distance from the angle desired (180 vs 0)\n if (angleFromDesired > 90 || angleFromDesired < -90)\n turnPower -= currentTurnSpeed;\n else\n turnPower += currentTurnSpeed;\n\n // For turn motor correction\n double drivePower = 0;\n\n // Set drive power (if angle between this and desired angle is greater than 90, reverse motor).\n if (drivingEnabled)\n {\n // Scale up/down motor power depending on how far we are from the ideal heading.\n drivePower = targetVector.magnitude;\n if (Math.abs(angleFromDesired) > 90) // Angle to turn != angle desired\n drivePower *= -1;\n\n if (targetVector.magnitude < .00001)\n {\n driveMotor.setVelocity(0);\n driveMotor.motor.setPower(0);\n }\n else\n {\n if (enableDrivePID)\n driveMotor.setVelocity(Range.clip(drivePower, -1, 1));\n else\n driveMotor.motor.setPower(Range.clip(drivePower / 95.0, -1, 1));\n }\n }\n\n // Try to counteract the torque applied by the driving motor.\n turnMotor.setPosition(Range.clip(turnPower + (driveMotorTorqueCorrectionEnabled ? driveMotorTorqueCorrection * drivePower : 0), 0, 1));\n\n if (wheelConsole != null)\n // Add console information.\n wheelConsole.write(\n \"Vector target: \" + targetVector.toString(Vector2D.VectorCoordinates.POLAR),\n \"Angle to turn: \" + angleLeftToTurn,\n \"Num skips: \" + numAbsoluteEncoderSkips,\n errorResponder instanceof PIDController ? ((PIDController) errorResponder).summary() : \"Using custom function adjustment method\",\n \"Displacement Vector: \" + displacementVector.toString(Vector2D.VectorCoordinates.POLAR));\n }\n\n // The ms to wait before updating again.\n return errorResponder.getUpdateRate();\n }", "@Override\r\n public void runOpMode() {\n\r\n mtrFL = hardwareMap.dcMotor.get(\"fl_drive\");\r\n mtrFR = hardwareMap.dcMotor.get(\"fr_drive\");\r\n mtrBL = hardwareMap.dcMotor.get(\"bl_drive\");\r\n mtrBR = hardwareMap.dcMotor.get(\"br_drive\");\r\n\r\n\r\n // Set directions for motors.\r\n mtrFL.setDirection(DcMotor.Direction.REVERSE);\r\n mtrFR.setDirection(DcMotor.Direction.FORWARD);\r\n mtrBL.setDirection(DcMotor.Direction.REVERSE);\r\n mtrBR.setDirection(DcMotor.Direction.FORWARD);\r\n\r\n\r\n //zero power behavior\r\n mtrFL.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n mtrFR.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n mtrBL.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n mtrBR.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n\r\n\r\n // Set power for all motors.\r\n mtrFL.setPower(powFL);\r\n mtrFR.setPower(powFR);\r\n mtrBL.setPower(powBL);\r\n mtrBR.setPower(powBR);\r\n\r\n\r\n // Set all motors to run with given mode\r\n mtrFL.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n mtrFR.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n mtrBL.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n mtrBR.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n\r\n waitForStart();\r\n\r\n // run until the end of the match (driver presses STOP)\r\n while (opModeIsActive()) {\r\n g1ch2 = -gamepad1.left_stick_y;\r\n g1ch3 = gamepad1.right_stick_x;\r\n g2ch2 = -gamepad2.left_stick_x;\r\n g2ch4 = -gamepad2.right_stick_x;\r\n g2left = gamepad2.left_trigger;\r\n g2right = gamepad2.right_trigger;\r\n\r\n\r\n powFL = Range.clip(g1ch2 + g1ch3, -1, 1);\r\n powFR = Range.clip(g1ch2 - g1ch3, -1, 1);\r\n powBL = Range.clip(g1ch2 + g1ch3, -1, 1);\r\n powBR = Range.clip(g1ch2 - g1ch3, -1, 1);\r\n\r\n\r\n mtrFL.setPower(powFL);\r\n mtrFR.setPower(powFR);\r\n mtrBL.setPower(powBL);\r\n mtrBR.setPower(powBR);\r\n sleep(50);\r\n }\r\n }", "protected void execute() {\n\t\tthrottle = getThrottle();\n\t\tturn = getCorrectTurnValue();\n\t\tforward = getForward();\n\t\tright = (forward - turn) * throttle;\n\t\tleft = (forward + turn) * throttle;\n\n\t\tRobot.driveTrain.driveManual(right, left);\n\t\tif (Robot.oi.bShiftUp.get()) {\n\t\t\tRobot.driveTrain.shiftToHigh(true);\n\t\t} else if (Robot.oi.bShiftDown.get()) {\n\t\t\tRobot.driveTrain.shiftToHigh(false);\n\t\t}\n\t}", "public void pos90() throws InterruptedException {\r\n bucketOverSweeper();\r\n sleep(2500);\r\n\r\n posElbow = 2200;\r\n posShoulder = 0;\r\n posBucket = 1.0;\r\n motorElbow.setTargetPosition(posElbow);\r\n motorShoulder.setTargetPosition(posShoulder);\r\n servoBucket.setPosition(posBucket);\r\n motorElbow.setPower(POWER_ELBOW_FAST);\r\n motorShoulder.setPower(POWER_SHOULDER_SLOW);\r\n\r\n posBucket = 0.2;\r\n servoBucket.setPosition(posBucket);\r\n sleep(1000);\r\n\r\n posBucket = 0.4;\r\n servoBucket.setPosition(posBucket);\r\n sleep(1000);\r\n\r\n posBucket = 0.5;\r\n servoBucket.setPosition(posBucket);\r\n sleep(200);\r\n\r\n posBucket = 0.4;\r\n servoBucket.setPosition(posBucket);\r\n sleep(200);\r\n\r\n posBucket = 0.3;\r\n servoBucket.setPosition(posBucket);\r\n sleep(200);\r\n\r\n posBucket = 0.2;\r\n servoBucket.setPosition(posBucket);\r\n sleep(200);\r\n\r\n posBucket = 0.15;\r\n servoBucket.setPosition(posBucket);\r\n sleep(2500);\r\n\r\n returnBucket();\r\n }", "private void scan(ScannedRobotEvent e) {\n double radarTurn = Utils.normalRelativeAngle(headOnBearing - p.getRadarHeadingRadians());\n double extraTurn = Math.min(Math.atan(36.0/e.getDistance()), Rules.RADAR_TURN_RATE_RADIANS);\n //adding a little bit more backwards turn when compensating backwards\n radarTurn += (radarTurn < 0 ? -extraTurn-6/Math.PI : extraTurn);\n p.setTurnRadarRightRadians(radarTurn);\n }", "@Override\n public void robotPeriodic() {\n double high = m_filter.calculate(m_photoHigh.getValue());// * kValueToInches;\n double low = m_filter.calculate(m_photoLow.getValue()); //* kValueToInches;\n if (low<=6){\n BallPresent = true;\n //stop motor if ultrasonic sensor median falls below 6 inches indicating a ball is blocking the sensor\n m_RightMotor.set(ControlMode.PercentOutput, 0);\n } else {\n BallPresent = false;\n //stop motor if ultrasonic sensor median falls below 6 inches indicating a ball is blocking the sensor\n m_RightMotor.set(ControlMode.PercentOutput, 0.5);\n }\n /*Shuffleboard.getTab(\"Shooter\").add(\"Ball Present\", BallPresent)\n .withWidget(BuiltInWidgets.kBooleanBox)\n .withPosition(0, 0)\n .withSize(1, 1)\n .withProperties(Map.of(\"colorWhenTrue\",\"green\",\"colorWhenFalse\",\"black\"));*/\n SmartDashboard.putNumber(\"High\", high);\n SmartDashboard.putNumber(\"Low\", low); \n /*Shuffleboard.getTab(\"Shooter\").add(\"Ultrasonic 1\", currentDistance)\n .withWidget(BuiltInWidgets.kGraph)\n .withPosition(0, 2)\n .withSize(4, 4);*/\n // convert distance error to a motor speed\n //double currentSpeed = (kHoldDistance - currentDistance) * kP;\n\n // drive robot\n //m_robotDrive.arcadeDrive(currentSpeed, 0);\n }", "public static void main(String[] args){\n Robot robot = new DifferentialWheels();\n\n // Get the time step of the current world.\n int timeStep = (int) Math.round(robot.getBasicTimeStep());\n\n // Get references to, and enable, all required devices on the robot.\n Lidar lidar = robot.getLidar(\"lms291\");\n lidar.enable(timeStep);\n lidar.enablePointCloud();\n\n GPS gps = robot.getGPS(\"gps\");\n gps.enable(timeStep);\n\n Emitter emitter = robot.getEmitter(\"emitter\");\n emitter.setChannel(0);\n\n Compass compass = robot.getCompass(\"compass\");\n compass.enable(timeStep);\n\n Motor frontLeft = robot.getMotor(\"front_left_wheel\");\n frontLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor frontRight = robot.getMotor(\"front_right_wheel\");\n frontRight.setPosition(Double.POSITIVE_INFINITY);\n Motor backLeft = robot.getMotor(\"back_left_wheel\");\n backLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor backRight = robot.getMotor(\"back_right_wheel\");\n backRight.setPosition(Double.POSITIVE_INFINITY);\n\n TestTurnPB turnPBController = new TestTurnPB(gps, compass, emitter, frontLeft, frontRight, backLeft, backRight);\n System.out.println(\"current param : \" + turnPBController.toString());\n\n //Initialise Start and Goal Coordinates\n robot.step(timeStep);\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n turnPBController.isRunning = true;\n turnPBController.initMetrics();\n turnPBController.initPositions();\n //potBugController.initAlgorithm();\n turnPBController.runInit();\n\n //Iteration Count\n int itCount = 0;\n\n while (robot.step(timeStep*100) != -1) {\n //Check max iteration\n //while (itCount<DEFAULT_MAX_ITERATION_COUNT){\n //Update Turn Angles\n turnPBController.updateAngles();\n\n //Update Sensor Information\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n\n //Check if goal is reached and terminate as appropriate\n if (turnPBController.isGoalReached()){\n turnPBController.isRunning = false;\n turnPBController.setRobotSpeed(0,0);\n turnPBController.terminatePotBug();\n System.out.println(\"Goal Reached Successfully!\");\n }\n\n if(!turnPBController.isGoalReached() && turnPBController.isRunning){\n //Check for goal direction on forwards semi-circle\n if (!turnPBController.isObstruction()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n //Move 'freely' to the next sample point, towards goal\n turnPBController.updateMetrics();\n\n } else {\n\n if (turnPBController.isClearToLeave()){\n\n if (turnPBController.isProgressAttained() &&\n turnPBController.isClearToLeave()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n turnPBController.updateMetrics();\n\n }\n } else {\n\n if (turnPBController.hitPoint == null){\n\n turnPBController.setHitPoint();\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_CONTOUR);\n turnPBController.updateMetrics();\n\n } else {\n\n // engaged mode\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_ALONG_CONTOUR);\n turnPBController.updateMetrics();\n\n }\n }\n }\n }\n //}\n }\n }", "public void driveStraightBackwards(double speed) {\r\n \tspeed = Math.abs(speed);\r\n \tint angle = getGyroAngle();\r\n \tdrivetrain.drive(-1 * speed, angle * kP);\r\n \tTimer.delay(0.004); //4 millisecond delay to allow for gyro to calibrate\r\n }", "@Override\n public void testPeriodic()\n {\n // test is currently built to debug cargo arm placements\n // press 'A' on the second controller to output the encoder's position\n // and whatever angle it thinks we're at\n // press 'Select' on p2 to re-zero the cargo arm\n \n // cargoArm.armUp();\n \n if(driver2.pressed(driver2.A))\n {\n System.out.println(\"Cargo arm is at encoder value: \" + cargoArm.encCargoArm.position());\n System.out.println(\"Which is \" + (cargoArm.encCargoArm.angle() + cargoArm.ZERO_ANGLE) + \" degrees.\");\n \n System.out.println(\"Hatch finger is at encoder value: \" + hatchArm.fingerEncValue());\n }\n if(driver2.pressed(driver2.Select))\n {\n cargoArm.zeroEncoder();\n System.out.println(\"Cargo arm zeroed.\");\n\n hatchArm.zero();\n System.out.println(\"Hatch finger zeroed.\");\n\n hatchArm.finger_target = 0;\n hatchArm.finger_moving = false;\n hatchArm.dirMoving = 0;\n }\n \n // if(driver2.pressed(driver2.B))\n // {\n // cargoArm.armPositionTarget = testGoalAngle * 56.9;\n // //double forceToApply = cargoArm.getArmCalculation();\n // System.out.println(\"To reach the goal of \" + testGoalAngle + \", the following force would be applied: \" + forceToApply);\n // }\n \n // adjust test goal angle to combine with the above to see, without moving, a cargo arm motor speed to apply\n if(driver2.dpad(driver2.Up))\n {\n testGoalAngle += 5;\n cargoArm.armPositionTarget = testGoalAngle * 56.9;\n System.out.println(\"Test goal angle incremented to \" + testGoalAngle);\n }\n if(driver2.dpad(driver2.Down))\n {\n testGoalAngle -= 5;\n \n cargoArm.armPositionTarget = testGoalAngle * 56.9;\n System.out.println(\"Test goal angle decremented to \" + testGoalAngle);\n }\n \n // // adjust gravitational constant for on-the-go tweak testing\n // // if you don't know what you're doing, do not try to do this!\n // if(driver2.pressed(driver2.R1))\n // {\n // cargoArm.GRAV_CONSTANT += 0.02;\n // System.out.println(\"Gravitational constant incremented to \" + cargoArm.GRAV_CONSTANT);\n // }\n // if(driver2.pressed(driver2.L1))\n // {\n // cargoArm.GRAV_CONSTANT -= 0.02;\n // System.out.println(\"Gravitational constant decremented to \" + cargoArm.GRAV_CONSTANT);\n // }\n // button 7: L2\n // button 8: R2\n // L2 will reverse the finger\n // R2 will rotate it forward\n if(driver2.down(driver2.L1))\n {\n hatchArm.rotateFinger(1);\n }\n else\n {\n if(driver2.down(driver2.L2))\n {\n hatchArm.rotateFinger(-1);\n }\n else\n {\n hatchArm.rotateFinger(0);\n }\n }\n hatchArm.periodic();\n\n if(driver2.pressed(driver2.B))\n {\n hatchArm.toggleFinger();\n }\n\n // test brake power\n if(driver2.pressed(driver2.Start))\n {\n cargoArm.toggleBrake();\n System.out.println(\"Bike brake toggled to: \" + cargoArm.solArmBrake.get());\n }\n\n // press 'x' to toggle whether or not arm should attempt to ONLY counterract the force of gravity\n // use this to check if the grav constant is correct. if it is, the arm should not fall\n if(driver2.pressed(driver2.X))\n {\n cargoArm.toggleArmLock();\n System.out.println(\"Arm lock toggled.\");\n if(cargoArm.armLockEnabled)\n {\n System.out.println(\"Arm should stay constant at given location.\");\n }\n }\n\n // if(driver2.down(driver2.L2) && driver2.pressed(driver2.R2))\n // {\n // movementInTest = !movementInTest;\n // if(movementInTest)\n // {\n // System.out.println(\"Movement in test has been enabled!\");\n // }\n // else\n // {\n // System.out.println(\"Movement in test has been disabled.\");\n // }\n // }\n if(driver2.pressed(driver2.R1))\n {\n System.out.println(\"Moving hatch finger to UP\");\n hatchArm.fingerUp();\n }\n if(driver2.pressed(driver2.R2))\n {\n System.out.println(\"Moving hatch finger to GRAB\");\n hatchArm.fingerGrab();\n }\n\n // if(movementInTest)\n // {\n // cargoArm.rotateArm(cargoArm.getArmCalculation());\n // }\n \n // // this is an attempt to read values from the DriverStation so we can edit constants without redeploying\n // // this may need tweaking b/c the resource that said this was possible was from 2013\n // if(driver2.pressed(driver2.Start))\n // {\n // System.out.println(\"Grabbing constants from Smart Dashboard...\");\n // cargoArm.GRAV_CONSTANT = prefs.getDouble(\"Grav_Constant\", 0.5);\n // // cargoArm.ENCODER_RATIO = prefs.getDouble(\"Cargo_Gear_Ratio\", 1);\n // cargoArm.armPositions[1] = prefs.getDouble(\"Cargo_Full_Down_Pos\", -6000);\n // }\n\n }", "public void gyroTurn ( double speed, double angle) {\n\n // keep looping while we are still active, and not on heading.\n while (!onHeading(speed, angle, P_TURN_COEFF) ) {\n // Update telemetry & Allow time for other processes to run.\n try {\n sleep(50);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n\n }", "@Override\n public void runOpMode() {\n RobotOmniWheels5 myRobot = new RobotOmniWheels5(hardwareMap);\n\n // Put initialization blocks here.\n waitForStart();\n\n //code will continue to run until you hit stop in the app\n while(opModeIsActive()) {\n\n double leftStickYValue = gamepad1.left_stick_y;\n if (leftStickYValue < -.1) {\n //Set the robotspeed to the stick value\n //As Stick Y value is negative when pressed up, use negative in front\n myRobot.setRobotSpeed(-leftStickYValue);\n myRobot.move();\n } else {\n if (leftStickYValue > .1){\n //Set the robotspeed to the stick value\n //As Stick Y value is positive when pressed down, use negative in front to move back\n myRobot.setRobotSpeed(-leftStickYValue);\n myRobot.move();\n }\n else {\n myRobot.stopMoving();\n }\n }\n }\n }", "@Override\n protected void execute() {\n\n int leftMultiplier = -1;\n if (IsLeft) {\n leftMultiplier = 1;\n }\n Robot.m_drivetrain.drive(leftMultiplier * .5, -leftMultiplier * .5);\n\n }", "public void strafeLeftEnc()\r\n\t{\r\n//\t\tdrive.setPos(0, 0, -Config.Auto.encStrafeDistance, -Config.Auto.encStrafeDistance);\r\n//\t\tif(Math.abs(drive.getFrontEncDist() - Config.Auto.encStrafeDistance) < Config.Auto.encTolerance && Math.abs(drive.getBackEncDist() - Config.Auto.encStrafeDistance) < Config.Auto.encTolerance)\r\n//\t\t{\r\n//\t\t\tdrive.setPos(-Config.Auto.encDistanceBetweenTotes, -Config.Auto.encDistanceBetweenTotes, -Config.Auto.encStrafeDistance, -Config.Auto.encStrafeDistance);\r\n//\t\t\t\r\n//\t\t\tif(Math.abs(drive.getLeftEncDist() - Config.Auto.encDistanceBetweenTotes) < Config.Auto.encTolerance && Math.abs(drive.getRightEncDist() - Config.Auto.encDistanceBetweenTotes) < Config.Auto.encTolerance)\r\n//\t\t\t{\r\n//\t\t\t\tdrive.setPos(-Config.Auto.encDistanceBetweenTotes, -Config.Auto.encDistanceBetweenTotes, 0, 0);\r\n//\t\t\t\t\r\n//\t\t\t\tif((Math.abs(drive.getFrontEncDist()) < Config.Auto.encTolerance && Math.abs(drive.getBackEncDist()) < Config.Auto.encTolerance))\r\n//\t\t\t\t\tendRoutine();\t\t\t\t\r\n//\t\t\t}\r\n//\t\t}\r\n\t}", "@Override\n public void loop() { //Starts this loop after you press the START Button\n /**\n * Functional control of up down lift with no limit switches Meet 0 ready\n */\n double liftposition = robot.liftUpDown.getCurrentPosition();\n double liftrotposition = robot.liftRotate.getCurrentPosition();\n telemetry.addData(\"Lift Position\",\"%5.2f\",liftposition);\n telemetry.addData(\"LiftRot Position\", \"%5.2f\", liftrotposition);\n // telemetry.addData(\"Block Stack\", BlockStack);\n telemetry.update();\n\n/**Main drive controls\n * Driver 1\n */\n\n/**\n * Drag servos\n */\n if (gamepad1.a){ //release\n robot.drag1.setPosition(0);\n robot.drag2.setPosition(1);\n } else if (gamepad1.b){//grab\n robot.drag1.setPosition(1);\n robot.drag2.setPosition(0);\n }\n\n/**Mast and Lift controls\n *\n *\n * Driver Two\n *\n *\n*/\n\n/**\n * Need controls to\n * Maybe predetermined locations based on number of pushes of a button.\n */\n\n /**\n * Functional arm rotation with limit switches and encoder limits. Meet 2 ready\n */\n\n //Twists lift up after verifying that rotate up limit switch is not engaged and that step count is less than 5400\n if ( gamepad2.dpad_up && robot.rotateup.getState() == true){\n robot.liftRotate.setPower(1.0);\n }\n else if (gamepad2.dpad_down && robot.rotatedown.getState() == true){ //Twists lift down\n robot.liftRotate.setPower(-1.0);\n }\n //required or lift rotate motor continues to run in last direction (breaks the motor shaft)\n else robot.liftRotate.setPower(0);\n\n /**\n * claw controls a= open b= close\n * FUNCTIONAL Meet 2 ready\n */\n if (gamepad2.a){\n robot.claw1.setPosition(0);\n robot.claw2.setPosition(1);\n } else if (gamepad2.b){\n robot.claw1.setPosition(1);\n robot.claw2.setPosition(0);\n }\n\n /**\n * Lift controls with limit switches and encoder position Meet 2 ready\n * right_trigger = lift\n * left_trigger = down\n */\n\n if ( gamepad2.right_trigger>= 0.2 && robot.liftup.getState()) {\n triggerpress=true;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftUpDown.setPower(.9);\n robot.liftRotate.setPower(.15);\n }\n if (gamepad2.left_trigger>=0.2){\n triggerpress=true;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftUpDown.setPower(-0.9);\n robot.liftRotate.setPower(-0.15);\n }\n if (gamepad2.left_trigger<.2 && gamepad2.right_trigger<.2 && triggerpress ){\n robot.liftUpDown.setPower(0);\n robot.liftRotate.setPower(0);\n triggerpress=false;\n }\n\n int x;\n int y;\n double motorDelayTime;\n //Necessary Debounce to keep bumper from being seen as multiple touches\n/* motorDelayTime=.1;\n if (robot.liftUpDown.getCurrentPosition()<50){\n BlockStack =0;\n }\n //skips servos unless runtime is greater than 20 ms.\n if( runtime.time() > motorDelayTime ) {\n //Need to move 5.5 inches on position 2, subsequent blocks will only need to move up 4 inches.\n x = robot.liftUpDown.getCurrentPosition();\n y= robot.liftRotate.getCurrentPosition();\n if (gamepad2.right_bumper ) {\n\n BlockStack= BlockStack + 1;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.liftUpDown.setTargetPosition(x + robot.floorheight);\n robot.liftUpDown.setPower(.9);\n robot.liftRotate.setTargetPosition(y + robot.floorheightrotate);\n robot.liftRotate.setPower(.1);\n bumperpress=true;\n\n //don't want to drive the cable too far loose checks that we can move a full block down\n } else if (gamepad2.left_bumper && x >= robot.floorheight ) {\n BlockStack= BlockStack - 1;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.liftUpDown.setTargetPosition(x - robot.floorheight);\n robot.liftUpDown.setPower(-.5);\n}\n\n runtime.reset();\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }*/\n\n /**\n * Limit switch tests that reset the encoders Meet 1 ready\n * * liftdown also allows the X button to work\n * * rotatedown also allows the Y button to work\n */\n\n if (robot.rotatedown.getState() == false) {\n robot.liftRotate.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.liftRotate.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "@Override\n protected void initialize() {\n\n /* System clock starts */\n baseTime = System.currentTimeMillis();\n /* Determines time that robot has to timeout after */\n thresholdTime = baseTime + duration;\n\n /* Convert the starting angle */\n if (Robot.drivetrain.getGyroYaw() < 0.0f) {\n /* Negative turn to 180-360 */\n startingAngle = Robot.drivetrain.getGyroYaw() + 360.0f;\n } else {\n /* Positives stay 0-180 */\n startingAngle = Robot.drivetrain.getGyroYaw();\n }\n\n /* The total angle needed to turn */\n totalAngleTurn = startingAngle + inputAngle;\n\n /* Declare the turning direction of special cases when the angle passes over 0 or 360 */\n if (totalAngleTurn < 0.0f) { \n /* If the angle is negative, convert it */\n totalAngleTurn += 360.0f;\n /* Trigger special case */\n specialCase = true;\n /* Trigger counterclockwise */\n clockwise = false;\n }\n if (totalAngleTurn > 360.0f) {\n /* If the angle is above 360, subtract 360 */\n totalAngleTurn -= 360.0f;\n /* Trigger special case */\n specialCase = true;\n /* Trigger clockwise */\n clockwise = true;\n }\n /* Only run if the special cases do not already declare a turning direction */\n if (!specialCase) {\n /* If the input angle is bigger, turn clockwise */\n if (totalAngleTurn > startingAngle) {\n clockwise = true;\n }\n /* If the input angle is smaller, turn counterclockwise */\n if (totalAngleTurn < startingAngle) {\n clockwise = false;\n }\n }\n }", "protected void execute() {\n \n \t\n \t \n \t\n \n System.out.println((Timer.getFPGATimestamp()- starttime ) + \",\" + (RobotMap.motorLeftTwo.getEncPosition()) + \",\"\n + (RobotMap.motorLeftTwo.getEncVelocity()*600)/-4096 + \",\" + RobotMap.motorRightTwo.getEncPosition() + \",\" + (RobotMap.motorRightTwo.getEncVelocity()*600)/4096);\n \n /*if(endpoint > 0){\n cruiseVelocityLeft = (float) (this.initCruiseVelocityLeft+ angleorientation.getResult());\n cruiseVelocityRight = (float) (this.initCruiseVelocityRight - angleorientation.getResult());\n }\n if(endpoint <= 0){\n cruiseVelocityLeft = (float) (this.initCruiseVelocityLeft- angleorientation.getResult());\n cruiseVelocityRight = (float) (this.initCruiseVelocityRight + angleorientation.getResult());\n }*/\n System.out.println(this.motionMagicEndPoint*4096 + RobotMap.motorLeftTwo.getEncPosition() + \"l\");\n System.out.println(this.motionMagicEndPoint*4096 - RobotMap.motorRightTwo.getEncPosition() + \"r\");\n \n \n \t if(RobotMap.motorLeftTwo.getEncVelocity()!= velocityLeft)\n velocityLeft = RobotMap.motorLeftTwo.getEncVelocity(); \n velocityRight = RobotMap.motorRightTwo.getEncVelocity();\n SmartDashboard.putNumber(\"LeftWheelError\", (this.motionMagicEndPoint*4096 + RobotMap.motorLeftTwo.getEncPosition()));\n SmartDashboard.putNumber(\"RightWheelError\",(this.motionMagicEndPoint*4096 - RobotMap.motorRightTwo.getEncPosition()));\n SmartDashboard.putNumber(\"LeftWheelVelocity\", (RobotMap.motorLeftTwo.getEncVelocity())*600/4096);\n SmartDashboard.putNumber(\"RightWheelVelocity\",(RobotMap.motorRightTwo.getEncVelocity()*600)/4096);\n \n \n count++;\n \tangleorientation.updatePID(RobotMap.navx.getAngle());\n }", "void move(int direction)\n {\n int step = 1;\n int covered = 0;\n if ((direction==1 && tankY==0) || (direction==2 && tankY >= 512) || (direction==3 && tankX == 0) || (direction==1 && tankX >=512)){\n System.out.println(\"Illegal move \"+ direction);\n return;\n }\n turn(direction);\n\n while (covered < 64){\n if (direction ==1 ){\n tankY -= step;\n }\n if (direction ==2 ){\n tankY += step;\n }\n if (direction ==4){\n tankX += step;\n }\n if (direction ==3 ){\n tankX -= step;\n }\n covered +=step;\n }\n repaint();\n sleep(speed);\n\n }", "protected void execute() {\n \tRobot.driveTrain.arcadeNoConstants(MOVE_SPEED_PERCENT, Robot.driveTrain.gyroPReturn(direction));\n }", "@Override\n public void runOpMode() {\n float strafeRight;\n float strafeLeft;\n\n frontRight = hardwareMap.dcMotor.get(\"frontRight\");\n backRight = hardwareMap.dcMotor.get(\"backRight\");\n frontLeft = hardwareMap.dcMotor.get(\"frontLeft\");\n backLeft = hardwareMap.dcMotor.get(\"backLeft\");\n flipper = hardwareMap.crservo.get(\"flipper\");\n\n // Put initialization blocks here.\n frontRight.setDirection(DcMotorSimple.Direction.REVERSE);\n backRight.setDirection(DcMotorSimple.Direction.REVERSE);\n waitForStart();\n while (opModeIsActive()) {\n // Power to drive\n frontRight.setPower(gamepad1.right_stick_y * 0.5);\n frontRight.setPower(gamepad1.right_stick_y * 0.75);\n backRight.setPower(gamepad1.right_stick_y * 0.75);\n frontLeft.setPower(gamepad1.left_stick_y * 0.75);\n backLeft.setPower(gamepad1.left_stick_y * 0.75);\n flipper.setPower(gamepad2.left_stick_y);\n // Strafing code\n strafeRight = gamepad1.right_trigger;\n strafeLeft = gamepad1.left_trigger;\n if (strafeRight != 0) {\n frontLeft.setPower(-(strafeRight * 0.8));\n frontRight.setPower(strafeRight * 0.8);\n backLeft.setPower(strafeRight * 0.8);\n backRight.setPower(-(strafeRight * 0.8));\n } else if (strafeLeft != 0) {\n frontLeft.setPower(strafeLeft * 0.8);\n frontRight.setPower(-(strafeLeft * 0.8));\n backLeft.setPower(-(strafeLeft * 0.8));\n backRight.setPower(strafeLeft * 0.8);\n }\n // Creep\n if (gamepad1.dpad_up) {\n frontRight.setPower(-0.4);\n backRight.setPower(-0.4);\n frontLeft.setPower(-0.4);\n backLeft.setPower(-0.4);\n } else if (gamepad1.dpad_down) {\n frontRight.setPower(0.4);\n backRight.setPower(0.4);\n frontLeft.setPower(0.4);\n backLeft.setPower(0.4);\n } else if (gamepad1.dpad_right) {\n frontRight.setPower(-0.4);\n backRight.setPower(-0.4);\n } else if (gamepad1.dpad_left) {\n frontLeft.setPower(-0.4);\n backLeft.setPower(-0.4);\n }\n if (gamepad1.x) {\n frontLeft.setPower(1);\n backLeft.setPower(1);\n frontRight.setPower(1);\n backRight.setPower(1);\n sleep(200);\n frontRight.setPower(1);\n backRight.setPower(1);\n frontLeft.setPower(-1);\n backLeft.setPower(-1);\n sleep(700);\n }\n telemetry.update();\n }\n }", "@Override\n public void testPeriodic() {\n go_speed=-xbox_controller.getRawAxis(1);\n turn_speed=xbox_controller.getRawAxis(4);\n right_motor_2.set(-go_speed+turn_speed);\n left_motor_1.set(go_speed+turn_speed);\n\n while(xbox_controller.getRawButton(2)){\n double x = tx.getDouble(0.0);\n double a = ta.getDouble(0.0);\n if(a >= 1 && a <= 1.7){\n servo.set(0.26);\n if (x > -6 && x < 6){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 6 ){\n right_motor_2.set(0.15);\n left_motor_1.set(0.15);\n }\n else if ( x <= -6 ){\n right_motor_2.set(-0.15);\n left_motor_1.set(-0.15);\n }\n }\n else if(a>=0.8 && a<1){\n servo.set(0.35);\n if (x > -2.3 && x < 2.3){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 2.3 ){\n right_motor_2.set(0.11);\n left_motor_1.set(0.11);\n }\n else if ( x <= -2.3 ){\n right_motor_2.set(-0.11);\n left_motor_1.set(-0.11);\n }\n }\n else if(a>=0.5 && a<0.8){\n servo.set(0.5);\n if (x > -1.7 && x < 1.7){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1.7 ){\n right_motor_2.set(0.08);\n left_motor_1.set(0.08);\n }\n else if ( x <= -1.7 ){\n right_motor_2.set(-0.08);\n left_motor_1.set(-0.08);\n }\n }\n else if(a>=0.3 && a<0.5){\n servo.set(0.32);\n if (x > -1.2 && x < 1.2){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1.2 ){\n right_motor_2.set(0.05);\n left_motor_1.set(0.05);\n }\n else if ( x <= -1.2 ){\n right_motor_2.set(-0.05);\n left_motor_1.set(-0.05);\n }\n }\n else{}\n }\n\n if(xbox_controller.getRawAxis(2)!=0){\n ball_collection_motor.set(1);\n }\n else{\n ball_collection_motor.set(0);\n }\n\n while(joystick.getRawButton(5)){\n double a=ta.getDouble(0.0);\n if(a>=1&&a<=1.7){\n servo.set(0.26);\n }\n else if(a>=0.8 && a<1){\n servo.set(0.35);\n }\n else if(a>=0.5 && a<0.8){\n servo.set(0.5);\n }\n else if(a>=0.3 && a<0.5){\n servo.set(0.32);\n }\n else{}\n }\n\n while (joystick.getRawButton(6)) {\n double x = tx.getDouble(0.0);\n if ( x>-1 && x<1 ){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1 ){\n right_motor_2.set(0.05);\n left_motor_1.set(0.05);\n }\n else if ( x <= -1 ){\n right_motor_2.set(-0.05);\n left_motor_1.set(-0.05);\n }\n else{}\n }\n\n if(xbox_controller.getRawButton(3)){\n System.out.println(currentServoAngle);\n servo.set(currentServoAngle + factor);\n currentServoAngle += factor;\n pushed = true;\n if(currentServoAngle >= 1 || (currentServoAngle <= 0 && pushed == true)){\n factor *= -1;\n } \n }\n \n \n //ball_collection_motor.set(xbox_controller.getRawAxis(2));//xbox rt\n if(xbox_controller.getRawAxis(3)!=0){\n while(xbox_controller.getRawAxis(3)){\n left_low_eject.set(ControlMode.PercentOutput, 1);\n right_low_eject.set(ControlMode.PercentOutput,-1);\n TimeUnit.SECONDS.sleep(0.5);\n left_belt.set(ControlMode.PercentOutput,-0.5);\n right_belt.set(ControlMode.PercentOutput,0.5);\n }\n }\n else{\n left_low_eject.set(ControlMode.PercentOutput,0);\n right_low_eject.set(ControlMode.PercentOutput,0);\n left_belt.set(ControlMode.PercentOutput,0);\n right_belt.set(ControlMode.PercentOutput,0);\n }\n if(xbox_controller.getRawButton(1)){\n double_solenoid_1.set(DoubleSolenoid.Value.kForward);\n }\n else if(xbox_controller.getRawButton(4)){\n double_solenoid_1.set(DoubleSolenoid.Value.kReverse);\n }\n if(xbox_controller.getRawButton(5)){\n right_motor_2.set(-0.1);\n left_motor_1.set(-0.1);\n }\n else if(xbox_controller.getRawButton(6)){\n right_motor_2.set(0.1);\n left_motor_1.set(0.1);\n }\n if(xbox_controller.getRawButton(8)){\n /*\n for(double speed=0;speed<=0.85;speed+=0.000002){\n left_high_eject.set(speed+0.2*(joystick.getRawAxis(3)-control_speed_init));\n } \n */\n if(high_eject_run==false){\n high_eject_run=true;\n eject_speed=0;\n }\n\n }\n\n if(xbox_controller.getRawButton(7)){\n left_high_eject.set(0);\n high_eject_run=false;\n eject_speed=0;\n }\n if(high_eject_run){\n if(eject_speed<=0.85){\n //System.out.println(123);\n eject_speed+=0.001;\n //System.out.println(eject_speed);\n left_high_eject.set(-eject_speed);\n }\n }\n\n \n }", "@Override\n public void runOpMode() {\n leftDrive = hardwareMap.get(DcMotor.class, \"left_drive\");\n rightDrive = hardwareMap.get(DcMotor.class, \"right_drive\");\n intake = hardwareMap.get (DcMotor.class, \"intake\");\n dropServo = hardwareMap.get(Servo.class, \"drop_Servo\");\n leftDrive.setDirection(DcMotor.Direction.REVERSE);\n rightDrive.setDirection(DcMotor.Direction.FORWARD);\n\n dropServo.setPosition(1.0);\n waitForStart();\n dropServo.setPosition(0.6);\n sleep(500);\n VuforiaOrientator();\n encoderSequence(\"dumbDrive\");\n\n\n }", "@Override\n\tprotected void execute() {\n\t\tdouble speed = Robot.oi.getSpeed();\n\t\tdouble turn = Robot.oi.getTurn();\n\t\tdouble leftSpeed;\n\t\tdouble rightSpeed;\n\n\t\tif (Robot.oi.getGyroReset()) {\n\t\t\tRobot.chassisSubsystem.resetGyroHeading();\n\t\t}\n\n\t\tif (Robot.oi.getGyroCalibrate()) {\n\t\t\tRobot.chassisSubsystem.calibrateGyro();\n\t\t}\n\n\t\t/**\n\t\t * If the chassisSubsystem says that we should be in high gear, switch\n\t\t * to high gear, otherwise, switch to low gear.\n\t\t */\n\t\tif (Robot.oi.getGearShiftButton() >= 0.5) {\n\t\t\tRobot.chassisSubsystem.setGear(Gear.HIGH);\n\t\t} else {\n\t\t\tRobot.chassisSubsystem.setGear(Gear.LOW);\n\t\t}\n\n\t\t\n\n\t\t/**\n\t\t * If the user is not turning, then follow the gyro using the GoStraight\n\t\t * command.\n\t\t */\n\t\t/*\n\t\t * if (Math.abs(turn) < 0.03) { Scheduler.getInstance().add(new\n\t\t * GoStraightCommand(Robot.chassisSubsystem.getCurrentAngle())); return;\n\t\t * }\n\t\t */\n\n\t\t/*\n\t\t * double defaultValue = 0; Robot.chassisSubsystem.resetGyroHeading();\n\t\t * double angle = Robot.oi.table.getNumber(\"angle\", defaultValue);\n\t\t * System.out.println(angle);\n\t\t * \n\t\t * if(Robot.oi.getAlignShotButton()) { Scheduler.getInstance().add(new\n\t\t * PivotToAngleCommand(angle)); return; }\n\t\t */\n\n\n\t\tdouble targetCenterX = 0;\n\t\tif (Robot.oi.getAutoAlignShotButton() && targetCenterX != RobotMap.NO_VISION_TARGET) {\n\t\t\tScheduler.getInstance().add(new AlignAndShootHighShotCommand(MatchPeriod.TELEOP));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (Robot.oi.getManualAlignShotButton()) {\n\t\t\tScheduler.getInstance().add(new AlignAndShootHighShotCommand(MatchPeriod.TELEOP));\n\t\t\treturn;\n\t\t}\n\n\t\t// Use the driver input to set the speed and direction.\n\t\tif (Math.abs(speed) < 0.03) {\n\t\t\tleftSpeed = turn / 2.0;\n\t\t\trightSpeed = -turn / 2.0;\n\t\t} else {\n\t\t\tleftSpeed = (turn < 0.0) ? speed * (1.0 + turn) : speed;\n\t\t\trightSpeed = (turn < 0.0) ? speed : speed * (1.0 - turn);\n\t\t}\n\n\t\tRobot.chassisSubsystem.setSpeed(leftSpeed, rightSpeed);\n\t}", "@Override\n public void runOpMode() {\n\n robot.init(hardwareMap);\n robot.MotorRightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.MotorLeftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.MotorRightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.MotorLeftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n /** Wait for the game to begin */\n while (!isStarted()) {\n telemetry.addData(\"angle\", \"0\");\n telemetry.update();\n }\n\n\n }", "void driveTracker()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tlong time = System.currentTimeMillis();\r\n\t\t\tint last_direction = 0;\r\n\t\t\twhile(System.currentTimeMillis()-time < 20000 && status.equals(\"wait\"))\r\n\t\t\t{\r\n\t\t\t\tint direction = -1;\r\n\t\t\t\tint flow_min = Main.MAX_INT;\r\n\t\t\t\tif((loc.i-1)>=0 && BFS.adj_const[(loc.i-1)*80+loc.j][loc.i*80+loc.j]==1 && Flow.flows[loc.i-1][loc.j][1] < flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tdirection = 0;//up\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i-1][loc.j][1];\r\n\t\t\t\t}\r\n\t\t\t\tif((loc.i+1)<80 && BFS.adj_const[(loc.i+1)*80+loc.j][loc.i*80+loc.j]==1 && Flow.flows[loc.i][loc.j][1] < flow_min)\r\n\t\t\t\t{\t\r\n\t\t\t\t\tdirection = 1;//down\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i][loc.j][1];\r\n\t\t\t\t}\r\n\t\t\t\tif((loc.j-1)>=0 && BFS.adj_const[loc.i*80+loc.j][loc.i*80+loc.j-1]==1 && Flow.flows[loc.i][loc.j-1][0] < flow_min)\r\n\t\t\t\t{\t\r\n\t\t\t\t\tdirection = 2;//left\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i][loc.j-1][0];\r\n\t\t\t\t}\r\n\t\t\t\tif((loc.j+1)<80 && BFS.adj_const[loc.i*80+loc.j][loc.i*80+loc.j+1]==1 && Flow.flows[loc.i][loc.j][0] < flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tdirection = 3;//right\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i][loc.j][0];\r\n\t\t\t\t}\r\n\t\t\t\tLight light = Traffic.findLight(loc.i,loc.j);\r\n\t\t\t\tif(light!=null)\r\n\t\t\t\t{\r\n\t\t\t\t\twhile(!leaveLight(light,last_direction,direction))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmeet_light = true;\r\n\t\t\t\t\t\tThread.sleep(100);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmeet_light = false;\r\n\t\t\t\t}\r\n\t\t\t\tswitch(direction)\r\n\t\t\t\t{\r\n\t\t\t\tcase 0 ://up\r\n\t\t\t\t\tif(BFS.adj_matrix[(loc.i-1)*80+loc.j][loc.i*80+loc.j] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i-1][loc.j][1]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.i -= 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 1 ://down\r\n\t\t\t\t\tif(BFS.adj_matrix[(loc.i+1)*80+loc.j][loc.i*80+loc.j] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i][loc.j][1]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.i += 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2 ://left\r\n\t\t\t\t\tif(BFS.adj_matrix[loc.i*80+loc.j][loc.i*80+loc.j-1] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i][loc.j-1][0]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.j -= 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3 ://right\r\n\t\t\t\t\tif(BFS.adj_matrix[loc.i*80+loc.j][loc.i*80+loc.j+1] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i][loc.j][0]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.j += 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tThread.sleep(100);\r\n\t\t\t\tlast_direction = direction;\r\n\t\t\t}\r\n\t\t\tif(status.equals(\"wait\"))\r\n\t\t\t{\r\n\t\t\t\tstatus = \"stop\";\r\n\t\t\t\tThread.sleep(1000);//stop\r\n\t\t\t\tstatus = \"wait\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttransStatus();\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Sorry to catch Exception!\");\r\n\t\t}\r\n\t}", "protected void execute() {\n \n \n \torientation.updatePID(RobotMap.navx.getAngle());\n \tRobotMap.motorLeftOne.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() - speed));\n \tRobotMap.motorLeftTwo.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() - speed));\n \t\n \tRobotMap.motorRightOne.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() + speed));\n \tRobotMap.motorRightTwo.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() + speed));\n \tSystem.out.println(RobotMap.navx.getAngle()-desiredAngle);\n }", "@Override\n public void execute() {\n\n angleCorrection = pidAngle.run(drivetrain.getGyroAngle(), targetAngle);\n \n speedCorrection = pidSpeed.run(distanceTraveled, targetDistance);\n \n if (speedCorrection > 1.0) {\n speedCorrection = 1.0;\n } else if (speedCorrection < -1.0) {\n speedCorrection = -1.0;\n }\n drivetrain.autoDrive(speedCorrection * direction * kAutoDriveSpeed + angleCorrection, speedCorrection * direction*kAutoDriveSpeed - angleCorrection);\n SmartDashboard.putNumber(\"Angle Correction\", angleCorrection);\n SmartDashboard.putNumber(\"Speed Correction\", speedCorrection);\n\n double totalRotationsRight = Math.abs((drivetrain.getMasterRightEncoderPosition() - rightEncoderStart));\n double totalRotationsLeft = Math.abs((drivetrain.getMasterLeftEncoderPosition() - leftEncoderStart));\n\n distanceTraveled = (kWheelDiameter * Math.PI * (totalRotationsLeft + totalRotationsRight) / 2.0) / AUTO_ENCODER_REVOLUTION_FACTOR;\n }", "@SuppressWarnings(\"unused\")\n\tpublic void execute(){\n\t\tdouble mtrFrontRight;\n\t\tdouble mtrFrontLeft;\n\t\tdouble mtrBackRight;\n\t\tdouble mtrBackLeft;\n\t\t\n\t\tdouble speed = 3.0; //The variable we are assigning\n\t\tdouble yawHeading = 0; //Obtained from Robot class\n\t\t\n\t\tdouble getCurrentSetPoint = 0.0; //This Will be obtained via a variable set in the turn to heading class as it is obtained. (possible issues)\n\t\tdouble actualEncoderSetpoint; //Represents the value the encoder is actually at.\n\t\t\n\t\tdouble zeroHeading; //This is a weird one. it is there because of the odd difference calculations issue of say being 5 off of zero and heading being 355;\n\t\t\n\t\t\n\t\t//Switch structure stuff\n\t\tint forward = 0;\n\t\tint left = 1;\n\t\tint right = 2;\n\t\tint state = forward;\n\t\t\n\t\t\n\t\tif(getCurrentSetPoint == 0) {\n\t\t\tstate = forward;\n\t\t} else if(getCurrentSetPoint == 90) {\n\t\t\tstate = right;\n\t\t} else if(getCurrentSetPoint == 270) {\n\t\t\tstate = left;\n\t\t}\n\t\t\n\t\t//where the weirdness of zero heading comes into play.\n\t\tif(yawHeading > 180){\n\t\t\tzeroHeading = 360 - yawHeading;\n\t\t\tzeroHeading = -(zeroHeading);\n\t\t} else {\n\t\t\tzeroHeading = yawHeading;\n\t\t}\n\t\t\n\t\t//Here comes the fun math.\n\t\t// oh yeah and brackets are fun just saying.\n\t\t//try not to get cancer.\n\t\t\n\t\tswitch (state) {\n\t\t\t\n\t\t\tcase 0 :\n\t\t\t\tif(zeroHeading < -5) {\n\t\t\t\t\tmtrFrontRight = -(speed - ((-zeroHeading * Math.pow(10, -1)) * .3) );\n\t\t\t\t\tmtrBackRight = -(speed - ((-zeroHeading * Math.pow(10, -1)) * .3) );\n\t\t\t\t} else {\n\t\t\t\t\tmtrFrontRight = -speed;\n\t\t\t\t\tmtrBackRight = -speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(zeroHeading > 5) {\n\t\t\t\t\tmtrFrontLeft = speed - ((zeroHeading * Math.pow(10, -1)) * .3);\n\t\t\t\t\tmtrBackLeft = speed - ((zeroHeading * Math.pow(10, -1)) * .3);\n\t\t\t\t} else {\n\t\t\t\t\tmtrFrontLeft = speed;\n\t\t\t\t\tmtrBackLeft = speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\tcase 1 :\n\t\t\t\tif(zeroHeading > 5) {\n\t\t\t\t\t\tmtrBackRight = -(speed - ((zeroHeading * Math.pow(10, -1)) * .3) );\n\t\t\t\t\t\tmtrBackLeft = speed - ((zeroHeading * Math.pow(10, -1)) * .3);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmtrBackRight = -speed;\n\t\t\t\t\t\tmtrBackLeft = speed;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(zeroHeading < -5) {\n\t\t\t\t\t\tmtrFrontRight = -(speed - ((-zeroHeading * Math.pow(10, -1)) * .3) );\n\t\t\t\t\t\tmtrFrontLeft = speed - ((-zeroHeading * Math.pow(10, -1)) * .3);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmtrFrontRight = -speed;\n\t\t\t\t\t\tmtrFrontLeft = speed;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\tcase 2 : \n\t\t\t\tif(zeroHeading < -5) {\n\t\t\t\t\tmtrBackRight = -(speed - ((-zeroHeading * Math.pow(10, -1)) * .3) );\n\t\t\t\t\tmtrBackLeft = speed - ((-zeroHeading * Math.pow(10, -1)) * .3);\n\t\t\t\t} else {\n\t\t\t\t\tmtrBackRight = -speed;\n\t\t\t\t\tmtrBackLeft = speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(zeroHeading > 5) {\n\t\t\t\t\tmtrFrontRight = -(speed - ((zeroHeading * Math.pow(10, -1)) * .3) );\n\t\t\t\t\tmtrFrontLeft = speed - ((zeroHeading * Math.pow(10, -1)) * .3);\n\t\t\t\t} else {\n\t\t\t\t\tmtrFrontRight = -speed;\n\t\t\t\t\tmtrFrontLeft = speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\n\t\t}\n\t}", "@Override\n protected void execute() {\n headingPID.setSetpoint(-angle); //should be -angle \n Robot.driveBase.DriveAutonomous();\n }" ]
[ "0.67922366", "0.66007733", "0.6457799", "0.64248097", "0.6267561", "0.6137096", "0.6129774", "0.61091185", "0.61031055", "0.60752934", "0.6031281", "0.5970532", "0.59629905", "0.5954052", "0.59333545", "0.5927801", "0.591496", "0.5904601", "0.590049", "0.5874309", "0.58362204", "0.580029", "0.5797765", "0.57823735", "0.5781468", "0.57794154", "0.5778871", "0.57709825", "0.5757792", "0.57556826", "0.5741679", "0.5741513", "0.5732999", "0.57301927", "0.5725611", "0.5725281", "0.5724369", "0.5719947", "0.571836", "0.5711695", "0.57088876", "0.57058644", "0.5693684", "0.56856203", "0.5678814", "0.5669571", "0.56688136", "0.56646955", "0.56625617", "0.5662226", "0.56568754", "0.56420404", "0.56412923", "0.56399477", "0.5637857", "0.56340146", "0.5633038", "0.56260264", "0.5624794", "0.5620161", "0.5619709", "0.5616495", "0.56121224", "0.5607316", "0.5600641", "0.55981874", "0.5596056", "0.5591351", "0.55874056", "0.558174", "0.5578415", "0.5562541", "0.556194", "0.5553412", "0.55495113", "0.55448717", "0.55322653", "0.55244195", "0.55224925", "0.5518118", "0.5517682", "0.549982", "0.5489256", "0.5488504", "0.54866266", "0.5465186", "0.54642004", "0.5459187", "0.5457083", "0.54564047", "0.5450757", "0.54500777", "0.5442678", "0.5429427", "0.5423298", "0.54186755", "0.5414744", "0.54125607", "0.5410647", "0.54095006" ]
0.6018897
11
Method to spin on central axis to point in a new direction. Move will stop if either of these conditions occur: 1) Move gets to the heading (angle) 2) Driver stops the opmode running.
public void gyroTurn ( double speed, double angle, double timeoutS) { eTime.reset(); // keep looping while we are still active, and not on heading. while (opModeIsActive() && (eTime.seconds() < timeoutS) && !onHeading(speed, angle, P_TURN_COEFF)) { // Update telemetry & Allow time for other processes to run. telemetry.update(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void move() {\n\t\tthis.position.stepForwad();\n\t\tthis.position.spin();\n\t}", "private void Turn(double degrees) {\n\n // Update the target angle\n TargetAngle = NormalizeAngle(TargetAngle + degrees);\n\n // Loops until the robot has reached the target\n while (opModeIsActive()) {\n\n // Calculate how many degrees the robot still has to turn\n double DegreesRemaining = NormalizeAngle(TargetAngle - GetRobotAngle());\n\n // Calculate the turn speed\n double TurnSpeed;\n if (DegreesRemaining < 180)\n TurnSpeed = -MinTurnSpeed + -((MaxTurnSpeed - MinTurnSpeed) * Math.min(DegreesRemaining / AccelAngle, 1));\n else\n TurnSpeed = MinTurnSpeed + ((MaxTurnSpeed - MinTurnSpeed) * Math.min((360 - DegreesRemaining) / AccelAngle, 1));\n\n // Apply the new motor speeds\n backleft.setPower(TurnSpeed);\n backright.setPower(TurnSpeed);\n frontleft.setPower(TurnSpeed);\n frontright.setPower(TurnSpeed);\n\n if(Math.abs(DegreesRemaining) < 1)\n break;\n }\n\n // Stop the motors\n frontright.setPower(0);\n frontleft.setPower(0);\n backright.setPower(0);\n backleft.setPower(0);\n }", "public void gyroDrive ( double speed,\n double distance,\n double angle) {\n\n\n // Ensure that the opmode is still activ\n\n // Determine new target position, and pass to motor controller\n moveCounts = (int)(distance * COUNTS_PER_INCH);\n newLeftTarget = leftmotor.getCurrentPosition() + moveCounts;\n newRightTarget = rightmotor.getCurrentPosition() + moveCounts;\n\n // Set Target and Turn On RUN_TO_POSITION\n leftmotor.setTargetPosition(newLeftTarget);\n rightmotor.setTargetPosition(newRightTarget);\n\n leftmotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n rightmotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // start motion.\n speed = Range.clip(Math.abs(speed), 0.0, 1.0);\n\n maxSpeed = speed;\n speed = INCREMENT;\n rampUp = true;\n\n leftmotor.setPower(speed);\n rightmotor.setPower(speed);\n\n // keep looping while we are still active, and BOTH motors are running.\n while ((leftmotor.isBusy() && rightmotor.isBusy())) {\n if (rampUp){\n speed += INCREMENT ;\n if (speed >= maxSpeed ) {\n speed = maxSpeed;\n }\n }\n\n // adjust relative speed based on heading error.\n error = getError(angle);\n steer = getSteer(error, P_DRIVE_COEFF);\n\n // if driving in reverse, the motor correction also needs to be reversed\n if (distance < 0)\n steer *= -1.0;\n\n leftSpeed = speed - steer;\n rightSpeed = speed + steer;\n\n // Normalize speeds if either one exceeds +/- 1.0;\n max = Math.max(Math.abs(leftSpeed), Math.abs(rightSpeed));\n if (max > 1.0)\n {\n leftSpeed /= max;\n rightSpeed /= max;\n }\n\n leftmotor.setPower(leftSpeed);\n rightmotor.setPower(rightSpeed);\n }\n\n // Stop all motion;\n leftmotor.setPower(0);\n rightmotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n leftmotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightmotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n gyroHold(TURN_SPEED,angle,0.166);\n\n }", "@Override\n protected void execute() {\n headingPID.setSetpoint(-angle); //should be -angle \n Robot.driveBase.DriveAutonomous();\n }", "private void moveOrTurn() {\n\t\t// TEMP: look at center of canvas if out of bounds\n\t\tif (!isInCanvas()) {\n\t\t\tlookAt(sens.getXMax() / 2, sens.getYMax() / 2);\n\t\t}\n\n\t\t// if we're not looking at our desired direction, turn towards. Else, move forward\n\t\tif (needToTurn()) {\n\t\t\tturnToDesiredDirection();\n\t\t} else {\n\t\t\tmoveForward(2.0);\n\t\t}\n\n\t\t// move in a random direction every 50 roaming ticks\n\t\tif (tickCount % 100 == 0) {\n\t\t\tgoRandomDirection();\n\t\t}\n\t\ttickCount++;\n\t}", "@Override\n public void move(){\n setDirectionSpeed(180, 7);\n this.moveTowardsAPoint(target.getCenterX(), target.getCenterY());\n }", "public void gyroDrive ( double speed,\n double distance,\n double angle) {\n\n int newLeftTarget;\n int newRightTarget;\n int moveCounts;\n double max;\n double error;\n double steer;\n double leftSpeed;\n double rightSpeed;\n\n // Ensure that the opmode is still active\n if (opModeIsActive()) {\n\n // Determine new target position, and pass to motor controller\n moveCounts = (int)(distance * COUNTS_PER_INCH);\n newLeftTarget = leftMotor.getCurrentPosition() + moveCounts;\n newRightTarget = rightMotor.getCurrentPosition() + moveCounts;\n\n // Set Target and Turn On RUN_TO_POSITION\n leftMotor.setTargetPosition(newLeftTarget);\n rightMotor.setTargetPosition(newRightTarget);\n\n leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // start motion.\n speed = Range.clip(Math.abs(speed), 0.0, 1.0);\n leftMotor.setPower(speed);\n rightMotor.setPower(speed);\n\n // keep looping while we are still active, and BOTH motors are running.\n while (opModeIsActive() &&\n (leftMotor.isBusy() && rightMotor.isBusy())) {\n\n // adjust relative speed based on heading error.\n error = getError(angle);\n steer = getSteer(error, P_DRIVE_COEFF);\n\n // if driving in reverse, the motor correction also needs to be reversed\n if (distance < 0)\n steer *= -1.0;\n\n leftSpeed = speed - steer;\n rightSpeed = speed + steer;\n\n // Normalize speeds if any one exceeds +/- 1.0;\n max = Math.max(Math.abs(leftSpeed), Math.abs(rightSpeed));\n if (max > 1.0)\n {\n leftSpeed /= max;\n rightSpeed /= max;\n }\n\n leftMotor.setPower(leftSpeed);\n rightMotor.setPower(rightSpeed);\n\n // Display drive status for the driver.\n telemetry.addData(\"Err/St\", \"%5.1f/%5.1f\", error, steer);\n telemetry.addData(\"Target\", \"%7d:%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Actual\", \"%7d:%7d\", leftMotor.getCurrentPosition(),\n rightMotor.getCurrentPosition());\n telemetry.addData(\"Speed\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n telemetry.update();\n }\n\n // Stop all motion;\n\n rightMotor.setPower(0);\n leftMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "@Override\n protected void execute() {\n /*\n * Keep the angle read from the gyro constantly converted as long as currentAngle is \n * referenced compared to always reading raw values from the getGyroYaw.\n */\n if (Robot.drivetrain.getGyroYaw() < 0.0f) {\n currentAngle = Robot.drivetrain.getGyroYaw() + 360.0f;\n } else {\n currentAngle = Robot.drivetrain.getGyroYaw();\n\n }\n if (!clockwise) {\n /* Counterclockwise turning */\n Robot.drivetrain.arcadeDrive(speedY, -speedZ);\n } else if (clockwise) {\n /* Clockwise turning */\n Robot.drivetrain.arcadeDrive(speedY, speedZ);\n }\n }", "public void moveForward()\r\n\t{\r\n\t\tif(loc[1] > 1)\r\n\t\t{\r\n\t\t\tthis.loc[0] -= Math.sin(Math.toRadians(heading-90))*distance; \r\n\t\t\tthis.loc[2] -= Math.cos(Math.toRadians(heading-90))*distance;\r\n\t\t}\r\n\t}", "@Override\n\tpublic void action() {\n\t\tsuppressed = false;\n\t\t//if (Settings.motorAAngle == -90) Settings.motorAAngle = -95;\n\n\t\tMotor.A.rotateTo(Settings.motorAAngle, true);\n\n\t\twhile (Motor.A.isMoving() && !Motor.A.isStalled() && !suppressed);\t\t\t\n\t\t\n\t\tMotor.A.stop();\n\t}", "@Override\n public void step(double deltaTime) {\n // wheel radius, in meters\n double wheelCircumference = 2 * simulatorConfig.driveBase.wheelRadius * Math.PI;\n\n double leftRadians = 0;\n double rightRadians = 0;\n for (SimMotor simMotor : motorStore.getSimMotorsSorted()) {\n if (simMotor.isLeftDriveMotor()) {\n leftRadians = simMotor.position / simulatorConfig.driveBase.gearRatio;\n } else if (simMotor.isRightDriveMotor()) {\n rightRadians = simMotor.position / simulatorConfig.driveBase.gearRatio;\n }\n }\n\n // invert the left side because forward motor movements mean backwards wheel movements\n rightRadians = -rightRadians;\n\n double currentLinearRadians = (leftRadians + rightRadians) / 2;\n\n double deltaRadians = currentLinearRadians - lastLinearRadians;\n double metersPerRadian = wheelCircumference / (Math.PI * 2);\n double deltaLinearPosition = deltaRadians * metersPerRadian;\n double newHeading = ((leftRadians - rightRadians) * metersPerRadian / simulatorConfig.driveBase.radius);\n\n // for next loop\n lastLinearRadians = currentLinearRadians;\n\n robotPosition.heading = newHeading + startHeading;\n\n robotPosition.velocity = deltaLinearPosition / deltaTime;\n robotPosition.x += deltaLinearPosition * Math.sin(robotPosition.heading);\n robotPosition.y += deltaLinearPosition * Math.cos(robotPosition.heading);\n\n SimNavX simNavX = SimSPI.getNavX(SPI.Port.kMXP.value);\n if (simNavX != null) {\n float degrees = (float)((robotPosition.heading - simulatorConfig.startPosition.heading) * 360 / (Math.PI * 2));\n\n // degrees are between 0 and 360\n if (degrees < 0) {\n degrees = 360 - (Math.abs(degrees) % 360);\n } else {\n degrees = degrees % 360;\n }\n simNavX.heading = degrees;\n }\n\n }", "public void RotateRight(double speed, int distance) {\n // Reset Encoders\n robot2.DriveRightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveRightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n sleep(500);\n\n robot2.DriveRightFront.setTargetPosition(0);\n robot2.DriveRightRear.setTargetPosition(0);\n robot2.DriveLeftFront.setTargetPosition(0);\n robot2.DriveLeftRear.setTargetPosition(0);\n\n // Set RUN_TO_POSITION\n\n robot2.DriveRightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot2.DriveLeftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot2.DriveRightRear.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot2.DriveLeftRear.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // Set Motor Power to 0\n robot2.DriveRightFront.setPower(0);\n robot2.DriveRightRear.setPower(0);\n robot2.DriveLeftFront.setPower(0);\n robot2.DriveLeftRear.setPower(0);\n\n\n double InchesMoving = (distance * COUNTS_PER_INCH);\n\n // Set Target to RotateRight\n robot2.DriveRightFront.setTargetPosition((int) -InchesMoving);\n robot2.DriveRightRear.setTargetPosition((int) -InchesMoving);\n robot2.DriveLeftRear.setTargetPosition((int) InchesMoving);\n robot2.DriveLeftFront.setTargetPosition((int) InchesMoving);\n\n while (robot2.DriveRightFront.isBusy() && robot2.DriveRightRear.isBusy() && robot2.DriveLeftRear.isBusy() && robot2.DriveLeftFront.isBusy()) {\n\n // wait for robot to move to RUN_TO_POSITION setting\n\n double MoveSpeed = speed;\n\n // Set Motor Power\n robot2.DriveRightFront.setPower(MoveSpeed);\n robot2.DriveRightRear.setPower(MoveSpeed);\n robot2.DriveLeftFront.setPower(MoveSpeed);\n robot2.DriveLeftRear.setPower(MoveSpeed);\n\n } // THis brace close out the while Loop\n\n //Reset Encoders\n robot2.DriveRightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveRightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot2.DriveLeftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n\n\n robot2.DriveRightFront.setPower(0);\n robot2.DriveRightRear.setPower(0);\n robot2.DriveLeftFront.setPower(0);\n robot2.DriveLeftRear.setPower(0);\n }", "protected void rotateTo(double target) {\n robot.rightFront.setDirection(REVERSE);\n robot.rightBack.setDirection(REVERSE);\n\n while (opModeIsActive() && robot.rightFront.getDirection() != REVERSE) {\n idle();\n }\n\n if (target < 0) target += 360;\n\n double heading = get360Heading();\n while (opModeIsActive() && !withinRange(heading, target)) {\n // Run Dubberke-Richards logic\n if (Math.abs(heading - target) <= 180) {\n if (heading-target >= 0) {\n rotateRight();\n } else {\n rotateLeft();\n }\n } else { // |heading-target| > 180\n if (heading-target<0) {\n rotateRight();\n } else {\n rotateLeft();\n }\n }\n\n // Update heading for next loop\n heading = get360Heading();\n\n telemetry.addData(\"Heading\", heading);\n telemetry.update();\n }\n\n halt();\n }", "@Override\n public void move(){\n if (flatbed.getCurrentAngle() == flatbed.getMinAngle()){\n super.move();\n }\n }", "@Override\n\tpublic void run() {\n\t\t// what angle you're at right now\n\t\tmCurrentAngle = mNavigation.getHeadingInDegrees(); \t\t\n\t\tdouble turn;\n\t\t\n\t\tif (!onTarget()) { //if just angle is not on target\n\t\t\tturn = super.calculate(mCurrentAngle - mGoalAngle);\n\t\t\tmDrive.setSpeedTurn(mSpeed, turn);\n\t\t} else // else just drive straight\n\t\t\tmDrive.setSpeedTurn(mSpeed, 0.0);\t\n\t}", "private void turnAround() {\r\n this.setCurrentDirection(-getCurrentDirection());\r\n }", "public void gyroDrive ( double speed,\n double distance,\n double angle) {\n\n int newLeftTarget;\n int newRightTarget;\n int moveCounts;\n double max;\n double error;\n double steer;\n double leftSpeed;\n double rightSpeed;\n\n // Ensure that the opmode is still active\n if (opModeIsActive()) {\n\n // Determine new target position, and pass to motor controller\n moveCounts = (int)(distance * COUNTS_PER_INCH);\n newLeftTarget = robot.leftDrive.getCurrentPosition() + moveCounts;\n newRightTarget = robot.rightDrive.getCurrentPosition() + moveCounts;\n\n // Set Target and Turn On RUN_TO_POSITION\n robot.leftDrive.setTargetPosition(newLeftTarget);\n robot.rightDrive.setTargetPosition(newRightTarget);\n\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // start motion.\n speed = Range.clip(Math.abs(speed), 0.0, 1.0);\n robot.leftDrive.setPower(speed);\n robot.rightDrive.setPower(speed);\n\n // keep looping while we are still active, and BOTH motors are running.\n while (opModeIsActive() &&\n (robot.leftDrive.isBusy() && robot.rightDrive.isBusy())) {\n\n // adjust relative speed based on heading error.\n error = getError(angle);\n steer = getSteer(error, P_DRIVE_COEFF);\n\n // if driving in reverse, the motor correction also needs to be reversed\n if (distance < 0)\n steer *= -1.0;\n\n leftSpeed = speed - steer;\n rightSpeed = speed + steer;\n\n // Normalize speeds if either one exceeds +/- 1.0;\n max = Math.max(Math.abs(leftSpeed), Math.abs(rightSpeed));\n if (max > 1.0)\n {\n leftSpeed /= max;\n rightSpeed /= max;\n }\n\n robot.leftDrive.setPower(leftSpeed);\n robot.rightDrive.setPower(rightSpeed);\n\n // Display drive status for the driver.\n telemetry.addData(\"Err/St\", \"%5.1f/%5.1f\", error, steer);\n telemetry.addData(\"Target\", \"%7d:%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Actual\", \"%7d:%7d\", robot.leftDrive.getCurrentPosition(),\n robot.rightDrive.getCurrentPosition());\n telemetry.addData(\"Speed\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n telemetry.update();\n }\n\n // Stop all motion;\n robot.leftDrive.setPower(0);\n robot.rightDrive.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n }", "public void execute() {\n RobotContainer.drive.turnToAngle(this.angle, turnSpeed);\n }", "private void spin() {\n\t\t\tArrayList<Integer> sequence = getDna().getSequence();\n\t\t\tint randomDirection = sequence.get(new Random().nextInt(sequence.size()));\n\t\t\tsetDirection((this.direction + randomDirection) % 8);\t\n\t\t}", "public void setDirectionMove(double direction);", "@Override\n public void initialize() {\n setPoint = (((targetAngle + driveSubsystem.getHeading() + 180) % 360) - 180);\n }", "public void spinMotor(double percentOutput){\n armMotor.set(ControlMode.PercentOutput, percentOutput);\n }", "public void operatorControl() {\n \tmyRobot.setSafetyEnabled(true);\n while (isOperatorControl() && isEnabled()) {\n \tdouble x = stick2.getRawAxis(0);\n \tdouble y = stick2.getRawAxis(1);\n \tdouble rot = stick.getRawAxis(0);\n \tSmartDashboard.putNumber(\"x1\", x);\n SmartDashboard.putNumber(\"y1\", y);\n SmartDashboard.putNumber(\"rot1\", rot);\n \tif(Math.abs(x) < .2)\n \t\tx = 0;\n \tif(Math.abs(y) < .2)\n \t\ty = 0;\n \tif(Math.abs(rot) < .2)\n \t\trot = 0;\n \tmyRobot.mecanumDrive_Cartesian(x*-1, y*-1,rot*-1, gyro.getAngle());\n double current1 = pdp.getCurrent(0);\n double current2 = pdp.getCurrent(13);\n double current3 = pdp.getCurrent(15);\n double current4 = pdp.getCurrent(12);\n SmartDashboard.putNumber(\"Front Left current\", current1);\n SmartDashboard.putNumber(\"back Left current\", current2);\n SmartDashboard.putNumber(\"Front right current\", current3);\n SmartDashboard.putNumber(\"back right current\", current4);\n SmartDashboard.putNumber(\"x\", x);\n SmartDashboard.putNumber(\"y\", y);\n SmartDashboard.putNumber(\"rot\", rot);\n SmartDashboard.putNumber(\"Gyro\", gyro.getAngle());\n \tTimer.delay(0.005);\t\t// wait for a motor update time\n }\n }", "public static void moveStraightFor(double distance) {\n //Set motor speeds and rotate them by the given distance.\n // This method will not return until the robot has finished moving.\n leftMotor.setSpeed(FORWARD_SPEED);\n rightMotor.setSpeed(FORWARD_SPEED);\n leftMotor.rotate(convertDistance(distance), true);\n rightMotor.rotate(convertDistance(distance), false);\n \n }", "public static void move(double distance) {\n LEFT_MOTOR.rotate(convertDistance(WHEEL_RAD, distance), true);\n RIGHT_MOTOR.rotate(convertDistance(WHEEL_RAD, distance), false);\n }", "public void paradiseMove(){\n if (!getCurrentMainCellCoordinates().equals(new DiscreteCoordinates(11, 9))) {\n move(30);\n }\n }", "public abstract boolean moveOn(\n double currentX, double currentY, double currentAngle,\n double velX, double velY, double velAngle);", "public void drive(double xSpeed, double ySpeed, double rot, boolean fieldRelative, boolean rateLimit) {\n \n double xSpeedCommanded;\n double ySpeedCommanded;\n\n if (rateLimit) {\n // Convert XY to polar for rate limiting\n double inputTranslationDir = Math.atan2(ySpeed, xSpeed);\n double inputTranslationMag = Math.sqrt(Math.pow(xSpeed, 2) + Math.pow(ySpeed, 2));\n\n // Calculate the direction slew rate based on an estimate of the lateral acceleration\n double directionSlewRate;\n if (m_currentTranslationMag != 0.0) {\n directionSlewRate = Math.abs(DriveConstants.kDirectionSlewRate / m_currentTranslationMag);\n } else {\n directionSlewRate = 500.0; //some high number that means the slew rate is effectively instantaneous\n }\n \n\n double currentTime = WPIUtilJNI.now() * 1e-6;\n double elapsedTime = currentTime - m_prevTime;\n double angleDif = SwerveUtils.AngleDifference(inputTranslationDir, m_currentTranslationDir);\n if (angleDif < 0.45*Math.PI) {\n m_currentTranslationDir = SwerveUtils.StepTowardsCircular(m_currentTranslationDir, inputTranslationDir, directionSlewRate * elapsedTime);\n m_currentTranslationMag = m_magLimiter.calculate(inputTranslationMag);\n }\n else if (angleDif > 0.85*Math.PI) {\n if (m_currentTranslationMag > 1e-4) { //some small number to avoid floating-point errors with equality checking\n // keep currentTranslationDir unchanged\n m_currentTranslationMag = m_magLimiter.calculate(0.0);\n }\n else {\n m_currentTranslationDir = SwerveUtils.WrapAngle(m_currentTranslationDir + Math.PI);\n m_currentTranslationMag = m_magLimiter.calculate(inputTranslationMag);\n }\n }\n else {\n m_currentTranslationDir = SwerveUtils.StepTowardsCircular(m_currentTranslationDir, inputTranslationDir, directionSlewRate * elapsedTime);\n m_currentTranslationMag = m_magLimiter.calculate(0.0);\n }\n m_prevTime = currentTime;\n \n xSpeedCommanded = m_currentTranslationMag * Math.cos(m_currentTranslationDir);\n ySpeedCommanded = m_currentTranslationMag * Math.sin(m_currentTranslationDir);\n m_currentRotation = m_rotLimiter.calculate(rot);\n\n\n } else {\n xSpeedCommanded = xSpeed;\n ySpeedCommanded = ySpeed;\n m_currentRotation = rot;\n }\n\n // Convert the commanded speeds into the correct units for the drivetrain\n double xSpeedDelivered = xSpeedCommanded * DriveConstants.kMaxSpeedMetersPerSecond;\n double ySpeedDelivered = ySpeedCommanded * DriveConstants.kMaxSpeedMetersPerSecond;\n double rotDelivered = m_currentRotation * DriveConstants.kMaxAngularSpeed;\n\n var swerveModuleStates = DriveConstants.kDriveKinematics.toSwerveModuleStates(\n fieldRelative\n ? ChassisSpeeds.fromFieldRelativeSpeeds(xSpeedDelivered, ySpeedDelivered, rotDelivered, Rotation2d.fromDegrees(m_gyro.getAngle()))\n : new ChassisSpeeds(xSpeedDelivered, ySpeedDelivered, rotDelivered));\n SwerveDriveKinematics.desaturateWheelSpeeds(\n swerveModuleStates, DriveConstants.kMaxSpeedMetersPerSecond);\n m_frontLeft.setDesiredState(swerveModuleStates[0]);\n m_frontRight.setDesiredState(swerveModuleStates[1]);\n m_rearLeft.setDesiredState(swerveModuleStates[2]);\n m_rearRight.setDesiredState(swerveModuleStates[3]);\n }", "@Override\n\tfinal public void rotate(double angle, Axis axis)\n\t{\n\t\t//center.setDirection(angle);\n\t}", "public void moveOneStep() {\n //We will create a line that checks the movement of the ball.\n Line trajectory = new Line(this.center.getX(), this.center.getY(),\n this.center.getX() + this.velocity.getDx(), this.center.getY() + this.velocity.getDy());\n //We will get information for the closest barrier.\n CollisionInfo info = this.gameEnvironment.getClosestCollision(trajectory);\n //If there is information about an obstacle on the way, we will almost change our direction before reaching\n // the barrier.\n if (info != null) {\n this.center = new Velocity(-0.2 * this.velocity.getDx(),\n -0.2 * this.velocity.getDy()).applyToPoint(this.center);\n this.velocity = info.collisionObject().hit(this, info.collisionPoint(), this.velocity);\n //Otherwise, we will allow it to reach its destination\n } else {\n this.center = this.velocity.applyToPoint(this.center);\n }\n }", "public void move()\n {\n double angle = Math.toRadians( getRotation() );\n int x = (int) Math.round(getX() + Math.cos(angle) * WALKING_SPEED);\n int y = (int) Math.round(getY() + Math.sin(angle) * WALKING_SPEED);\n setLocation(x, y);\n }", "void turnTo(double theta){\n\t\tdouble currT = odometer.getTheta();\n\t\tdouble deltaT = theta-currT;\n\t\t//makes sure smallest angle\n\t\tif(deltaT>180){\n\t\t\tdeltaT=deltaT-360;\n\t\t}\n\t\telse if(deltaT <-180){\n\t\t\tdeltaT= deltaT+360;\n\t\t}\n\t\t// set motors here \n\t\tleftMotor.setSpeed(LocalizationLab.ROTATE_SPEED);\n\t\trightMotor.setSpeed(LocalizationLab.ROTATE_SPEED);\n\t\tleftMotor.rotate(convertAngle(LocalizationLab.WHEEL_RADIUS, LocalizationLab.TRACK, deltaT), true);\n\t\trightMotor.rotate(-convertAngle(LocalizationLab.WHEEL_RADIUS, LocalizationLab.TRACK, deltaT), false);\n\n\t}", "@Override\n protected void initialize() {\n\n /* System clock starts */\n baseTime = System.currentTimeMillis();\n /* Determines time that robot has to timeout after */\n thresholdTime = baseTime + duration;\n\n /* Convert the starting angle */\n if (Robot.drivetrain.getGyroYaw() < 0.0f) {\n /* Negative turn to 180-360 */\n startingAngle = Robot.drivetrain.getGyroYaw() + 360.0f;\n } else {\n /* Positives stay 0-180 */\n startingAngle = Robot.drivetrain.getGyroYaw();\n }\n\n /* The total angle needed to turn */\n totalAngleTurn = startingAngle + inputAngle;\n\n /* Declare the turning direction of special cases when the angle passes over 0 or 360 */\n if (totalAngleTurn < 0.0f) { \n /* If the angle is negative, convert it */\n totalAngleTurn += 360.0f;\n /* Trigger special case */\n specialCase = true;\n /* Trigger counterclockwise */\n clockwise = false;\n }\n if (totalAngleTurn > 360.0f) {\n /* If the angle is above 360, subtract 360 */\n totalAngleTurn -= 360.0f;\n /* Trigger special case */\n specialCase = true;\n /* Trigger clockwise */\n clockwise = true;\n }\n /* Only run if the special cases do not already declare a turning direction */\n if (!specialCase) {\n /* If the input angle is bigger, turn clockwise */\n if (totalAngleTurn > startingAngle) {\n clockwise = true;\n }\n /* If the input angle is smaller, turn counterclockwise */\n if (totalAngleTurn < startingAngle) {\n clockwise = false;\n }\n }\n }", "private void turnClockwise() {\n\t\torientation = TurnAlgorithmExecutor.getAlgorithmFromCondition(orientation).execute(orientation);\n\t}", "protected void execute() {\n \tif (m_moving)\n \t{\n \t\tdouble direction;\n \tif (Math.abs(Gyro.getYaw() - m_desiredYaw) < m_tolerance)\n \t{\n \t\tdirection = 0;\n \t\tm_moving = false;\n \t\tm_cameraThread = new CameraThread();\n \t\tm_cameraThread.start();\n \t\tRobot.getDriveBase().teleopDrive(0.0, 0.0);\n \t}\n \telse\n \t{\n\t \tif (Gyro.getYaw() < m_desiredYaw)\n\t \t{\n\t \t\tdirection = 1;\n\t \t}\n\t \telse\n\t \t{\n\t \t\tdirection = -1;\n\t \t}\n\t \t\n\t \tif (((Gyro.getYaw() - m_lastYaw) * direction) - (m_degreesPerSecond / 50) > m_intervalTolerance)\n\t \t{\n\t \t\tm_speed -= 0.05;\n\t \t}\n\t \telse if (((Gyro.getYaw() - m_lastYaw) * direction) - (m_degreesPerSecond / 50) < (m_intervalTolerance * -1))\n\t \t{\n\t \t\tm_speed += 0.05;\n\t \t}\n\t \t\n\t \tif (Math.abs((Gyro.getYaw() - m_lastYaw) + Gyro.getYaw() / Math.abs(m_desiredYaw)) >= m_percentDegreesToSlow)\n\t \t{\n\t \t\tm_speed -= 0.007;\n\t \t}\n\t \t\n\t \tif (m_speed < 0)\n\t \t{\n\t \t\tm_speed = 0.0;\n\t \t}\n\t \telse if (m_speed > 1)\n\t \t{\n\t \t\tm_speed = 1.0;\n\t \t}\n\t \t\n\t \tRobot.getDriveBase().teleopDrive(0.0, m_speed * direction);\n\t \tm_lastYaw = Gyro.getYaw();\n \t}\n \t}\n \telse\n \t{\n\t \tif (m_cameraThread.isAlive() == false)\n\t \t{\n\t \t\tif (m_cameraThread.weHaveAShot())\n\t \t\t{\n\t \t\t\tif (Gyro.getYaw() >= CameraThread.desiredLeftYaw() && Gyro.getYaw() <= CameraThread.desiredRightYaw())\n\t \t\t\t{\n\t \t\t\t\tm_onTarget = true;\n\t \t\t\t}\n\t \t\t\telse\n\t \t\t\t{\n\t \t\t\t\tm_desiredYaw = CameraThread.desiredCenterYaw();\n\t\t \t\t\tm_moving = true;\n\t \t\t\t}\n\t \t\t}\n\t \t\telse\n\t \t\t{\n\t \t\t\tdouble pixels = m_cameraThread.shotAngleError();\n\t \t\t\t//m_desiredYaw = CameraThread.yawWhenPicture() - pixels * 54 / 640;\n\t \t\t\tm_desiredYaw = CameraThread.yawWhenPicture() - pixels * 0.075; //try with 61 / 640\n\t \t\t\tif (Math.abs(Gyro.getYaw() - m_desiredYaw) < m_tolerance)\n\t \t\t\t{\n\t \t\t\t\tm_onTarget = true;\n\t \t\t\t}\n\t \t\t\telse\n\t \t\t\t{\n\t \t\t\t\tm_moving = true;\n\t \t\t\t}\n\t \t\t}\n\t \t}\n \t}\n \tSmartDashboard.putNumber(\"Desired Yaw\", m_desiredYaw);\n \t\n \tSystem.out.println(\"speed: \" + m_speed);\n \tSystem.out.println(\"desired yaw: \" + m_desiredYaw);\n \tSystem.out.println(\"is moving: \" + m_moving);\n }", "@Override\n public TimeMeasure onContinueTask() throws InterruptedException\n {\n // If we aren't going to be driving anywhere, don't try to align.\n if (targetVector.magnitude < .00001 && !enablePassiveAlignmentCorrection)\n {\n turnMotor.setPosition(0.5);\n currentTurnSpeed = 0;\n\n // Could be passively turning\n currentAbsoluteEncoderReading = swerveEncoder.position();\n double currentAngle = Vector2D.clampAngle(currentAbsoluteEncoderReading - physicalEncoderOffset);\n displacementVector = displacementVector.add(Vector2D.polar(driveMotor.currentDistanceMoved() - lastDriveMotorPosition, currentAngle));\n lastDriveMotorPosition = driveMotor.currentDistanceMoved();\n\n if (errorResponder instanceof PIDController)\n ((PIDController) errorResponder).pauseController();\n\n if (driveMotor != null)\n driveMotor.setVelocity(0);\n\n if (wheelConsole != null)\n // Add console information.\n wheelConsole.write(\n \"Num skips: \" + numAbsoluteEncoderSkips,\n \"Angle to turn: \" + angleLeftToTurn,\n errorResponder instanceof PIDController ? ((PIDController) errorResponder).summary() : \"Using constant method\",\n \"Displacement Vector: \" + displacementVector.toString(Vector2D.VectorCoordinates.POLAR));\n }\n else\n {\n // Whether or not we should check whether the current module position is different from the last one.\n if (ABSOLUTE_ENCODER_UPDATE_CHECK)\n {\n // currentAbsoluteEncoderReading currently represents old swivel orientation.\n double newSwivelOrientation = swerveEncoder.position();\n\n // If we're turning but the absolute encoder hasn't registered the turn position change (latency).\n if (Math.abs(currentTurnSpeed) > .15 && Math.abs(newSwivelOrientation - currentAbsoluteEncoderReading) < .5)\n {\n // Record that this happened\n numAbsoluteEncoderSkips++;\n\n if (DAMP_TURN_SPEED_IF_SO)\n {\n // Slightly damp the power of the turning\n currentTurnSpeed *= .95;\n turnMotor.setPosition(0.5 + currentTurnSpeed);\n }\n\n // Try to immediately update.\n return TimeMeasure.IMMEDIATE;\n }\n\n currentAbsoluteEncoderReading = newSwivelOrientation;\n }\n else\n // Update position.\n currentAbsoluteEncoderReading = swerveEncoder.position();\n\n // Shortest angle from current heading to desired heading.\n double desiredAngle = targetVector.angle;\n double currentAngle = Vector2D.clampAngle(currentAbsoluteEncoderReading - physicalEncoderOffset);\n\n // Apply this movement to the cumulative displacement vector.\n displacementVector = displacementVector.add(Vector2D.polar(driveMotor.currentDistanceMoved() - lastDriveMotorPosition, currentAngle));\n lastDriveMotorPosition = driveMotor.currentDistanceMoved();\n\n // Calculate how to turn\n double angleFromDesired = (Vector2D.clampAngle(desiredAngle - currentAngle) + 180) % 360 - 180;\n angleFromDesired = angleFromDesired < -180 ? angleFromDesired + 360 : angleFromDesired;\n\n // Clip this angle to 90 degree maximum turns.\n if (angleFromDesired > 90)\n angleLeftToTurn = -angleFromDesired + 180;\n else if (angleFromDesired < -90)\n angleLeftToTurn = -angleFromDesired - 180;\n else\n angleLeftToTurn = angleFromDesired;\n\n // Set turn power.\n double turnPower = 0.5;\n\n // Use PID to calculate the correction factor (error bars contained within PID). angle left ^ 1.2\n currentTurnSpeed = errorResponder.value(angleLeftToTurn);\n\n // Change the turn factor depending on our distance from the angle desired (180 vs 0)\n if (angleFromDesired > 90 || angleFromDesired < -90)\n turnPower -= currentTurnSpeed;\n else\n turnPower += currentTurnSpeed;\n\n // For turn motor correction\n double drivePower = 0;\n\n // Set drive power (if angle between this and desired angle is greater than 90, reverse motor).\n if (drivingEnabled)\n {\n // Scale up/down motor power depending on how far we are from the ideal heading.\n drivePower = targetVector.magnitude;\n if (Math.abs(angleFromDesired) > 90) // Angle to turn != angle desired\n drivePower *= -1;\n\n if (targetVector.magnitude < .00001)\n {\n driveMotor.setVelocity(0);\n driveMotor.motor.setPower(0);\n }\n else\n {\n if (enableDrivePID)\n driveMotor.setVelocity(Range.clip(drivePower, -1, 1));\n else\n driveMotor.motor.setPower(Range.clip(drivePower / 95.0, -1, 1));\n }\n }\n\n // Try to counteract the torque applied by the driving motor.\n turnMotor.setPosition(Range.clip(turnPower + (driveMotorTorqueCorrectionEnabled ? driveMotorTorqueCorrection * drivePower : 0), 0, 1));\n\n if (wheelConsole != null)\n // Add console information.\n wheelConsole.write(\n \"Vector target: \" + targetVector.toString(Vector2D.VectorCoordinates.POLAR),\n \"Angle to turn: \" + angleLeftToTurn,\n \"Num skips: \" + numAbsoluteEncoderSkips,\n errorResponder instanceof PIDController ? ((PIDController) errorResponder).summary() : \"Using custom function adjustment method\",\n \"Displacement Vector: \" + displacementVector.toString(Vector2D.VectorCoordinates.POLAR));\n }\n\n // The ms to wait before updating again.\n return errorResponder.getUpdateRate();\n }", "private void getNextPosition() {\n \n if (turnLeft) {\n angleSpeed += angleMoveSpeed;\n if (angleSpeed > maxAngleSpeed) {\n angleSpeed = maxAngleSpeed;\n }\n angle += angleSpeed;\n \n if (angle > 360) {\n angle = angle - 360 + angleSpeed;\n }\n \n if (forward)\n {\n speed += moveSpeed;\n if (speed > maxSpeed)\n {\n speed = maxSpeed;\n }\n } else if (backwards)\n {\n speed -= moveSpeed;\n if (speed < -maxSpeed)\n {\n speed = -maxSpeed;\n }\n }\n }\n //moving in negative x direction\n if (turnRight) {\n angleSpeed -= angleMoveSpeed;\n if (angleSpeed < -maxAngleSpeed) {\n angleSpeed = -maxAngleSpeed;\n }\n angle += angleSpeed;\n \n if (angle < -360) {\n angle = angle + 360 - angleSpeed;\n }\n \n if (backwards)\n {\n speed -= moveSpeed;\n if (speed < -maxSpeed)\n {\n speed = -maxSpeed;\n }\n } else if (forward)\n {\n speed += moveSpeed;\n if (speed > maxSpeed)\n {\n speed = maxSpeed;\n }\n }\n }\n \n //moving in positive y direction\n if (backwards) {\n speed += moveSpeed;\n if (speed > maxSpeed) {\n speed = maxSpeed;\n }\n }\n //moving in negative y direction\n if (forward) {\n speed -= moveSpeed;\n if (speed < -maxSpeed) {\n speed = -maxSpeed;\n }\n }\n \n //not moving forward or backwards direction\n if (isNotMoving()) {\n //stop moving in the x direction\n if (speed > 0) {\n speed -= stopSpeed;\n if (speed < 0) {\n speed = 0;\n }\n }\n else if (speed < 0) {\n speed += stopSpeed;\n if (speed > 0) {\n speed = 0;\n }\n }\n \n if (isNotTurning()) {\n //stop moving in the y direction\n if (angleSpeed > 0) {\n angleSpeed -= stopSpeed;\n if (angleSpeed < 0) {\n angleSpeed = 0;\n }\n }\n else if (angleSpeed < 0) {\n angleSpeed += stopSpeed;\n if (angleSpeed > 0) {\n angleSpeed = 0;\n }\n }\n } \n }\n }", "public void move() {\n\t\tSystem.out.println(\"Robot Can Move\");\n\t}", "public float MoveForward(){\n motorLeft1Power = normalSpeed;\n motorLeft2Power = normalSpeed;\n motorRight1Power = normalSpeed;\n motorRight2Power = normalSpeed;\n\n startOrientation = imu.getAngularOrientation().toAxesReference(AxesReference.INTRINSIC).toAxesOrder(AxesOrder.ZYX).firstAngle;\n motorPID = new PIDController(startOrientation);\n return startOrientation;\n }", "public AutoRotateCommand(double angle){\r\n\t\tAHRS ahrs = new AHRS(Port.kMXP);\r\n\t\trequires(Robot.driveSys);\r\n\t\tdouble gangle = ahrs.getAngle();\t\r\n\t\tif(gangle < angle)\r\n\t\t\tspeed = -DEFAULT_SPEED;\r\n\t\telse\r\n\t\t\tspeed = DEFAULT_SPEED;\r\n\t}", "public void driveTo(double targetX, double targetY, float heading, double speedLimit) throws InterruptedException {\n float error = heading - zRotation; //The number of degrees between the true heading and desired heading\n double correction; //Modifies power to account for error\n double max;\n double Y_P_COEFF = 0.17825353626292278; //0.002\n double Y_I_COEFF = 0.2852056580206765; //0.0035\n double Y_D_COEFF = 0.0003; //0.00042\n double X_P_COEFF = 0.17825353626292278; //0.002\n double X_I_COEFF = 0.2852056580206765; //0.0035\n double X_D_COEFF = 0.0003; //0.00042\n double T_P_COEFF = 0.0084;\n double T_I_COEFF = 0.0168;\n double T_D_COEFF = 0.0028;\n double driveY, driveX;\n double distanceY;\n double distanceX;\n long loops = 0;\n heading = (int) normalize360(heading);\n\n double frontLeft;\n double frontRight;\n double backLeft;\n double backRight;\n\n setEncoderBase();\n int lastEncoderY = 0;\n int lastEncoderX = 0;\n float lastHeading = zRotation;\n\n speedLimit = Range.clip(speedLimit, 0.0, 1.0);\n\n if (speedLimit==0){\n return;\n }\n\n double power;\n double deltaT;\n double derivativeY = 0;\n double derivativeX = 0;\n double derivativeT = 0;\n double integralY = 0;\n double integralX = 0;\n double integralT = 0;\n int deltaDY;\n int deltaDX;\n float deltaDT;\n\n double theta;\n double theta2;\n double gamma;\n double h;\n double local_globalX;\n double local_globalY;\n\n double lastTime = callingOpMode.getRuntime();\n\n while ((((((Math.abs(targetY)-1) > Math.abs(globalY)) || ((Math.abs(targetY)+1) < Math.abs(globalY))) ||\n (((Math.abs(targetX)-1) > Math.abs(globalX)) || ((Math.abs(targetX)+1) < Math.abs(globalX)))) ||\n (Math.abs(error)>=5.0f)) && ((LinearOpMode) callingOpMode).opModeIsActive()) {\n\n error = heading - zRotation;\n\n while (error > 180) error = (error - 360);\n while (error <= -180) error = (error + 360);\n\n local_globalX = globalX;\n local_globalY = globalY;\n\n theta = zRotation * Math.PI / 180.0;\n\n // these represent the current x and y translations still to do, in global coordinates ... in inches\n driveY = targetY - local_globalY;\n driveX = targetX - local_globalX;\n\n theta2 = Math.atan2(driveY, driveX);\n gamma = theta+theta2;\n h = Math.sqrt((driveX*driveX)+(driveY*driveY));\n\n // in robot coordinates,\n distanceY = Math.sin(gamma)*h;\n distanceX = Math.cos(gamma)*h;\n\n deltaT = callingOpMode.getRuntime()-lastTime;\n lastTime = callingOpMode.getRuntime();\n deltaDY = getEncoderWheelYPosition()-lastEncoderY;\n lastEncoderY = getEncoderWheelYPosition();\n deltaDX = getEncoderWheelXPosition()-lastEncoderX;\n lastEncoderX = getEncoderWheelXPosition();\n deltaDT = zRotation-lastHeading;\n lastHeading = zRotation;\n\n derivativeY = ((double) deltaDY)/deltaT;\n derivativeX = ((double) deltaDX)/deltaT;\n derivativeT = ((double) deltaDT/deltaT);\n\n if(Math.abs(distanceY*Y_P_COEFF)<1 && Math.abs(distanceY)>1){\n integralY += distanceY*deltaT;\n } else {\n integralY = 0;\n }\n if(Math.abs(distanceX*X_P_COEFF)<1 && Math.abs(distanceX)>1){\n integralX += distanceX*deltaT;\n } else {\n integralX = 0;\n }\n if(Math.abs(error*T_P_COEFF)<1 && Math.abs(error)>5){\n integralT += error*deltaT;\n } else {\n integralT = 0;\n }\n\n power = (distanceY*Y_P_COEFF) + (integralY*Y_I_COEFF) - (derivativeY*Y_D_COEFF);\n\n frontLeft = power;\n frontRight = power;\n backLeft = power;\n backRight = power;\n\n power = (distanceX*X_P_COEFF) + (integralX*X_I_COEFF) - (derivativeX*X_D_COEFF);\n\n frontLeft += power;\n frontRight -= power;\n backLeft -= power;\n backRight += power;\n\n max = Math.max(Math.max(Math.abs(frontLeft), Math.abs(frontRight)), Math.max(Math.abs(backLeft), Math.abs(backRight)));\n if (max > Math.abs(speedLimit)) {\n frontLeft /= max;\n frontRight /= max;\n backLeft /= max;\n backRight /= max;\n frontLeft *= Math.abs(speedLimit);\n frontRight *= Math.abs(speedLimit);\n backLeft *= Math.abs(speedLimit);\n backRight *= Math.abs(speedLimit);\n }\n\n correction = (error*T_P_COEFF) + (integralT*T_I_COEFF) - (derivativeT*T_D_COEFF);\n\n frontLeft -= correction;\n frontRight += correction;\n backLeft -= correction;\n backRight += correction;\n\n max = Math.max(Math.max(Math.abs(frontLeft), Math.abs(frontRight)), Math.max(Math.abs(backLeft), Math.abs(backRight)));\n if (max > 1.0) {\n frontLeft /= max;\n frontRight /= max;\n backLeft /= max;\n backRight /= max;\n }\n\n updateDriveMotors(frontLeft, frontRight, backLeft, backRight);\n\n if (((loops+10) % 10) == 0) {\n callingOpMode.telemetry.addData(\"zRotation\" , zRotation);\n callingOpMode.telemetry.addData(\"globalY\" , local_globalY);\n callingOpMode.telemetry.addData(\"globalX\" , local_globalX);\n callingOpMode.telemetry.addData(\"distanceY\", distanceY);\n callingOpMode.telemetry.addData(\"distanceX\", distanceX);\n callingOpMode.telemetry.addData(\"theta\", theta);\n callingOpMode.telemetry.addData(\"theta2\",theta2);\n callingOpMode.telemetry.addData(\"gamma\",gamma);\n callingOpMode.telemetry.addData(\"driveY\",driveY);\n callingOpMode.telemetry.addData(\"driveX\",driveX);\n callingOpMode.telemetry.addData(\"error\", error);\n callingOpMode.telemetry.addData(\"loops\", loops);\n callingOpMode.telemetry.update();\n }\n\n loops++;\n\n updateGlobalPosition();\n\n ((LinearOpMode) callingOpMode).sleep(10);\n }\n }", "private void turnToDesiredDirection() {\n\n\t\tdouble dir = sens.getDirection();\n\n\t\tif (dir < desiredDirection) {\n\t\t\tif (Math.abs(dir - desiredDirection) < 180) {\n\t\t\t\tdir += TURNSPEED;\n\t\t\t} else {\n\t\t\t\tdir -= TURNSPEED;\n\t\t\t}\n\t\t} else {\n\t\t\tif (Math.abs(dir - desiredDirection) < 180) {\n\t\t\t\tdir -= TURNSPEED;\n\t\t\t} else {\n\t\t\t\tdir += TURNSPEED;\n\t\t\t}\n\t\t}\n\t\t\n\t\tsens.setDirection(dir);\n\t\t\n\t}", "public void move() {\n\t\t// tolerance of angle at which the Base starts moving\n\t\tint tolerance = 10;\n\t\tif(Math.abs(angle) < Math.abs(angleDesired)+tolerance && Math.abs(angleDesired)-tolerance < Math.abs(angle)) {\n\t\t\tdouble vX = Math.cos(Math.toRadians(this.angle + 90)) * v;\n\t\t\tdouble vY = Math.sin(Math.toRadians(this.angle + 90)) * v;\n\t\t\t\n\t\t\tthis.x += vX;\n\t\t\tthis.y += vY;\t\n\t\t\tthis.rectHitbox = new Rectangle((int)(x-rectHitbox.width/2),(int)(y-rectHitbox.height/2),rectHitbox.width,rectHitbox.height);\n\t\t}\n\t\t// curTargetPathBoardRectangle\n\t\tRectangle curTPBR = pathBoardRectangles.get(curTargetPathCellIndex).rect;\n\t\tRectangle rectSmallerBR = new Rectangle((int)curTPBR.getCenterX()-5,(int)curTPBR.getCenterY()-5,10,10);\n\t\t// updates the index when it crosses a pathCell so it counts down from pathCell to pathCell,\n\t\t// always having the next pathCell in the array as the target until the end is reached then it stops\n\t\tif(rectSmallerBR.contains(new Point((int)x,(int)y))) {\n\t\t\tif(curTargetPathCellIndex < pathBoardRectangles.size()-1) {\n\t\t\t\tcurTargetPathCellIndex++;\n\t\t\t\tparentGP.boardRect = pathBoardRectangles.get(curTargetPathCellIndex-1);\n\t\t\t\ttAutoDirectionCorrection.restart();\n\t\t\t}else {\n\t\t\t\tparentGP.isMoving = false;\n\t\t\t\tparentGP.boardRect = pathBoardRectangles.get(curTargetPathCellIndex);\n\t\t\t\tpathBoardRectangles.clear();\n\t\t\t\ttAutoDirectionCorrection.stop();\n\t\t\t\tStagePanel.tryCaptureGoldMine(parentGP);\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic void move() {\n\t\theading = Heading.randHeading();\n\t\tif (heading == Heading.NORTH) {\n\t\t\tthis.location.y -= Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t} else if (heading == Heading.EAST) {\n\t\t\tthis.location.x += Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t} else if (heading == Heading.SOUTH) {\n\t\t\tthis.location.y += Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t} else if (heading == Heading.WEST) {\n\t\t\tthis.location.x -= Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t}\n\t\tadjustPos();\n\t\tinfect();\n\t}", "public void turn() {\n rightMotor.resetTachoCount();\n rightMotor.setSpeed(DEFAULT_TURN_SPEED);\n leftMotor.setSpeed(DEFAULT_TURN_SPEED);\n rightMotor.forward();\n leftMotor.backward();\n\n }", "public void spinLeft(double speed) {\r\n \tspeed = Math.abs(speed);\r\n \tleftTopMotor.set(-1 * speed);\r\n \tleftBottomMotor.set(-1 * speed);\r\n \trightTopMotor.set(-1 * speed);\r\n \trightBottomMotor.set(-1 * speed);\r\n }", "int spinTheWheel();", "protected void execute() {\n \tif(degrees > 0)\n \t{\n \t\tRobot.driveBase.set(ControlMode.PercentOutput, -speed, speed);\n \t}\n \telse if(degrees < 0)\n \t{\n \t\tRobot.driveBase.set(ControlMode.PercentOutput, speed, -speed);\n \t}\n \t\n }", "public void basicMotion() {\r\n\t\tPVector v = behavior.behavior(obj.getMotion());\r\n\t\tobj.getMotion().setVelocity(v);\r\n\t\t\r\n\t\tobj.getMotion().kinematicUpdate();\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tfloat x = obj.getMotion().getPosition().x;\r\n\t\tfloat y = obj.getMotion().getPosition().y;\r\n\t\tif(y <= turnCornerMin ) {\r\n\t\t\tbehavior.setDest(turnCornerMax,turnCornerMin);\r\n\t\t\t\t\r\n\t\t}\r\n\t\tif(x >= turnCornerMax) {\r\n\t\t\tbehavior.setDest(turnCornerMax, turnCornerMax);\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tif(y >= turnCornerMax) {\r\n\t\t\tbehavior.setDest(turnCornerMin, turnCornerMax);\r\n\t\t}\r\n\t\t\r\n\t\tif(x < turnCornerMin) {\r\n\t\t\treturn;\r\n\t\t\t\r\n\t\t}\r\n\t\t\t\r\n\t\tobj.updateObjKinematics(x, y, obj.getMotion().getOrientation());\r\n\t}", "public void startTurningBy(double degrees) {\r\n turningPID.setSetpoint(targetingGyro.getAngle() + degrees);\r\n turningPID.enable();\r\n }", "public void move() {\n\n if (_currentFloor == Floor.FIRST) {\n _directionOfTravel = DirectionOfTravel.UP;\n }\n if (_currentFloor == Floor.SEVENTH) {\n _directionOfTravel = DirectionOfTravel.DOWN;\n }\n\n\n if (_directionOfTravel == DirectionOfTravel.UP) {\n _currentFloor = _currentFloor.nextFloorUp();\n } else if (_directionOfTravel == DirectionOfTravel.DOWN) {\n _currentFloor = _currentFloor.nextFloorDown();\n }\n\n if(_currentFloor.hasDestinationRequests()){\n stop();\n } \n\n }", "public abstract void move(int direction, double speed);", "public void moveForward(boolean endWithBrake){\r\n \r\n Motor.B.rotate(DEGREES_PER_TILE, true);//Accesses Motor thread\r\n Motor.C.rotate(DEGREES_PER_TILE, true);\r\n while(Motor.B.isMoving() || Motor.C.isMoving())\r\n ;//wait for motors to be done\r\n return;\r\n }", "protected void execute() {\n \tRobot.driveTrain.arcadeNoConstants(MOVE_SPEED_PERCENT, Robot.driveTrain.gyroPReturn(direction));\n }", "public static void wheelRadCheck() {\n\t\t// reset the motor\n\t\tfor (EV3LargeRegulatedMotor motor : new EV3LargeRegulatedMotor[] { leftMotor, rightMotor }) {\n\t\t\tmotor.stop();\n\t\t\tmotor.setAcceleration(2000);\n\t\t}\n\t\ttry {\n\t\t\tThread.sleep(1000);\n\t\t} catch (InterruptedException e) {\n\t\t\t// There is nothing to be done here\n\t\t}\n\t\t//move the robot forward until the Y asis is detected\n\t\tleftMotor.setSpeed(200);\n\t\trightMotor.setSpeed(200);\n\t\tleftMotor.rotate(Navigation_Test.convertDistance(Project_Test.WHEEL_RAD, 2*Project_Test.TILE_SIZE), true);\n\t\trightMotor.rotate(Navigation_Test.convertDistance(Project_Test.WHEEL_RAD, 2*Project_Test.TILE_SIZE), false);\n\t}", "private void move() {\n\n if(currentPosition.getX() == -1 && currentPosition.getY() == -1) {\n System.out.println(\"Robot is not placed, yet.\");\n return;\n }\n\n Position.Direction direction = currentPosition.getDirection();\n int newX = -1;\n int newY = -1;\n switch (direction) {\n case EAST:\n newX = currentPosition.getX() + 1;\n newY = currentPosition.getY();\n break;\n case WEST:\n newX = currentPosition.getX() - 1;\n newY = currentPosition.getY();\n break;\n case NORTH:\n newX = currentPosition.getX();\n newY = currentPosition.getY() + 1;\n break;\n case SOUTH:\n newX = currentPosition.getX();\n newY = currentPosition.getY() - 1;\n break;\n }\n\n if(newX < lowerBound.getX() || newY < lowerBound.getY()\n || newX > upperBound.getX() || newY > upperBound.getY()) {\n System.out.println(\"Cannot move to \" + direction);\n return;\n }\n\n currentPosition.setX(newX);\n currentPosition.setY(newY);\n }", "public void move() {\n if (!canMove) {\n return;\n }\n int moveX = currDirection == EAST ? PACE : currDirection == WEST ? -PACE : 0;\n int moveY = currDirection == NORTH ? PACE : currDirection == SOUTH ? -PACE : 0;\n if (grid == null || grid.isOutside(currX + moveX, currY + moveY)) {\n return;\n }\n currX += moveX;\n currY += moveY;\n }", "private void move() {\n\t\t\tangle += Math.PI/24;\n\t\n\t\t\tcow.locX = Math.sin(angle) * 2.5 + player.getLocation().getX();\n\t\t\tcow.locZ = Math.cos(angle) * 2.5 + player.getLocation().getZ();\n\t\t\t\n\t\t\tLocation loc = new Location(player.getWorld(), cow.locX, player.getLocation().getY() + 1.5, cow.locZ);\n\t\t\tloc.setDirection(player.getLocation().subtract(loc).toVector()); //Look at the player\n\t\t\t\n\t\t\tPacketHandler.teleportFakeEntity(player, cow.getId(), loc);\n\t\t}", "public static void moveArm(double speed) {\n\t\tSmartDashboard.putNumber(\"Arm Max value\",maxPos);\n\t\tSmartDashboard.putNumber(\"Arm Min value\",minPos);\n\t\tActuators.getArmAngleMotor().changeControlMode(TalonControlMode.PercentVbus);\t//CHECK THIS SCOTT\n\t\tSmartDashboard.putNumber(\"Percent of Arm Angle\", unMapPosition(Actuators.getArmAngleMotor().getPosition()));\t//CHECK THIS SCOTT\n\t\tSmartDashboard.putNumber(\"Arm Position\", Actuators.getArmAngleMotor().getPosition());\n\t\tSmartDashboard.putNumber(\"THeoreticalPID position\", mapPosition(unMapPosition(Actuators.getArmAngleMotor().getPosition())));\n\t\tif (Gamepad.secondary.getBack()) {\n\t\t\tActuators.getArmAngleMotor().set(speed);\n\t\t} else {\n\t\t\tif ((Actuators.getArmAngleMotor().getPosition() < MAX_ARM_POSITION && Sensors.getArmMinLimitSwitch().get())\n\t\t\t\t\t&& speed > 0) {\n\t\t\t\tActuators.getArmAngleMotor().set(speed / 2);\n\t\t\t} else if ((Actuators.getArmAngleMotor().getPosition() > MIN_ARM_POSITION\n\t\t\t\t\t&& Sensors.getArmMaxLimitSwitch().get()) && speed < 0) {\n\t\t\t\tActuators.getArmAngleMotor().set(speed);\n\t\t\t} else if (!Sensors.getArmMaxLimitSwitch().get()){\n\t\t\t\tActuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\t\t\t\t//CHECK THIS SCOTT\n\t\t\t\tmaxPos = Actuators.getArmAngleMotor().getPosition();\t\t//CHECK THIS SCOTT\n\t\t\t} else if (!Sensors.getArmMinLimitSwitch().get()){\t\t\t\t\t\t//CHECK THIS SCOTT\n\t\t\t\tActuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\t\t\t\t//CHECK THIS SCOTT\n\t\t\t\tminPos = Actuators.getArmAngleMotor().getPosition();\t\t//CHECK THIS SCOTT\n\t\t\t}\n\t\t\telse {\n\t\t\t\tActuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\n\t\t\t}\n\n\t\t\t// speed = -speed;\n\t\t\tSmartDashboard.putNumber(\"Arm Position\", Actuators.getArmAngleMotor().getPosition());\n\t\t\tif (Gamepad.secondary.getBack()) {\n\t\t\t\tActuators.getArmAngleMotor().set(speed);\n\t\t\t} else {\n\t\t\t\tif ((Sensors.getArmMaxLimitSwitch().get()) && speed < 0) {\n\t\t\t\t\tActuators.getArmAngleMotor().set(speed);\n\t\t\t\t} else if ((Sensors.getArmMinLimitSwitch().get()) && speed > 0) {\n\t\t\t\t\tActuators.getArmAngleMotor().set(speed);\n\t\t\t\t} else if (!Sensors.getArmMaxLimitSwitch().get()){\n\t\t\t\t\tActuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\t\t\t\t//CHECK THIS SCOTT\n\t\t\t\t\tmaxPos = Actuators.getArmAngleMotor().getPosition();\t\t//CHECK THIS SCOTT\n\t\t\t\t} else if (!Sensors.getArmMinLimitSwitch().get()){\t\t\t\t\t\t//CHECK THIS SCOTT\n\t\t\t\t\tActuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\t\t\t\t//CHECK THIS SCOTT\n\t\t\t\t\tminPos = Actuators.getArmAngleMotor().getPosition();\t\t//CHECK THIS SCOTT\n\t\t\t\t} else {\n\t\t\t\t\tActuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\t// if (!(/*\n\t\t\t\t// * Actuators.getArmAngleMotor().getPosition() >\n\t\t\t\t// * MAX_ARM_POSITION &&\n\t\t\t\t// */\n\t\t\t\t// Sensors.getArmMaxLimitSwitch().get()) && speed > 0) {\n\t\t\t\t// Actuators.getArmAngleMotor().set(speed);\n\t\t\t\t// } else if (!(/*\n\t\t\t\t// * Actuators.getArmAngleMotor().getPosition() <\n\t\t\t\t// * MIN_ARM_POSITION &&\n\t\t\t\t// */\n\t\t\t\t// Sensors.getArmMinLimitSwitch().get()) && speed < 0) {\n\t\t\t\t// Actuators.getArmAngleMotor().set(speed);\n\t\t\t\t// } else {\n\t\t\t\t// Actuators.getArmAngleMotor().set(Actuators.STOP_MOTOR);\n\t\t\t\t//\n\t\t\t\t// }\n\t\t\t}\n\t\t}\n\t}", "public void gyroTurn ( double speed, double angle) {\n\n // keep looping while we are still active, and not on heading.\n while (opModeIsActive() && !onHeading(speed, angle, P_TURN_COEFF)) {\n // Update telemetry & Allow time for other processes to run.\n telemetry.addData(\"Direction\", gyro.getHeading());\n telemetry.update();\n }\n }", "protected void execute() {\n\n\t\tspeed = oi.getLeftY();\n\n\t\tleftTicks = drive.getLeftRotation();\n\t\trightTicks = drive.getRightRotation();\n\n\t\t/*\n\t\t * if (startAngle == drive.getAngle()) { drive.setBoth(oi.getLeftY()); }\n\t\t * else if (startAngle < drive.getAngle()) { if (oi.getLeftY() > 0)\n\t\t * drive.setBoth(oi.getLeftY(), .9 * oi.getLeftY()); else drive.setBoth(\n\t\t * .9 * oi.getLeftY(),oi.getLeftY()); } else if (startAngle >\n\t\t * drive.getAngle()) { if (oi.getLeftY() > 0)\n\t\t * drive.setBoth(oi.getLeftY(), .9 * oi.getLeftY()); else\n\t\t * drive.setBoth(.9 * oi.getLeftY(), oi.getLeftY()); }\n\t\t */\n\t\tif (leftTicks == 0 || rightTicks == 0)\n\t\t\tdrive.setBoth(speed);\n\t\telse\n\t\t\tdrive.setBoth(MathUtil.setLimits((rightTicks / leftTicks) * speed, -1.0, 1.0),\n\t\t\t\t\tMathUtil.setLimits((leftTicks / rightTicks) * speed, -1.0, 1.0));\n\n\t}", "protected void execute() {\n \n \n \torientation.updatePID(RobotMap.navx.getAngle());\n \tRobotMap.motorLeftOne.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() - speed));\n \tRobotMap.motorLeftTwo.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() - speed));\n \t\n \tRobotMap.motorRightOne.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() + speed));\n \tRobotMap.motorRightTwo.set(com.ctre.phoenix.motorcontrol.ControlMode.PercentOutput, 0.5*(orientation.getResult() + speed));\n \tSystem.out.println(RobotMap.navx.getAngle()-desiredAngle);\n }", "public void angleTurn(float angle, int timeout){\n\t\tcalculateAngles();\n\n\t\t// Get the current program time and starting encoder position before we start our drive loop\n\t\tfloat StartTime = data.time.currentTime();\n\t\tfloat StartPosition = data.drive.leftDrive.getCurrentPosition();\n\n\t\t// Reset our Integral and Derivative data.\n\t\tdata.PID.integralData.clear();\n\t\tdata.PID.derivativeData.clear();\n\n\n\t\t// Manually calculate our first target\n\t\tdata.PID.target = (calculateAngles() + (data.PID.IMURotations * 360)) + angle;\n\n\t\t// We need to keep track of how much time passes between a loop.\n\t\tfloat LoopTime = data.time.currentTime();\n\n\t\t// This is the main loop of our straight drive.\n\t\t// We use encoders to form a loop that corrects rotation until we reach our target.\n\t\twhile(StartTime + timeout > data.time.currentTime()){\n\n\t\t\t// Record the time since the previous loop.\n\t\t\tLoopTime = data.time.timeFrom(LoopTime);\n\t\t\t// Calculate our angles. This method may modify the input Rotations.\n\t\t\t//IMURotations =\n\t\t\tcalculateAngles();\n\t\t\t// Calculate our PID\n\t\t\tcalculatePID(LoopTime);\n\n\t\t\t// Calculate the Direction to travel to correct any rotational errors.\n\t\t\tfloat Direction = ((data.PID.I * data.PID.ITuning) / 2000) + ((data.PID.P * data.PID.PTuning) / 2000) + ((data.PID.D * data.PID.DTuning) / 2000);;\n\n\t\t\tif(Math.abs(Direction) <= 0.03f) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdata.drive.rightDrive.setPower(data.drive.POWER_CONSTANT - (Direction));\n\t\t\tdata.drive.leftDrive.setPower(data.drive.POWER_CONSTANT + (Direction));\n\t\t}\n\t\t// Our drive loop has completed! Stop the motors.\n\t\tdata.drive.rightDrive.setPower(0);\n\t\tdata.drive.leftDrive.setPower(0);\n\t}", "@Override\n protected void execute() {\n Robot.getEndEffectorAngle().goToPos(holdPos);\n }", "public void move()\n {\n move(WALKING_SPEED);\n }", "@Override\n public void move() {\n switch (direction){\n case SOUTH:\n position.setY(position.getY() + currentSpeed);\n break;\n case NORTH:\n position.setY(position.getY() - currentSpeed);\n break;\n case WEST:\n position.setX(position.getX() - currentSpeed);\n break;\n case EAST:\n position.setX(position.getX() + currentSpeed);\n }\n }", "protected void updateMotionDriveArc(CommandHelper cmdHelp, PlanState planState) {\r\n ParameterList params = cmdHelp.getParameters();\r\n float distance = params.getFloat(MOTION_METHOD_DRIVEARC_PARAM_DISTANCE.VALUE);\r\n float headingChange = params.getFloat(MOTION_METHOD_DRIVEARC_PARAM_HEADINGCHANGE.VALUE);\r\n float crabDirection = params.getFloat(MOTION_METHOD_DRIVEARC_PARAM_CRABDIRECTION.VALUE);\r\n if(headingChange == 0 && crabDirection == 0) {\r\n Vector3 wpXyz = new Vector3();\r\n Vector3 drive = new Vector3(distance, 0, 0);\r\n Transform xfm = planState.getTransform(new Transform());\r\n xfm.applyForward(drive, wpXyz);\r\n\r\n //-- get z from terrain\r\n ReadOnlyTransform siteToWorld = planState.getSiteToWorldTransform();\r\n siteToWorld.applyForward(wpXyz, t_world);\r\n VerveBaseMap.setZFromMap(t_world, 0);\r\n siteToWorld.applyInverse(t_world, wpXyz);\r\n\r\n setIsDirectional(false);\r\n setTolerance(0.2f);\r\n\r\n planState.setXyz(wpXyz);\r\n }\r\n else {\r\n logger.warn(\"FIXME: updateMotionDriveArc only supports straight line drives\");\r\n }\r\n }", "public void act() \n {\n move(-2);\n if(isAtEdge())\n {\n turn(180);\n getImage().mirrorVertically();\n }\n }", "void turn(float degrees) {\n _rotVector.rotate(radians(degrees));\n }", "@Override\npublic void teleopPeriodic() {\nm_robotDrive.arcadeDrive(m_stick.getRawAxis(5)* (-0.5), m_stick.getRawAxis(4)*0.5);\n}", "public void target()\n {\n if(noRotation == false)\n {\n if(timer % 3 == 0)\n {\n int currentRotation = getRotation();\n turnTowards(xMouse, yMouse);\n int newRotation = getRotation();\n if (Math.abs(currentRotation-newRotation) > 180)\n {\n if (currentRotation < 180) currentRotation += 360;\n else newRotation += 360;\n }\n if(currentRotation != newRotation)\n { \n setRotation(currentRotation+direction()*8);\n }\n }\n }\n }", "@Test\n public void rotateCommand() {\n ICommand cmd = Commands.getComand(\"rotate\");\n Robot robot = new Robot(0, 0);\n Vector2Di dir = robot.getDir();\n int rot_amount = 90;\n double orig_angle = dir.angle();\n cmd.exec(rot_amount, robot, null);\n assertEquals(orig_angle + rot_amount, dir.angle(), 0.1);\n }", "public void TurnCommand() {\n\n requires(Robot.driveSubsystem);\n\n }", "public void operatorControl() {\n \tdouble ctrlThresh = .2; \n \tdouble minPower = .05; \n \tdouble maxPower = .75; \n \tdouble recip = (1 - ctrlThresh); \n \tdouble mult = (maxPower - minPower); \n \tdouble right; \n \tdouble strafe; \n \tdouble rotate; \n \tdouble rightAxis; \n \tdouble strafeAxis; \n \tdouble rotateAxis; \n \t// \tboolean leftLeft; \n \t// \tboolean leftRight; \n \tdouble rightDir; \n \tdouble strafeDir; \n \tdouble rotateDir; \n \tdouble rightPower; \n \tdouble rotatePower; \n \tdouble strafePower; \n \t\n \tint winchCount;\n \tboolean winchDirection;\n \n \t// \tdouble frontLeftPower; \n \t// \tdouble frontRightPower; \n \t// \tdouble backLeftPower; \n \t// \tdouble backRightPower; \n \n \t//myRobot.setSafetyEnabled(true); \n \t\n \tAccelerometer test = new BuiltInAccelerometer();\n \t\n \twhile (isOperatorControl() && isEnabled()) { \n \t\t// ACCEL TEST CODE\n// \t\tSystem.out.println(test.getX() + \", \" + test.getY() + \", \" + test.getZ());\n \t\t// END ACCEL TEST CODE\n \n \t\t// ********** BEGIN DRIVING CODE ********** \n \t\t// Code for driving using omniwheels and two wheels for strafing \n \t\t// Diagram for the wheels of the robot below. \n \n \t\t// L S R \n \t\t// /--------------------------\\ \n \t\t//\t ||------------------------|| \n \t\t// || [][] || \n \t\t// || [] [] || \n \t\t// || [] [] || \n \t\t// || || \n \t\t// || || \n \t\t// || || \n \t\t// || || \n \t\t// || || \n \t\t// || [] [] || \n \t\t// || [] [] || \n \t\t// || [][] || \n \t\t// ||------------------------|| \n \t\t// \\--------------------------/ \n \t\t// \n \t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ \n \n \t\tctrlThresh = .2; // the point at which we want to sense joystick action \n \t\trecip = 1-ctrlThresh; \t\t // = 0.8 \n \n \t\trightAxis = rightStick.getRawAxis(1);\t\t\t\t// right joystick, y (up/down) axis\n \t\t\n \t\t//System.out.println(\"\"+rightAxis);\n \t\tstrafeAxis = rightStick.getRawAxis(0);\t\t\t\t// right joystick, x (left/right) axis; this is \n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// arbitrary and could have been the left stick\n \t\trotateAxis = rightStick.getRawAxis(4);\t\t\t\t\t// left joystick, y axis\n \n \t\trightDir = rightAxis/Math.abs(rightAxis);\t\t\t// forward or backward (+1 or -1)\n \t\tstrafeDir = strafeAxis/Math.abs(strafeAxis); \t// \t\t\t'' \n \t\trotateDir = rotateAxis/Math.abs(rotateAxis); // \t\t\t'' \n \n \t\tright = 0; // right input formatted for range of detected values [0.2,1] \n \t\trotate = 0; // left input formatted \n \t\tstrafe = 0; // strafe input formatted \n \n \t\tif(Math.abs(rightAxis) > ctrlThresh) \t// user moved stick beyond threshold \n \t\t{right = (rightAxis-ctrlThresh*rightDir)/recip;} // format right: scale back, set direction, proportion it \n \t\tif(Math.abs(strafeAxis) > ctrlThresh) \n \t\t{strafe = (strafeAxis-ctrlThresh*strafeDir)/recip;} // format left... \n \t\tif(Math.abs(rotateAxis) > ctrlThresh) \n \t\t{rotate = (rotateAxis-ctrlThresh*rotateDir)/recip;}\t\t// format strafe... \n \n \n \t\trightDir = right/Math.abs(right); \n \t\trightPower = (Math.abs(right*mult) + minPower) * rightDir; \t\t// re-proportion for power's range, strip direction,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// and then add back threshold and direction. \n \t\trotateDir = rotate/Math.abs(rotate); \n \t\trotatePower = (Math.abs(rotate*mult) + minPower) * rotateDir;\t\t\t// \t\t'' \n \n \t\tstrafeDir = strafe/Math.abs(strafe); \n \t\tstrafePower = (Math.abs(strafe*mult) + minPower) * strafeDir;\t// \t\t'' \n \n \t\tif(Math.abs(rightPower)>0.2){\n \t\t\tfrontRight.set(rightPower);\t\t\t\t\t\t// set all the motors with the powers we \n \t\t\tbackRight.set(rightPower);\t\t\t\t\t\t/// calculated above : drive! \n \t\t\tfrontLeft.set(-1*rightPower); \n \t\t\tbackLeft.set(-1*rightPower);\n \t\t}\n \t\telse{\n \t\t\tfrontRight.set(rotatePower);\n \t\t\tbackRight.set(rotatePower);\n \t\t\tfrontLeft.set(rotatePower);\n \t\t\tbackLeft.set(rotatePower);\n \t\t}\n \t\t\n// \t\tfrontStrafe.set(strafePower); \n// \t\tbackStrafe.set(-1*strafePower); \n \n// \t\tmyRobot.tankDrive(leftStick, rightStick); \n \t\t \n \t\t// ********** END OF DRIVING CODE ********** \n \t\t//======================================================================= \n \t\t// ************ BEGIN WINCH CODE *********** \n \t\t// We need to code the winch to help raise and lower the elevator \n \t\t// This is just one option between the winch and the lead screw. \n \t\t \n \t\t\n \t\t//second winch test\n \t\t/*\n \t\twinchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n \t \tSystem.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n \t \tif(winchCount<240){\n \t \t\t\n \t \t\twinchCim1.set(.1);\n \t \t\twinchCim2.set(.1);\n \t \t}\n \t \telse{\n \t \t\twinchCim1.set(0);\n \t \t\twinchCim2.set(0);\n \t \t\t\n \t \t}\n \t if(rightStick.getRawButton(5)) \n { \n\t\t\t winchEncoder.reset();// reset the pulse count\n\t\t\t winchCount = 0;\n\t\t\t winchCim1.set(0);\n\t\t\t winchCim2.set(0);\n\t\t\t \n } */ //end of second winch test \n \t \t\n \t\t\n \t\t if(rightStick.getRawButton(5)) \n { \n \t\t\t //winchEncoder.reset();// reset the pulse count\n \tSystem.out.println(\"A\");\n \t winchCim1.set(.5); \t// set winchCim1 to 0.5 power (upwards) \n \t winchCim2.set(.5); \t\t\t\t\t\t\t// set winchCim2 to 0.5 power\n \t\t\t \n } \n \t\telse if(rightStick.getRawButton(4))\n \t\t{\n \t\t\tSystem.out.println(\"B\");\n \t\t\t//winchEncoder.reset();\t\t\t\t\t\t\t// reset the pulse count\n \t \twinchCim1.set(-.3); // set winchCim1 to -0.5 power (downwards) \n \t \twinchCim2.set(-.3);\t \t\t\t\t\t\t\t// set winchCim2 to -0.5 power\n \t\t}\n \n \t \telse// if(rightStick.getRawButton(2)) \n { \n \t winchCim1.set(0); \t\t\t\t\t\t\t// set winchCim1 to 0 power (off/stop) \n \t winchCim2.set(0);\t\t\t\t\t\t\t\t// set winchCim2 to 0 pwoer (off/stop)\n// \t winchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n// \t System.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n } \n \n \t\t// ********** END OF WINCH CODE ********** \n \t\t//======================================================================= \n \t\t \n \t\t \n \t\tTimer.delay(0.005);\t\t// wait for a motor update time \n } \n }", "public void move(String direction) {\n \n }", "public void gyroTurn ( double speed, double angle) {\n\n // keep looping while we are still active, and not on heading.\n while (!onHeading(speed, angle, P_TURN_COEFF) ) {\n // Update telemetry & Allow time for other processes to run.\n try {\n sleep(50);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n\n }", "@Override\n public void tick(\n final double dt,\n final ISensor<Position> aSensor,\n final IController<SpeedAndTurnRate> aController) {\n \n mCurrentAngle = aSensor.getValue().getAngle();\n \n if (goalReached()) {\n mDistanceController.reset();\n mAngleController.reset();\n return;\n }\n \n Logger.getLogger(BioteSocket.class.getName()).log(Level.INFO,\n \"Turning forward torward \" + mTargetAngle + \" current \" + mCurrentAngle);\n \n mDistanceController.setPosition(0.0);\n mAngleController.setPosition(mTargetAngle);\n\n mDistanceController.tick(dt, mDistanceSensor, mSpeedController);\n mAngleController.tick(dt, mAngleSensor, mTurnRateController);\n \n aController.setOutput(\n new SpeedAndTurnRate(mSpeed, mTurnRate)\n );\n }", "public void startMoving ()\n {\n if (canMove()) {\n ((Mobile)_actor).setDirection(_actor.getRotation());\n _actor.set(Mobile.MOVING);\n }\n }", "private void spinCompass(ImageView imageView, float angle){\n //Check that the angle is valid\n if (angle >= 0 || angle <= 360)\n imageView.setRotation(-angle + 180); //Flip and rotate the image to correspond to the actual angle\n\t}", "private void moveForwards() {\n\t\tposition = MoveAlgorithmExecutor.getAlgorithmFromCondition(orientation).execute(position);\n\t\t\n\t\t// Extracted the condition to check if tractor is in Ditch\n\t\tif(isTractorInDitch()){\n\t\t\tthrow new TractorInDitchException();\n\t\t}\n\t}", "private void moveAround()\n {\n if(getY()>75)\n {\n setRotation(270);\n }\n else if(getX()<75)\n {\n setRotation(0);\n }\n else if (getX()>getWorld().getWidth()-50)\n {\n setRotation(180);\n }\n else if (isTouching(Player.class))\n {\n Actor actor = getOneIntersectingObject(Player.class);\n turnTowards(actor.getX(), actor.getY());\n turn(180);\n }\n else if(Greenfoot.getRandomNumber(100) < 3)\n {\n setRotation(Greenfoot.getRandomNumber(360));\n }\n move(1);\n }", "private synchronized void updatePose(Move event) {\n\t\tfloat angle = event.getAngleTurned() - angle0;\n\t\tfloat distance = event.getDistanceTraveled() - distance0;\n\t\tdouble dx = 0, dy = 0;\n\t\tdouble headingRad = (Math.toRadians(heading));\n\n\t\tif (event.getMoveType() == Move.MoveType.TRAVEL\n\t\t\t\t|| Math.abs(angle) < 0.2f) {\n\t\t\tdx = (distance) * (float) Math.cos(headingRad);\n\t\t\tdy = (distance) * (float) Math.sin(headingRad);\n\t\t} else if (event.getMoveType() == Move.MoveType.ARC) {\n\t\t\tdouble turnRad = Math.toRadians(angle);\n\t\t\tdouble radius = distance / turnRad;\n\t\t\tdy = radius\n\t\t\t\t\t* (Math.cos(headingRad) - Math.cos(headingRad + turnRad));\n\t\t\tdx = radius\n\t\t\t\t\t* (Math.sin(headingRad + turnRad) - Math.sin(headingRad));\n\t\t}\n\t\tx += dx;\n\t\ty += dy;\n\t\theading = normalize(heading + angle); // keep angle between -180 and 180\n\t\tangle0 = event.getAngleTurned();\n\t\tdistance0 = event.getDistanceTraveled();\n\t\tcurrent = !event.isMoving();\n\t}", "public void spinOnAxis(Vector3d from, Vector3d to, Vector3d spinAxis)\n {\n // get the amount of rotation around the spin axis required to\n // move \"from\" to \"to\". To do this, project the vectors\n // onto the plane perpendicular to the spin axis, then find the\n // angle between the projections.\n Vector3d startProj = Plane.unitProjection(spinAxis, from);\n Vector3d endProj = Plane.unitProjection(spinAxis, to);\n double dot = MathUtil.clamp(startProj.dot(endProj), -1., 1.);\n double rotAngle = Math.acos(dot);\n // Determine whether the rotation is positive or negative by comparing\n // the spinAxis direction with the rotAxis direction.\n Vector3d rotAxis = startProj.cross(endProj).getNormalized();\n if (rotAxis.dot(spinAxis) > 0)\n {\n rotAngle *= -1.;\n }\n ViewerPosition3D first = getSpinOnAxisPosition(rotAngle, spinAxis, false, getPosition());\n // tilt the spin axis\n Vector3d oToV = new Vector3d(first.getLocation()).getNormalized();\n if (MathUtil.isZero(Math.abs(oToV.dot(spinAxis)) - 1d))\n {\n return;\n }\n Vector3d tiltPlaneNormal = oToV.cross(spinAxis).getNormalized();\n startProj = Plane.unitProjection(tiltPlaneNormal, from);\n endProj = Plane.unitProjection(tiltPlaneNormal, to);\n dot = MathUtil.clamp(startProj.dot(endProj), -1., 1.);\n rotAngle = Math.acos(dot);\n rotAxis = startProj.cross(endProj).getNormalized();\n if (rotAxis.dot(tiltPlaneNormal) > 0)\n {\n rotAngle *= -1.;\n }\n ViewerPosition3D finish = getSpinOnAxisPosition(rotAngle, tiltPlaneNormal, false, first);\n setView(finish.getLocation(), finish.getDir(), finish.getUp());\n }", "public void move() { \n\t\tSystem.out.println(\"MOVING\");\n\t\tswitch(direction) {\n\t\t\tcase NORTH: {\n\t\t\t\tyloc -= ySpeed;\n\t\t\t}\n\t\t\tcase SOUTH: {\n\t\t\t\tyloc+= xSpeed;\n\t\t\t}\n\t\t\tcase EAST: {\n\t\t\t\txloc+= xSpeed;\n\t\t\t}\n\t\t\tcase WEST: {\n\t\t\t\txloc-= xSpeed;\n\t\t\t}\n\t\t\tcase NORTHEAST: {\n\t\t\t\txloc+=xSpeed;\n\t\t\t\tyloc-=ySpeed;\n\t\t\t}\n\t\t\tcase NORTHWEST: {\n\t\t\t\txloc-=xSpeed;\n\t\t\t\tyloc-=ySpeed;\n\t\t\t}\n\t\t\tcase SOUTHEAST: {\n\t\t\t\txloc+=xSpeed;\n\t\t\t\tyloc+=ySpeed;\n\t\t\t}\n\t\t\tcase SOUTHWEST: {\n\t\t\t\txloc-=xSpeed;\n\t\t\t\tyloc+= ySpeed;\n\t\t\t}\n\t\t}\n\t}", "public void strafe(double speed, boolean angle, double inches, double timeout){\n int newLeftTarget;\n int newRightTarget;\n int newLeftBottomTarget;\n int newRightBottomTarget;\n if (opModeIsActive()) {\n if (angle) {\n //strafe right\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftFrontMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newLeftBottomTarget = robot.leftBackMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newRightTarget = robot.rightFrontMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newRightBottomTarget = robot.rightBackMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n robot.leftFrontMotor.setTargetPosition(newLeftTarget);\n robot.leftBackMotor.setTargetPosition(newLeftBottomTarget);\n robot.rightFrontMotor.setTargetPosition(newRightTarget);\n robot.rightBackMotor.setTargetPosition(newRightBottomTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftFrontMotor.setPower(Math.abs(speed));\n robot.rightFrontMotor.setPower(Math.abs(speed));\n robot.leftBackMotor.setPower(Math.abs(speed));\n robot.rightBackMotor.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n\n while (opModeIsActive() &&\n (runtime.seconds() < timeout) &&\n (robot.leftFrontMotor.isBusy() && robot.rightFrontMotor.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftFrontMotor.getCurrentPosition(),\n robot.rightFrontMotor.getCurrentPosition(), robot.leftBackMotor.getCurrentPosition(), robot.rightBackMotor.getCurrentPosition());\n telemetry.update();\n }\n // Stop all motion;\n robot.rightFrontMotor.setPower(0);\n robot.rightBackMotor.setPower(0);\n robot.leftFrontMotor.setPower(0);\n robot.leftBackMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n } else if (!angle) {\n //strafe left\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftFrontMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newLeftBottomTarget = robot.leftBackMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newRightTarget = robot.rightFrontMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newRightBottomTarget = robot.rightBackMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n robot.leftFrontMotor.setTargetPosition(newLeftTarget);\n robot.leftBackMotor.setTargetPosition(newLeftBottomTarget);\n robot.rightFrontMotor.setTargetPosition(newRightTarget);\n robot.rightBackMotor.setTargetPosition(newRightBottomTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftFrontMotor.setPower(Math.abs(speed));\n robot.rightFrontMotor.setPower(Math.abs(speed));\n robot.leftBackMotor.setPower(Math.abs(speed));\n robot.rightBackMotor.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n\n while (opModeIsActive() &&\n (runtime.seconds() < timeout) &&\n (robot.leftFrontMotor.isBusy() && robot.rightFrontMotor.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftFrontMotor.getCurrentPosition(),\n robot.rightFrontMotor.getCurrentPosition(), robot.leftBackMotor.getCurrentPosition(), robot.rightBackMotor.getCurrentPosition());\n telemetry.update();\n }\n // Stop all motion;\n robot.rightFrontMotor.setPower(0);\n robot.rightBackMotor.setPower(0);\n robot.leftFrontMotor.setPower(0);\n robot.leftBackMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }\n }", "void turnToDir(float angle) { \n float radian = radians(angle);\n _rotVector.set(cos(radian), sin(radian));\n _rotVector.setMag(1);\n }", "private void rotateDrive(double throttle, double error) {\n double output = visionDrive.getOutput(error);\n left.set(ControlMode.PercentOutput, throttle - output);\n right.set(ControlMode.PercentOutput, throttle + output);\n }", "public static void moveServoTo(double motorPosition) {\n\t\ttry {\n\t\t\t// Get the servo that is available\n\t\t\tMotorMover.getInstance();\n\t\t\tSystem.out.println(\"Lock opening: Moving to lock position \" + motorPosition);\n\t\t\tservo.setMaxPosition(210.0);\n\t\t\tservo.setTargetPosition(motorPosition);\n\t\t\tservo.setEngaged(true);\n\t\t} catch (PhidgetException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void turnTo(double theta){//takes theta in degrees\r\n\t\t\t//set the motor speeds to the rotate speed\r\n\t\t\tleftMotor.setSpeed(ROTATE_SPEED);\r\n\t\t\trightMotor.setSpeed(ROTATE_SPEED);\r\n\r\n\t\t\t//makes the left wheel rotate forward theta\r\n\t\t\t//and the right wheel rotate backwards theta\r\n\t\t\tleftMotor.rotate(convertAngle(wheelRadius, wheelBase, theta), true);\r\n\t\t\trightMotor.rotate(-convertAngle(wheelRadius, wheelBase, theta), false);\r\n\t\t\t\r\n\t\t}", "public void moveOneStep() {\n if (velocity.getDx() < 0 && this.center.getX() - this.radius < bottomLeftBound) {\n this.setVelocity(-velocity.getDx(), velocity.getDy());\n } else if (velocity.getDx() > 0 && this.center.getX() + this.radius > bottomRightBound) {\n this.setVelocity(-velocity.getDx(), velocity.getDy());\n }\n if (velocity.getDy() < 0 && this.center.getY() - this.radius < topLeftBound) {\n this.setVelocity(velocity.getDx(), -velocity.getDy());\n } else if (velocity.getDy() > 0 && this.center.getY() + this.radius > topRightBound) {\n this.setVelocity(velocity.getDx(), -velocity.getDy());\n }\n this.center = this.getVelocity().applyToPoint(this.center);\n }", "protected void moveCar(E_Direction direction) {\n\t\tif(!this.isFinished()) {\n\t\ttry {\n\t\t\tThread.sleep(1000);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tswitch (direction) {\n\t\tcase DOWN:\n\t\t\tmoveDown();\n\t\t\tsetDirection(E_Direction.DOWN);\n\t\t\tbreak;\n\t\tcase LEFT:\n\t\t\tmoveLeft();\n\t\t\tsetDirection(E_Direction.LEFT);\n\t\t\tbreak;\n\t\tcase RIGHT:\n\t\t\tmoveRight();\n\t\t\tsetDirection(E_Direction.RIGHT);\n\t\t\tbreak;\n\t\tcase UP:\n\t\t\tmoveUp();\n\t\t\tsetDirection(E_Direction.UP);\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t}", "private void robotMovement()\n {\n\n /* If it will be rotating, don't drive */\n if (!joystick.rightShouldMove()) {\n\n if (joystick.leftShouldMove()) {\n\n /* Derive movement values from gamepad */\n Joystick.Direction direction = joystick.getLeftDirection();\n double power = joystick.getLeftPower();\n\n int[] modifier;\n\n if (direction == Joystick.Direction.UP) {\n modifier = modUP;\n } else if (direction == Joystick.Direction.DOWN) {\n modifier = modDOWN;\n } else if (direction == Joystick.Direction.RIGHT) {\n modifier = modRIGHT;\n } else {\n modifier = modLEFT;\n }\n\n motorLeftFront.setPower(modifier[0] * ((power * 0.8) + (0.01 * frontInc)));\n motorRightFront.setPower(modifier[1] * ((power * 0.8) + (0.01 * frontInc)));\n motorLeftBack.setPower(modifier[2] * ((power * 0.8) + (0.01 * backInc)));\n motorRightBack.setPower(modifier[3] * ((power * 0.8) + (0.01 * backInc)));\n\n } else {\n setMotorPowerToZero();\n }\n\n } else {\n\n /* Rotation modifiers for sides of bot */\n Joystick.Direction d = joystick.getRightDirection();\n double power = joystick.getRightPower();\n boolean left = d == Joystick.Direction.LEFT;\n double sideMod = left ? 1 : -1;\n\n /* Set motor power */\n motorLeftFront.setPower(sideMod * power);\n motorLeftBack.setPower(sideMod * power);\n motorRightFront.setPower(sideMod * power);\n motorRightBack.setPower(sideMod * power);\n\n }\n\n }", "public void travel(double distance, boolean waitLeft, boolean waitRight) {\n\t\tint converted = LengthConverter.convertDistance(distance);\n\t\tleftMotor.rotate(converted, waitLeft);\n\t\trightMotor.rotate(converted, waitRight);\n\t}", "protected void execute()\n\t{\n\t\tdouble speed = Robot.oi.getActuatorSpeed();\n\t\t// Treat a zone around the center position as zero to prevent fluctuating\n\t\t// motor speeds when the joystick is at rest in the center position.\n\t\tRobot.linearActuator.setSpeed(Math.abs(speed) >= .1 ? speed : 0);\n\t}", "public void turnAbsolute(int target)\n {\n int heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n double turnSpeed = 0.15;\n\n while (Math.abs(heading - target) > 45)\n { //Continue while the robot direction is further than three degrees from the target\n if (heading > target) //if gyro is positive, we will turn right\n {\n movePower(\"left\", 0.5, 0.01);\n }\n\n if (heading < target)\n {\n movePower(\"right\", 0.5, 0.01);\n }\n heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n telemetry.addData(\"heading\", String.format(\"%03d\", heading));\n telemetry.update();\n }\n while (Math.abs(heading - target) > 10)\n { //Continue while the robot direction is further than three degrees from the target\n if (heading > target) //if gyro is positive, we will turn right\n {\n movePower(\"left\", 0.1, 0.01);\n }\n\n if (heading < target)\n {\n movePower(\"right\", 0.1, 0.01);\n }\n heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n telemetry.addData(\"heading\", String.format(\"%03d\", heading));\n telemetry.update();\n }\n while (Math.abs(heading - target) > 5)\n { //Continue while the robot direction is further than three degrees from the target\n if (heading > target) //if gyro is positive, we will turn right\n {\n movePower(\"left\", 0.01, 0.01);\n }\n\n if (heading < target)\n {\n movePower(\"right\", 0.01, 0.01);\n }\n heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n telemetry.addData(\"heading\", String.format(\"%03d\", heading));\n telemetry.update();\n }\n stop();\n }", "private void turnClockwise(){\n\t\tswitch(this.facingDirection){\n\t\tcase NORTH:\n\t\t\tfacingDirection = Direction.EAST;\n\t\t\tbreak;\n\t\tcase SOUTH:\n\t\t\tfacingDirection = Direction.WEST;\n\t\t\tbreak;\n\t\tcase WEST:\n\t\t\tfacingDirection = Direction.NORTH;\n\t\t\tbreak;\n\t\tcase EAST:\n\t\t\tfacingDirection = Direction.SOUTH;\n\t\t}\n\t}", "public void updateAngle(){\n\t\tif (turnUp && (angle < 180) ){\n\t\t\tangle+=1;\n\t\t}\n\t\tif (turnDown && (angle > 0)){\n\t\t\tangle-=1;\n\t\t}\n\t}", "private void rotate(int degrees, double power) {\n telemetry.addData(\"command\", \"turn %f.1\\u00B0 turn.\");\n // restart imu angle tracking.\n resetAngle();\n\n // if degrees > 359 we cap at 359 with same sign as original degrees.\n if (Math.abs(degrees) > 359)\n degrees = (int) Math.copySign(359, degrees);\n\n // Start pid controller. PID controller will monitor the turn angle with\n // respect to the target angle and reduce power as we approach the target\n // angle. This is to prevent the robots momentum from overshooting the\n // turn after we turn off the power. The PID controller reports onTarget\n // () = true when the difference between turn angle and target angle is\n // within 1% of target (tolerance) which is about 1 degree. This helps\n // prevent overshoot. Overshoot depends on the motor and gearing\n // configuration, starting power, weight of the robot and the on target\n // tolerance. If the controller overshoots, it will reverse the sign of\n // the output turning the robot back toward the setpoint value.\n\n pidRotate.reset();\n pidRotate.setSetpoint(degrees);\n pidRotate.setInputRange(0, degrees);\n pidRotate.setOutputRange(0, power);\n pidRotate.setTolerance(0.01);\n pidRotate.enable();\n\n // getAngle() returns + when rotating counter clockwise (left) and - when\n // rotating clockwise (right).\n\n // rotate until turn is completed.\n\n if (degrees < 0) {\n do {\n power = pidRotate.performPID(getAngle()); // power will be - on right\n // turn.\n robot.leftDrive.setPower(-power);\n robot.rightDrive.setPower(power);\n } while (opModeIsActive() && !pidRotate.onTarget());\n } else // left turn.\n do {\n power = pidRotate.performPID(getAngle()); // power will be + on left\n // turn.\n robot.leftDrive.setPower(-power);\n robot.rightDrive.setPower(power);\n } while (opModeIsActive() && !pidRotate.onTarget());\n // reset angle tracking on new heading.\n stopMotors();\n pidDrive.disable();\n\n // wait for motors to calm down.\n sleep(500);\n\n rotation = getAngle();\n resetAngle();\n }", "void MoveTimed( double power, double theta_degrees, double t_secs, boolean set_gTheta){\n if( set_gTheta ) gTheta = getAngle();\n \n double t_start = getRuntime();\n while ( opModeIsActive() ) {\n \n GoDir( power, theta_degrees );\n \n Position pos = imu.getPosition();\n \n double t_elapsed = getRuntime()-t_start;\n telemetry.addData(\"T remaining\", t_secs-t_elapsed);\n telemetry.addData(\"delta Theta\", getAngle() - gTheta);\n telemetry.addData(\"encoder\", leftDrive.getCurrentPosition());\n telemetry.update();\n if ( t_elapsed >= t_secs ) break;\n }\n\n topDrive.setPower( 0 );\n leftDrive.setPower( 0 );\n rightDrive.setPower( 0 );\n }", "public void move(TrackerState state) {\n\t\t\n\t\tcurrentPosition[0] = state.devicePos[0];\n\t\tcurrentPosition[1] = state.devicePos[1];\n\t\tcurrentPosition[2] = state.devicePos[2];\n\t\t\n\t\tboolean processMove = false;\n\t\t\n\t\tboolean isWheel = (state.actionType == TrackerState.TYPE_WHEEL);\n\t\tboolean isZoom = (isWheel || state.ctrlModifier);\n\t\t\n\t\tif (isZoom) {\n\t\t\t\n\t\t\tdirection[0] = 0;\n\t\t\tdirection[1] = 0;\n\t\t\t\n\t\t\tif (isWheel) {\n\t\t\t\tdirection[2] = state.wheelClicks * 0.1f;\n\t\t\t\t\n\t\t\t} else if (state.ctrlModifier) {\n\t\t\t\tdirection[2] = (currentPosition[1] - startPosition[1]);\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tdirection[2] = 0;\n\t\t\t}\n\t\t\t\n\t\t\tif (direction[2] != 0) {\n\t\t\t\t\n\t\t\t\tdirection[2] *= 16;\n\t\t\t\t\n\t\t\t\tdata.viewpointTransform.getTransform(startViewMatrix);\n\t\t\t\tstartViewMatrix.get(positionVector);\n\t\t\t\t\n\t\t\t\tinVector.x = startViewMatrix.m02;\n\t\t\t\tinVector.y = startViewMatrix.m12;\n\t\t\t\tinVector.z = startViewMatrix.m22;\n\t\t\t\tinVector.normalize();\n\t\t\t\tinVector.scale(direction[2]);\n\t\t\t\t\n\t\t\t\tpositionVector.add(inVector);\n\t\t\t\t\n\t\t\t\t// stay above the floor\n\t\t\t\tif (positionVector.y > 0) {\n\t\t\t\t\tdestViewMatrix.set(startViewMatrix);\n\t\t\t\t\tdestViewMatrix.setTranslation(positionVector);\n\t\t\t\t\t\n\t\t\t\t\tprocessMove = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t\n\t\t\tdirection[0] = -(startPosition[0] - currentPosition[0]);\n\t\t\tdirection[1] = -(currentPosition[1] - startPosition[1]);\n\t\t\tdirection[2] = 0;\n\t\t\t\n\t\t\tfloat Y_Rotation = direction[0];\n\t\t\tfloat X_Rotation = direction[1];\n\t\t\t\n\t\t\tif( ( Y_Rotation != 0 ) || ( X_Rotation != 0 ) ) {\n\t\t\t\t\n\t\t\t\tdouble theta_Y = -Y_Rotation * Math.PI;\n\t\t\t\tdouble theta_X = -X_Rotation * Math.PI;\n\t\t\t\t\n\t\t\t\tdata.viewpointTransform.getTransform(startViewMatrix);\n\t\t\t\tstartViewMatrix.get(positionVector);\n\t\t\t\t\n\t\t\t\tpositionVector.x -= centerOfRotation.x;\n\t\t\t\tpositionVector.y -= centerOfRotation.y;\n\t\t\t\tpositionVector.z -= centerOfRotation.z;\n\t\t\t\t\n\t\t\t\tif (theta_Y != 0) {\n\n\t\t\t\t\trot.set(0, 1, 0, (float)theta_Y);\n\t\t\t\t\tmtx.set(rot);\n\t\t\t\t\tmtx.transform(positionVector);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (theta_X != 0) {\n\t\t\t\t\t\n\t\t\t\t\tvec.set(positionVector);\n\t\t\t\t\tvec.normalize();\n\t\t\t\t\tfloat angle = vec.angle(Y_AXIS);\n\t\t\t\t\t\n\t\t\t\t\tif (angle == 0) {\n\t\t\t\t\t\tif (theta_X > 0) {\n\t\t\t\t\t\t\trightVector.x = startViewMatrix.m00;\n\t\t\t\t\t\t\trightVector.y = startViewMatrix.m10;\n\t\t\t\t\t\t\trightVector.z = startViewMatrix.m20;\n\t\t\t\t\t\t\trightVector.normalize();\n\t\t\t\t\t\t\trot.set(rightVector.x, 0, rightVector.z, (float)theta_X);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trot.set(0, 0, 1, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ((theta_X + angle) < 0) {\n\t\t\t\t\t\t\ttheta_X = -(angle - 0.0001f);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvec.y = 0;\n\t\t\t\t\t\tvec.normalize();\n\t\t\t\t\t\trot.set(vec.z, 0, -vec.x, (float)theta_X);\n\t\t\t\t\t}\n\t\t\t\t\tmtx.set(rot);\n\t\t\t\t\tmtx.transform(positionVector);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tpositionPoint.x = positionVector.x + centerOfRotation.x;\n\t\t\t\tpositionPoint.y = positionVector.y + centerOfRotation.y;\n\t\t\t\tpositionPoint.z = positionVector.z + centerOfRotation.z;\n\t\t\t\t\n\t\t\t\t// don't go below the floor\n\t\t\t\tif (positionPoint.y > 0) {\n\t\t\t\t\t\n\t\t\t\t\tmatrixUtils.lookAt(positionPoint, centerOfRotation, Y_AXIS, destViewMatrix);\n\t\t\t\t\tmatrixUtils.inverse(destViewMatrix, destViewMatrix);\n\t\t\t\t\t\n\t\t\t\t\tprocessMove = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (processMove) {\n\t\t\t\n\t\t\tboolean collisionDetected = \n\t\t\t\tcollisionManager.checkCollision(startViewMatrix, destViewMatrix);\n\t\t\t\n\t\t\tif (!collisionDetected) {\n\t\t\t\tAV3DUtils.toArray(destViewMatrix, array);\n\t\t\t\tChangePropertyTransientCommand cptc = new ChangePropertyTransientCommand(\n\t\t\t\t\tve, \n\t\t\t\t\tEntity.DEFAULT_ENTITY_PROPERTIES, \n\t\t\t\t\tViewpointEntity.VIEW_MATRIX_PROP,\n\t\t\t\t\tarray,\n\t\t\t\t\tnull);\n\t\t\t\tcmdCntl.execute(cptc);\n\t\t\t\tif (statusManager != null) {\n\t\t\t\t\tstatusManager.fireViewMatrixChanged(destViewMatrix);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstartPosition[0] = currentPosition[0];\n\t\tstartPosition[1] = currentPosition[1];\n\t\tstartPosition[2] = currentPosition[2];\n\t}" ]
[ "0.63524884", "0.6199894", "0.6198574", "0.61760813", "0.6099999", "0.6026032", "0.5986196", "0.59773237", "0.59629214", "0.59602845", "0.59578264", "0.59531003", "0.5915632", "0.5912794", "0.5905117", "0.5896838", "0.5875451", "0.5874661", "0.5833867", "0.58014095", "0.5800436", "0.5794495", "0.5766055", "0.5759337", "0.57503015", "0.57338995", "0.57258993", "0.5724669", "0.56812173", "0.5677347", "0.56740195", "0.566532", "0.56638503", "0.56590897", "0.56406766", "0.5640397", "0.5624505", "0.5623079", "0.56191534", "0.561731", "0.56057525", "0.5600034", "0.5595745", "0.55909497", "0.55871356", "0.5586363", "0.55855054", "0.5582125", "0.55753034", "0.5574188", "0.5571482", "0.5567707", "0.5564736", "0.55632496", "0.55623364", "0.5560776", "0.55576015", "0.555484", "0.5532118", "0.5524918", "0.5518414", "0.5515047", "0.5498325", "0.5490007", "0.5489204", "0.5476861", "0.54734945", "0.547106", "0.5470741", "0.54667705", "0.54659736", "0.54562855", "0.5455904", "0.5455682", "0.54549223", "0.5451356", "0.54461116", "0.5440688", "0.5437186", "0.543703", "0.54311615", "0.54290944", "0.5425596", "0.5425595", "0.542214", "0.5418416", "0.5416267", "0.54151255", "0.5411619", "0.5410566", "0.53989714", "0.5392662", "0.5391044", "0.5389526", "0.53835076", "0.53792703", "0.53749394", "0.5370175", "0.5367271", "0.5366783" ]
0.5493195
63
Method to obtain & hold a heading for a finite amount of time Move will stop once the requested time has elapsed
public void gyroHold( double speed, double angle, double holdTime) { ElapsedTime holdTimer = new ElapsedTime(); // keep looping while we have time remaining. holdTimer.reset(); while (opModeIsActive() && (holdTimer.time() < holdTime)) { // Update telemetry & Allow time for other processes to run. onHeading(speed, angle, P_TURN_COEFF); telemetry.update(); } // Stop all motion; robot.leftDrive.setPower(0); robot.rightDrive.setPower(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void move(int elapsedTime);", "public double getRolledHeading() {\n double heading = 360.0 - getRawHeading();\n if (lastHeading < 100 && heading > 300) {\n rotationAmt--;\n } else if (heading < 100 && lastHeading > 300) {\n rotationAmt++;\n }\n lastHeading = heading;\n return heading + rotationAmt * 360.0;\n }", "double getHeadingDiff(double init_h) {\n double curr_h = getHeading();\n double diff_h = init_h - curr_h;\n if( diff_h>=360.0 ) diff_h -= 360.0;\n else if( diff_h<=-360.0 ) diff_h += 360.0;\n return diff_h ;\n }", "public void timePassed() {\n if (keyboard.isPressed(KeyboardSensor.LEFT_KEY) && keyboard.isPressed(KeyboardSensor.RIGHT_KEY)) {\n return;\n } else if (keyboard.isPressed(KeyboardSensor.LEFT_KEY)) {\n moveLeft();\n\n } else if (keyboard.isPressed(KeyboardSensor.RIGHT_KEY)) {\n moveRight();\n }\n }", "public void timePassed() {\n this.moveOneStep();\n }", "@Override\n public void step(double deltaTime) {\n // wheel radius, in meters\n double wheelCircumference = 2 * simulatorConfig.driveBase.wheelRadius * Math.PI;\n\n double leftRadians = 0;\n double rightRadians = 0;\n for (SimMotor simMotor : motorStore.getSimMotorsSorted()) {\n if (simMotor.isLeftDriveMotor()) {\n leftRadians = simMotor.position / simulatorConfig.driveBase.gearRatio;\n } else if (simMotor.isRightDriveMotor()) {\n rightRadians = simMotor.position / simulatorConfig.driveBase.gearRatio;\n }\n }\n\n // invert the left side because forward motor movements mean backwards wheel movements\n rightRadians = -rightRadians;\n\n double currentLinearRadians = (leftRadians + rightRadians) / 2;\n\n double deltaRadians = currentLinearRadians - lastLinearRadians;\n double metersPerRadian = wheelCircumference / (Math.PI * 2);\n double deltaLinearPosition = deltaRadians * metersPerRadian;\n double newHeading = ((leftRadians - rightRadians) * metersPerRadian / simulatorConfig.driveBase.radius);\n\n // for next loop\n lastLinearRadians = currentLinearRadians;\n\n robotPosition.heading = newHeading + startHeading;\n\n robotPosition.velocity = deltaLinearPosition / deltaTime;\n robotPosition.x += deltaLinearPosition * Math.sin(robotPosition.heading);\n robotPosition.y += deltaLinearPosition * Math.cos(robotPosition.heading);\n\n SimNavX simNavX = SimSPI.getNavX(SPI.Port.kMXP.value);\n if (simNavX != null) {\n float degrees = (float)((robotPosition.heading - simulatorConfig.startPosition.heading) * 360 / (Math.PI * 2));\n\n // degrees are between 0 and 360\n if (degrees < 0) {\n degrees = 360 - (Math.abs(degrees) % 360);\n } else {\n degrees = degrees % 360;\n }\n simNavX.heading = degrees;\n }\n\n }", "void MoveTimed( double power, double theta_degrees, double t_secs, boolean set_gTheta){\n if( set_gTheta ) gTheta = getAngle();\n \n double t_start = getRuntime();\n while ( opModeIsActive() ) {\n \n GoDir( power, theta_degrees );\n \n Position pos = imu.getPosition();\n \n double t_elapsed = getRuntime()-t_start;\n telemetry.addData(\"T remaining\", t_secs-t_elapsed);\n telemetry.addData(\"delta Theta\", getAngle() - gTheta);\n telemetry.addData(\"encoder\", leftDrive.getCurrentPosition());\n telemetry.update();\n if ( t_elapsed >= t_secs ) break;\n }\n\n topDrive.setPower( 0 );\n leftDrive.setPower( 0 );\n rightDrive.setPower( 0 );\n }", "public void move(float deltaTime) {\n }", "private void setNPCInitialHeading()\n {\n float alpha = (float) (Math.PI/2 - Math.atan2(end.getZ()-begin.getZ(), end.getX()-begin.getX()));\n npc.setAngle(alpha);\n npc.setSpeed(NPC.walkSpeed);//this automatically sets the \"walk\" anim so no need for this line:\n //npc.setAnimation(\"walk\");\n npc.setHeadingUpdateTime();\n }", "public static void move()\n\t{\n\t\tswitch(step)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\ttimer.start();\n\t\t\t\tstep = 1;\n\t\t\tbreak;\n\t\t\t// 1. Right wheels forward\n\t\t\tcase 1:\n\t\t\t\tif(timer.get() < time)\n\t\t\t\t{\n\t\t\t\t\tsetSpeed(0, .5);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttimer.reset();\n\t\t\t\t\tstep = 2;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\ttimer.start();\n\t\t\t\tstep = 3;\n\t\t\tbreak;\n\t\t\t// 2. Right wheels back\n\t\t\tcase 3:\n\t\t\t\tif(timer.get() < time)\n\t\t\t\t{\n\t\t\t\t\tsetSpeed(0, -.5);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttimer.reset();\n\t\t\t\t\tstep = 4;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\ttimer.start();\n\t\t\t\tstep = 5;\n\t\t\tbreak;\n\t\t\t// 3. Left wheels forward\n\t\t\tcase 5:\n\t\t\t\tif(timer.get() < time)\n\t\t\t\t{\n\t\t\t\t\tsetSpeed(.5, 0);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttimer.reset();\n\t\t\t\t\tstep = 6;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\ttimer.start();\n\t\t\t\tstep = 7;\n\t\t\tbreak;\n\t\t\t// 4. Left wheels back\n\t\t\tcase 7:\n\t\t\t\tif(timer.get() < time)\n\t\t\t\t{\n\t\t\t\t\tsetSpeed(-.5, 0);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttimer.reset();\n\t\t\t\t\tstep = 8;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\ttimer.start();\n\t\t\t\tstep = 9;\n\t\t\tbreak;\n\t\t\t// 5. Intake pick up\n\t\t\tcase 9:\n\t\t\t\tif(timer.get() < time)\n\t\t\t\t{\n\t\t\t\t\tsetSpeed(0, 0);\n\t\t\t\t\tshoot(.5);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttimer.reset();\n\t\t\t\t\tstep = 10;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 10:\n\t\t\t\ttimer.start();\n\t\t\t\tstep = 11;\n\t\t\tbreak;\n\t\t\t// 6. Intake shoot\n\t\t\tcase 11:\n\t\t\t\tif(timer.get() < time)\n\t\t\t\t{\n\t\t\t\t\tsetSpeed(0, 0);\n\t\t\t\t\tpickUp(.5);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttimer.reset();\n\t\t\t\t\tstep = 12;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\t// Stop and reset everything\n\t\t\tcase 12:\n\t\t\t\tsetSpeed(0, 0);\n\t\t\t\tpickUp(0);\n\t\t\t\tshoot(0);\n\t\t\t\ttimer.reset();\n\t\t\tbreak;\n\t\t}\n\t}", "@Override\n public void timePassed() {\n moveOneStep();\n }", "float getHeading();", "float getHeading();", "float getHeading();", "double getHeading() {\n if( CACHE_IMU_READING && loop_cnt_==last_imu_read_loop_id_ ) {\n // return the existing heading when getHeading() is called in the same loop\n return heading_ ;\n }\n\n heading_ = 0;\n if( USE_IMU && imu_!=null && imu_init_ok_ ) {\n imu_angles_ = imu_.getAngularOrientation().toAxesReference(AxesReference.INTRINSIC).toAxesOrder(AxesOrder.ZYX); // acquiring angles are expensive, keep it minimal\n // IMU can automatically detect orientation, and return heading as first angle, 2020/01/25\n heading_ = AngleUnit.DEGREES.normalize(imu_angles_.firstAngle);\n last_imu_read_loop_id_ = loop_cnt_;\n } else if( USE_IMU2 && imu2_!=null && imu2_init_ok_ ) {\n // use IMU2 if IMU failed\n imu2_angles_ = imu2_.getAngularOrientation().toAxesReference(AxesReference.INTRINSIC).toAxesOrder(AxesOrder.ZYX);\n heading_ = AngleUnit.DEGREES.normalize(imu2_angles_.firstAngle);\n last_imu_read_loop_id_ = loop_cnt_;\n }\n return heading_;\n }", "public int heading() {\n\t\theading = heading + 5;\n\t\tif (heading >= 359) {\n\t\t\t//Setting the heading to 0\n\t\t\tsetHeading(0);\n\t\t}\n\t\t//Returning the heading\n\t\treturn heading;\n\t}", "public void turnLeft()\r\n\t{\r\n\t\t\r\n\t\theading -= 2; //JW\r\n\t\t//Following the camera:\r\n\t\t\t//heading -= Math.sin(Math.toRadians(15))*distance; \r\n\t\t\t//heading -= Math.cos(Math.toRadians(15))*distance;\r\n\t}", "private boolean onHeading(double speed, double angle, double PCoeff) {\n double error;\n double steer;\n boolean onTarget = false;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n } else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n robot.DriveLeft1.setPower(leftSpeed);\n robot.DriveRight1.setPower(rightSpeed);\n robot.DriveLeft2.setPower(leftSpeed);\n robot.DriveRight2.setPower(rightSpeed);\n /*\n // Display it for the driver.\n telemetry.addData(\"Target\", \"%5.2f\", angle);\n telemetry.addData(\"Err/St\", \"%5.2f/%5.2f\", error, steer);\n telemetry.addData(\"Speed.\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n\n\n */\n return onTarget;\n }", "boolean onHeading(double speed, double angle, double PCoeff) {\n double error ;\n double steer ;\n boolean onTarget = false ;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n }\n else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n robot.leftDrive.setPower(leftSpeed);\n robot.rightDrive.setPower(rightSpeed);\n\n // Display it for the driver.\n telemetry.addData(\"Target\", \"%5.2f\", angle);\n telemetry.addData(\"Err/St\", \"%5.2f/%5.2f\", error, steer);\n telemetry.addData(\"Speed.\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n\n return onTarget;\n }", "public void setHeading() {\n super.setHeading(getPrevious().getHeadingTo(this)); //The absolute angle position that robot needs to face to reach this position\n }", "double normalizeHeading(double h) {\n double nh = h;\n if( h>-180 && h<180 ) {\n } else if( h <= -180 ) {\n nh = h+360;\n } else if( h > 180 ) {\n nh = h-360;\n }\n return nh;\n }", "boolean onHeading(double speed, double angle, double PCoeff) {\n double error ;\n double steer ;\n boolean onTarget = false ;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n }\n else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n leftMotor.setPower(leftSpeed);\n rightMotor.setPower(rightSpeed);\n\n // Display it for the driver.\n telemetry.addData(\"Target\", \"%5.2f\", angle);\n telemetry.addData(\"Err/St\", \"%5.2f/%5.2f\", error, steer);\n telemetry.addData(\"Speed.\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n\n return onTarget;\n }", "boolean onHeading(double speed, double angle, double PCoeff) {\n double error ;\n double steer ;\n boolean onTarget = false ;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n }\n else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n leftmotor.setPower(leftSpeed);\n rightmotor.setPower(rightSpeed);\n\n return onTarget;\n }", "private float getHeading() {\n Orientation anglesA = robot.imu.getAngularOrientation(\n AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);\n return AngleUnit.DEGREES.normalize(\n AngleUnit.DEGREES.fromUnit(anglesA.angleUnit, anglesA.firstAngle));\n }", "public float getTimeToMove()\n\t{\n\t\treturn this.timeToMove;\n\t}", "private static double calcHeading(double angleA, double angleB) { \n\t\t\n\t\tdouble heading;\n\t\t\n\t\tif (angleA < angleB){\n\t\t\theading = 45 - (angleA + angleB) /2 ;\n\t\t}else {\n\t\t\theading = 225 - (angleA + angleB) /2 ;\t\n\t\t}\n\t\treturn heading;\n\t}", "public float getHeading() {\n return heading_;\n }", "public float getHeading() {\n return heading_;\n }", "public void timePassed(double dt) {\r\n this.moveOneStep(dt);\r\n }", "public static double getHeading(double heading) {\n double newHeading;\n if (heading >=0.0 && heading < 90.0)\n newHeading = -1.0;\n else if (heading >= 90.0 && heading < 180.0)\n newHeading = -0.33;\n else if (heading >= 180.0 && heading < 270.0)\n newHeading = 0.33;\n else if (heading >= 270.0 && heading < 360.0)\n newHeading = 1.0;\n else\n newHeading = -1.0;\n return newHeading;\n }", "public float getHeading() {\n return heading_;\n }", "public void timePassed(double dt) {\r\n moveOneStep(dt);\r\n }", "public Direction getCurrentHeading()\r\n\t{\r\n\t\treturn this.currentDirection;\r\n\t\t\r\n\t}", "public double getHeadingInDegrees(){\r\n double headingRadians = calculateHeadingRadians();\r\n return headingRadians * 180 / Math.PI;\r\n }", "private void driveForwardTimer()\r\n\t{\r\n\t\tif(timer.get() < Config.Auto.timeDriveForward){\r\n\t\t\tdrive.setSpeed(0, 0, Config.Auto.driveForwardSpeed, Config.Auto.driveForwardSpeed);\r\n\t\t\tSystem.out.println(timer.get());}\r\n\t\t\r\n\t\telse\r\n\t\t{\r\n\t\t\tdrive.setSpeed(0, 0, 0, 0);\r\n\t\t\tautoStep++;\r\n\t\t}\r\n\t}", "public void gyroHold( double speed, double angle, double holdTime) {\n\n ElapsedTime holdTimer = new ElapsedTime();\n\n // keep looping while we have time remaining.\n holdTimer.reset();\n while ((holdTimer.time() < holdTime)) {\n // Update telemetry & Allow time for other processes to run.\n onHeading(speed, angle, P_TURN_COEFF);\n try {\n sleep(50);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n\n }\n\n // Stop all motion;\n leftmotor.setPower(0);\n rightmotor.setPower(0);\n }", "public void idle(double deltaTime) {\n\n\n float distance = distanceCalc();\n if (distance < 10000) {\n homing();\n } else {\n idleMovement -= deltaTime;\n\n Random rand = new Random();\n int directionNum = rand.nextInt((4 - 1) + 1) + 1;\n\n if (directionNum == 1) {\n yPos -= speed * deltaTime;\n idleMovement = idleRate;\n }\n if (directionNum == 2) {\n yPos += speed * deltaTime;\n idleMovement = idleRate;\n }\n if (directionNum == 3) {\n xPos -= speed * deltaTime;\n idleMovement = idleRate;\n }\n if (directionNum == 4) {\n xPos += speed * deltaTime;\n idleMovement = idleRate;\n }\n }\n }", "public void timePassed(double dt) {\r\n if (keyboard.isPressed(KeyboardSensor.RIGHT_KEY)) {\r\n moveRight(dt);\r\n }\r\n if (keyboard.isPressed(KeyboardSensor.LEFT_KEY)) {\r\n moveLeft(dt);\r\n }\r\n }", "public float getHeading() {\n return heading_;\n }", "public int TakeStep()\n\t\t{\n\t\t// the eventual movement command is placed here\n\t\tVec2\tresult = new Vec2(0,0);\n\n\t\t// get the current time for timestamps\n\t\tlong\tcurr_time = abstract_robot.getTime();\n\n\n\t\t/*--- Get some sensor data ---*/\n\t\t// get vector to the ball\n\t\tVec2 ball = abstract_robot.getBall(curr_time);\n\n\t\t// get vector to our and their goal\n\t\tVec2 ourgoal = abstract_robot.getOurGoal(curr_time);\n\t\tVec2 theirgoal = abstract_robot.getOpponentsGoal(curr_time);\n\n\t\t// get a list of the positions of our teammates\n\t\tVec2[] teammates = abstract_robot.getTeammates(curr_time);\n\n\t\t// find the closest teammate\n\t\tVec2 closestteammate = new Vec2(99999,0);\n\t\tfor (int i=0; i< teammates.length; i++)\n\t\t\t{\n\t\t\tif (teammates[i].r < closestteammate.r)\n\t\t\t\tclosestteammate = teammates[i];\n\t\t\t}\n\n\n\t\t/*--- now compute some strategic places to go ---*/\n\t\t// compute a point one robot radius\n\t\t// behind the ball.\n\t\tVec2 kickspot = new Vec2(ball.x, ball.y);\n\t\tkickspot.sub(theirgoal);\n\t\tkickspot.setr(abstract_robot.RADIUS);\n\t\tkickspot.add(ball);\n\n\t\t// compute a point three robot radii\n\t\t// behind the ball.\n\t\tVec2 backspot = new Vec2(ball.x, ball.y);\n\t\tbackspot.sub(theirgoal);\n\t\tbackspot.setr(abstract_robot.RADIUS*5);\n\t\tbackspot.add(ball);\n\n\t\t// compute a north and south spot\n\t\tVec2 northspot = new Vec2(backspot.x,backspot.y+0.7);\n\t\tVec2 southspot = new Vec2(backspot.x,backspot.y-0.7);\n\n\t\t// compute a position between the ball and defended goal\n\t\tVec2 goaliepos = new Vec2(ourgoal.x + ball.x,\n\t\t\t\tourgoal.y + ball.y);\n\t\tgoaliepos.setr(goaliepos.r*0.5);\n\n\t\t// a direction away from the closest teammate.\n\t\tVec2 awayfromclosest = new Vec2(closestteammate.x,\n\t\t\t\tclosestteammate.y);\n\t\tawayfromclosest.sett(awayfromclosest.t + Math.PI);\n\n\n\t\t/*--- go to one of the places depending on player num ---*/\n\t\tint mynum = abstract_robot.getPlayerNumber(curr_time);\n\n\t\t/*--- Goalie ---*/\n\t\tif (mynum == 0)\n\t\t\t{\n\t\t\t// go to the goalie position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = goaliepos;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.1) \n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\t/*--- midback ---*/\n\t\telse if (mynum == 1)\n\t\t\t{\n\t\t\t// go to a midback position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = backspot;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.30) \n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse if (mynum == 2)\n\t\t\t{\n\t\t\t// go to a the northspot position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = northspot;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.30) \n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse if (mynum == 4)\n\t\t\t{\n\t\t\t// go to a the northspot position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = southspot;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.3 )\n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\t/*---Lead Forward ---*/\n\t\telse if (mynum == 3)\n\t\t\t{\n\t\t\t// if we are more than 4cm away from the ball\n\t\t\tif (ball.r > .3)\n\t\t\t\t// go to a good kicking position\n\t\t\t\tresult = kickspot;\n\t\t\telse\n\t\t\t\t// go to the ball\n\t\t\t\tresult = ball;\n\t\t\t}\n\n\n\t\t/*--- Send commands to actuators ---*/\n\t\t// set the heading\n\t\tabstract_robot.setSteerHeading(curr_time, result.t);\n\n\t\t// set speed at maximum\n\t\tabstract_robot.setSpeed(curr_time, 1.0);\n\n\t\t// kick it if we can\n\t\tif (abstract_robot.canKick(curr_time))\n\t\t\tabstract_robot.kick(curr_time);\n\n\t\t/*--- Send message to other robot ---*/\n\t\t// COMMUNICATION\n\t\t// if I can kick\n\t\tif (abstract_robot.canKick(curr_time))\n\t\t\t{\n\t\t\t// and I am robot #3\n\t\t\tif ((mynum==3))\n\t\t\t\t{\n\t\t\t\t// construct a message\n\t\t\t\tStringMessage m = new StringMessage();\n\t\t\t\tm.val = (new Integer(mynum)).toString();\n\t\t\t\tm.val = m.val.concat(\" can kick\");\n\n\t\t\t\t// send the message to robot 2\n\t\t\t\t// note: broadcast and multicast are also\n\t\t\t\t// available.\n\t\t\t\ttry{abstract_robot.unicast(2,m);}\n\t\t\t\tcatch(CommunicationException e){}\n\t\t\t\t}\n\t\t\t}\n\n\t\t/*--- Look for incoming messages ---*/\n\t\t//COMMUNICATION\n\t\twhile (messagesin.hasMoreElements())\n\t\t\t{\n\t\t\tStringMessage recvd = \n\t\t\t\t(StringMessage)messagesin.nextElement();\n\t\t\tSystem.out.println(mynum + \" received:\\n\" + recvd);\n\t\t\t}\n\n\t\t// tell the parent we're OK\n\t\treturn(CSSTAT_OK);\n\t\t}", "public void timePassed(double dt) {\n this.moveOneStep(dt);\n }", "public void move()\n {\n move(WALKING_SPEED);\n }", "@Override\n\tpublic void move() {\n\t\theading = Heading.randHeading();\n\t\tif (heading == Heading.NORTH) {\n\t\t\tthis.location.y -= Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t} else if (heading == Heading.EAST) {\n\t\t\tthis.location.x += Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t} else if (heading == Heading.SOUTH) {\n\t\t\tthis.location.y += Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t} else if (heading == Heading.WEST) {\n\t\t\tthis.location.x -= Utilities.rng.nextInt(Simulation.WORLD_SIZE/10);\n\t\t}\n\t\tadjustPos();\n\t\tinfect();\n\t}", "public abstract void advance(double deltaTime);", "public float getHeading() {\n return heading_;\n }", "public float getHeading() {\n return heading_;\n }", "void move( float deltaTime, Body body );", "void move(float tpf);", "public float calculateIdealHeading(double currentHeading, Vector2 target) {\n\t\tdouble delta_x = target.x() - position.x();\r\n\t\tdouble delta_y = target.y() - position.y();\r\n\t\tdouble idealAngle = Math.toDegrees(Math.atan(delta_x / delta_y));\r\n\t\treturn (float)idealAngle;\r\n\t}", "public double turn (double degrees) {\n setHeading(getHeading() + degrees);\n return Math.abs(degrees);\n }", "public void movePower(String movement, double power, double duration)\n {\n double startTime = getRuntime();\n switch(movement)\n {\n case \"forward\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power);\n robot.FR_drive.setPower(power * -1);\n robot.BL_drive.setPower(power);\n robot.BR_drive.setPower(power * -1);\n }\n break;\n\n case \"backward\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power * -1);\n robot.FR_drive.setPower(power);\n robot.BL_drive.setPower(power * -1);\n robot.BR_drive.setPower(power);\n }\n break;\n\n case \"right\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power);\n robot.FR_drive.setPower(power);\n robot.BL_drive.setPower(power * -1);\n robot.BR_drive.setPower(power * -1);\n }\n break;\n\n case \"left\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power * -1);\n robot.FR_drive.setPower(power * -1);\n robot.BL_drive.setPower(power);\n robot.BR_drive.setPower(power);\n }\n break;\n\n case \"leftTurn\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power);\n robot.FR_drive.setPower(power);\n robot.BL_drive.setPower(power);\n robot.BR_drive.setPower(power);\n }\n break;\n\n case \"rightTurn\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power * -1);\n robot.FR_drive.setPower(power * -1);\n robot.BL_drive.setPower(power * -1);\n robot.BR_drive.setPower(power * -1);\n }\n break;\n }\n stop();\n }", "@Override\n\tpublic void move() {\n\t\ttry {\n\t\t\tTimeUnit.SECONDS.sleep(new Random().nextInt(5));\n\t\t} catch (InterruptedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tSystem.out.println(\"Tank moving...\");\n\t}", "public TowardsMovement(int waitPeriod, Vector targ) {\n\t\tsuper(waitPeriod);\n\t\ttarget = targ;\n\t}", "@Override\n\t\tpublic final double time() throws Throwable {\n\t\t\tinit();\n\t\t\ttimer.lap();\n\t\t\ttimed();\n\t\t\tdouble time = timer.lap();\n\t\t\tcleanup();\n\t\t\treturn time;\n\t\t}", "public float calculateDeltaIdealHeading(double currentHeading, Vector2 target) {\r\n\t\t//first calculate the angle from here to the target\r\n\t\tdouble delta_x = target.x() - position.x();\r\n\t\tdouble delta_y = target.y() - position.y();\r\n\t\tdouble idealAngle = Math.toDegrees(Math.atan(delta_x / delta_y));\r\n\t\tdouble deltaAngle = idealAngle - currentHeading;\r\n\t\treturn (float)deltaAngle;\r\n\t}", "public void engage(ScannedRobotEvent e){\r\n setTurnRight(e.getBearing());\r\n setAhead(e.getDistance() + 5);\r\n \r\n //tell where it is heading\r\n fire(1);\r\n }", "public double calculateHeadingRadians(){\r\n if(coordinateHistory.size() > 2){\r\n GPSCoordinate firstPoint = coordinateHistory.get(coordinateHistory.size() - 2);\r\n GPSCoordinate secondPoint = coordinateHistory.get(coordinateHistory.size() - 1);\r\n \r\n if(!firstPoint.compareTo(secondPoint)){\r\n double latA = firstPoint.getLatitude();\r\n double longA = firstPoint.getLongitude();\r\n double latB = secondPoint.getLatitude();\r\n double longB = secondPoint.getLongitude();\r\n\r\n double X = Math.cos(latB) * Math.sin(longB - longA);\r\n double Y = (Math.cos(latA) * Math.sin(latB)) - (Math.sin(latA) * Math.cos(latB) * Math.cos(longB - longA));\r\n\r\n headingRadians = - Math.atan2(X, Y);\r\n return headingRadians;\r\n }else{\r\n return headingRadians;\r\n }\r\n }else{\r\n return headingRadians;\r\n }\r\n }", "public abstract void tilt(long ms);", "public void gyroTurn ( double speed, double angle, double timeoutS) {\n\n eTime.reset();\n\n // keep looping while we are still active, and not on heading.\n while (opModeIsActive() && (eTime.seconds() < timeoutS) && !onHeading(speed, angle, P_TURN_COEFF)) {\n // Update telemetry & Allow time for other processes to run.\n telemetry.update();\n }\n }", "public TimedTurn(double timeout, double angleSetpoint) {\n super(timeout);\n angle = angleSetpoint;\n // Use requires() here to declare subsystem dependencies\n // eg. requires(chassis);\n }", "public double getHeading() {\n return Rotation2d.fromDegrees(m_gyro.getAngle()).getDegrees();\n }", "public abstract void move(int direction, double speed);", "public void gyroHold(double speed, double angle, double holdTime) {\n\n ElapsedTime holdTimer = new ElapsedTime();\n\n // keep looping while we have time remaining.\n holdTimer.reset();\n while (opModeIsActive() && (holdTimer.time() < holdTime)) {\n // Update telemetry & Allow time for other processes to run.\n onHeading(speed, angle, P_TURN_COEFF);\n //telemetry.update();\n }\n\n // Stop all motion;\n robot.DriveLeft1.setPower(0);\n robot.DriveRight1.setPower(0);\n robot.DriveLeft2.setPower(0);\n robot.DriveRight2.setPower(0);\n }", "public void gyroHold( double speed, double angle, double holdTime) {\n\n ElapsedTime holdTimer = new ElapsedTime();\n\n // keep looping while we have time remaining.\n holdTimer.reset();\n while (opModeIsActive() && (holdTimer.time() < holdTime)) {\n // Update telemetry & Allow time for other processes to run.\n onHeading(speed, angle, P_TURN_COEFF);\n telemetry.update();\n }\n\n // Stop all motion;\n leftMotor.setPower(0);\n rightMotor.setPower(0);\n }", "@Override\r\n\tpublic void doTimeStep() {\n\t\tdir = Critter.getRandomInt(8);\r\n\t\t\r\n\t\tnumSteps = Critter.getRandomInt(maxStep) + 1;\r\n\t\t\r\n\t\t//go a random number of steps in that direction\r\n\t\tfor(int i = 0; i < numSteps; i++) {\r\n\t\t\twalk(dir);\r\n\t\t}\t\t\r\n\t}", "void move(int steps);", "public int getTurnaround (){\n return finishingTime-arrival_time;\n }", "public Rotation2d getHeading() {\n return Rotation2d.fromDegrees(Math.IEEEremainder(gyro.getAngle(), 360) * (Const.kGyroReversed ? -1.0 : 1.0));\n }", "Double getRemainingTime();", "public abstract void timeStep(char currCommand, World world);", "public void setTimeToMove(float time_)\n\t{\n\t\tthis.timeToMove=time_;\n\t}", "@Override\n public void specialUpdate(double time) {\n if(relativeAngle > maxAngle) {\n angleDirection = -1;\n }\n if(relativeAngle < minAngle) {\n angleDirection = 1;\n }\n relativeAngle += angleDirection * BODY_MEMBER_MOVING_SPEED * time * (person.getCurrentSpeed() / 2.0);\n }", "public void moveForward()\r\n\t{\r\n\t\tif(loc[1] > 1)\r\n\t\t{\r\n\t\t\tthis.loc[0] -= Math.sin(Math.toRadians(heading-90))*distance; \r\n\t\t\tthis.loc[2] -= Math.cos(Math.toRadians(heading-90))*distance;\r\n\t\t}\r\n\t}", "private long calcRotTime (int newSector)\r\n\t{\r\n\t\t//\tCompute number of sectors to wait until we rotate to where\r\n\t\t//\twe should be.\r\n\t\tint moveSect = newSector - this.sector;\r\n\t\t//\tIf newSector < currSector, adjust from negative.\r\n\t\tif (moveSect < 0) moveSect += config.getSectors();\r\n\t\t//\tCompute time to rotate into position.\r\n\t\tlong moveTime = Math.round(moveSect * config.getRotSect());\r\n\t\treturn moveTime;\r\n\t}", "public void move(long deltaTime) {\n\n Point currentTile = getOccupyingTile(position);\n\n /*\n if (!Simulator.getInstance().getTileMap().isInsideMap(currentTile))\n return;\n\n if (Simulator.getInstance().getTileMap().isAWall(currentTile) || Simulator.getInstance().getDestination().getDistanceMap().isNotInitialized(currentTile))\n return;\n*/\n\n if (Simulator.getInstance().getDestination().getDistanceMap().isNotInitialized(currentTile))\n return;\n\n setTargetVector(Simulator.getInstance().getDestination().getDistanceMap().getTiles()[currentTile.y][currentTile.x].getVector());\n\n\n if (!Simulator.getInstance().getDestination().getDistanceMap().isNotInitialized(currentTile) && Simulator.getInstance().getDestination().getDistanceMap().getTiles()[currentTile.y][currentTile.x].getVector().equals(new Point2D.Double(0.0, 0.0))) {\n setTargetVector(Simulator.getInstance().getDestination().getDistanceMap().getTiles()[currentTile.y][currentTile.x].getVector());\n double angle = 0;\n while ((angle >= 60 && angle <= 120) || (angle >= 150 && angle <= 210) || (angle >= 240 && angle <= 300) || (angle >= 330) || (angle <= 30)) {\n\n angle = Math.random() * 360;\n }\n setVector(new Point2D.Double(Math.cos(Math.toRadians(angle)) / 1.5, Math.sin(Math.toRadians(angle)) / 1.5));\n } else {\n setTargetVector(Simulator.getInstance().getDestination().getDistanceMap().getTiles()[currentTile.y][currentTile.x].getVector());\n }\n\n\n Point2D vectorDiff = new Point2D.Double(vector.getX() - targetVector.getX(), vector.getY() - targetVector.getY());\n\n if (vectorDiff.getX() < 0)\n vector.setLocation(vector.getX() + 0.001 * velocity * deltaTime, vector.getY());\n else if (vectorDiff.getX() > 0)\n vector.setLocation(vector.getX() - 0.001 * velocity * deltaTime, vector.getY());\n\n if (vectorDiff.getY() < 0)\n vector.setLocation(vector.getX(), vector.getY() + 0.001 * velocity * deltaTime);\n else if (vectorDiff.getY() > 0)\n vector.setLocation(vector.getX(), vector.getY() - 0.001 * velocity * deltaTime);\n\n\n Point2D newPosition = new Point2D.Double(\n position.getX() + (velocity * deltaTime) * vector.getX(), position.getY() + (velocity * deltaTime) * vector.getY());\n\n\n Point targetTile = getOccupyingTile(newPosition);\n\n\n Point direction = getDirection(currentTile, targetTile);\n\n\n if (!Simulator.getInstance().getTileMap().isInsideMap(targetTile) || Simulator.getInstance().getTileMap().isAWall(targetTile)\n || Simulator.getInstance().getDestination().getDistanceMap().isNotInitialized(targetTile)) {// || Simulator.getInstance().getDestination().getDistanceMap().getTiles()[targetTile.y][targetTile.x].getVector() == new Point2D.Double(0, 0)) {\n\n if (Simulator.getInstance().isUsingBounceCollision()) {\n if (direction.x > 0 || direction.x < 0)\n vector.setLocation(vector.getX() * -0.5, vector.getY());\n if (direction.y > 0 || direction.y < 0)\n vector.setLocation(vector.getX(), vector.getY() * -0.5);\n\n newPosition = new Point2D.Double(\n position.getX() + (velocity * deltaTime) * vector.getX(), position.getY() + (velocity * deltaTime) * vector.getY());\n\n\n targetTile = getOccupyingTile(newPosition);\n\n //Secondary check to make sure the bounce doesn't make it go out of bounds\n if (!Simulator.getInstance().getTileMap().isInsideMap(targetTile) || Simulator.getInstance().getTileMap().isAWall(targetTile)\n || Simulator.getInstance().getDestination().getDistanceMap().isNotInitialized(targetTile)) { //|| Simulator.getInstance().getDestination().getDistanceMap().getTiles()[targetTile.y][targetTile.x].getVector() == new Point2D.Double(0, 0)) {\n vector.setLocation(0, 0);\n } else {\n setPosition(newPosition);\n }\n\n\n } else {\n vector.setLocation(0, 0);\n }\n\n } else {\n setPosition(newPosition);\n }\n\n }", "public void moveAhead(int time) {\n\t\tdouble rotationInRadius = rotation * (Math.PI / 180.0);\r\n\t\tposition.addVector(new DoublePoint(velocity * Math.cos(rotationInRadius), velocity * Math.sin(rotationInRadius)));\r\n\t}", "public void moveForward() {\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t // 2\n\t\tseconds += tic;\n\t\tif (seconds >= 60.0) {\n\t\t\tseconds -= 60.0;\n\t\t\tminutes++;\n\t\t\tif (minutes == 60) {\n\t\t\t\tminutes = 0;\n\t\t\t\thours++;\n\t\t\t}\n\t\t}\n\t}", "private void run() {\n\n //if no time has elapsed, do not do anything\n if (Harness.getTime().equals(lastRunTime)) {\n return;\n }\n\n //double deltaV, deltaX;\n double newSpeed;\n double newPosition;\n double targetSpeed = 0;\n double currentSpeed = 0;\n double acceleration = 0;\n\n switch (driveOrderedState.speed()) {\n case STOP:\n targetSpeed = 0.0;\n break;\n case LEVEL:\n targetSpeed = LevelingSpeed;\n break;\n case SLOW:\n targetSpeed = SlowSpeed;\n break;\n case FAST:\n targetSpeed = FastSpeed;\n break;\n default:\n throw new RuntimeException(\"Unknown speed\");\n }\n /*\n * JDR Bug fix to make the speed stop in the case where the command is\n * Direction=STOP but speed is something other than STOP.\n */\n if (driveOrderedState.direction() == Direction.STOP) {\n targetSpeed = 0.0;\n }\n if (driveOrderedState.direction() == Direction.DOWN) {\n targetSpeed *= -1;\n }\n\n currentSpeed = driveSpeedState.speed();\n if (driveSpeedState.direction() == Direction.DOWN) {\n currentSpeed *= -1;\n }\n\n if (Math.abs(targetSpeed) > Math.abs(currentSpeed)) {\n //need to accelerate\n acceleration = Acceleration;\n } else if (Math.abs(targetSpeed) < Math.abs(currentSpeed)) {\n //need to decelerate\n acceleration = -1 * Deceleration;\n } else {\n acceleration = 0;\n }\n if (currentSpeed < 0) {\n //reverse everything for negative motion (going down)\n acceleration *= -1;\n }\n\n //get the time offset in seconds since the last update\n double timeOffset = SimTime.subtract(Harness.getTime(), lastRunTime).getFracSeconds();\n //remember this time as the last update\n lastRunTime = Harness.getTime();\n\n //now update speed\n //deltav = at\n newSpeed = currentSpeed + (acceleration * timeOffset);\n\n //deltax= vt+ 1/2 at^2\n newPosition = carPositionState.position() +\n (currentSpeed * timeOffset) + \n (0.5 * acceleration * timeOffset * timeOffset);\n if ((currentSpeed < targetSpeed &&\n newSpeed > targetSpeed) ||\n (currentSpeed > targetSpeed &&\n newSpeed < targetSpeed)) {\n //if deltaV causes us to exceed the target speed, set the speed to the target speed\n driveSpeedState.setSpeed(Math.abs(targetSpeed));\n } else {\n driveSpeedState.setSpeed(Math.abs(newSpeed));\n }\n //determine the direction\n if (driveSpeedState.speed() == 0) {\n driveSpeedState.setDirection(Direction.STOP);\n } else if (targetSpeed > 0) {\n driveSpeedState.setDirection(Direction.UP);\n } else if (targetSpeed < 0) {\n driveSpeedState.setDirection(Direction.DOWN);\n }\n carPositionState.set(newPosition);\n\n physicalConnection.sendOnce(carPositionState);\n physicalConnection.sendOnce(driveSpeedState);\n\n log(\" Ordered State=\", driveOrderedState,\n \" Speed State=\", driveSpeedState,\n \" Car Position=\", carPositionState.position(), \" meters\");\n }", "public double getHoldTime();", "private int timeToNextAttack() {\n return ATTACK_SPEED - mAttacker.getSpeed();\n }", "public Heading(Double compassHeading) {\n\t\tthis.compassHeading = compassHeading;\n\t}", "public void moveOneStep(double dt) {\r\n double movementX = this.p.getX() + dt * this.vel.getDx();\r\n double movementY = this.p.getY() + dt * this.vel.getDy();\r\n Line trajectory = new Line(this.p, new Point(movementX, movementY));\r\n CollisionInfo collInfo = gameE.getClosestCollision(trajectory);\r\n // if there is a collision point collInfo doesn't equal to null.\r\n if (collInfo != null) {\r\n double x = this.getX();\r\n double y = this.getY();\r\n Point collisionPoint = collInfo.collisionPoint();\r\n Collidable obj = collInfo.collisionObject();\r\n Rectangle r = obj.getCollisionRectangle();\r\n // Check if the ball hit on one of the corners block.\r\n if (collisionPoint.getY() == collisionPoint.getX()) {\r\n // If the ball hit on the top corners.\r\n if (collisionPoint.getY() == r.getUpperLeft().getY()\r\n || collisionPoint.getX() == r.getUpperLeft().getX()) {\r\n x = collisionPoint.getX() - this.getSize() - 0.001;\r\n y = collisionPoint.getY() - this.getSize() - 0.001;\r\n // else the ball hit on the bottom corners.\r\n } else {\r\n x = collisionPoint.getX() + this.getSize() + 0.001;\r\n y = collisionPoint.getY() + this.getSize() + 0.001;\r\n }\r\n // Set a new velocity.\r\n this.setVelocity(obj.hit(this, collInfo.collisionPoint(), this.getVelocity()));\r\n this.p = new Point(x, y);\r\n return;\r\n }\r\n\r\n // If the ball hit on the left border block.\r\n if (collisionPoint.getX() == r.getUpperLeft().getX()) {\r\n x = collisionPoint.getX() - this.getSize() - 0.001;\r\n y = collisionPoint.getY();\r\n // If the ball hit on the right border block.\r\n } else if (collisionPoint.getX() == r.getWidth() + r.getUpperLeft().getX()) {\r\n x = collisionPoint.getX() + this.getSize() + 0.001;\r\n y = collisionPoint.getY();\r\n\r\n }\r\n // If the ball hit on the top border block.\r\n if (collisionPoint.getY() == r.getUpperLeft().getY()) {\r\n y = collisionPoint.getY() - this.getSize() - 0.001;\r\n x = collisionPoint.getX();\r\n // If the ball hit on the bottom border block.\r\n } else if (collisionPoint.getY() == r.getHeight() + r.getUpperLeft().getY()) {\r\n y = collisionPoint.getY() + this.getSize() + 0.001;\r\n x = collisionPoint.getX();\r\n }\r\n // set a new velocity.\r\n this.setVelocity(obj.hit(this, collInfo.collisionPoint(), this.getVelocity()));\r\n this.p = new Point(x, y);\r\n // else move the ball one step.\r\n } else {\r\n this.p = this.getVelocity().applyToPoint(this.p, dt);\r\n }\r\n }", "private void ControlType1(int time) {\n\t\tif (GameEngine.isKeyHeld(\"D\")) {\n\t\t\tgraphic.setX(graphic.getX() + speed * time);\n\t\t\tgraphic.setDirection(0);\n\t\t}\n\t\tif (GameEngine.isKeyHeld(\"A\")) {\n\t\t\tgraphic.setX(graphic.getX() - speed * time);\n\t\t\tgraphic.setDirection((float)Math.PI);\n\t\t}\n\t\tif (GameEngine.isKeyHeld(\"S\")) {\n\t\t\tgraphic.setY(graphic.getY() + speed * time);\n\t\t\tgraphic.setDirection((float)(Math.PI / 2));\n\t\t}\n\t\tif (GameEngine.isKeyHeld(\"W\")) {\n\t\t\tgraphic.setY(graphic.getY() - speed * time);\n\t\t\tgraphic.setDirection((float)((Math.PI * 3) / 2));\n\t\t}\n\t\t//SET HERO facing WASD direction\n\t}", "public void turnAbsolute(int target)\n {\n int heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n double turnSpeed = 0.15;\n\n while (Math.abs(heading - target) > 45)\n { //Continue while the robot direction is further than three degrees from the target\n if (heading > target) //if gyro is positive, we will turn right\n {\n movePower(\"left\", 0.5, 0.01);\n }\n\n if (heading < target)\n {\n movePower(\"right\", 0.5, 0.01);\n }\n heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n telemetry.addData(\"heading\", String.format(\"%03d\", heading));\n telemetry.update();\n }\n while (Math.abs(heading - target) > 10)\n { //Continue while the robot direction is further than three degrees from the target\n if (heading > target) //if gyro is positive, we will turn right\n {\n movePower(\"left\", 0.1, 0.01);\n }\n\n if (heading < target)\n {\n movePower(\"right\", 0.1, 0.01);\n }\n heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n telemetry.addData(\"heading\", String.format(\"%03d\", heading));\n telemetry.update();\n }\n while (Math.abs(heading - target) > 5)\n { //Continue while the robot direction is further than three degrees from the target\n if (heading > target) //if gyro is positive, we will turn right\n {\n movePower(\"left\", 0.01, 0.01);\n }\n\n if (heading < target)\n {\n movePower(\"right\", 0.01, 0.01);\n }\n heading = 360 - mrGyro.getHeading(); //Set variables to gyro readings\n telemetry.addData(\"heading\", String.format(\"%03d\", heading));\n telemetry.update();\n }\n stop();\n }", "public void driveTo(double targetX, double targetY, float heading, double speedLimit) throws InterruptedException {\n float error = heading - zRotation; //The number of degrees between the true heading and desired heading\n double correction; //Modifies power to account for error\n double max;\n double Y_P_COEFF = 0.17825353626292278; //0.002\n double Y_I_COEFF = 0.2852056580206765; //0.0035\n double Y_D_COEFF = 0.0003; //0.00042\n double X_P_COEFF = 0.17825353626292278; //0.002\n double X_I_COEFF = 0.2852056580206765; //0.0035\n double X_D_COEFF = 0.0003; //0.00042\n double T_P_COEFF = 0.0084;\n double T_I_COEFF = 0.0168;\n double T_D_COEFF = 0.0028;\n double driveY, driveX;\n double distanceY;\n double distanceX;\n long loops = 0;\n heading = (int) normalize360(heading);\n\n double frontLeft;\n double frontRight;\n double backLeft;\n double backRight;\n\n setEncoderBase();\n int lastEncoderY = 0;\n int lastEncoderX = 0;\n float lastHeading = zRotation;\n\n speedLimit = Range.clip(speedLimit, 0.0, 1.0);\n\n if (speedLimit==0){\n return;\n }\n\n double power;\n double deltaT;\n double derivativeY = 0;\n double derivativeX = 0;\n double derivativeT = 0;\n double integralY = 0;\n double integralX = 0;\n double integralT = 0;\n int deltaDY;\n int deltaDX;\n float deltaDT;\n\n double theta;\n double theta2;\n double gamma;\n double h;\n double local_globalX;\n double local_globalY;\n\n double lastTime = callingOpMode.getRuntime();\n\n while ((((((Math.abs(targetY)-1) > Math.abs(globalY)) || ((Math.abs(targetY)+1) < Math.abs(globalY))) ||\n (((Math.abs(targetX)-1) > Math.abs(globalX)) || ((Math.abs(targetX)+1) < Math.abs(globalX)))) ||\n (Math.abs(error)>=5.0f)) && ((LinearOpMode) callingOpMode).opModeIsActive()) {\n\n error = heading - zRotation;\n\n while (error > 180) error = (error - 360);\n while (error <= -180) error = (error + 360);\n\n local_globalX = globalX;\n local_globalY = globalY;\n\n theta = zRotation * Math.PI / 180.0;\n\n // these represent the current x and y translations still to do, in global coordinates ... in inches\n driveY = targetY - local_globalY;\n driveX = targetX - local_globalX;\n\n theta2 = Math.atan2(driveY, driveX);\n gamma = theta+theta2;\n h = Math.sqrt((driveX*driveX)+(driveY*driveY));\n\n // in robot coordinates,\n distanceY = Math.sin(gamma)*h;\n distanceX = Math.cos(gamma)*h;\n\n deltaT = callingOpMode.getRuntime()-lastTime;\n lastTime = callingOpMode.getRuntime();\n deltaDY = getEncoderWheelYPosition()-lastEncoderY;\n lastEncoderY = getEncoderWheelYPosition();\n deltaDX = getEncoderWheelXPosition()-lastEncoderX;\n lastEncoderX = getEncoderWheelXPosition();\n deltaDT = zRotation-lastHeading;\n lastHeading = zRotation;\n\n derivativeY = ((double) deltaDY)/deltaT;\n derivativeX = ((double) deltaDX)/deltaT;\n derivativeT = ((double) deltaDT/deltaT);\n\n if(Math.abs(distanceY*Y_P_COEFF)<1 && Math.abs(distanceY)>1){\n integralY += distanceY*deltaT;\n } else {\n integralY = 0;\n }\n if(Math.abs(distanceX*X_P_COEFF)<1 && Math.abs(distanceX)>1){\n integralX += distanceX*deltaT;\n } else {\n integralX = 0;\n }\n if(Math.abs(error*T_P_COEFF)<1 && Math.abs(error)>5){\n integralT += error*deltaT;\n } else {\n integralT = 0;\n }\n\n power = (distanceY*Y_P_COEFF) + (integralY*Y_I_COEFF) - (derivativeY*Y_D_COEFF);\n\n frontLeft = power;\n frontRight = power;\n backLeft = power;\n backRight = power;\n\n power = (distanceX*X_P_COEFF) + (integralX*X_I_COEFF) - (derivativeX*X_D_COEFF);\n\n frontLeft += power;\n frontRight -= power;\n backLeft -= power;\n backRight += power;\n\n max = Math.max(Math.max(Math.abs(frontLeft), Math.abs(frontRight)), Math.max(Math.abs(backLeft), Math.abs(backRight)));\n if (max > Math.abs(speedLimit)) {\n frontLeft /= max;\n frontRight /= max;\n backLeft /= max;\n backRight /= max;\n frontLeft *= Math.abs(speedLimit);\n frontRight *= Math.abs(speedLimit);\n backLeft *= Math.abs(speedLimit);\n backRight *= Math.abs(speedLimit);\n }\n\n correction = (error*T_P_COEFF) + (integralT*T_I_COEFF) - (derivativeT*T_D_COEFF);\n\n frontLeft -= correction;\n frontRight += correction;\n backLeft -= correction;\n backRight += correction;\n\n max = Math.max(Math.max(Math.abs(frontLeft), Math.abs(frontRight)), Math.max(Math.abs(backLeft), Math.abs(backRight)));\n if (max > 1.0) {\n frontLeft /= max;\n frontRight /= max;\n backLeft /= max;\n backRight /= max;\n }\n\n updateDriveMotors(frontLeft, frontRight, backLeft, backRight);\n\n if (((loops+10) % 10) == 0) {\n callingOpMode.telemetry.addData(\"zRotation\" , zRotation);\n callingOpMode.telemetry.addData(\"globalY\" , local_globalY);\n callingOpMode.telemetry.addData(\"globalX\" , local_globalX);\n callingOpMode.telemetry.addData(\"distanceY\", distanceY);\n callingOpMode.telemetry.addData(\"distanceX\", distanceX);\n callingOpMode.telemetry.addData(\"theta\", theta);\n callingOpMode.telemetry.addData(\"theta2\",theta2);\n callingOpMode.telemetry.addData(\"gamma\",gamma);\n callingOpMode.telemetry.addData(\"driveY\",driveY);\n callingOpMode.telemetry.addData(\"driveX\",driveX);\n callingOpMode.telemetry.addData(\"error\", error);\n callingOpMode.telemetry.addData(\"loops\", loops);\n callingOpMode.telemetry.update();\n }\n\n loops++;\n\n updateGlobalPosition();\n\n ((LinearOpMode) callingOpMode).sleep(10);\n }\n }", "public int liftStepper() {\n if(robot.wrist.getPosition()> .25)\n {\n if(robot.jaw.getPosition()> .25)\n {\n telemetry.addLine(\"I could self damage.\");\n }\n }\n else{\n if (this.improvedGamepad1.y.isInitialPress()) {\n step = step + 1;\n if (step > 5) {\n step = 5;\n }\n power = .5;\n //up by one\n }\n if (this.improvedGamepad1.a.isInitialPress()) {\n step = step - 1;\n if (step < 0) {\n step = 0;\n }\n power = .5;\n //down by one\n }\n\n if (this.improvedGamepad1.b.isInitialPress()) {\n topStep = step;\n step = 0;\n power = .7;\n //to bottom\n }\n\n if (this.improvedGamepad1.x.isInitialPress()) {\n step = topStep;\n power = .7;\n //to top\n }\n\n }\n\n telemetry.addData(\"Step\", step);\n telemetry.addData(\"Top Step\", topStep);\n telemetry.update();\n\n\n //DcMotor lift = this.hardwareMap.dcMotor.get(\"lift\");\n int targetPosition = step * 750;\n\n robot.lift.setTargetPosition(targetPosition);\n robot.lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.lift.setPower(power);\n\n telemetry.update();\n return step;\n\n }", "abstract public double timeUntilCollision(Ball ball);", "public double getHeadingAtTimeStamp(long timeStamp) {\n\n double heading = Double.NaN;\n\n try {\n if (timeStamp > m_gyroData.get(0).timeStamp) {\n\n heading = m_gyroData.get(0).angle;\n System.out.println(String.format(\n \"Couldn't determine heading from timeStamp %d, it's too young. Returned youngest heading of %f.\", timeStamp,\n heading));\n /*\n * We don't have data fresher than the timeStamp the caller is looking for; we\n * haven't acquired it yet. So just return the freshest heading we have.\n */\n return heading;\n }\n } catch (Exception e) {\n /*\n * We don't have ANY heading information. Just return NaN to the caller.\n */\n\n System.out.println(String.format(\n \"Couldn't return ANY heading for timestamp %d. No heading data has been added. (Did you call GyroDiary::add() periodically?)\",\n timeStamp));\n return Double.NaN;\n }\n\n try {\n if (timeStamp < m_gyroData.get(m_gyroData.size() - 1).timeStamp) {\n heading = m_gyroData.get(m_gyroData.size() - 1).angle;\n System.out.println(\n String.format(\"Couldn't determine heading from timeStamp %d, it's too old. Returned oldest heading of %f.\",\n timeStamp, heading));\n return heading;\n }\n } catch (Exception e) {\n /*\n * We don't have ANY heading information. Just return NaN to the caller.\n */\n System.out.println(String.format(\n \"Couldn't return ANY heading for timestamp %d. No heading data has been added. (Did you call GyroDiary::add() periodically?)\",\n timeStamp));\n return Double.NaN;\n }\n\n for (int index = 0; index < m_gyroData.size() - 1; ++index) {\n\n if (timeStamp <= m_gyroData.get(index).timeStamp) {\n\n /*\n * We've found two headings that are bracketing the timeStamp the caller asked\n * for. Perform a linear interpolation between these two headings to get the\n * best heading information we can generate.\n */\n double y0 = m_gyroData.get(index).angle;\n double y1 = m_gyroData.get(index + 1).angle;\n\n long x0 = m_gyroData.get(index).timeStamp;\n long x1 = m_gyroData.get(index + 1).timeStamp;\n\n try {\n heading = (y0 + (timeStamp - x0) * (y1 - y0) / (x1 - x0));\n } catch (Exception e) {\n heading = y0;\n\n System.out.println(String.format(\"Couldn't interpolate heading for timeStamp %d. Returned %f instead. %s\",\n timeStamp, heading, e.toString()));\n }\n\n }\n }\n return heading;\n }", "public void angleTurn(float angle, int timeout){\n\t\tcalculateAngles();\n\n\t\t// Get the current program time and starting encoder position before we start our drive loop\n\t\tfloat StartTime = data.time.currentTime();\n\t\tfloat StartPosition = data.drive.leftDrive.getCurrentPosition();\n\n\t\t// Reset our Integral and Derivative data.\n\t\tdata.PID.integralData.clear();\n\t\tdata.PID.derivativeData.clear();\n\n\n\t\t// Manually calculate our first target\n\t\tdata.PID.target = (calculateAngles() + (data.PID.IMURotations * 360)) + angle;\n\n\t\t// We need to keep track of how much time passes between a loop.\n\t\tfloat LoopTime = data.time.currentTime();\n\n\t\t// This is the main loop of our straight drive.\n\t\t// We use encoders to form a loop that corrects rotation until we reach our target.\n\t\twhile(StartTime + timeout > data.time.currentTime()){\n\n\t\t\t// Record the time since the previous loop.\n\t\t\tLoopTime = data.time.timeFrom(LoopTime);\n\t\t\t// Calculate our angles. This method may modify the input Rotations.\n\t\t\t//IMURotations =\n\t\t\tcalculateAngles();\n\t\t\t// Calculate our PID\n\t\t\tcalculatePID(LoopTime);\n\n\t\t\t// Calculate the Direction to travel to correct any rotational errors.\n\t\t\tfloat Direction = ((data.PID.I * data.PID.ITuning) / 2000) + ((data.PID.P * data.PID.PTuning) / 2000) + ((data.PID.D * data.PID.DTuning) / 2000);;\n\n\t\t\tif(Math.abs(Direction) <= 0.03f) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdata.drive.rightDrive.setPower(data.drive.POWER_CONSTANT - (Direction));\n\t\t\tdata.drive.leftDrive.setPower(data.drive.POWER_CONSTANT + (Direction));\n\t\t}\n\t\t// Our drive loop has completed! Stop the motors.\n\t\tdata.drive.rightDrive.setPower(0);\n\t\tdata.drive.leftDrive.setPower(0);\n\t}", "public void initHeading(Direction heading)\r\n\t{\r\n\t\tthis.currentDirection=heading;\r\n\t}", "private short getHeadingAxe()\r\n\t{\r\n\t\t// Condition based on the angle change\r\n\t\tdouble difA = 0;\r\n\t\tshort movDir = 0;\r\n\r\n\t\t// Difference between the real and ideal angle\r\n\t\tdifA = Math.abs((this.pose.getHeading()/Math.PI*180) - Po_ExpAng);\r\n\t\t\r\n\t\t// Axe detection\r\n\t\tif ((Po_CORNER_ID % 2) == 0)\r\n\t\t{\r\n\t\t\t// Movement in x\r\n\t\t\tif (((Po_CORNER_ID == 0) && ((difA > 70) && (100*this.pose.getX() > 165))) || ((Po_CORNER_ID == 2) && ((difA > 70) && (100*this.pose.getX() < 160))) || ((Po_CORNER_ID == 4) && ((difA > 70) && (100*this.pose.getX() < 35))) || ((Po_CORNER_ID == 6) && ((difA > 70) && (100*this.pose.getX() < 5))))\r\n\t\t\t//if (difA > 70)\r\n\t\t\t{\r\n\t\t\t\tmovDir = 1;\t\t\t// y direction\r\n\t\t\t\tSound.beepSequenceUp();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmovDir = 0;\t\t\t// x direction\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Movement in y\r\n\t\t\tif (((Po_CORNER_ID == 1) && ((difA > 30) && (100*this.pose.getY() > 55))) || ((Po_CORNER_ID == 3) && ((difA > 70) && (100*this.pose.getY() < 45))) || ((Po_CORNER_ID == 5) && ((difA > 70) && (100*this.pose.getY() > 55))) || ((Po_CORNER_ID == 7) && (difA > 70) && (100*this.pose.getY() < 5)))\r\n\t\t\t//if (difA > 70)\r\n\t\t\t{\r\n\t\t\t\tmovDir = 0;\t\t\t// x direction\r\n\t\t\t\tSound.beepSequence();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmovDir = 1;\t\t\t// y direction\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (((Po_AxeP == 0) && (movDir == 1)) || ((Po_AxeP == 1) && (movDir == 0)))\r\n\t\t{\r\n\t\t\tif (Po_CORNER_ID < 7)\r\n\t\t\t{\r\n\t\t\t\tPo_CORNER_ID = Po_CORNER_ID + 1;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tPo_CORNER_ID = 0;\r\n\t\t\t\t\r\n\t\t\t\tif (this.parkingSlotDetectionIsOn)\r\n\t\t\t\t{\r\n\t\t\t\t\tPo_RoundF = 1;\t\t// Round finished, don't add any new parking slots\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tPo_Corn = 1;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tPo_Corn = 0;\r\n\t\t}\r\n\t\t\r\n\t\tPo_AxeP = movDir;\r\n\t\t\r\n\t\tLCD.drawString(\"Corn_ID: \" + (Po_CORNER_ID), 0, 6);\r\n\t\t\r\n\t\treturn movDir;\r\n\t}", "public double getHeading() {\n return imu.getAngularOrientation().firstAngle;\n }", "public void turnRight()\r\n\t{\r\n\t\theading += 2; //JW\r\n\t\t//Following the camera\r\n\t\t//heading += Math.sin(Math.toRadians(15)); \r\n\t\t//heading += Math.cos(Math.toRadians(15));\r\n\t}", "double getHorDist(double initial_hor_vel, double time)\n {\n ux = initial_hor_vel;\n t = time;\n x = ux*t;\n return x;\n }", "public void smoothMovePower(String movement, double power, double duration)\n {\n double startTime = getRuntime();\n switch(movement)\n {\n case \"forward\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power);\n robot.FR_drive.setPower(power * -1);\n robot.BL_drive.setPower(power);\n robot.BR_drive.setPower(power * -1);\n }\n break;\n\n case \"backward\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power * -1);\n robot.FR_drive.setPower(power);\n robot.BL_drive.setPower(power * -1);\n robot.BR_drive.setPower(power);\n }\n break;\n\n case \"right\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power);\n robot.FR_drive.setPower(power);\n robot.BL_drive.setPower(power * -1);\n robot.BR_drive.setPower(power * -1);\n }\n break;\n\n case \"left\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power * -1);\n robot.FR_drive.setPower(power * -1);\n robot.BL_drive.setPower(power);\n robot.BR_drive.setPower(power);\n }\n break;\n\n case \"leftTurn\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power);\n robot.FR_drive.setPower(power);\n robot.BL_drive.setPower(power);\n robot.BR_drive.setPower(power);\n }\n break;\n\n case \"rightTurn\":\n runtime.reset();\n while (runtime.seconds() < duration)\n {\n robot.FL_drive.setPower(power * -1);\n robot.FR_drive.setPower(power * -1);\n robot.BL_drive.setPower(power * -1);\n robot.BR_drive.setPower(power * -1);\n }\n break;\n }\n }", "double normaliseHeading(double ang) {\r\n\t\tif (ang > 2 * PI)\r\n\t\t\tang -= 2 * PI;\r\n\t\tif (ang < 0)\r\n\t\t\tang += 2 * PI;\r\n\t\treturn ang;\r\n\t}", "private long calcSeekTime (int newCylinder)\r\n\t{\r\n\t\t//\tCompute number of cylinders to move.\r\n\t\tint moveCyl = Math.abs(newCylinder - this.cylinder);\r\n\t\t//\tCompute time to move that many cylinders.\r\n\t\tlong moveTime = (long)(2 * config.getRampTime());\r\n\t\tmoveTime += Math.round(moveCyl * config.getTrack2Track());\r\n\t\treturn moveTime;\r\n\t}", "public void move(int delta);", "public void strafeLeftTimer()\r\n\t{\r\n\t\tif(timer.get() < Config.Auto.timeStrafe)\r\n\t\t{\r\n\t\t\tdrive.setSpeed(0, 0, Config.Auto.strafeSpeed, Config.Auto.strafeSpeed);\r\n\t\t}\r\n\t\t\r\n\t\telse if(timer.get() < Config.Auto.timeDriveTowardTote)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"in second else if\");\r\n\t\t\tdrive.setSpeed(-Config.Auto.driveTowardToteSpeed, -Config.Auto.driveTowardToteSpeed, 0, 0);\r\n\t\t}\r\n\t\t\r\n\t\telse if(timer.get() < Config.Auto.timeStrafeBackwards)\r\n\t\t\tdrive.setSpeed(0, 0, -Config.Auto.strafeSpeed, -Config.Auto.strafeSpeed);\r\n\t\t\r\n\t\telse\r\n\t\t\tendRoutine();\r\n\t}", "public void move() {\n\t\tthis.position.stepForwad();\n\t\tthis.position.spin();\n\t}" ]
[ "0.6544754", "0.6293712", "0.6154865", "0.6126283", "0.6086996", "0.60411316", "0.60012895", "0.59850264", "0.5979953", "0.5956157", "0.5947555", "0.5915224", "0.5915224", "0.5915224", "0.58975405", "0.5878366", "0.5826589", "0.57927364", "0.5789005", "0.5767381", "0.5750151", "0.5734282", "0.5713799", "0.57133776", "0.57051474", "0.5698212", "0.56977904", "0.56977904", "0.5696668", "0.56790346", "0.567075", "0.56639117", "0.56550694", "0.56363094", "0.56330115", "0.5620153", "0.56172794", "0.5613777", "0.56047696", "0.5576626", "0.55737484", "0.55706596", "0.5566756", "0.5563669", "0.5551971", "0.5551971", "0.55488306", "0.55475354", "0.55454", "0.55135244", "0.5463588", "0.54560155", "0.5452637", "0.544773", "0.5445659", "0.5429981", "0.5426469", "0.54254454", "0.54078805", "0.540729", "0.54062325", "0.5398803", "0.53955454", "0.5395148", "0.5387402", "0.5385002", "0.53772116", "0.53715575", "0.5366721", "0.5363514", "0.53582513", "0.53579587", "0.5353694", "0.5349228", "0.53343326", "0.53286964", "0.53250664", "0.5318362", "0.53102475", "0.5305557", "0.52970994", "0.5276783", "0.5271862", "0.5269618", "0.52509433", "0.5245798", "0.52317363", "0.5230188", "0.5218446", "0.52183473", "0.52183354", "0.5217259", "0.5213308", "0.5212615", "0.52112883", "0.52036166", "0.52020687", "0.5194708", "0.5194681", "0.51940644" ]
0.5382583
66
Perform one cycle of closed loop heading control.
boolean onHeading(double speed, double angle, double PCoeff) { double error ; double steer ; boolean onTarget = false ; double leftSpeed; double rightSpeed; // determine turn power based on +/- error error = getError(angle); if (Math.abs(error) <= HEADING_THRESHOLD) { steer = 0.0; leftSpeed = 0.0; rightSpeed = 0.0; onTarget = true; } else { steer = getSteer(error, PCoeff); rightSpeed = speed * steer; leftSpeed = -rightSpeed; } // Send desired speeds to motors. robot.leftDrive.setPower(leftSpeed); robot.rightDrive.setPower(rightSpeed); // Display it for the driver. telemetry.addData("Target", "%5.2f", angle); telemetry.addData("Err/St", "%5.2f/%5.2f", error, steer); telemetry.addData("Speed.", "%5.2f:%5.2f", leftSpeed, rightSpeed); return onTarget; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void toggleLoop();", "public void cycle(){\r\n \r\n \r\n if(collision()){\r\n endtime = 1;\r\n animator.stop();\r\n }else{\r\n if(max_h == false)\r\n ch.v--;\r\n if(ch.v == 150)\r\n max_h = true;\r\n\r\n if(max_h == true & ch.v <= 330){\r\n ch.v++;\r\n if(ch.v == 330){\r\n done = true;\r\n \r\n }\r\n }\r\n }\r\n }", "public void cycleOutput(long tick)\n {\n }", "public void start() {\n setClosedLoopControl(true);\n }", "@Override protected boolean turnPeriodic(double headingDegrees, int i) {\r\n\r\n // add your turn code here\r\n\r\n // return true when this segment is completed\r\n return false;\r\n\r\n }", "@Override public void loop() {\n }", "public void loop(){\n \n \n }", "public void loop(){\n\t\t\n\t}", "@Override public void loop () {\n }", "public void loop(){\n\t}", "@Override\n public void visit(LoopControlNode loopControlNode) {\n }", "@Override\n public void loop()\n {\n }", "private void loop() {\n mStateTimeTextView.setText(\"\" + getStateTimeMs() / 1000);\n\n switch (mState) {\n case SEEKING_HOME:\n // Really this is the area to check your GPS and heading and drive the wheels.\n\n if (getStateTimeMs() > 6000) {\n setState(State.READY);\n }\n break;\n default:\n // Catch for all the states that you know do nothing\n break;\n }\n\n }", "public void tick() {\n\t\ttick(1);\n\t}", "@Override\r\n public void loop() {\r\n //CodeHere\r\n }", "public void loop() {\n\t\tloop(1.0f, 1.0f);\n\t}", "@Override\n public void loop() {\n\n }", "@Override\n public void loop() {\n\n }", "public abstract void loop();", "public SingleLoopHead() {\n super(CFASingleLoopTransformation.ARTIFICIAL_PROGRAM_COUNTER_FUNCTION_NAME);\n }", "public void loop() {\n System.out.println(\"loop\");\n }", "@Override\n public void run() {\n while (!stop) {\n if(encodereCitite) {\n /**pressing y resets the heading*/\n if (gamepad1.y) {\n offset = (EncDr - EncSt) / 2.0;\n x=0;\n y=0;\n }\n /**calculating the current heading in degrees*/\n lastAngle = angle;\n\n encRot = ((EncDr - EncSt) / 2.0) - offset;\n angle = Math.toRadians(encRot / tickPerDeg) % (2 * PI);\n\n lastCorrectedY = correctedY;\n lastCorrectedX = correctedX;\n\n correctedY = (EncSt + EncDr)/2.0;\n correctedX = EncSp - PIDControllerTestConfig.sidewaysCalib * encRot;\n\n deltaY = correctedY - lastCorrectedY;\n deltaX = correctedX - lastCorrectedX;\n correctedAngle = (lastAngle + angle)/2;\n\n cosdeltay = (Math.cos(angle) * deltaY);\n cosdeltax = (Math.cos((PI/2)- angle) * deltaX);\n sindeltay = -(Math.sin(angle) * deltaY);\n sindeltax = (Math.sin((PI/2)-angle) * deltaX);\n\n y = y + (cosdeltay + cosdeltax) * mmPerTick;\n x = x + (sindeltay + sindeltax) * mmPerTick;\n\n encodereCitite = false;\n }\n }\n }", "public void tick() {\n if (showTutorial) {\n if (backButton.isPressed()) {\n showTutorial = false;\n }\n } else {\n if (tutorialButton.isPressed()) {\n showTutorial = true;\n }\n titleAnimation.tick();\n }\n startButton.tick();\n highscoreButton.tick();\n tutorialButton.tick();\n backButton.tick();\n }", "public void initHeading(Direction heading)\r\n\t{\r\n\t\tthis.currentDirection=heading;\r\n\t}", "protected abstract void trace_begin_loop();", "public void tick() {\r\n }", "@Override\n public void loop() {\n // --------------- DESCRIPTION --------------------------\n // Title\n // Description\n // ------------------ START -----------------------------\n // Code\n // ------------------ END -----------------------------\n\n\n // ######################################################\n // ## RELIC ##\n // ######################################################\n //\n // --------------- DESCRIPTION --------------------------\n // Relic Arm\n // Uses Continuous rotation servo from gamepad 2\n // X = 0.45 Moves arm down (required in autonomous)\n // Y = 0.60 Moves arm up (with Relic)\n // !X & !Y = 0.5 no power to the servo (free movement)\n // ------------------ START -----------------------------\n\n arm.setPosition(gamepad1.right_stick_x);\n telemetry.addLine(\"Servo:\"+ gamepad1.right_stick_x);\n // ------------------ END -----------------------------\n\n\n\n\n// \\\n\n }", "protected abstract void trace_end_loop();", "@Override\n\tpublic void run() {\n\n\t\t// Loop through the intro message with a delay\n\t\twhile (!messageToDisplay.isEmpty()) {\n\n\t\t\ttry {\n\t\t\t\tSystem.out.println(messageToDisplay.poll());\n\t\t\t\t//only pauses betweeen lines when it has not been interrupted\n\t\t\t\tif (!Thread.interrupted()) {\n\t\t\t\t\tThread.sleep(1337);\n\t\t\t\t}\n\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\t//on interrupt continue to print message\n\t\t\t}\n\n\t\t}\n\n\t}", "@Override\n\t\t\tpublic void loop() throws ConnectionLostException,\n\t\t\t\t\tInterruptedException {\n\t\t\t\t\n\t\t\t\tif (showChecked) {\n\t\t\t\t\trunDemo();\n\t\t\t\t\t// thread.sleep ?\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// initial position\n\t\t\t\t// high = true, low = false\n\t\t\t\t// read pedal position\n\t\t\t\tboolean pedalInHighPosition = pedalButton.read();\n\t\t\t\tif (lastKnownPedalPosition == pedalInHighPosition) {\n\t\t\t\t\t// no change from last time, wait a little, than continue\n\t\t\t\t\tThread.sleep(20);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// save current status of the pedal\n\t\t\t\tlastKnownPedalPosition = pedalInHighPosition;\n\t\t\t\t\n\t\t\t\tif (!pedalInHighPosition) {\n\t\t\t\t\tLOG.debug(\"Pedal is pressed\");\n\t\t\t\t\tif (preferences.getPedalMode() == RoboTarPreferences.PRESS_AND_RELEASE) {\n\t\t\t\t\t\t// no action\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// do action, PRESS_AND_HOLD\n\t\t\t\t\tsendChord2RoboTar();\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tLOG.debug(\"Pedal is released\");\n\t\t\t\t\t\n\t\t\t\t\t// turn off led\n\t\t\t\t\tstateLedOff = true;\n\t\t\t\t\tstateLED.write(stateLedOff);\n\t\t\t\t\t\n\t\t\t\t\t// reset servos - in both cases\n\t\t\t\t\tresetAll();\n\t\t\t\t\t\n\t\t\t\t\tif (preferences.getPedalMode() == RoboTarPreferences.PRESS_AND_RELEASE) {\n\t\t\t\t\t\t// do action\n\t\t\t\t\t\tsendChord2RoboTar();\n\t\t\t\t\t}\n\n\t\t\t\t} \n\t\t\t\t\n\t\t\t}", "public final native void setHeading(int heading) /*-{\n this.setHeading(heading);\n }-*/;", "public void tick() {\r\n tick++;\r\n }", "public void setHeading(String heading) {\n this.heading = heading;\n }", "private void loopButton(ActionEvent e) {\n if (loop) {\n if (drawPanel.animationDone()) {\n this.tick = 0;\n atTick(this.tick);\n timer.restart();\n }\n }\n }", "public void tick() {\n\t}", "public void tick() {\n\t}", "protected void execute() {\n Robot.imu.setUniversalHeading(heading);\n }", "@Override\n public void startTimeLoop() {\n MyLog.log(\"startTimeLoop::\");\n // handler.sendEmptyMessage(5);\n }", "Loop createLoop();", "public void tick()\n {\n if ( --ticksUntilVSync == 0 )\n {\n ticksUntilVSync = ticksUntilVSyncLatch;\n copper.restart();\n irqController.triggerIRQ( IRQController.IRQSource.VBLANK );\n }\n if ( dmaController.isCopperDMAEnabled() )\n {\n copper.tick();\n }\n\n hpos++;\n if ( hpos == 0xd8 ) { // $d8 = 216 = 8 pixel hblank + 200 pixel + 8 pixel hblank\n hpos = 0;\n\n if ( amiga.isNTSC() )\n {\n // toggle long/short line flag, only applicable for NTSC amigas\n longLine ^= 0b1000_0000;\n }\n\n vpos++;\n /*\n | Normal | Interlaced\nPAL | 283 | 567\nNTSC| 241 | 483\n */\n\n if ( isInterlaced() )\n {\n final int maxY = amiga.isPAL() ? 283 : 241;\n if ( vpos >= maxY )\n {\n longFrame = 0x8000;\n }\n }\n\n int maxY;\n if ( amiga.isPAL() )\n {\n maxY = 29 + (isInterlaced() ? 567 : 283);\n }\n else\n {\n maxY = 21 + (isInterlaced() ? 483 : 241);\n }\n if ( vpos == maxY ) {\n vpos = 0;\n longFrame = 0;\n copper.restart();\n }\n }\n }", "@Override\n public void loop() {\n try {\n if ((runtime.seconds()-prevTime) >= 60) {\n prevTime = (long)runtime.seconds();\n writer.write(\"\\n\" + String.format(Locale.US, \"%f\", runtime.seconds()/60) + \",\" +\n String.format(Locale.US,\"%2.2f\", batVolt.getVoltage()) + \",\");\n robot.shooterServoDown(false);\n Thread.sleep(800);\n robot.shooterServoDown(true);\n }else if (batVolt.getVoltage() < 10 || robot.touchSensor.isPressed()) {\n if (writer != null)\n writer.close();\n robot.shooterPower(0);\n requestOpModeStop();\n }\n telemetry.addData(\"Runtime\", runtime.toString());\n telemetry.addData(\"PrevTime\", prevTime);\n } catch (IOException | InterruptedException e) {\n e.printStackTrace();\n }\n }", "public void performHEAD(String command)\n {\n int currow;\n\n ASPManager mgr = getASPManager();\n ASPTransactionBuffer trans = mgr.newASPTransactionBuffer();\n\n currow = headset.getCurrentRowNo();\n if (headlay.isMultirowLayout())\n headset.storeSelections();\n else\n headset.selectRow();\n headset.markSelectedRows(command);\n mgr.submit(trans);\n headset.goTo(currow);\n }", "public void outputNext() {\n ++this.currentIndex;\n this.currentChName = this.operOutHeaders.get(this.currentIndex - 1);\n }", "@Override\n public void run()\n {\n while(true)\n {\n try\n {\n Thread.sleep(1000);\n } catch (InterruptedException e)\n {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n obj.printOdd();\n }\n }", "@Override\n public void run()\n {\n char alt;\n\n while((alt = barStub.lookAround()) != 'E')\n {\n switch(alt)\n {\n case 'N':\n tabStub.saluteTheClient();\n break;\n\n case 'O' :\n tabStub.getThePad();\n kitStub.handNoteToTheChef();\n break;\n\n case 'C' :\n do\n {\n kitStub.collectPortion();\n tabStub.deliverPortion();\n } while(!tabStub.haveAllClientsBeenServed());\n break;\n\n case 'P' :\n barStub.prepareTheBill();\n tabStub.presentTheBill();\n break;\n\n case 'G' :\n barStub.sayGoodbye();\n break;\n }\n\n if(alt != 'G') barStub.returnToTheBar();\n }\n }", "@Override\n public void init_loop() {\n telemetry.addData(\"Say\", \"We pressed INIT!\");\n robot.clawRight.setPosition(0);\n robot.clawLeft.setPosition(0);\n }", "private void printHeading()\n {\n System.out.println(\"==============================================\");\n System.out.println(\" Stock Management Application \");\n System.out.println(\" App05: by Haroon Sadiq \");\n System.out.println(\"==============================================\");\n }", "@Override\r\n\tpublic void tick() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void tick() {\n\t\t\r\n\t}", "private static void printHeading(){\n\t\tSystem.out.println(\"Your Name\");\n\t\tSystem.out.println(\"Course name and semester\");\n\t\tSystem.out.println(\"Programming Project 1\");\n\t\tSystem.out.println(\"Your Name in Code\");\n\t\tSystem.out.println();\n\n\t}", "public void step()\n {\n LCD.clear();\n sw.reset();\n for( int i = 0; i<3; i++)m[i].resetTachoCount();\n for( int i = 0; i<3; i++)m[i].forward();\n for(int r = 0 ; r<8; r++)\n {\n while(sw.elapsed() < 200* r)Thread.yield();\n for( int i = 0; i<3; i++)\n LCD.drawInt(m[i].getTachoCount(),5*i,r);\n }\n for( int i = 0; i<3; i++)m[i].stop();\n Button.waitForPress();\n }", "public void tick() \n {\n //Einfache Bildschirmausgabe. Kann spaeter in Subklasse beliebig ueberschreiben werden.\n zaehler++;\n zaehler = zaehler % 2;\n if ( zaehler == 1 ) \n {\n System.out.println( \"Tick!\" );\n }\n else \n {\n System.out.println( \"Tack!\" );\n }\n }", "protected void onTick() {\n//Count down\nif (w > 0) {\nSystem.out.println(w + \" seconds left.\");\n\nw--;\n} else {\nSystem.out.println(\"Bye, bye\");\nmyAgent.doDelete(); //Delete this agent\n}\n}", "void sayWelcome() {\n\t\tfor (int i = 0; i<=10; i++) {\n\t\t\tSystem.out.println(\"Welcome\");\n\t\t}\n\t}", "@Override\r\n\tpublic void stop() {\n\t\tSystem.out.println(\"H1型号是这样熄火的.....\");\r\n\t}", "public void playTopHat() {\n\t\tSystem.out.println(\"ding ding da-ding\");\n\t\t\n\t}", "public int heading() {\n\t\theading = heading + 5;\n\t\tif (heading >= 359) {\n\t\t\t//Setting the heading to 0\n\t\t\tsetHeading(0);\n\t\t}\n\t\t//Returning the heading\n\t\treturn heading;\n\t}", "@Override\r\n public void teleopPeriodic() {\n if (m_stick.getRawButton(12)){\r\n TestCompressor.setClosedLoopControl(true);\r\n System.out.println(\"??\");\r\n } \r\n if (m_stick.getRawButton(11)) {\r\n TestCompressor.setClosedLoopControl(false);\r\n }\r\n //// fireCannon(Solenoid_1, m_stick, 8);\r\n //// fireCannon(Solenoid_2, m_stick, 10);\r\n //// fireCannon(Solenoid_3, m_stick, 12);\r\n //// fireCannon(Solenoid_4, m_stick, 7);\r\n //// fireCannon(Solenoid_5, m_stick, 9);\r\n //// fireCannon(Solenoid_6, m_stick, 11);\r\n\r\n // Logic to control trigering is inside\r\n // DO: Move the logic out here, makes more sense. \r\n fireTrio(topSolonoids, m_stick, 5);\r\n fireTrio(bottomSolonoids, m_stick, 6);\r\n\r\n // Make robit go\r\n double[] movementList = adjustJoystickInput(-m_stick.getY(), m_stick.getX(), m_stick.getThrottle());\r\n m_myRobot.arcadeDrive(movementList[0], movementList[1]);\r\n //System.out.println(m_gyro.getAngle());\r\n }", "@Override\n public void loop() {\n\n // Right wheels will be controlled by the right stick\n // Left wheels will be controlled by the left stick\n float rightWheels = gamepad1.right_stick_y;\n float leftWheels = gamepad1.left_stick_y;\n\n // write the values to the motors\n setRightMotors(rightWheels);\n setLeftMotors(leftWheels);\n\n //When dino arms are open\n if (gamepad2.left_bumper){\n openDinoArms();\n }\n\n //When dino arms are closed\n if (gamepad2.right_bumper){\n closeDinoArms();\n }\n\n //When ball channel is open\n if (gamepad2.b) {\n openBallChannel();\n } else {\n //When ball channel is closed\n closeBallChannel();\n }\n\n //When the deflector is raised\n if (gamepad2.y) {\n openDeflector();\n }\n else {\n stopDeflector();\n }\n\n //When deflector is lowered\n if (gamepad2.a) {\n closeDeflector();\n }\n else {\n stopDeflector();\n }\n\n //When ball is shooting\n if (gamepad2.x) {\n shootBalls();\n }\n else{\n stopShootBalls();\n }\n\n //When collector is collecting balls\n if (gamepad1.right_trigger>0){\n collectorForward();\n }\n else {\n stopCollector();\n }\n\n //When collector is spitting balls out\n if (gamepad1.left_trigger>0){\n collectorBackward();\n }\n else{\n stopCollector();\n }\n }", "public void run(){\n for(;;)\r\n System.out.println(\"Hello\" + name);\r\n }", "public void forward() {\n\t\t\n\t\tif(hasEaten()) {\n\t\t\taddBodyPart();\n\t\t} else {\n\t\t\tshuffleBody();\n\t\t}\n\t\t\n\t\tthis.setLocation(this.getX()+dX, this.getY()+dY); // move head\n\t\tthis.display(w); \n\t}", "@Override\n\tpublic void run() {\n\t\twhile (true) {\n\n\t\t\t//The philosopher is currently thinking\n\t\t\taction(\"Thinking\");\n\n\t\t\t//The philosopher acquired his first ChopStick\n\t\t\tsynchronized (leftChopStick) {\n\t\t\t\taction(\"Taking left chopstick\");\n\n\t\t\t\t//The philosopher acquired his second ChopStick and eats\n\t\t\t\tsynchronized (rightChopStick) {\n\t\t\t\t\taction(\"Taking right chopstick\"); \n\t\t\t\t\taction(\"Eating\");\n\t\t\t\t}\n\n\t\t\t\t//Once the philosopher finishes eating, he puts down both chopSticks marked by the end of both synchronized statement\n\t\t\t\taction(\"Puting chopsticks down\");\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tmVideoContrl.maltiSpeedPlayNext();\r\n\r\n\t\t\t\t\t}", "private void loop() {\r\n\t\tfloat elapsed;\r\n\t\tfloat accumulated = 0f;\r\n\t\tfloat interval = 1f / TARGET_UPS;\r\n\t\tdouble time;\r\n\t\tdouble lastCall = System.nanoTime();\r\n\t\t\r\n\t\trunning = true;\r\n\t\t//loop while running and the window hasn't received a close command\r\n\t\twhile (running) {\r\n\t\t\ttime = System.nanoTime();\r\n\t\t\t\r\n\t\t\telapsed = (float) ((time-lastCall) / 1e9);\r\n\t\t\tlastCall = time;\r\n\t\t\t\r\n\t\t\taccumulated += elapsed;\r\n\t\t\t\r\n\t\t\twhile (accumulated >= interval) {\r\n\t\t\t\tupdate();\r\n\t\t\t\taccumulated -= interval;\r\n\t\t\t}\r\n\t\t\t//render once per loop, then wait until the render time slot is over before restarting\r\n\t\t\tgame.render();\r\n\t\t\tsync(lastCall/1e9);\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n public void loop() {\n\n\n if (gamepad1.right_bumper) {\n leftDrive.setDirection(DcMotor.Direction.FORWARD);\n leftDrive.setPower(3);\n } else if (gamepad1.left_bumper) {\n leftDrive.setDirection(DcMotor.Direction.REVERSE);\n leftDrive.setPower(3);\n\n }\n\n }", "public void actionPerformed(ActionEvent arg0) {\n\t\ttimeLeft--;\n\t\ttimerText.setText(timeLeft + \" seconds\");\n\t\ttimerText.repaint();\n\t\tif (timeLeft == 0) {\n\t\t\twindow.displayHS();\n\t\t\twindow.write();\n\t\t\tdispose();\n\t\t}\n\t}", "public static void periodic() {\n a2 = limelightTable.getEntry(\"ty\").getDouble(0); //Sets a2, the y position of the target\n d = Math.round((h2-h1) / Math.tan(Math.toRadians(a1+a2))); //Calculates distance using a tangent\n\n if(m_gamepad.getStartButtonReleased()) { //Reset errorSum to 0 when start is released\n errorSum = 0;\n }\n\n shooting(); //Determine when we should be shooting\n reportStatistics(); //Report telemetry to the Driver Station\n }", "@Override\n public void loop() {\n switch (auto) {\n case 0:\n // robot.runToTarget(Movement.BACKWARD, 10);\n break;\n\n case 1:\n robot.changeRunMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n break;\n }\n telemetry.addData(\"Case:\", auto);\n telemetry.update();\n }", "public void tick(){\n oilLevel --;\n maintenance --;\n happiness --;\n health --;\n boredom ++;\n }", "private void controlCompass(ArrayList<Float> heading, SeekBar slider){\n\t\tif(!heading.isEmpty() && !(slider.getProgress()>=heading.size())) { //If we have data\n\t\t\tspinCompass(compass, heading.get(slider.getProgress()));\n\t\t}\n\t}", "@Override\n public void loop() {\n smDrive.loop();\n smArm.loop();\n telemetry.update();\n }", "@Override\n public void run() {\n Thread ct = Thread.currentThread();\n while (ct == h1) {\n calcula();\n lblHora.setText(hora + \":\" + minutos + \":\" + segundos + \":\" + ampm);\n try {\n Thread.sleep(1000);\n } catch (Exception e) {\n System.out.println(e);\n }\n }\n }", "public void hang() {\n // WRITE CODE BETWEEN THESE LINES -------------------------------------------------------- //\n // TODO: run the intake motor to both extend and pull in hanger\n // Note: only enable running motor when the m_extended flag is true\n\n // ^^-----------------------------------------------------------------------------------^^ //\n }", "protected void end() {\r\n // stop motor, reset position on the dumper, enable closed loop\r\n }", "public void changeHeading(int newHeading)\n\t{\n\t\theading = newHeading;\n\t}", "public void tick() {\r\n if (this.ticking == true) {\r\n \t this.ticks++;\r\n //Every 100 ticks is 10 seconds.\r\n //Reset the display.\r\n if (this.ticks == 100) {\r\n if (this.isLocked == false) {\r\n this.lockGui.setDisplay(\"Open\");\r\n }\r\n\r\n else {\r\n this.lockGui.setDisplay(\"Locked\");\r\n }\r\n\r\n this.ticking = false;\r\n this.entered = \"\";\r\n }\r\n }\r\n }", "public void run() {\n setSpeed(MAX_SPEED, MAX_SPEED);\n while (step(TIME_STEP) != 16) {\n String name = \"\";\n if (behaviourList.get(2).takeControl()){\n name = \"inFrontOfWall\";\n behaviourList.get(2).action();\n } else if (behaviourList.get(1).takeControl()){\n name = \"isBallanceBall\";\n behaviourList.get(1).action();\n } else if (behaviourList.get(0).takeControl()){\n name = \"searchBall\";\n behaviourList.get(0).action();\n }\n printDistanceInfo(name);\n }\n }", "@Override\r\n\tpublic void tick() {\r\n\t\tif(interacted == false)\r\n\t\t\tinteract();\t\t\r\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\t\t\n\t}", "@Override\n\tpublic void tick() {\n\n\t}", "private void resetHeaderSmoothly() {\n if (null != mViewHandler) {\n isChanging = true;\n Message message = new Message();\n message.what = ViewHandler.SMOOTH_CHANGE_START;\n message.arg1 = ViewHandler.SMOOTH_TYPE_HEADER;\n mViewHandler.sendMessage(message);\n } else\n resetHeaderState();\n }", "public void cycleDay() {\r\n player.gametick();\r\n }", "private org.gwtbootstrap3.client.ui.Heading get_f_Heading30() {\n return build_f_Heading30();\n }", "@Override\r\n\tpublic void display() {\n\t\tSystem.out.println(\"RedHeadDuck\");\r\n\t}", "public void eventLoop() {\n while (looping) {\n try {\n int c = Util.keyPress(String.format(format, num_threads, time, timeout, print_details, print_incrementers));\n switch (c) {\n case '1':\n startBenchmark();\n break;\n case '2':\n printView();\n break;\n case '4':\n changeFieldAcrossCluster(NUM_THREADS, Util.readIntFromStdin(\"Number of incrementer threads: \"));\n break;\n case '6':\n changeFieldAcrossCluster(TIME, Util.readIntFromStdin(\"Time (secs): \"));\n break;\n case 'd':\n changeFieldAcrossCluster(PRINT_DETAILS, !print_details);\n break;\n case 'i':\n changeFieldAcrossCluster(PRINT_INVOKERS, !print_incrementers);\n break;\n case 't':\n changeFieldAcrossCluster(TIMEOUT, Util.readIntFromStdin(\"incr timeout (ms): \"));\n break;\n case 'v':\n System.out.printf(\"Version: %s, Java version: %s\\n\", Version.printVersion(),\n System.getProperty(\"java.vm.version\", \"n/a\"));\n break;\n case 'x':\n case -1:\n looping = false;\n break;\n case 'X':\n try {\n RequestOptions options = new RequestOptions(ResponseMode.GET_NONE, 0)\n .flags(Message.Flag.OOB, Message.Flag.DONT_BUNDLE, Message.Flag.NO_FC);\n disp.callRemoteMethods(null, new MethodCall(QUIT_ALL), options);\n break;\n } catch (Throwable t) {\n System.err.println(\"Calling quitAll() failed: \" + t);\n }\n break;\n default:\n break;\n }\n } catch (Throwable t) {\n t.printStackTrace();\n }\n }\n stop();\n }", "public void setLoops(boolean aValue) { setEndAction(aValue? \"Loop\" : \"\"); }", "@Override\r\n\tpublic void physics() {\n\t\tSystem.out.println(\"Every Thursday evening\");\r\n\t\t\r\n\t}", "@Override\n public Relay automaticMode() {\n return closedLoop;\n }", "@Override\n\tpublic void run() {\n\t\tMidiEvent event;\n\t\tBoolean bIsEnd = false;\n\t\tint skippingTicks = MidiPlayer.getPlayer().skippingTicks;\n\t\tGlobal.Debug(\"KTextThread Begin\");\n\n\n\t\twhile (isLoop) {\n\t\t\ttry {\n\t\t\t\tcurTick = MidiPlayer.getPlayer().getCurrentTicks();\n\n\t\t\t\tif(status == STATUS_PAUSE) {\n\t\t\t\t\tThread.sleep(Global.THREAD_MINDELAY);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (curTick > skippingTicks)\n\t\t\t\t\tprocessInterludes(curTick);\n\n\t\t\t\t// Process Lyric Sync Information\n\t\t\t\tfor(;;) {\n\t\t\t\t\tif(currentIdx >= eventSize) {\n\t\t\t\t\t\tbIsEnd = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isLoop)\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tevent = events.get(currentIdx);\n\t\t\t\t\tif (Global.isLyricsEvent(event)) {\n\t\t\t\t\t\tboolean isSkip = (event.StartTime <= skippingTicks) ? true : false;\n\t\t\t\t\t\tif (isSkip) {\n\t\t\t\t\t\t\tprocessInterludes(event.StartTime);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbIsSkip = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(event.StartTime >= curTick) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsendMidiEvent(event, (currentIdx < eventSize - 1) ? events.get(currentIdx + 1) : null, isSkip);\n\t\t\t\t\t}\n\t\t\t\t\tcurrentIdx++;\n\t\t\t\t}\n\n\t\t\t\tif(bIsEnd) {\n\t\t\t\t\tGlobal.Debug(\"bIsEnd True\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tThread.sleep(Global.THREAD_MINDELAY);\n\t\t\t\t\n\t\t\t} catch(Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tGlobal.Debug(\"KTextThread End: isLoop-\" + isLoop + \", currentIdx-\" + currentIdx + \", eventSize-\" + eventSize);\n\t}", "public void cont(){\n\t\t//System.out.println(\"SimulationTime.cont\");\n\t\tif(this.running && this.pause){\n\t\t\tthis.pause = false;\n\t\t}\n\t}", "public void tick();", "public void tick();", "public void tick();", "@Override\n public void setHeading(String heading) {\n }", "public void run()\n\t{\n\t\ttry \n\t\t{\n\t\t\twhile (lost != true)\n\t\t\t{\n\t\t\t\tSystem.out.print(\"\");\n\t\t\t\twhile (view.getInGamePanel().getGameStart() == true)\n\t\t\t\t{\n\t\t\t\t\tloop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (Exception exception) \n\t\t{\n\t\t}\n\t}" ]
[ "0.58913374", "0.58259284", "0.57376826", "0.56493765", "0.5585272", "0.5565978", "0.55151707", "0.55044556", "0.5477577", "0.547361", "0.5470497", "0.54594445", "0.5408429", "0.5389504", "0.53297687", "0.5310724", "0.5301246", "0.5301246", "0.52899456", "0.52723736", "0.5252408", "0.5252076", "0.5247116", "0.52410465", "0.5228223", "0.5215249", "0.5210196", "0.5205567", "0.5200738", "0.5195641", "0.51901686", "0.5185623", "0.5182816", "0.5167354", "0.51635134", "0.51635134", "0.51618403", "0.51527345", "0.5141073", "0.5135005", "0.5127291", "0.51171476", "0.51050454", "0.50774163", "0.50652504", "0.50631505", "0.5060763", "0.5042631", "0.5042631", "0.5042297", "0.50396603", "0.50376534", "0.5030886", "0.5028935", "0.5015599", "0.5014862", "0.5009577", "0.5008432", "0.4990156", "0.49755755", "0.4974696", "0.49725875", "0.49659663", "0.49652594", "0.4962418", "0.49592468", "0.4955682", "0.49515143", "0.49467406", "0.49460167", "0.49456683", "0.49435118", "0.49422336", "0.4941879", "0.49295676", "0.49230927", "0.49220133", "0.4919673", "0.49186355", "0.49186355", "0.49186355", "0.49186355", "0.49186355", "0.49186355", "0.49186355", "0.49144387", "0.4913832", "0.4900078", "0.4894985", "0.4889398", "0.48885804", "0.48864102", "0.488356", "0.4883347", "0.4881876", "0.48808986", "0.48801345", "0.48801345", "0.48801345", "0.48800343", "0.4879054" ]
0.0
-1
Create a new instance of a configuration class and check the connection with that database Return the result of the connection check
@Override public boolean isDatabaseAvailable(UserDatabase userDatabase) { return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public boolean createConnection(String database);", "abstract public boolean createConnection();", "private boolean connect() throws ClassNotFoundException, SQLException {\r\n\r\n\t\tClass.forName(\"com.mysql.jdbc.Driver\");\r\n\r\n\t\tif (dbConnection == null || dbConnection.isClosed()) {\r\n\t\t\tdbConnection = DriverManager.getConnection(Conf.getDbPath(), Conf.getDbUser(), Conf.getDbPassword());\r\n\t\t\tif (!dbConnection.isValid(10)) {\r\n\t\t\t\tConf.setDbLog(false);\r\n\t\t\t\treturn false;\r\n\t\t\t} else\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "boolean initConfiguration(Connection con, String schema, boolean dropIfExist) throws Exception;", "private void checkDataBase() {\n final Config dbConfig = config.getConfig(\"db\");\n\n checkArgument(!isNullOrEmpty(dbConfig.getString(\"driver\")), \"db.driver is not set!\");\n checkArgument(!isNullOrEmpty(dbConfig.getString(\"url\")), \"db.url is not set!\");\n\n dbConfig.getString(\"user\");\n dbConfig.getString(\"password\");\n dbConfig.getObject(\"additional\");\n }", "@Test\n public void testConstructorConnection() {\n assertEquals(connection, dao.getDatabaseConnection());\n }", "public interface DatabaseConfiguration {\n\n\t/**\n\t * TODO (paulo 21/01/2011 14:52:38): escrever javadoc\n\t *\n\t * @return\n\t */\n\tDatabaseTypes getDatabaseType();\n\t\n\t/**\n\t * TODO (paulo 21/01/2011 14:52:40): escrever javadoc\n\t *\n\t * @return\n\t * @throws DatabaseConfigurationException {@link RuntimeException} throw when not retrieve connection.\n\t */\n\tConnection getConnection();\n\t\n}", "public ConnectionConfig createConnection()\n {\n return _connectionConfig;\n }", "@Test\n\tpublic void testGetDbInstance(){\n\t\tConnection c = DatabaseConnect.getInstance();\n\t\tassertTrue(c != null);\t\n\t}", "public Connection createConnection(){\n Connection conn = null;\n registerDriver();\n createURL();\n\n try {\n conn = DriverManager.getConnection(urlDB,username,password);\n } catch (SQLException e) {\n e.printStackTrace();\n }\n\n System.out.println((conn != null)?\"You made it, take control your database now!\":\"Failed to make connection!\");\n\n return conn;\n}", "public DatabaseConnection newConnection();", "public static SQLDBConfig getInstance () {\n\t\tif ( sqldbconf == null ) {\n\t\t\tsynchronized ( SQLDBConfig.class ) {\n\t\t\t\tsqldbconf = new SQLDBConfig ();\n\t\t\t}\n\t\t}\n\t\treturn sqldbconf;\n\t}", "private DatabaseConnectionService() {\n ds = new HikariDataSource();\n ds.setMaximumPoolSize(20);\n ConfigProperties configProperties = ConfigurationLoader.load();\n if (configProperties == null) {\n throw new RuntimeException(\"Unable to read the config.properties.\");\n }\n ds.setDriverClassName(configProperties.getDatabaseDriverClassName());\n ds.setJdbcUrl(configProperties.getDatabaseConnectionUrl());\n ds.addDataSourceProperty(\"user\", configProperties.getDatabaseUsername());\n ds.addDataSourceProperty(\"password\", configProperties.getDatabasePassword());\n ds.setAutoCommit(false);\n }", "private void apriConnessione() throws SQLException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException {\n\t\tString password, user;\n\t\tDatabaseProps dbConf = config.getDb();\n\n\t\tClass.forName(dbConf.getDriver()).getDeclaredConstructor().newInstance();\n\n\t\tuser = dbConf.getUsername();\n\t\tpassword = dbConf.getPassword();\n\n\t\tString uri = String.format(\"jdbc:%s://%s:%d/%s\", dbConf.getDbms(), dbConf.getHost(), dbConf.getPort(), dbConf.getName());\n\n\t\tconnessioneDB = DriverManager.getConnection(uri, user, password);\n\t}", "@Override\n\tpublic boolean checkdbconfig() {\n\t\t// get path\n\t\tString path = context.getRealPath(\"/\");\n\t\tString dbpath = path + Utility.DB_PATH;\n\t\tString dbconfig = \"\";\n\t\tFileInputStream fileInputStreamSystemSettings = null;\n\t\tProperties prop = new Properties();\n\t\ttry {\n\t\t\tfileInputStreamSystemSettings = new FileInputStream(dbpath);\n\t\t\ttry {\n\t\t\t\tprop.load(fileInputStreamSystemSettings);\n\t\t\t\tdbconfig = prop.getProperty(\"jdbc.dbconfig\");\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tfileInputStreamSystemSettings.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tif (dbconfig.equalsIgnoreCase(\"Y\")) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "static Connection getDatabaseConnection(String path_to_config_json) {\n if (connection == null) {\n Gson gson = new Gson();\n Reader reader;\n try {\n reader = new FileReader(path_to_config_json);\n } catch (FileNotFoundException e) {\n logger.info(\"FileNotFoundException: \" + e.getMessage());\n return null;\n }\n DatabaseConfig config = gson.fromJson(reader, DatabaseConfig.class);\n logger.info(\"Connecting to database \" + config.database + \"...\");\n String username = config.username;\n String password = config.password;\n String database = String.format(\"%s%s:%s/%s%s\", config.jdbc_prefix, config.host, config.port,\n config.database, config.jdbc_setting);\n try {\n connection = DriverManager.getConnection(database, username, password);\n connection.setAutoCommit(false);\n logger.info(\"Connected to \" + config.database);\n } catch (Exception e) {\n logger.info(\"Cannot connect to database:'\" + database + \"' with error \" + e.getMessage());\n }\n }\n return connection;\n }", "private Boolean initSqlConnection(String url, String user, String pass) {\n\t\t\n\t\ttry {\n\t\t\tBoolean exists = false;\n\t\t\tClass.forName(SQL_DRIVER);\n\t\t\tConnection sqlConn = DriverManager.getConnection(url, user, pass);\n\t\t\tDatabaseMetaData dm = sqlConn.getMetaData();\n\t\t\tResultSet rs = dm.getCatalogs();\n\t\t\t\n\t\t\twhile (rs.next()) {\n\t\t\t\tif (rs.getString(\"TABLE_CAT\").compareTo(DB_NAME) == 0) { exists = true; }\n\t\t\t}\n\t\t\t\n\t\t\tif (exists == false) {\n\t\t\t\tStatement smt = sqlConn.createStatement();\n\t\t\t\tsmt.executeUpdate(\"CREATE DATABASE \" + DB_NAME);\n\t\t\t\tsmt.close();\n\t\t\t\tplugin.sendToLog(\"SQL Database not found, creating database: mc_bukkit_naw\");\t\n\t\t\t}\n\t\t\t\n\t\t\trs.close();\n\t\t\tsqlConn.close();\n\t\t\tsqlConn = DriverManager.getConnection(url + DB_NAME, user, pass);\n\t\t\tplugin.sendToLog(\"SQL Database connection initialized\");\n\t\t\treturn true;\n\t\t} catch (Exception e) {\n\t\t\tplugin.sendToLog(\"SQL Database connection failed!: \" + e.getMessage());\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public Boolean connect_DB() {\n\n Boolean connected = false;\n\n try {\n Class.forName(\"com.mysql.jdbc.Driver\");\n\n try {\n for (int i=0; i<conns; i++) {\n con_pool[i] = DriverManager.getConnection(\"jdbc:mysql://\" + Host.concat(\":\").concat(Port).concat(\"/\").concat(Database), User, Password);\n }\n connected = true;\n\n } catch (SQLException ex) {\n ex.printStackTrace();\n }\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }\n return connected;\n }", "private static void initSystem() throws Exception{\n ConfigFileModel ConfigFileModel;\n ConfigFileModel = ConfigFileUtil.getSingleton().getConfigFileModel();\n\n final String instance = ConfigFileModel.getInstance();\n final String user = ConfigFileModel.getUser();\n final String password = ConfigFileModel.getPassword();\n final String db = ConfigFileModel.getDb();\n final String port = ConfigFileModel.getPort();\n\n //Save dbempresas params connection to hibernate config file\n final HibernateConfigModel HibernateConfigModel_ = new HibernateConfigModel();\n HibernateConfigModel_.setUser(user); \n HibernateConfigModel_.setPassword(password);\n HibernateConfigModel_.setPort(Integer.valueOf(port));\n HibernateConfigModel_.setInstance(instance);\n HibernateConfigModel_.setDatabase(db);\n HibernateUtil.getSingleton().setHibernateConfigModelDbEmpresas(HibernateConfigModel_);\n\n //Check if the main database exists\n boolean result = MysqlScriptsUtil.getInstance().existsDB(HibernateConfigModel_.getDatabase(), HibernateConfigModel_.getUser(), HibernateConfigModel_.getPassword(), HibernateConfigModel_.getInstance(), HibernateConfigModel_.getPort());\n \n if(!result) {//Else database not exists \n dbempresasNotExists();\n }\n else { //The dabatase already exists \n \n HibernateUtil.getSingleton().loadDbEmpresas();\n veryLicense();\n }\n }", "public Connection connection()\n {\n String host = main.getConfig().getString(\"db.host\");\n int port = main.getConfig().getInt(\"db.port\");\n String user = main.getConfig().getString(\"db.user\");\n String password = main.getConfig().getString(\"db.password\");\n String db = main.getConfig().getString(\"db.db\");\n\n MysqlDataSource dataSource = new MysqlDataSource();\n dataSource.setServerName(host);\n dataSource.setPort(port);\n dataSource.setUser(user);\n if (password != null ) dataSource.setPassword(password);\n dataSource.setDatabaseName(db);\n Connection connection = null;\n try\n {\n connection = dataSource.getConnection();\n }\n catch (SQLException sqlException)\n {\n sqlException.printStackTrace();\n }\n return connection;\n }", "private Connection createConnection() {\n try {\n return DriverManager.getConnection(\"jdbc:mysql://\" + host + \":\" + port + \"/\" + db, user, password);\n } catch (SQLException e) {\n e.printStackTrace();\n return null;\n }\n }", "protected Connection createConnection() {\n Properties connectionProperties = new Properties();\n JdbcPropertyAdapter adapter = getPropertyAdapter(dbType, properties);\n adapter.getExtraProperties(connectionProperties);\n\n String url = translator.getUrl(properties);\n logger.info(\"Opening connection to: \" + url);\n Connection connection;\n try {\n connection = DriverManager.getConnection(url, connectionProperties);\n connection.setAutoCommit(false);\n } catch (SQLException x) {\n throw translator.translate(x);\n }\n return connection;\n }", "public DBManager(){\r\n connect(DBConstant.driver,DBConstant.connetionstring);\r\n }", "@SuppressWarnings(\"finally\")\n\tpublic static Connection createConnection() throws Exception {\n\t\tConnection con = null;\n\t\ttry {\n\t\t\tClass.forName(Constants.dbClass);\n\t\t\tcon = DriverManager.getConnection(Constants.dbUrl, Constants.dbUser,Constants.dbPwd);\n\t\t} catch (Exception e) {\n\t\t\tthrow e;\n\t\t} finally {\n\t\t\treturn con;\n\t\t}\n\t}", "public ConnectionConfiguration loadConnectionConfiguration(){\n\t\tConnectionConfiguration savedconfig = null;\n\t\ttry {\n\t\t FileInputStream propInFile = new FileInputStream( getConnConfigFile());\n\t\t Properties p = new Properties();\n\t\t p.load( propInFile );\n\n\t\t String server = p.getProperty(\"server\");\n\t\t String user = p.getProperty(\"user\");\n\t\t String passwd = p.getProperty(\"passwd\");\n\t\t \n\t\t if (server != null & user != null & passwd != null){\n\t\t\t savedconfig = new ConnectionConfiguration();\n\t\t\t savedconfig.setServer(server);\n\t\t\t savedconfig.setUser(user);\n\t\t\t savedconfig.setPasswd(passwd);\n\t\t }\n\t\t \n\t\t }\n\t\t catch ( FileNotFoundException e ) {\n\t\t //createConnectionConfigurationDialog(Resources.getString(\"msg_no_config_file\"));\n\t\t }\n\t\t catch ( IOException e ) {\n\t\t //createConnectionConfigurationDialog(Resources.getString(\"msg_config_file_not_readable\"));\n\t }\n\t\t return savedconfig; \n\t}", "@Override\n public boolean verifyJobDatabase() {\n try (Connection conn = getConnection()) {\n } catch (Exception e) {\n LOG.error(\"Failed to verify connection to the Job Database. \", e);\n return false;\n }\n return true;\n }", "public ConnectDB(){\r\n\r\n\t}", "public static void init()\n {\n try\n {\n // The newInstance() call is a work around for some broken Java implementations\n Class.forName(\"com.mysql.jdbc.Driver\").newInstance();\n\n // Create a new configuration object\n BoneCPConfig config = new BoneCPConfig();\n\n // Setup the configuration\n config.setJdbcUrl(\"jdbc:mysql://cs304.c0mk5mvcjljr.us-west-2.rds.amazonaws.com/cs304\"); // jdbc url specific to your database, eg jdbc:mysql://127.0.0.1/yourdb\n config.setUsername(\"cs304\");\n config.setPassword(\"ubccs304\");\n config.setConnectionTestStatement(\"SELECT 1\");\n config.setConnectionTimeout(10, TimeUnit.SECONDS);\n config.setMinConnectionsPerPartition(5);\n config.setMaxConnectionsPerPartition(10);\n config.setPartitionCount(1);\n\n // Setup the connection pool\n _pool = new BoneCP(config);\n\n // Log\n LogManager.getLogger(DatabasePoolManager.class).info(\"Database configuration initialized\");\n }\n catch (Exception ex)\n {\n // Log\n LogManager.getLogger(DatabasePoolManager.class).fatal(\"Could not initialize Database configuration\", ex);\n }\n\n }", "@Override\n\tpublic void construct() {\n\t\tSystem.out.println(\"Getting a MySQL Database Connection\");\n\n\t}", "Connection createConnection();", "public BLFacadeImplementation() {\t\t\r\n\t\tSystem.out.println(\"Creating BLFacadeImplementation instance\");\r\n\t\tConfigXML c=ConfigXML.getInstance();\r\n\t\t\r\n\t\tif (c.getDataBaseOpenMode().equals(\"initialize\")) {\r\n\t\t\tDataAccess dbManager=new DataAccess(c.getDataBaseOpenMode().equals(\"initialize\"));\r\n\t\t\tdbManager.initializeDB();\r\n\t\t\tdbManager.close();\r\n\t\t\t}\r\n\t\t\r\n\t}", "@Test(expected = TermsOfUseDaoConfigurationException.class)\r\n public void testCtor_dbConnectionFactoryConfigInvalid2() throws Exception {\r\n configurationObject.getChild(\"dbConnectionFactoryConfig\").getChild(\r\n \"com.topcoder.db.connectionfactory.DBConnectionFactoryImpl\").getChild(\"connections\").setPropertyValue(\r\n \"default\", \"not_exist\");\r\n\r\n new ProjectTermsOfUseDaoImpl(configurationObject);\r\n }", "private DBConnection() \n {\n initConnection();\n }", "public static class_config getinstance(){\n\t\tif (instance==null){\n\t\t\tinstance = new class_config();\n\t\t\t\n singleton.mongo=new Mongo_DB();\n singleton.nom_bd=singleton.mongo.getNom_bd();\n singleton.nom_table=singleton.mongo.getNom_table();\n singleton.client = Mongo_DB.connect();\n if (singleton.client != null) {\n singleton.db = singleton.mongo.getDb();\n singleton.collection = singleton.mongo.getCollection();\n }\n \n\t\t\tsingleton_admin.admin= new ArrayList<admin_class>();\n\t\t\tsingleton_client.client= new ArrayList<client_class>();\n\t\t\tsingleton_reg.reg= new ArrayList<reg_user_class>();\n\t\t\t\n// A_auto_json.auto_openjson_admin();\n// C_auto_json.auto_openjson_client();\n R_auto_json.auto_openjson_reg();\n //funtions_files.auto_open();\n\t\t\tauto_config.auto_openconfig();\n //class_language.getinstance();\n\t\t\tsingleton_config.lang=new class_language();\n \n connectionDB.init_BasicDataSourceFactory();\n \n\t\t}\n\t\treturn instance;\n\t}", "private Database() throws SQLException, ClassNotFoundException {\r\n Class.forName(\"org.postgresql.Driver\");\r\n con = DriverManager.getConnection(\"jdbc:postgresql://localhost:5432/postgres\", \"postgres\", \"kuka\");\r\n }", "public void createConnection() {\n\t\tif (path != null) {\n\t\t\ttry {\n\t\t\t\tconn = DriverManager.getConnection(path);\n\t\t\t} catch(SQLException se){\n\t\t\t //Handle errors for JDBC\n\t\t\t se.printStackTrace();\n\t\t\t }catch(Exception e){\n\t\t\t //Handle errors for Class.forName\n\t\t\t e.printStackTrace();\n\t\t\t }\n\t\t}\n\t}", "public boolean connexion(){\n try{\n Class.forName(\"com.mysq.jdbc.Driver\").newInstance();\n this.bdConnect = DriverManager.getConnection(\"jdbc:mysql:\" + this.url, this.identifiant, this.mdp);\n this.bdStatement = this.bdConnect.createStatement();\n return true;\n }catch (SQLException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) {\n Logger.getLogger(ConnexionBD.class.getName()).log(Level.SEVERE, null, ex);\n }\n return false;\n }", "public static boolean start(Configuration config) {\n if (!dbTypes.containsKey(Config.dbType.toLowerCase())) {\n log.error(\"Unknown Datasource type %s!\", Config.dbType.toLowerCase());\n return false;\n }\n\n try {\n // Create MyTownDatasource instance\n datasource = (MyTownDatasource) dbTypes.get(Config.dbType.toLowerCase()).newInstance();\n datasource.setLog(log);\n } catch (Exception e) {\n log.error(\"Failed to instantiate the Datasource (%s)!\", e, Config.dbType.toLowerCase());\n return false;\n }\n\n // Load config options\n ConfigProcessor.load(config, datasource.getClass(), datasource);\n\n // Do actual initialization\n if (!datasource.initialize()) {\n log.error(\"Failed to initialize the Datasource!\");\n return false;\n }\n\n // Load everything\n if (!datasource.loadAll()) {\n log.error(\"Failed to load the Datasource!\");\n return false;\n }\n\n if (!datasource.checkAllOnStart()) {\n log.error(\"Failed to check the Datasource!\");\n return false;\n }\n\n // Yay, initialized/loaded!\n return true;\n }", "public static Connection getDBConnection(){\n\t\tConnection conn = null;\r\n\t\t\r\n\t\ttry {\r\n\t\t\t/*InputStream is = DBConfig.class.getClass().\r\n\t\t\t\t\tgetResourceAsStream(\"/resources/db.properties\");\r\n\t\t\tprop.load(is);\r\n\t\t\tClass.forName(prop.getProperty(\"drivername\"));\r\n\t\t\tconn = DriverManager.getConnection(prop.getProperty(\"jdbcurl\"),\r\n\t\t\t\t\tprop.getProperty(\"username\"),prop.getProperty(\"password\"));*/\r\n\t\t\t\r\n\t\t\tClass.forName(\"oracle.jdbc.driver.OracleDriver\");\r\n\t\t\tconn = DriverManager.getConnection(\"jdbc:oracle:thin:@localhost:1521:orcl\",\"fred\",\"flintstone\");\r\n\t\t\t/*Statement stmt = conn.createStatement();\r\n\t\t\tResultSet rs = stmt.executeQuery(\"SELECT LOCATION_NAME FROM LOCATIONS\");\r\n\t\t\twhile(rs.next()){\r\n\t\t\t\tSystem.out.println(rs.getString(\"LOCATION_NAME\"));\r\n\t\t\t}*/\r\n\t\t} catch (ClassNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} /*catch (FileNotFoundException e){\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}*/\r\n\t\t\r\n\t\treturn conn;\r\n\t}", "@Override\n public CheckDBDAO getInitDBDAO() {\n if (instanceCheckDBDAO == null) {\n return new MySQLCheckDBDAO(connection);\n } else {\n return instanceCheckDBDAO;\n }\n }", "@Test\r\n public void testCtor() {\r\n instance = new ProjectTermsOfUseDaoImpl(configurationObject);\r\n\r\n assertNotNull(\"'dbConnectionFactory' should be correct.\", instance.getDBConnectionFactory());\r\n assertNotNull(\"'log' should be correct.\", instance.getLog());\r\n }", "@Test\n public void testConnect() throws MainException {\n System.out.println(\"connect\");\n LinkingDb instance = new LinkingDb(new ConfigurazioneTO(\"jdbc:hsqldb:file:database/\",\n \"ADISysData\", \"asl\", \"\"));\n Connection result = instance.connect();\n assertNotNull(result);\n boolean expResult = true;\n assertEquals(instance.isConnected(), expResult);\n }", "public boolean open()\r\n {\r\n boolean result = true;\r\n if(connection == null)\r\n {\r\n try\r\n {\r\n connection = DriverManager.getConnection(\"jdbc:mysql://\" + HOST + \"/\" + DATABASE, USER, PASSWORD);\r\n result = true;\r\n } catch(SQLException exception)\r\n {\r\n LOG.log(Level.SEVERE, \"\", exception);\r\n result = false;\r\n }\r\n }\r\n return result;\r\n }", "public static Connection getInstance() {\n\t\tConnection conn = null;\n\t\ttry {\n\t\t\tconn = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/restaurant?useSSL=false\", \"root\", \"1234\");\n\t\t} catch (SQLException e) {\n\t\t\te.getStackTrace();\n\t\t}\n\t\treturn conn;\n\t}", "public static Connection createDBConnection() throws ClassNotFoundException, SQLException\r\n\t{\r\n\t\tString strDbUser = properties.getProperty(\"jdbc.username\"); // database login username\r\n String strDbPassword = properties.getProperty(\"jdbc.password\"); // database login password\r\n String remoteHost = properties.getProperty(\"remote.host\"); // remote host url (ie cloud server url\t\r\n String remotePort = properties.getProperty(\"remote.port\"); // remote post number\r\n String databaseName = properties.getProperty(\"databaseName\");\r\n Connection con;\r\n \r\n System.out.println(\"Trying connection \");\r\n \r\n\t\tClass.forName(\"org.postgresql.Driver\");\r\n// \tClass.forName(\"com.mysql.jdbc.Driver\");\r\n// con = DriverManager.getConnection(\"jdbc:mysql://127.0.0.1:\"+tunnelPort+\"/cos420?user=\"+strDbUser+\"&password=\"+strDbPassword);\r\n\t\tString connectString = \"jdbc:postgresql://\" + remoteHost +\":\" + remotePort + \"/\"+databaseName; \r\n\t\tcon = DriverManager.getConnection(connectString , strDbUser,strDbPassword);\r\n\r\n \tif(!con.isClosed())\r\n System.out.println(\"Successfully connected to Postgres server using TCP/IP...\");\r\n\r\n return con;\r\n\t}", "public boolean connect(){\n try{\n conn = DriverManager.getConnection(uri, user, password);\n }catch (SQLException sqle){\n DLException dle = new DLException(sqle, \"Unable to conclude this operation\");\n return false;\n }\n return true;\n }", "public static Connection createConnection() {\n\t\treturn new FabricaDeConexoes().getConnection();\n\t}", "public boolean connect(){\n if(isConnect)\n return true;\n\n this.isConnect = true;\n\n this.repository = sqLiteConnect(new Repository().getColumnType());\n\n if(this.repository == null){\n ItemBox.getLogger().severe(\"[Database] \\\"repository\\\" connect fail!\");\n return false;\n }\n\n\n ItemBox.getLogger().info(\"[Database] connect success\");\n return true;\n }", "public boolean connectDB(){\r\n\t\ttry{\r\n\t\t\t//Lo primero es cargar el controlador MySQL el cual automáticamente se registra\r\n\t\t\tClass.forName(CONTROLADOR_MYSQL);\r\n\t\t\t//Conectarnos a la BBDD\r\n\t\t\tconexion = DriverManager.getConnection(this.url,this.user,this.pass);\r\n\t\t}\r\n\t\tcatch( SQLException excepcionSql ) \r\n\t\t{\r\n\t\t\texcepcionSql.printStackTrace();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tcatch( ClassNotFoundException noEncontroClase)\r\n\t\t{\r\n\t\t\tnoEncontroClase.printStackTrace();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public void CheckConnection() {\n\t\tconn = SqlConnection.DbConnector();\n\t\tif (conn == null) {\n\t\t\tSystem.out.println(\"Connection Not Successful\");\n\t\t\tSystem.exit(1);\n\t\t} else {\n\t\t\tSystem.out.println(\"Connection Successful\");\n\t\t}\n\t}", "public static Connection createConnection() throws ClassNotFoundException, SQLException {\n\t\tClass.forName(\"oracle.jdbc.driver.OracleDriver\");\n\t\tconnection=DriverManager.getConnection(\"jdbc:oracle:thin:@localhost:1521:XE\",\"system\",\"bhanu\");\n\t\treturn connection;\n\t}", "public DBConnection()\n {\n\n }", "@BeforeClass\n\tpublic static void setup() throws SQLException {\n\t\tconfig = new ConnectionConfig();\n\t\tconfig.setDataSource(Mockito.mock(DataSource.class));\n\t\t//mock connection\n\t\tConnection connection = Mockito.mock(Connection.class);\n\t\tMockito.when(config.getDataSource().getConnection()).thenReturn(connection);\n\t\tMockito.when(connection.isValid((int) TimeUnit.MILLISECONDS.toSeconds(config.getValidationTimeout()))).thenReturn(true);\n\t\t//create the connection pool\n\t\tpool = new ConnectionPoolImpl(config);\n\t}", "private static DBConnectionFactory createDBConnectionFactory(ConfigurationObject config) {\r\n ConfigurationObject dbConnectionFactoryConfig = Helper.getChildConfig(config,\r\n DB_CONNECTION_FACTORY_CONFIG);\r\n\r\n // Create database connection factory using the extracted configuration\r\n try {\r\n return new DBConnectionFactoryImpl(dbConnectionFactoryConfig);\r\n } catch (UnknownConnectionException e) {\r\n throw new LateDeliverablesTrackerConfigurationException(\r\n \"Fails to create database connection factory.\", e);\r\n } catch (ConfigurationException e) {\r\n throw new LateDeliverablesTrackerConfigurationException(\r\n \"Fails to create database connection factory.\", e);\r\n }\r\n }", "private Connection createConnection() {\r\n\tConnection result = null;\r\n\r\n\ttry {\r\n\t Class.forName(\"org.sqlite.JDBC\");\r\n\t result = DriverManager.getConnection(\"jdbc:sqlite:\" + fileName);\r\n\t} catch (Exception e) {\r\n\t result = null;\r\n\t}\r\n\r\n\treturn result;\r\n }", "@Test(expected = TermsOfUseDaoConfigurationException.class)\r\n public void testCtor_dbConnectionFactoryConfigMissing() throws Exception {\r\n configurationObject.removeChild(\"dbConnectionFactoryConfig\");\r\n\r\n new ProjectTermsOfUseDaoImpl(configurationObject);\r\n }", "@Test\n public void testIsConnected() throws MainException {\n System.out.println(\"isConnected\");\n LinkingDb instance = new LinkingDb(new ConfigurazioneTO(\"jdbc:hsqldb:file:database/\",\n \"ADISysData\", \"asl\", \"\"));\n instance.connect();\n boolean expResult = true;\n boolean result = instance.isConnected();\n assertEquals(expResult, result);\n instance.disconnect();\n result = instance.isConnected();\n assertEquals(false, result);\n\n }", "private static List<Configuration> configure() {\n Map<String, Configuration> configurations = new HashMap<String, Configuration>();\n try {\n Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(\"jorm.properties\");\n \n while (resources.hasMoreElements()) {\n URL url = resources.nextElement();\n \n Database.get().log.debug(\"Found jorm configuration @ \" + url.toString());\n \n Properties properties = new Properties();\n InputStream is = url.openStream();\n properties.load(is);\n is.close();\n \n String database = null;\n String destroyMethodName = null;\n String dataSourceClassName = null;\n Map<String, String> dataSourceProperties = new HashMap<String, String>();\n int priority = 0;\n \n for (Entry<String, String> property : new TreeMap<String, String>((Map) properties).entrySet()) {\n String[] parts = property.getKey().split(\"\\\\.\");\n if (parts.length < 3 || !parts[0].equals(\"database\")) {\n continue;\n }\n if (database != null && !parts[1].equals(database)) {\n try {\n Configuration conf = configurations.get(database);\n if (conf == null || conf.priority < priority) {\n conf = new Configuration(database, dataSourceClassName, dataSourceProperties, destroyMethodName, priority);\n configurations.put(database, conf);\n Database.get().log.debug(\"Configured \" + conf);\n }\n } catch (Exception ex) {\n Database.get().log.warn(\"Failed to configure database: \" + ex.getMessage());\n }\n database = parts[1];\n destroyMethodName = null;\n dataSourceClassName = null;\n dataSourceProperties = new HashMap<String, String>();\n priority = 0;\n }\n\n if (parts.length == 3 && parts[2].equals(\"destroyMethod\")) {\n destroyMethodName = property.getValue();\n } else if (parts.length == 3 && parts[2].equals(\"priority\")) {\n try {\n priority = Integer.parseInt(property.getValue().trim());\n } catch (Exception ex) {\n \n }\n } else if (parts[2].equals(\"dataSource\")) {\n if (parts.length == 3) {\n dataSourceClassName = property.getValue();\n } else if (parts.length == 4) {\n dataSourceProperties.put(parts[3], property.getValue());\n } else {\n Database.get().log.warn(\"Invalid DataSource property '\" + property.getKey() + \"'\");\n }\n } else {\n Database.get().log.warn(\"Invalid property '\" + property.getKey() + \"'\");\n }\n }\n \n if (database != null) {\n try {\n Configuration conf = configurations.get(database);\n if (conf == null || conf.priority < priority) {\n conf = new Configuration(database, dataSourceClassName, dataSourceProperties, destroyMethodName, priority);\n configurations.put(database, conf);\n Database.get().log.debug(\"Configured \" + conf);\n }\n } catch (Exception ex) {\n Database.get().log.warn(\"Failed to configure database: \" + ex.getMessage());\n }\n }\n }\n \n for (Entry<String, Configuration> entry : configurations.entrySet()) {\n entry.getValue().apply();\n Database.get().log.debug(\"Configured \" + configuration);\n }\n } catch (IOException ex) {\n Database.get().log.warn(\"Failed to configure database: \" + ex.getMessage()); \n }\n \n return new ArrayList<Configuration>(configurations.values());\n }", "public static DatabaseConnection getInstance() throws SQLException {\n if (instance == null) {//if we didn't create it earlier\n instance = new DatabaseConnection();//we create new one\n }\n return instance;//otherwise it returns old one\n }", "public synchronized static Connection getInstance()\n\t{\n\t\tif(connect == null)\n\t\t{\n\t\t\tnew DAOconnexion();\n\t\t}\n\t\treturn connect;\n\t}", "public XMLDatabaseConnector()\n\t{\n\t\t\n\t\tProperties prop = new Properties();\n\t\t\n\t\t InputStream inputStream = this.getClass().getClassLoader()\n\t .getResourceAsStream(\"config.properties\");\n\t\t \n \ttry {\n //load a properties file\n \t\tprop.load(inputStream);\n \n //get the property value and print it out\n \t\tsetURI(prop.getProperty(\"existURI\"));\n \t\tusername = prop.getProperty(\"username\");\n \t\tpassword = prop.getProperty(\"password\");\n \n \t} catch (IOException ex) {\n \t\tex.printStackTrace();\n }\n\t}", "public static Connection getInstanceConnection(){\r\n\t\ttry {\r\n\t\t\tif(conn==null) {\r\n\t\t\t\tconn=DriverManager.getConnection(url, userDb, pwdDb);\r\n\t\t\t\tSystem.out.println(\"Connexion �tablie avec la base\");\r\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\tSystem.out.println(\"Probl�me de connexion\");\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn conn;\r\n\t}", "private DbConnection() {\n }", "protected boolean connect() {\n try {\n String metaData = \"\";\n metaData += \"jdbc:mysql://\";\n metaData += this.URL + \":\";\n metaData += this.PORT + \"/\";\n metaData += this.DATABASE;\n this.connection = DriverManager.getConnection(metaData, this.USERNAME, this.PASSWORD\n );\n } catch(SQLException ex) {\n Logger.getLogger(MySQLMariaDBConnector.class.getName()).log(Level.SEVERE, null, ex);\n System.exit(1);\n }\n return this.connection != null;\n }", "public DatabaseManager() {\n try {\n con = DriverManager.getConnection(DB_URL, \"root\", \"marko\");\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }", "public DBConnection() {\n this(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST, DB_PORT);\n }", "private static Connection getDriverMangerConnection(final OracleERPConfiguration config) {\r\n final String connectionUrl = config.getConnectionUrl();\r\n LOG.ok(\"getDriverMangerConnection connectionUrl {0}\", connectionUrl);\r\n\r\n // create the connection base on the configuration..\r\n final Connection[] ret = new Connection[1];\r\n try {\r\n // load the driver class..\r\n Class.forName(config.getDriver());\r\n // get the database URL..\r\n if (config.getPassword() == null) {\r\n throw new IllegalStateException(config.getMessage(MSG_PASSWORD_BLANK));\r\n }\r\n\r\n if (StringUtil.isBlank(config.getUser())) {\r\n throw new IllegalStateException(config.getMessage(MSG_USER_BLANK));\r\n }\r\n // check if there is authentication involved.\r\n config.getPassword().access(new GuardedString.Accessor() {\r\n public void access(char[] clearChars) {\r\n try {\r\n java.util.Properties info = new java.util.Properties();\r\n info.put(\"user\", config.getUser());\r\n info.put(\"password\", new String(clearChars));\r\n if (StringUtil.isNotBlank(config.getClientEncryptionType())) {\r\n LOG.ok(\"getDriverMangerConnection set oracle.net.encryption_types_client {0}\",\r\n config.getClientEncryptionType());\r\n info.put(\"oracle.net.encryption_types_client\", config\r\n .getClientEncryptionType());\r\n }\r\n if (StringUtil.isNotBlank(config.getClientEncryptionLevel())) {\r\n LOG.ok(\"getDriverMangerConnection set oracle.net.encryption_client {0}\",\r\n config.getClientEncryptionLevel());\r\n info.put(\"oracle.net.encryption_client\", config\r\n .getClientEncryptionLevel());\r\n }\r\n\r\n ret[0] = DriverManager.getConnection(connectionUrl, info);\r\n } catch (SQLException e) {\r\n // checked exception are not allowed in the access\r\n // method\r\n // Lets use the exception softening pattern\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n });\r\n // turn off auto-commit\r\n } catch (Exception e) {\r\n throw ConnectorException.wrap(e);\r\n }\r\n return ret[0];\r\n }", "@Test\n public void testGetInstance() {\n System.out.println(\"getInstance\");\n ConnectionManager result = ConnectionManager.getInstance();\n assertNotNull(result);\n assertEquals(instance,result);\n }", "private static Configuration getConfigurationFromDb(String conf_id) {\n FrontEndDBInterface f = new FrontEndDBInterface();\n Configuration config = f.getConfigInformation(Integer.parseInt(conf_id));\n return config;\n }", "private DBManager() {\n SETTINGS.load(Settings.class.getClassLoader().getResourceAsStream(\"db.properties\"));\n this.dbUrl = SETTINGS.getProperty(\"DB_URL\");\n this.dbUser = SETTINGS.getProperty(\"DB_USER\");\n this.dbPassword = SETTINGS.getProperty(\"DB_PASSWORD\");\n try {\n Class.forName(SETTINGS.getProperty(\"DB_DRIVER\"));\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }\n }", "public static void initConnection() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException{\r\n\t\t//create database connection only once\r\n\t\tif(dbCon == null){\t\r\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\r\n\t\t\tdbCon = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/wip?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC\",\"root\",\"\");\r\n\t\t}\r\n\t}", "private static void connectDatabase(){\n\t\t// register the driver\n\t\ttry{\n\t\t\tClass.forName(DRIVER).newInstance();\n\t\t\tconnection = DriverManager.getConnection(CONNECTION_URL);\n\t\t} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "public static boolean testConn() {\r\n\t\tboolean bool = false;\r\n\t\ttry (Connection conn = DataSource.getConnection()) {\r\n\t\t\tbool = conn.isValid(0);\r\n\t\t\tif (bool == true){\r\n\t\t\t\tdbStatus = \"ONLINE\";\r\n\t\t\t}\r\n\t\t\telse dbStatus = \"OFFLINE\";\r\n\t\t} catch (SQLException e) {\r\n\t\t\tSystem.out.println(e);\r\n\t\t}\r\n\t\treturn bool;\r\n\t}", "private DatabaseHandler(){\n createConnection();\n }", "private boolean managingConnections() {\n\n if (configWrapper.getConfig().getConnectionInfo().getDataSource() == null) {\n return false;\n }\n\n return true;\n\n }", "void checkTapDbVersion() throws ConfigurationException;", "private SQLite sqLiteConnect(DatabaseConfig config){\n SQLite result;\n String filePath = String.format(\"database\\\\%s.db\", config.getSqlName());\n result = new SQLite(filePath);\n\n if(result.connect())\n ItemBox.getLogger().info(\"[Database] connect successful \" + filePath);\n\n else{\n ItemBox.getLogger().severe(\"[Database] connect fail \" + filePath);\n return null;\n }\n\n SQLiteTable sqLiteTable = convertToSQLiteTable(config);\n SQLite.Status sqLiteResult = result.createTable(sqLiteTable);\n\n if(sqLiteResult == SQLite.Status.SUCCESS){\n ItemBox.getLogger().info(String.format(\"[Database] add table \\\"%s\\\" to %s\", config.getTableName(), filePath));\n }else{\n ItemBox.getLogger().info(String.format(\"[Database] found table \\\"%s\\\" from %s\", config.getTableName(), filePath));\n }\n\n ItemBox.getLogger().info(String.format(\"[Database] sql \\\"%s\\\" connected\", config.getSqlName()));\n return result;\n }", "public synchronized void connect(DatabaseConnection connection) throws DatabaseConfigurationException, DatabaseVersionException, SQLException {\n\t\tconnection.validate();\n\n\t\t// disconnect if we are currently connected to another database\n\t\tif (isConnected()) {\n\t\t\tdisconnect();\n\t\t}\n\n\t\t// get database adapter\n\t\tdatabaseAdapter = DatabaseAdapterFactory.getInstance().createDatabaseAdapter(connection.getDatabaseType());\n\n\t\t// general pool properties\n\t\tPoolProperties properties = new PoolProperties();\n\t\tproperties.setUrl(databaseAdapter.getJDBCUrl(connection.getServer(), connection.getPort(), connection.getSid()));\n\t\tproperties.setDriverClassName(databaseAdapter.getConnectionFactoryClassName());\n\t\tproperties.setUsername(connection.getUser());\n\t\tproperties.setPassword(connection.getPassword());\n\t\tproperties.setName(poolName);\n\t\tproperties.setDefaultAutoCommit(false);\n\t\tproperties.setRollbackOnReturn(true);\n\n\t\t// set user-definable pool properties\t\n\t\tif (connection.getMaxActive() != null) properties.setMaxActive(connection.getMaxActive());\n\t\tif (connection.getMaxIdle() != null) properties.setMaxIdle(connection.getMaxIdle());\n\t\tif (connection.getMinIdle() != null) properties.setMinIdle(connection.getMinIdle());\n\t\tif (connection.getInitialSize() != null) properties.setInitialSize(connection.getInitialSize());\n\t\tif (connection.getMaxWait() != null) properties.setMaxWait(connection.getMaxWait());\n\t\tif (connection.getTestOnBorrow() != null) properties.setTestOnBorrow(connection.getTestOnBorrow());\n\t\tif (connection.getTestOnReturn() != null) properties.setTestOnReturn(connection.getTestOnReturn());\n\t\tif (connection.getTestWhileIdle() != null) properties.setTestWhileIdle(connection.getTestWhileIdle());\n\t\tif (connection.getValidationQuery() != null) properties.setValidationQuery(connection.getValidationQuery());\n\t\tif (connection.getValidatorClassName() != null) properties.setValidatorClassName(connection.getValidatorClassName());\n\t\tif (connection.getTimeBetweenEvictionRunsMillis() != null) properties.setTimeBetweenEvictionRunsMillis(connection.getTimeBetweenEvictionRunsMillis());\n\t\tif (connection.getNumTestsPerEvictionRun() != null) properties.setNumTestsPerEvictionRun(connection.getNumTestsPerEvictionRun());\n\t\tif (connection.getMinEvictableIdleTimeMillis() != null) properties.setMinEvictableIdleTimeMillis(connection.getMinEvictableIdleTimeMillis());\n\t\tif (connection.getRemoveAbandoned() != null) properties.setRemoveAbandoned(connection.getRemoveAbandoned());\n\t\tif (connection.getRemoveAbandonedTimeout() != null) properties.setRemoveAbandonedTimeout(connection.getRemoveAbandonedTimeout());\n\t\tif (connection.getLogAbandoned() != null) properties.setLogAbandoned(connection.getLogAbandoned());\n\t\tif (connection.getConnectionProperties() != null) properties.setConnectionProperties(connection.getConnectionProperties());\n\t\tif (connection.getInitSQL() != null) properties.setInitSQL(connection.getInitSQL());\n\t\tif (connection.getValidationInterval() != null) properties.setValidationInterval(connection.getValidationInterval());\n\t\tif (connection.getJmxEnabled() != null) properties.setJmxEnabled(connection.getJmxEnabled());\n\t\tif (connection.getFairQueue() != null) properties.setFairQueue(connection.getFairQueue());\n\t\tif (connection.getAbandonWhenPercentageFull() != null) properties.setAbandonWhenPercentageFull(connection.getAbandonWhenPercentageFull());\n\t\tif (connection.getMaxAge() != null) properties.setMaxAge(connection.getMaxAge());\n\t\tif (connection.getUseEquals() != null) properties.setUseEquals(connection.getUseEquals());\n\t\tif (connection.getSuspectTimeout() != null) properties.setSuspectTimeout(connection.getSuspectTimeout());\n\n\t\t// pool maintenance\n\t\tproperties.setJdbcInterceptors(\"org.citydb.core.database.connection.ConcurrentStatementFinalizer\");\n\n\t\t// create new data source\n\t\tdataSource = new DataSource(properties);\n\t\tdataSource.setLoginTimeout(connection.isSetLoginTimeout() ?\n\t\t\t\tconnection.getLoginTimeout() :\n\t\t\t\tDEFAULT_LOGIN_TIMEOUT);\n\n\t\ttry {\n\t\t\t// create connection pool\n\t\t\tdataSource.createPool();\n\t\t\t\t\t\t\n\t\t\t// set connection details\n\t\t\tDatabaseConnectionDetails connectionDetails = new DatabaseConnectionDetails(connection);\n\t\t\tdatabaseAdapter.setConnectionDetails(connectionDetails);\n\n\t\t\t// check workspace\n\t\t\tif (databaseAdapter.hasVersioningSupport()) {\n\t\t\t\tif (connectionDetails.isSetWorkspace()) {\n\t\t\t\t\tWorkspace workspace = connectionDetails.getWorkspace();\n\t\t\t\t\tworkspace.setName(!workspace.isSetName() ?\n\t\t\t\t\t\t\tdatabaseAdapter.getWorkspaceManager().getDefaultWorkspaceName() :\n\t\t\t\t\t\t\tdatabaseAdapter.getWorkspaceManager().formatWorkspaceName(workspace.getName()));\n\n\t\t\t\t\t// fail fast if workspace is not available\n\t\t\t\t\tdatabaseAdapter.getWorkspaceManager().gotoWorkspace(dataSource.getConnection(), workspace);\n\t\t\t\t} else {\n\t\t\t\t\tString name = databaseAdapter.getWorkspaceManager().getDefaultWorkspaceName();\n\t\t\t\t\tconnectionDetails.setWorkspace(new Workspace(name));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// check database schema\n\t\t\tif (connectionDetails.isSetSchema()) {\n\t\t\t\tconnectionDetails.setSchema(databaseAdapter.getSchemaManager().formatSchema(connectionDetails.getSchema()));\n\t\t\t\tif (!databaseAdapter.getSchemaManager().existsSchema(connectionDetails.getSchema())) {\n\t\t\t\t\tthrow new SQLException(\"The database schema '\" + connectionDetails.getSchema() + \"' does not exist.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconnectionDetails.setSchema(databaseAdapter.getSchemaManager().getDefaultSchema());\n\t\t\t}\n\n\t\t\t// retrieve connection metadata\n\t\t\tdatabaseAdapter.setConnectionMetaData(databaseAdapter.getUtil().getDatabaseInfo(connectionDetails.getSchema()));\n\n\t\t\t// check for supported database version\n\t\t\tList<DatabaseConnectionWarning> warnings = versionChecker.checkVersionSupport(databaseAdapter);\n\t\t\tif (!warnings.isEmpty()) {\n\t\t\t\tdatabaseAdapter.addConnectionWarnings(warnings);\n\t\t\t}\n\n\t\t\t// check for registered ADEs\n\t\t\tList<ADEMetadata> ades = Collections.emptyList();\n\t\t\tif (databaseAdapter.getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0) {\n\t\t\t\tades = databaseAdapter.getUtil().getADEInfo();\n\t\t\t\tif (!ades.isEmpty()) {\n\t\t\t\t\tdatabaseAdapter.getConnectionMetaData().setRegisteredADEs(ades);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// check whether registered ADE are supported by ADE extensions\n\t\t\tDatabaseConnectionWarning warning = checkADESupport(ades);\n\t\t\tif (warning != null) {\n\t\t\t\tdatabaseAdapter.addConnectionWarning(warning);\n\t\t\t}\n\n\t\t\t// check whether user-defined reference systems are supported\n\t\t\tfor (DatabaseSrs refSys : config.getDatabaseConfig().getReferenceSystems()) {\n\t\t\t\tdatabaseAdapter.getUtil().getSrsInfo(refSys);\n\t\t\t}\n\t\t} catch (DatabaseVersionException | SQLException e) {\n\t\t\ttry {\n\t\t\t\tdisconnect();\n\t\t\t} catch (Exception ignored) {\n\t\t\t\t//\n\t\t\t}\n\n\t\t\tthrow e;\n\t\t}\n\n\t\t// fire property change event\n\t\teventDispatcher.triggerSyncEvent(new DatabaseConnectionStateEvent(false, true));\n\t}", "void createConnection();", "@Override\n public Configuration getConfiguration(Connection connection, Long configID) throws SQLException {\n PreparedStatement ps = null;\n try{\n String insertSQL = \"SELECT * FROM Configuration WHERE configurationID = ?;\";\n ps = connection.prepareStatement(insertSQL);\n ps.setLong(1, configID);\n ResultSet rs = ps.executeQuery();\n \n // Check if the result is empty\n if(!rs.isBeforeFirst()){\n return null;\n }\n \n Configuration configuration = new Configuration();\n rs.next();\n configuration.setConfigurationID(rs.getLong(\"configurationID\"));\n configuration.setDisplayName(rs.getString(\"displayName\"));\n configuration.setDefaultType(rs.getString(\"defaultType\"));\n configuration.setDefaultArg1(rs.getString(\"defaultArg1\"));\n configuration.setDefaultArg2(rs.getString(\"defaultArg2\"));\n \n return configuration;\n }\n catch(Exception ex){\n //ex.printStackTrace();\n System.out.println(\"Exception in ConfigurationDaoImpl.getConfiguration()\");\n if (ps != null && !ps.isClosed()){\n ps.close();\n }\n if (connection != null && !connection.isClosed()){\n connection.close();\n }\n \n return null;\n }\n }", "private static Configuration getConfigurationFromDb(int conf_id) {\n FrontEndDBInterface db = new FrontEndDBInterface();\n return db.getConfigInformation(conf_id);\n }", "public static void configuration() {\n\t\tProperties prop = new Properties();\n\t\tOutputStream output = null;\n\t\tInputStream input = null;\n\t\tString url = \"\", username = \"\", password;\n\t\tboolean test = false;\n\n\t\ttry {\n\t\t\tFile config = new File(configDirectory);\n\t\t\tif (!config.exists()) {\n\t\t\t\twhile (!test) {\n\t\t\t\t\toutput = new FileOutputStream(configDirectory);\n\n\t\t\t\t\tSystem.out\n\t\t\t\t\t\t\t.print(\"Configuration in progress, please answer the next set of questions to setup your database.\"\n\t\t\t\t\t\t\t\t\t+ \"\\n\"\n\t\t\t\t\t\t\t\t\t+ \"\\nDatabase URL: (Default localhost:3306/<database name>)\");\n\t\t\t\t\turl = UserInput.stringUserInput();\n\n\t\t\t\t\tSystem.out.print(\"Database Username: \");\n\t\t\t\t\tusername = UserInput.stringUserInput();\n\n\t\t\t\t\tSystem.out.print(\"Database password: \");\n\t\t\t\t\tpassword = UserInput.stringUserInput();\n\n\t\t\t\t\tDatabaseManager.setUrl(\"jdbc:mariadb://\" + url);\n\t\t\t\t\tDatabaseManager.setUser(username);\n\t\t\t\t\tDatabaseManager.setPass(password);\n\n\t\t\t\t\ttest = DatabaseManager.testDatabaseConnection();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tDatabaseManager.createDB();\n\n\t\t\t\ttest = false;\n\n\t\t\t\tString adminPassword = \"\", adminPasswordVerify;\n\n\t\t\t\twhile (!test) {\n\t\t\t\t\tSystem.out\n\t\t\t\t\t\t\t.print(\"Admin Account Password for Application: \");\n\t\t\t\t\tadminPassword = HashGeneratorUtils.generateHash(UserInput\n\t\t\t\t\t\t\t.stringUserInput());\n\n\t\t\t\t\tSystem.out.print(\"Verify Admin Password for Application: \");\n\t\t\t\t\tadminPasswordVerify = UserInput.stringUserInput();\n\n\t\t\t\t\ttest = HashGeneratorUtils.hashCompareTest(\n\t\t\t\t\t\t\tadminPasswordVerify, adminPassword);\n\t\t\t\t}\n\n\t\t\t\t// set the properties value\n\t\t\t\tprop.setProperty(\"database\", \"jdbc:mariadb://\" + url);\n\t\t\t\tprop.setProperty(\"adminpass\", adminPassword);\n\n\t\t\t\t// save properties to project folder\n\t\t\t\tprop.store(output, null);\n\t\t\t} else {\n\t\t\t\tinput = new FileInputStream(configDirectory);\n\n\t\t\t\t// load the property file\n\t\t\t\tprop.load(input);\n\n\t\t\t\t// get and set the property value\n\t\t\t\tDatabaseManager.setUrl(prop.getProperty(\"database\"));\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private Connection dbConnection() {\n\t\t\n\t\t///\n\t\t/// declare local variables\n\t\t///\n\t\t\n\t\tConnection result = null;\t// holds the resulting connection\n\t\t\n\t\t// try to make the connection\n\t\ttry {\n\t\t\tClass.forName(\"org.sqlite.JDBC\");\n\t\t\tresult = DriverManager.getConnection(CONNECTION_STRING);\n\t\t} catch (Exception ex) {\n\t\t\tSystem.out.println(ex.getMessage());\n\t\t}\n\t\t\n\t\t// return the resulting connection\n\t\treturn result;\n\t\t\n\t}", "public Connection connect(){\n Connection con = null; \n try {\n Class.forName(DB_DRIVE_NAME).newInstance();\n con = DriverManager.getConnection(CONNECTION_URL, DB_CONNECTION_USERNAME, DB_CONNECTION_PASSWORD); \n }catch (Exception e) {\n System.err.println(\"Cannot connect to database server\");\n System.err.println(e);\n }\n return con;\n }", "@Test\n public void testConfig() {\n DatabaseClientConfig config = getApplicationContext().getBean(DatabaseClientConfig.class);\n assertEquals(\"localhost\", config.getHost());\n assertEquals(8101, config.getPort());\n }", "public static Connection getConnection() {\r\n\r\n\t\tConfigLoader loader = new ConfigLoader();\r\n\t\tProperties properties = null;\r\n\t\t;\r\n\t\ttry {\r\n\t\t\tproperties = loader.loadConfigurations();\r\n\t\t} catch (IOException e) {\r\n\t\t\tlogger.error(e.getStackTrace().toString());\r\n\t\t}\r\n\t\tConnection connection = null;\r\n\t\ttry {\r\n\t\t\tString url = properties.getProperty(\"hsqldb.url\");\r\n\t\t\tString user = properties.getProperty(\"hsqldb.user\");\r\n\t\t\tString password = properties.getProperty(\"hsqldb.password\");\r\n\t\t\tlogger.info(\"Connecting to hsqlDB with db:\" + url);\r\n\t\t\tconnection = DriverManager.getConnection(url, user, password);\r\n\t\t} catch (SQLException e) {\r\n\t\t\tlogger.error(e.getStackTrace().toString());\r\n\t\t}\r\n\t\treturn connection;\r\n\t}", "private Connection database() {\n Connection con = null;\n String db_url = \"jdbc:mysql://localhost:3306/hospitalms\";\n String db_driver = \"com.mysql.jdbc.Driver\";\n String db_username = \"root\";\n String db_password = \"\";\n \n try {\n Class.forName(db_driver);\n con = DriverManager.getConnection(db_url,db_username,db_password);\n } \n catch (SQLException | ClassNotFoundException ex) { JOptionPane.showMessageDialog(null,ex); }\n return con;\n }", "public boolean testConnection(){\n\t\tboolean connected = false;\n\t\ttry {\t\t\t\n\t\t\tmMysqlConnection = DriverManager\n\t\t\t\t.getConnection(getConnectionURI());\n\t\t\t\n\t\t\tconnected = true;\n\t\t} catch (SQLException e) {\n\t\t\tLOGGER.severe(\"!EXCEPTION: \" + e.getMessage());\n\t\t}\n\n\t\treturn connected;\n\t}", "public Connection create() {\n\t\tif(ds==null)return null ;\n\t\ttry{\n\t\t\treturn ds.getConnection();\n\t\t}catch(Exception e ){\n\t\t\tSystem.out.println(e) ;\n\t\t\treturn null ;\n\t\t}\n\t\t\n\t}", "final void checkEnsure() {\r\n\t\t\r\n\t\ttry {\r\n\t\t\tif (this.conn == null || this.conn.isClosed()) {\r\n\t\t\t\tthis.conn = this.ci.createConnection();\r\n\t\t\t\tthis.databaseType = ConnectionHolder.DT_UNKNOWN;\r\n\t\t\t\tthis.loops = this.ci.connectionMaxLoops();\r\n\t\t\t\tthis.date = System.currentTimeMillis() + this.ci.connectionTimeToLive();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (--this.loops < 0 || this.date < System.currentTimeMillis()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tthis.conn.close();\r\n\t\t\t\t} catch (final Throwable t) {\r\n\t\t\t\t\t// ignore\r\n\t\t\t\t}\r\n\t\t\t\tthis.conn = this.ci.createConnection();\r\n\t\t\t\tthis.databaseType = ConnectionHolder.DT_UNKNOWN;\r\n\t\t\t\tthis.loops = this.ci.connectionMaxLoops();\r\n\t\t\t\tthis.date = System.currentTimeMillis() + this.ci.connectionTimeToLive();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (this.databaseType == ConnectionHolder.DT_UNKNOWN) {\r\n\t\t\t\tthis.databaseType = this.conn.getMetaData().getDatabaseProductName().toUpperCase().indexOf(\"ORACLE\") == -1\r\n\t\t\t\t\t? ConnectionHolder.DT_NORMAL\r\n\t\t\t\t\t: ConnectionHolder.DT_ORACLE;\r\n\t\t\t}\r\n\t\t\ttry (final Statement st = this.conn.createStatement()) {\r\n\t\t\t\t/** Do not use it here, may be unsupported? */\r\n\t\t\t\ttry {\r\n\t\t\t\t\tst.setQueryTimeout(10);\r\n\t\t\t\t} catch (final Throwable t) {\r\n\t\t\t\t\t// ignore\r\n\t\t\t\t}\r\n\t\t\t\tst.execute(\r\n\t\t\t\t\t\tthis.databaseType == ConnectionHolder.DT_ORACLE\r\n\t\t\t\t\t\t\t? \"SELECT 5 FROM DUAL\"\r\n\t\t\t\t\t\t\t: \"SELECT 5\");\r\n\t\t\t}\r\n\t\t} catch (final SQLException e) {\r\n\t\t\tif (this.conn != null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tthis.conn.close();\r\n\t\t\t\t} catch (final Throwable t) {\r\n\t\t\t\t\t// ignore\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.conn = this.ci.createConnection();\r\n\t\t\tthis.databaseType = ConnectionHolder.DT_UNKNOWN;\r\n\t\t\tthis.loops = this.ci.connectionMaxLoops();\r\n\t\t\tthis.date = System.currentTimeMillis() + this.ci.connectionTimeToLive();\r\n\t\t}\r\n\t}", "private ConnectionPool() {\r\n\t\tResourceManagerDB resourceManager = ResourceManagerDB.getInstance();\r\n\t\tthis.driver = resourceManager.getValue(ParameterDB.DRIVER_DB);\r\n\t\tthis.url = resourceManager.getValue(ParameterDB.URL_DB);\r\n\t\tthis.user = resourceManager.getValue(ParameterDB.USER_DB);\r\n\t\tthis.password = resourceManager.getValue(ParameterDB.PASSWORD_DB);\r\n\t\tthis.poolsize = Integer.parseInt(resourceManager.getValue(ParameterDB.POOLSIZE_DB));\r\n\t}", "private boolean checkDatabase(CommandPreferences preferences) {\n\n //checking class type of Preferences\n Logger.log(LogType.DEBUG, \"Class name of Preferences: \" + preferences.getClass().getName());\n prefClass = preferences.getClass();\n\n\n Logger.log(LogType.INFO, \"Checking Database connection...\");\n try (Connection connection = DriverManager.getConnection(purl, puser, ppassword)) {\n Logger.log(LogType.INFO, \"Database connected!\");\n isInit = true;\n con = connection;\n\n url = purl;\n user = puser;\n password = ppassword;\n\n } catch (SQLException e) {\n Logger.log(LogType.ERROR, \"Could not connect to Databse! \" + e);\n return false;\n }\n Logger.log(LogType.INFO, \"Database connection established.\");\n Logger.log(LogType.INFO, \"Checking Database setup: Tables...\");\n\n if (!checkTableExists(tablename)) return false;\n Logger.log(LogType.INFO, \"Checking Database setup: Columns...\");\n Logger.log(LogType.DEBUG, preferences.getClass().getFields().length + \"\");\n for (Field f : preferences.getClass().getFields()) {\n Logger.log(LogType.DEBUG, \"Field[\" + f.getName() + \"] \" + f.getType());\n if (!checkColumnExists(f.getName(), f)) return false;\n }\n Logger.log(LogType.INFO, \"Database check complete! starting...\");\n prefStructure = preferences;\n return true;\n }", "@Test\n public void testGetConnection() {\n System.out.println(\"getConnection\");\n Connection result = instance.getConnection();\n assertTrue(result!=null);\n \n }", "public boolean connect(){\n \n try{\n \n String url = \"jdbc:sqlite:database_lite/database_sge.db\";\n \n this.connection = DriverManager.getConnection(url);\n \n }catch(SQLException e){\n \n System.out.println(e.getMessage());\n return false;\n \n }\n \n System.out.println(\"Connection success\");\n \n return true;\n }", "private Connection getConnection() throws ClassNotFoundException, SQLException {\n\n log.info(\"Get DB connection\");\n\n String url = AppConfig.getInstance().getProperty(\"db.URL\") +\n AppConfig.getInstance().getProperty(\"db.schema\") +\n AppConfig.getInstance().getProperty(\"db.options\");\n String sDBUser = AppConfig.getInstance().getProperty(\"db.user\");\n String sDBPassword = AppConfig.getInstance().getProperty(\"db.password\");\n\n if (sDBUser != null && sDBPassword != null && sDBPassword.startsWith(\"crypt:\")) {\n AltEncrypter cypher = new AltEncrypter(\"cypherkey\" + sDBUser);\n sDBPassword = cypher.decrypt(sDBPassword.substring(6));\n }\n\n return DriverManager.getConnection(url, sDBUser, sDBPassword);\n }", "public void openConnection(){\n\n\t\tString dbIP = getConfig().getString(\"mysql.ip\");\n\t\tString dbDB = getConfig().getString(\"mysql.databaseName\");\n\t\tString dbUN = getConfig().getString(\"mysql.username\");\n\t\tString dbPW = getConfig().getString(\"mysql.password\");\n\n\t\ttry {\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t\tconnection = DriverManager.getConnection(\"jdbc:mysql://\" + dbIP + \"/\" + dbDB, dbUN, dbPW);\n\t\t\tgetLogger().info(\"Connected to databse!\");\n\t\t} catch (SQLException ex) {\n\t\t\t// handle any errors\n\t\t\tgetLogger().info(\"SQLException: \" + ex.getMessage());\n\t\t\tgetLogger().info(\"SQLState: \" + ex.getSQLState());\n\t\t\tgetLogger().info(\"VendorError: \" + ex.getErrorCode());\n\t\t} catch (ClassNotFoundException e) {\n\t\t\tgetLogger().info(\"Gabe, you done goof'd!\");\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "private Connection getConnection()\n/* */ throws Exception\n/* */ {\n/* 1371 */ DBParamsParser dbparamsparser = null;\n/* */ try {\n/* 1373 */ Thread.sleep(3000L);\n/* 1374 */ dbparamsparser = DBParamsParser.getInstance(new File(\".\" + File.separator + \"conf\" + File.separator + \"database_params.conf\"));\n/* */ }\n/* */ catch (Exception exception) {\n/* 1377 */ exception.printStackTrace();\n/* 1378 */ return null;\n/* */ }\n/* 1380 */ String s = dbparamsparser.getURL();\n/* 1381 */ Object obj = null;\n/* 1382 */ Object obj1 = null;\n/* */ try {\n/* 1384 */ Driver driver = (Driver)Class.forName(dbparamsparser.getDriverName()).newInstance();\n/* 1385 */ Properties properties = new Properties();\n/* 1386 */ properties.put(\"user\", dbparamsparser.getUserName());\n/* 1387 */ if (dbparamsparser.getPassword() != null)\n/* */ {\n/* 1389 */ properties.put(\"password\", dbparamsparser.getPassword());\n/* */ }\n/* 1391 */ return driver.connect(s, properties);\n/* */ }\n/* */ catch (Exception exception1) {}\n/* */ \n/* 1395 */ return null;\n/* */ }", "public void testNotReady() throws Exception {\n Properties props = new Properties();\n props.setProperty(LockssRepositoryImpl.PARAM_CACHE_LOCATION, tempDirPath);\n props\n\t.setProperty(ConfigManager.PARAM_PLATFORM_DISK_SPACE_LIST, tempDirPath);\n props.setProperty(SqlDbManager.PARAM_DATASOURCE_CLASSNAME, \"java.lang.String\");\n ConfigurationUtil.setCurrentConfigFromProps(props);\n\n startService();\n assertEquals(false, sqlDbManager.isReady());\n\n Connection conn = null;\n try {\n conn = sqlDbManager.getConnection();\n } catch (SQLException sqle) {\n }\n assertNull(conn);\n\n }", "private void createConnection() {\n this.callbacks = getCallbacks();\n\n Properties props = new Properties();\n props.putAll(getTestProps());\n props.putAll(getProps());\n this.connection = Connections.create((ConnectionCallbacks) callbacks, props);\n configureConnection(connection);\n }", "private Connection getConnection() throws SQLException, ClassNotFoundException {\n return connectionBuilder.getConnection();\n }", "public Connection createConnection() {\n Connection c = null;\n try {\n Class.forName(\"org.sqlite.JDBC\");\n c = DriverManager.getConnection(\"jdbc:sqlite:ase_i3.db\");\n } catch (Exception e) {\n System.err.println(e.getClass().getName() + \": \" + e.getMessage());\n return null;\n }\n System.out.println(\"Database connection succeed.\");\n return c;\n }" ]
[ "0.7005214", "0.6743744", "0.65655583", "0.65029466", "0.64859927", "0.64856106", "0.64327586", "0.642036", "0.64000034", "0.63498175", "0.6329798", "0.63219774", "0.63214326", "0.62628376", "0.6190851", "0.61787945", "0.6109132", "0.6108915", "0.6097141", "0.6094991", "0.6089139", "0.608491", "0.6065777", "0.6061124", "0.60439616", "0.6020994", "0.6019162", "0.59942925", "0.59912586", "0.59846044", "0.5975052", "0.59655577", "0.59628415", "0.59548837", "0.5953737", "0.59530276", "0.5947701", "0.59460413", "0.5940823", "0.5936537", "0.59323794", "0.59280705", "0.59227", "0.5920763", "0.5905951", "0.58993685", "0.58960587", "0.58921355", "0.58919066", "0.5891889", "0.589074", "0.58843803", "0.58694243", "0.586851", "0.5867999", "0.58652633", "0.586279", "0.58616745", "0.58606", "0.5854117", "0.5844346", "0.5839364", "0.5838473", "0.58384466", "0.5831321", "0.5819709", "0.58193815", "0.58106226", "0.58105075", "0.5810259", "0.580268", "0.5794624", "0.5793651", "0.57895863", "0.5782796", "0.5779918", "0.5772253", "0.5760114", "0.57573396", "0.57541996", "0.57497257", "0.57458574", "0.5737211", "0.5732985", "0.57316166", "0.57286674", "0.5715835", "0.57114035", "0.5708401", "0.5706256", "0.5700125", "0.5698343", "0.5686824", "0.5683066", "0.5678791", "0.56785536", "0.56767255", "0.56711745", "0.56664", "0.56612474", "0.56607944" ]
0.0
-1
Create a new instance of a configuration class and check the connection with that database return the repository of the connection
@Override public RemoteDomainRepository getDatabaseRepository (UserDatabase userDatabase) { return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface DatabaseConfiguration {\n\n\t/**\n\t * TODO (paulo 21/01/2011 14:52:38): escrever javadoc\n\t *\n\t * @return\n\t */\n\tDatabaseTypes getDatabaseType();\n\t\n\t/**\n\t * TODO (paulo 21/01/2011 14:52:40): escrever javadoc\n\t *\n\t * @return\n\t * @throws DatabaseConfigurationException {@link RuntimeException} throw when not retrieve connection.\n\t */\n\tConnection getConnection();\n\t\n}", "public ConnectionConfig createConnection()\n {\n return _connectionConfig;\n }", "private DatabaseConnectionService() {\n ds = new HikariDataSource();\n ds.setMaximumPoolSize(20);\n ConfigProperties configProperties = ConfigurationLoader.load();\n if (configProperties == null) {\n throw new RuntimeException(\"Unable to read the config.properties.\");\n }\n ds.setDriverClassName(configProperties.getDatabaseDriverClassName());\n ds.setJdbcUrl(configProperties.getDatabaseConnectionUrl());\n ds.addDataSourceProperty(\"user\", configProperties.getDatabaseUsername());\n ds.addDataSourceProperty(\"password\", configProperties.getDatabasePassword());\n ds.setAutoCommit(false);\n }", "abstract public boolean createConnection(String database);", "public ProduktRepositoryImpl() {\n this.conn = DatabaseConnectionManager.getDatabaseConnection();\n }", "public DatabaseConnection newConnection();", "static Connection getDatabaseConnection(String path_to_config_json) {\n if (connection == null) {\n Gson gson = new Gson();\n Reader reader;\n try {\n reader = new FileReader(path_to_config_json);\n } catch (FileNotFoundException e) {\n logger.info(\"FileNotFoundException: \" + e.getMessage());\n return null;\n }\n DatabaseConfig config = gson.fromJson(reader, DatabaseConfig.class);\n logger.info(\"Connecting to database \" + config.database + \"...\");\n String username = config.username;\n String password = config.password;\n String database = String.format(\"%s%s:%s/%s%s\", config.jdbc_prefix, config.host, config.port,\n config.database, config.jdbc_setting);\n try {\n connection = DriverManager.getConnection(database, username, password);\n connection.setAutoCommit(false);\n logger.info(\"Connected to \" + config.database);\n } catch (Exception e) {\n logger.info(\"Cannot connect to database:'\" + database + \"' with error \" + e.getMessage());\n }\n }\n return connection;\n }", "private DatabaseRepository() {\n try {\n // connect to database\n\n DB_URL = \"jdbc:sqlite:\"\n + this.getClass().getProtectionDomain()\n .getCodeSource()\n .getLocation()\n .toURI()\n .getPath().replaceAll(\"[/\\\\\\\\]\\\\w*\\\\.jar\", \"/\")\n + \"lib/GM-SIS.db\";\n connection = DriverManager.getConnection(DB_URL);\n mapper = ObjectRelationalMapper.getInstance();\n mapper.initialize(this);\n }\n catch (SQLException | URISyntaxException e) {\n System.out.println(e.toString());\n }\n }", "RepositoryConfiguration getRepositoryConfiguration();", "@Override\n public Configuration getConfiguration(Connection connection, Long configID) throws SQLException {\n PreparedStatement ps = null;\n try{\n String insertSQL = \"SELECT * FROM Configuration WHERE configurationID = ?;\";\n ps = connection.prepareStatement(insertSQL);\n ps.setLong(1, configID);\n ResultSet rs = ps.executeQuery();\n \n // Check if the result is empty\n if(!rs.isBeforeFirst()){\n return null;\n }\n \n Configuration configuration = new Configuration();\n rs.next();\n configuration.setConfigurationID(rs.getLong(\"configurationID\"));\n configuration.setDisplayName(rs.getString(\"displayName\"));\n configuration.setDefaultType(rs.getString(\"defaultType\"));\n configuration.setDefaultArg1(rs.getString(\"defaultArg1\"));\n configuration.setDefaultArg2(rs.getString(\"defaultArg2\"));\n \n return configuration;\n }\n catch(Exception ex){\n //ex.printStackTrace();\n System.out.println(\"Exception in ConfigurationDaoImpl.getConfiguration()\");\n if (ps != null && !ps.isClosed()){\n ps.close();\n }\n if (connection != null && !connection.isClosed()){\n connection.close();\n }\n \n return null;\n }\n }", "protected Connection createConnection() {\n Properties connectionProperties = new Properties();\n JdbcPropertyAdapter adapter = getPropertyAdapter(dbType, properties);\n adapter.getExtraProperties(connectionProperties);\n\n String url = translator.getUrl(properties);\n logger.info(\"Opening connection to: \" + url);\n Connection connection;\n try {\n connection = DriverManager.getConnection(url, connectionProperties);\n connection.setAutoCommit(false);\n } catch (SQLException x) {\n throw translator.translate(x);\n }\n return connection;\n }", "@Override\n public CheckDBDAO getInitDBDAO() {\n if (instanceCheckDBDAO == null) {\n return new MySQLCheckDBDAO(connection);\n } else {\n return instanceCheckDBDAO;\n }\n }", "public static Connection getDBConnection(){\n\t\tConnection conn = null;\r\n\t\t\r\n\t\ttry {\r\n\t\t\t/*InputStream is = DBConfig.class.getClass().\r\n\t\t\t\t\tgetResourceAsStream(\"/resources/db.properties\");\r\n\t\t\tprop.load(is);\r\n\t\t\tClass.forName(prop.getProperty(\"drivername\"));\r\n\t\t\tconn = DriverManager.getConnection(prop.getProperty(\"jdbcurl\"),\r\n\t\t\t\t\tprop.getProperty(\"username\"),prop.getProperty(\"password\"));*/\r\n\t\t\t\r\n\t\t\tClass.forName(\"oracle.jdbc.driver.OracleDriver\");\r\n\t\t\tconn = DriverManager.getConnection(\"jdbc:oracle:thin:@localhost:1521:orcl\",\"fred\",\"flintstone\");\r\n\t\t\t/*Statement stmt = conn.createStatement();\r\n\t\t\tResultSet rs = stmt.executeQuery(\"SELECT LOCATION_NAME FROM LOCATIONS\");\r\n\t\t\twhile(rs.next()){\r\n\t\t\t\tSystem.out.println(rs.getString(\"LOCATION_NAME\"));\r\n\t\t\t}*/\r\n\t\t} catch (ClassNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} /*catch (FileNotFoundException e){\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}*/\r\n\t\t\r\n\t\treturn conn;\r\n\t}", "public Connection connection()\n {\n String host = main.getConfig().getString(\"db.host\");\n int port = main.getConfig().getInt(\"db.port\");\n String user = main.getConfig().getString(\"db.user\");\n String password = main.getConfig().getString(\"db.password\");\n String db = main.getConfig().getString(\"db.db\");\n\n MysqlDataSource dataSource = new MysqlDataSource();\n dataSource.setServerName(host);\n dataSource.setPort(port);\n dataSource.setUser(user);\n if (password != null ) dataSource.setPassword(password);\n dataSource.setDatabaseName(db);\n Connection connection = null;\n try\n {\n connection = dataSource.getConnection();\n }\n catch (SQLException sqlException)\n {\n sqlException.printStackTrace();\n }\n return connection;\n }", "@Test\n public void testConstructorConnection() {\n assertEquals(connection, dao.getDatabaseConnection());\n }", "private static List<Configuration> configure() {\n Map<String, Configuration> configurations = new HashMap<String, Configuration>();\n try {\n Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(\"jorm.properties\");\n \n while (resources.hasMoreElements()) {\n URL url = resources.nextElement();\n \n Database.get().log.debug(\"Found jorm configuration @ \" + url.toString());\n \n Properties properties = new Properties();\n InputStream is = url.openStream();\n properties.load(is);\n is.close();\n \n String database = null;\n String destroyMethodName = null;\n String dataSourceClassName = null;\n Map<String, String> dataSourceProperties = new HashMap<String, String>();\n int priority = 0;\n \n for (Entry<String, String> property : new TreeMap<String, String>((Map) properties).entrySet()) {\n String[] parts = property.getKey().split(\"\\\\.\");\n if (parts.length < 3 || !parts[0].equals(\"database\")) {\n continue;\n }\n if (database != null && !parts[1].equals(database)) {\n try {\n Configuration conf = configurations.get(database);\n if (conf == null || conf.priority < priority) {\n conf = new Configuration(database, dataSourceClassName, dataSourceProperties, destroyMethodName, priority);\n configurations.put(database, conf);\n Database.get().log.debug(\"Configured \" + conf);\n }\n } catch (Exception ex) {\n Database.get().log.warn(\"Failed to configure database: \" + ex.getMessage());\n }\n database = parts[1];\n destroyMethodName = null;\n dataSourceClassName = null;\n dataSourceProperties = new HashMap<String, String>();\n priority = 0;\n }\n\n if (parts.length == 3 && parts[2].equals(\"destroyMethod\")) {\n destroyMethodName = property.getValue();\n } else if (parts.length == 3 && parts[2].equals(\"priority\")) {\n try {\n priority = Integer.parseInt(property.getValue().trim());\n } catch (Exception ex) {\n \n }\n } else if (parts[2].equals(\"dataSource\")) {\n if (parts.length == 3) {\n dataSourceClassName = property.getValue();\n } else if (parts.length == 4) {\n dataSourceProperties.put(parts[3], property.getValue());\n } else {\n Database.get().log.warn(\"Invalid DataSource property '\" + property.getKey() + \"'\");\n }\n } else {\n Database.get().log.warn(\"Invalid property '\" + property.getKey() + \"'\");\n }\n }\n \n if (database != null) {\n try {\n Configuration conf = configurations.get(database);\n if (conf == null || conf.priority < priority) {\n conf = new Configuration(database, dataSourceClassName, dataSourceProperties, destroyMethodName, priority);\n configurations.put(database, conf);\n Database.get().log.debug(\"Configured \" + conf);\n }\n } catch (Exception ex) {\n Database.get().log.warn(\"Failed to configure database: \" + ex.getMessage());\n }\n }\n }\n \n for (Entry<String, Configuration> entry : configurations.entrySet()) {\n entry.getValue().apply();\n Database.get().log.debug(\"Configured \" + configuration);\n }\n } catch (IOException ex) {\n Database.get().log.warn(\"Failed to configure database: \" + ex.getMessage()); \n }\n \n return new ArrayList<Configuration>(configurations.values());\n }", "public interface DBConfig_I {\r\n\r\n /**\r\n * Dateformat the user sends<br/>\r\n * If the DAO receives a DTO that has a column of type DATE/TIMESTAMP\r\n * then it looks up this format to \"know\" the syntax.\r\n * \r\n * @return Java Dateformat\r\n */\r\n public String getGUIDateFormat();\r\n \r\n/**\r\n * This is how the SQL database wants a date to be<br/>\r\n * This depends on the datasource one is using.<br/>\r\n * And it only applies, if one uses a String coded Date,\r\n * recommended is *always* to use a PreparedStatement and a\r\n * setDate()<br/>\r\n * \r\n * @return format of the SQL date\r\n */\r\n public String getSQLDateFormat();\r\n \r\n /**\r\n * User set a Timestamp (as String) inside a DTO<br/>\r\n * \r\n * @return Java Dateformat \r\n */\r\n \r\n public String getGUITimestampFormat();\r\n \r\n/**\r\n * This is how the database \"wants\" a Timestamp in String representation\r\n * \r\n * @return sql timestamp format, *very* database and country dependend...\r\n */\r\n public String getSQLTimestampFormat();\r\n \r\n public String getSQLTimestampFormatQuery();\r\n \r\n/**\r\n * java.sql.Connection\r\n * \r\n * For each instance of this class -> only one connection\r\n * \r\n * This means every call to \"getConnection\" will return the *same*\r\n * Connection object.\r\n * \r\n * This saves massively ressources, but has some other severe drawbacks!\r\n * \r\n * @return instance of java.sql.Connection\r\n */\r\n public Connection getConnection();\r\n \r\n public String getDatabaseType();\r\n \r\n/**\r\n * Class that creates a unique primary key<br/>\r\n * \r\n * Needed, since almost every database has its own mechanism\r\n * to provide a unique numeric value (Autonum, Sequence...)\r\n * \r\n * @return fully qualified classname of the primary key creator\r\n */\r\n public String getPKCClass();\r\n \r\n}", "public IDatabaseConnection getConnection() {\n try {\n DatabaseConnection databaseConnection = new DatabaseConnection(getDataSource().getConnection());\n editConfig(databaseConnection.getConfig());\n return databaseConnection;\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "public interface IDataSourceConfiguration {\r\n\r\n\t/**\r\n\t * \r\n\t * @return Nombre del driver \r\n\t */\r\n\tpublic String getDriverName();\r\n\t\r\n\t/**\r\n\t * \r\n\t * @param driverName Nombre del driver\r\n\t */\r\n\tpublic void setDriverName(String driverName);\r\n\t\r\n\t/**\r\n\t * \r\n\t * @return User name de conexion\r\n\t */\r\n\tpublic String getUserName();\r\n\t\r\n\t/**\r\n\t * \r\n\t * @param userName User name de conexion\r\n\t */\r\n\tpublic void setUserName(String userName);\r\n\t\r\n\t/**\r\n\t * \r\n\t * @return Password de conexion\r\n\t */\r\n\tpublic String getPassword();\r\n\t\r\n\t/**\r\n\t * \r\n\t * @param password Password de conexion\r\n\t */\r\n\tpublic void setPassword(String password);\r\n\t\r\n\t/**\r\n\t * \r\n\t * @return URL de conexion. Por ejemplo jdbc:postgresql://55.55.55.55:5432/ehcos\r\n\t */\r\n\tpublic String getUrl();\r\n\t\r\n\t/**\r\n\t * \r\n\t * @param url URL de conexion. Por ejemplo jdbc:postgresql://55.55.55.55:5432/ehcos\r\n\t */\r\n\tpublic void setUrl(String url);\r\n\t\r\n\t/**\r\n\t * \r\n\t * @return Alternative User name de conexion\r\n\t */\r\n\tpublic String getAltUserName();\r\n\t\r\n\t/**\r\n\t * \r\n\t * @param userName Alternative User name de conexion\r\n\t */\r\n\tpublic void setAltUserName(String altUserName);\r\n\t\r\n\t/**\r\n\t * \r\n\t * @return Password de conexion\r\n\t */\r\n\tpublic String getAltPassword();\r\n\t\r\n\t/**\r\n\t * \r\n\t * @param password Alternative Password de conexion\r\n\t */\r\n\tpublic void setAltPassword(String altPassword);\r\n\t\r\n}", "public BLFacadeImplementation() {\t\t\r\n\t\tSystem.out.println(\"Creating BLFacadeImplementation instance\");\r\n\t\tConfigXML c=ConfigXML.getInstance();\r\n\t\t\r\n\t\tif (c.getDataBaseOpenMode().equals(\"initialize\")) {\r\n\t\t\tDataAccess dbManager=new DataAccess(c.getDataBaseOpenMode().equals(\"initialize\"));\r\n\t\t\tdbManager.initializeDB();\r\n\t\t\tdbManager.close();\r\n\t\t\t}\r\n\t\t\r\n\t}", "@Override\n\tpublic DBConnection getDBConnection() {\n\t\t\n\t\tSystem.out.println(\"Started to create DB Connection Object\");\n\t\tDBConnection connection = new DBConnection();\n\t\tconnection.setImplementorName(\"MySQL Implementation\");\n\t\tSystem.out.println(\"Completed to create DB Connection Object\");\n\t\treturn connection;\n\t}", "public ConnectionConfiguration loadConnectionConfiguration(){\n\t\tConnectionConfiguration savedconfig = null;\n\t\ttry {\n\t\t FileInputStream propInFile = new FileInputStream( getConnConfigFile());\n\t\t Properties p = new Properties();\n\t\t p.load( propInFile );\n\n\t\t String server = p.getProperty(\"server\");\n\t\t String user = p.getProperty(\"user\");\n\t\t String passwd = p.getProperty(\"passwd\");\n\t\t \n\t\t if (server != null & user != null & passwd != null){\n\t\t\t savedconfig = new ConnectionConfiguration();\n\t\t\t savedconfig.setServer(server);\n\t\t\t savedconfig.setUser(user);\n\t\t\t savedconfig.setPasswd(passwd);\n\t\t }\n\t\t \n\t\t }\n\t\t catch ( FileNotFoundException e ) {\n\t\t //createConnectionConfigurationDialog(Resources.getString(\"msg_no_config_file\"));\n\t\t }\n\t\t catch ( IOException e ) {\n\t\t //createConnectionConfigurationDialog(Resources.getString(\"msg_config_file_not_readable\"));\n\t }\n\t\t return savedconfig; \n\t}", "private static Connection getDriverMangerConnection(final OracleERPConfiguration config) {\r\n final String connectionUrl = config.getConnectionUrl();\r\n LOG.ok(\"getDriverMangerConnection connectionUrl {0}\", connectionUrl);\r\n\r\n // create the connection base on the configuration..\r\n final Connection[] ret = new Connection[1];\r\n try {\r\n // load the driver class..\r\n Class.forName(config.getDriver());\r\n // get the database URL..\r\n if (config.getPassword() == null) {\r\n throw new IllegalStateException(config.getMessage(MSG_PASSWORD_BLANK));\r\n }\r\n\r\n if (StringUtil.isBlank(config.getUser())) {\r\n throw new IllegalStateException(config.getMessage(MSG_USER_BLANK));\r\n }\r\n // check if there is authentication involved.\r\n config.getPassword().access(new GuardedString.Accessor() {\r\n public void access(char[] clearChars) {\r\n try {\r\n java.util.Properties info = new java.util.Properties();\r\n info.put(\"user\", config.getUser());\r\n info.put(\"password\", new String(clearChars));\r\n if (StringUtil.isNotBlank(config.getClientEncryptionType())) {\r\n LOG.ok(\"getDriverMangerConnection set oracle.net.encryption_types_client {0}\",\r\n config.getClientEncryptionType());\r\n info.put(\"oracle.net.encryption_types_client\", config\r\n .getClientEncryptionType());\r\n }\r\n if (StringUtil.isNotBlank(config.getClientEncryptionLevel())) {\r\n LOG.ok(\"getDriverMangerConnection set oracle.net.encryption_client {0}\",\r\n config.getClientEncryptionLevel());\r\n info.put(\"oracle.net.encryption_client\", config\r\n .getClientEncryptionLevel());\r\n }\r\n\r\n ret[0] = DriverManager.getConnection(connectionUrl, info);\r\n } catch (SQLException e) {\r\n // checked exception are not allowed in the access\r\n // method\r\n // Lets use the exception softening pattern\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n });\r\n // turn off auto-commit\r\n } catch (Exception e) {\r\n throw ConnectorException.wrap(e);\r\n }\r\n return ret[0];\r\n }", "private static DBConnectionFactory createDBConnectionFactory(ConfigurationObject config) {\r\n ConfigurationObject dbConnectionFactoryConfig = Helper.getChildConfig(config,\r\n DB_CONNECTION_FACTORY_CONFIG);\r\n\r\n // Create database connection factory using the extracted configuration\r\n try {\r\n return new DBConnectionFactoryImpl(dbConnectionFactoryConfig);\r\n } catch (UnknownConnectionException e) {\r\n throw new LateDeliverablesTrackerConfigurationException(\r\n \"Fails to create database connection factory.\", e);\r\n } catch (ConfigurationException e) {\r\n throw new LateDeliverablesTrackerConfigurationException(\r\n \"Fails to create database connection factory.\", e);\r\n }\r\n }", "public Connection getConnection() throws PersistenceException {\r\n\t\tConnection connection;\r\n\r\n\t\tString password = null; \r\n\r\n\t\tProperties prop = new Properties();\r\n\t\tInputStream input = null;\r\n\r\n\t\ttry {\r\n\r\n\t\t\t\r\n\r\n\t\t\tprop.load(getClass().getClassLoader().getResourceAsStream(\"config.properties\"));\r\n\t\t\t// get the property value and print it out\r\n\r\n\t\t\tpassword = prop.getProperty(\"MYSQL_PASSWORD\");\r\n\r\n\t\t} catch (IOException ex) {\r\n\t\t\tex.printStackTrace();\r\n\t\t} finally {\r\n\t\t\tif (input != null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tinput.close();\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\ttry {\r\n\t\t\tClass.forName(driver);\r\n\t\t\t//Class.forName(\"org.postgresql.Driver\");\t\t//driver class loading\r\n\t\t\t/*\r\n\t\t\t * Now the driver is registered at DriverManager (postgreSQL driver automatically\r\n\t\t\t * registers itself at DriverManager once his class is loaded).\r\n\t\t\t * Since driver is loaded and registered, I can obtain a connection to the database \r\n\t\t\t */\r\n\t\t\tconnection = DriverManager.getConnection(dbURI, userName, password);\r\n\t\t} catch (ClassNotFoundException e) {\r\n\t\t\tSystem.out.println(\"Where is your MySQL JDBC Driver?\");\r\n\t\t\t//\t\t\tSystem.out.println(\"Where is your postgreSQL JDBC Driver?\");\r\n\t\t\te.printStackTrace();\r\n\t\t\tthrow new PersistenceException(e.getMessage());\r\n\t\t} catch(SQLException e) {\r\n\t\t\tthrow new PersistenceException(e.getMessage());\r\n\t\t}\r\n\t\treturn connection;\r\n\t}", "private static Configuration getConfigurationFromDb(String conf_id) {\n FrontEndDBInterface f = new FrontEndDBInterface();\n Configuration config = f.getConfigInformation(Integer.parseInt(conf_id));\n return config;\n }", "public static Connection createConnection() {\n\t\treturn new FabricaDeConexoes().getConnection();\n\t}", "public interface DatabaseFactory {\r\n\r\n Database makeDatabase();\r\n}", "public static SQLDBConfig getInstance () {\n\t\tif ( sqldbconf == null ) {\n\t\t\tsynchronized ( SQLDBConfig.class ) {\n\t\t\t\tsqldbconf = new SQLDBConfig ();\n\t\t\t}\n\t\t}\n\t\treturn sqldbconf;\n\t}", "public Connection getConnection(){\n try {\n return connectionFactory.getConnection(); // wird doch schon im Konstruktor von TodoListApp aufgerufen ???\n } catch (SQLException e) {\n e.printStackTrace();\n throw new RuntimeException(e);\n }\n }", "private Connection getConnection() throws SQLException, ClassNotFoundException {\n return connectionBuilder.getConnection();\n }", "private Connection createConnection() {\n try {\n return DriverManager.getConnection(\"jdbc:mysql://\" + host + \":\" + port + \"/\" + db, user, password);\n } catch (SQLException e) {\n e.printStackTrace();\n return null;\n }\n }", "public DBManager(){\r\n connect(DBConstant.driver,DBConstant.connetionstring);\r\n }", "public interface IDatabaseManager {\n\tString USERNAME = \"spring.datasource.username\";\n\n\tString PASSWORD = \"spring.datasource.password\";\n\n\tString URL = \"spring.datasource.url\";\n\n\tpublic Connection getConnection() throws SQLException ;\n\t\n\t}", "Connection createConnection();", "private static Configuration getConfigurationFromDb(int conf_id) {\n FrontEndDBInterface db = new FrontEndDBInterface();\n return db.getConfigInformation(conf_id);\n }", "abstract public boolean createConnection();", "@Bean(destroyMethod = \"close\")\n\tpublic DataSource dataSource() {\n\t\tHikariConfig config = Utils.getDbConfig(dataSourceClassName, url, port, \"postgres\", user, password);\n\n try {\n\t\t\tlogger.info(\"Configuring datasource {} {} {}\", dataSourceClassName, url, user);\n config.setMinimumIdle(0);\n\t\t\tHikariDataSource ds = new HikariDataSource(config);\n\t\t\ttry {\n\t\t\t\tString dbExist = \"SELECT datname FROM pg_catalog.pg_database WHERE lower(datname) = lower('\"+databaseName+\"')\";\n\t\t\t\tPreparedStatement statementdbExist = ds.getConnection().prepareStatement(dbExist);\n\t\t\t\tif(statementdbExist.executeQuery().next()) {\n\t\t\t\t\tstatementdbExist.close();\n\t\t\t\t\tds.close();\n\t\t\t\t\tthis.dataBaseExist = true;\n\t\t\t\t} else {\n\t\t\t\t\tstatementdbExist.close();\n\t\t\t\t\tString sql = \"CREATE DATABASE \" + databaseName;\n\t\t\t\t\tPreparedStatement statement = ds.getConnection().prepareStatement(sql);\n\t\t\t\t\tstatement.executeUpdate();\n\t\t\t\t\tstatement.close();\n\t\t\t\t\tds.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException e) {\n\t\t\t\tlogger.error(\"ERROR Configuring datasource SqlException {} {} {}\", e);\n\t\t\t\tthis.dataBaseExist = true;\n\t\t\t} catch (Exception ee) {\n\t\t\t\tthis.dataBaseExist = true;\n\t\t\t\tlogger.debug(\"ERROR Configuring datasource catch \", ee);\n\t\t\t}\n\t\t\tHikariConfig config2 = Utils.getDbConfig(dataSourceClassName, url, port, databaseName, user, password);\n\t\t\treturn new HikariDataSource(config2);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(\"ERROR in database configuration \", e);\n\t\t} finally {\n\t\t\t\n\t\t}\n\t\treturn null;\n\t}", "public BaseInterface getConnection(String connType){\r\n\t\t\r\n\t\tif(connType!=null && connType.equals(HIBERNATE)){\r\n\t\t\t base = new HibernateImpl();\r\n\t\t\t return base;\r\n\t\t}else if(connType!=null && connType.equals(JDBC)){\r\n\t\t\t base = new JDBCImpl();\r\n\t\t\t return base;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "private synchronized Connection getConnection(String serverName)\n {\n if (configurationStoreConnection == null)\n {\n ConnectorConfigurationFactory connectorConfigurationFactory = new ConnectorConfigurationFactory();\n\n return connectorConfigurationFactory.getServerConfigConnection(serverName);\n }\n else\n {\n return configurationStoreConnection;\n }\n }", "boolean initConfiguration(Connection con, String schema, boolean dropIfExist) throws Exception;", "public static DatabaseRepository getInstance() {\n if (instance == null) instance = new DatabaseRepository();\n return instance;\n }", "@Override\n\tpublic void construct() {\n\t\tSystem.out.println(\"Getting a MySQL Database Connection\");\n\n\t}", "private ConnectionPool() {\r\n\t\tResourceManagerDB resourceManager = ResourceManagerDB.getInstance();\r\n\t\tthis.driver = resourceManager.getValue(ParameterDB.DRIVER_DB);\r\n\t\tthis.url = resourceManager.getValue(ParameterDB.URL_DB);\r\n\t\tthis.user = resourceManager.getValue(ParameterDB.USER_DB);\r\n\t\tthis.password = resourceManager.getValue(ParameterDB.PASSWORD_DB);\r\n\t\tthis.poolsize = Integer.parseInt(resourceManager.getValue(ParameterDB.POOLSIZE_DB));\r\n\t}", "private DBManager() {\n SETTINGS.load(Settings.class.getClassLoader().getResourceAsStream(\"db.properties\"));\n this.dbUrl = SETTINGS.getProperty(\"DB_URL\");\n this.dbUser = SETTINGS.getProperty(\"DB_USER\");\n this.dbPassword = SETTINGS.getProperty(\"DB_PASSWORD\");\n try {\n Class.forName(SETTINGS.getProperty(\"DB_DRIVER\"));\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }\n }", "public interface DatabaseAPI {\n\n /**\n * Подключиться к базе данных.\n * Этот метод должен использоваться единожды и его результат нужно хранить, как зеницу ока.\n * @param host адрес\n * @param port порт\n * @param username имя пользователя\n * @param password пароль\n * @param databaseName имя базы данных\n * @param threads максимальное количество потоков, которое может использоваться для асинхронного доступа\n * к базе данных. Этот параметр может быть проигнорирован на серверах, где мы не предусматриваем\n * многопоточного доступа к базе данных.\n * Если не уверены, что сюда ставить, пишите двойку.\n * @return держатель подключения к базе данных.\n */\n DatabaseConnectionHolder getDatabaseConnection(String host, int port, String username, String password, String databaseName, int threads);\n\n}", "public final DBI getConnect() {\n try {\n Class.forName(\"com.mysql.cj.jdbc.Driver\");\n // String dbc = System.getenv(\"DB_CONNECTION\");\n // if (dbc == null || dbc.equals(\"\")) {\n // dbc = \"localhost:3306\";\n // }\n // DBI dbi = new DBI(\"jdbc:mysql://\" + dbc + \"/MLPXX?allowPublicKeyRetrieval=true&useSSL=false\", \"MLPXX\", \"MLPXX\");\n DBI dbi = new DBI(\"jdbc:mysql://localhost:3306/MLPXX?allowPublicKeyRetrieval=true&useSSL=false\", \"MLPXX\", \"MLPXX\");\n\n //DBI dbi = new DBI(\"jdbc:mysql://\" + dbc + \"/MLPXX?useSSL=false\", \"MLPXX\", \"MLPXX\");\n // dbi.setSQLLog(new PrintStreamLog());\n return dbi;\n } catch (ClassNotFoundException e) {\n //return null;\n throw new RuntimeException(e);\n }\n }", "private PaymentService makeNewConnection()\n throws Exception {\n try {\n\n //TO-DO.. load property file and create new connection\n PaymentService paymentservice = new PaymentService(url, appId, user, password, rcode, domainId, false);\n // Load database driver if not already loaded\n// Class.forName(driver);\n// // Establish network connection to database\n// PaymentService connection =\n// DriverManager.getConnection(url, username, password);\n return (paymentservice);\n } catch (Exception cnfe) {\n // Simplify try/catch blocks of people using this by\n // throwing only one exception type.\n throw new Exception(cnfe.getMessage());\n }\n }", "public static DbConnector getInstancia() {\r\n\t\tif (instancia == null) {\r\n\t\t\tinstancia = new DbConnector();\r\n\t\t}\r\n\t\treturn instancia;\r\n\t}", "public Connection createConnection(){\n Connection conn = null;\n registerDriver();\n createURL();\n\n try {\n conn = DriverManager.getConnection(urlDB,username,password);\n } catch (SQLException e) {\n e.printStackTrace();\n }\n\n System.out.println((conn != null)?\"You made it, take control your database now!\":\"Failed to make connection!\");\n\n return conn;\n}", "private void apriConnessione() throws SQLException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException {\n\t\tString password, user;\n\t\tDatabaseProps dbConf = config.getDb();\n\n\t\tClass.forName(dbConf.getDriver()).getDeclaredConstructor().newInstance();\n\n\t\tuser = dbConf.getUsername();\n\t\tpassword = dbConf.getPassword();\n\n\t\tString uri = String.format(\"jdbc:%s://%s:%d/%s\", dbConf.getDbms(), dbConf.getHost(), dbConf.getPort(), dbConf.getName());\n\n\t\tconnessioneDB = DriverManager.getConnection(uri, user, password);\n\t}", "public interface ConnectionFactory {\n\n public abstract Connection createConnection();\n\n}", "public interface ConnectionFactory {\r\n\r\n /**\r\n * Creates a connection instance based on the given parameters.\r\n * \r\n * @param context\r\n * the context\r\n * @param <T>\r\n * the type of the objects that are handled by the connection.\r\n * @return the connection instance\r\n * @throws ConnectionBuildException\r\n * if creating the connection fails\r\n */\r\n public <T> Connection<T> createConnection( ConnectionContext<T> context ) throws ConnectionBuildException;\r\n\r\n}", "Database getDatabase(Properties properties, ApplicationContext applicationContext);", "private DatabaseProvider getDatabaseProvider() {\n return new DatabaseProvider(\n System.getProperty(\"url\"),\n System.getProperty(\"user\"),\n System.getProperty(\"password\")\n );\n }", "private Connection createConnection() {\r\n\tConnection result = null;\r\n\r\n\ttry {\r\n\t Class.forName(\"org.sqlite.JDBC\");\r\n\t result = DriverManager.getConnection(\"jdbc:sqlite:\" + fileName);\r\n\t} catch (Exception e) {\r\n\t result = null;\r\n\t}\r\n\r\n\treturn result;\r\n }", "public interface DatabaseProvider {\n\n /**\n * Optionally make any property modifications before refreshing the application context.\n *\n * @param properties properties\n * @return modified properties\n */\n Properties modifyProperties(Properties properties);\n\n\n /**\n * Create and initialize the database.\n *\n * @param properties app properties\n * @param applicationContext app context\n * @return new initialized database\n */\n Database getDatabase(Properties properties, ApplicationContext applicationContext);\n}", "private Connection dbConnection() {\n\t\t\n\t\t///\n\t\t/// declare local variables\n\t\t///\n\t\t\n\t\tConnection result = null;\t// holds the resulting connection\n\t\t\n\t\t// try to make the connection\n\t\ttry {\n\t\t\tClass.forName(\"org.sqlite.JDBC\");\n\t\t\tresult = DriverManager.getConnection(CONNECTION_STRING);\n\t\t} catch (Exception ex) {\n\t\t\tSystem.out.println(ex.getMessage());\n\t\t}\n\t\t\n\t\t// return the resulting connection\n\t\treturn result;\n\t\t\n\t}", "private Connection getConnection() throws ClassNotFoundException, SQLException {\n\n log.info(\"Get DB connection\");\n\n String url = AppConfig.getInstance().getProperty(\"db.URL\") +\n AppConfig.getInstance().getProperty(\"db.schema\") +\n AppConfig.getInstance().getProperty(\"db.options\");\n String sDBUser = AppConfig.getInstance().getProperty(\"db.user\");\n String sDBPassword = AppConfig.getInstance().getProperty(\"db.password\");\n\n if (sDBUser != null && sDBPassword != null && sDBPassword.startsWith(\"crypt:\")) {\n AltEncrypter cypher = new AltEncrypter(\"cypherkey\" + sDBUser);\n sDBPassword = cypher.decrypt(sDBPassword.substring(6));\n }\n\n return DriverManager.getConnection(url, sDBUser, sDBPassword);\n }", "public static class_config getinstance(){\n\t\tif (instance==null){\n\t\t\tinstance = new class_config();\n\t\t\t\n singleton.mongo=new Mongo_DB();\n singleton.nom_bd=singleton.mongo.getNom_bd();\n singleton.nom_table=singleton.mongo.getNom_table();\n singleton.client = Mongo_DB.connect();\n if (singleton.client != null) {\n singleton.db = singleton.mongo.getDb();\n singleton.collection = singleton.mongo.getCollection();\n }\n \n\t\t\tsingleton_admin.admin= new ArrayList<admin_class>();\n\t\t\tsingleton_client.client= new ArrayList<client_class>();\n\t\t\tsingleton_reg.reg= new ArrayList<reg_user_class>();\n\t\t\t\n// A_auto_json.auto_openjson_admin();\n// C_auto_json.auto_openjson_client();\n R_auto_json.auto_openjson_reg();\n //funtions_files.auto_open();\n\t\t\tauto_config.auto_openconfig();\n //class_language.getinstance();\n\t\t\tsingleton_config.lang=new class_language();\n \n connectionDB.init_BasicDataSourceFactory();\n \n\t\t}\n\t\treturn instance;\n\t}", "public DataConnection() {\n\t\ttry {\n\t\t\tString dbClass = \"com.mysql.jdbc.Driver\";\n\t\t\tClass.forName(dbClass).newInstance();\n\t\t\tConnection con = DriverManager.getConnection(DIR_DB, USER_DB, PASS_DB);\n\t\t\tstatement = con.createStatement();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@SuppressWarnings(\"finally\")\n\tpublic static Connection createConnection() throws Exception {\n\t\tConnection con = null;\n\t\ttry {\n\t\t\tClass.forName(Constants.dbClass);\n\t\t\tcon = DriverManager.getConnection(Constants.dbUrl, Constants.dbUser,Constants.dbPwd);\n\t\t} catch (Exception e) {\n\t\t\tthrow e;\n\t\t} finally {\n\t\t\treturn con;\n\t\t}\n\t}", "public Connection getDBConnection()\r\n {\r\n Connection conn = null;\r\n try\r\n {\r\n // Quitamos los drivers\r\n Enumeration e = DriverManager.getDrivers();\r\n while (e.hasMoreElements())\r\n {\r\n DriverManager.deregisterDriver((Driver) e.nextElement());\r\n }\r\n DriverManager.registerDriver(new com.geopista.sql.GEOPISTADriver());\r\n String sConn = aplicacion.getString(UserPreferenceConstants.LOCALGIS_DATABASE_URL);\r\n conn = DriverManager.getConnection(sConn);\r\n AppContext app = (AppContext) AppContext.getApplicationContext();\r\n conn = app.getConnection();\r\n conn.setAutoCommit(false);\r\n } catch (Exception e)\r\n {\r\n return null;\r\n }\r\n return conn;\r\n }", "static RepositoryConnection getRepositoryConnection(Repository rep)\n {\n RepositoryConnection connection = null;\n \n try\n {\n connection = rep.getConnection();\n }\n catch (RepositoryException e)\n {\n System.err.println(\"Could not obtain repository connection!\");\n System.exit(1);\n }\n \n return connection;\n }", "private DBConnection() \n {\n initConnection();\n }", "private Connection makeNewConnection() throws SQLException {\n try {\n // Load database driver if not already loaded\n Class.forName(driver);\n // Establish network connection to database\n Connection connection = DriverManager.getConnection(url, username,\n password);\n return (connection);\n } catch (ClassNotFoundException cnfe) {\n // Simplify try/catch blocks of people using this by\n // throwing only one exception type.\n throw new SQLException(\"Can't find class for driver: \" + driver);\n }\n }", "private DbConnection() {\n }", "public interface GcJdbcConnectionProvider {\n\n /**\n * if the provider requires jdbc data in the subject.properties\n * @return true if provider requires data in subject.properties\n */\n public boolean requiresJdbcConfigInSourcesXml();\n \n /** \n * init the pool \n * @param properties \n * @param sourceId mainly for logging\n * @param driver driver\n * @param maxActive max active connection if pool\n * @param defaultMaxActive if max active is needed, and blank, then use this\n * @param maxIdle max idle connections if pool\n * @param defaultMaxIdle if max is needed, and blank, then use this\n * @param maxWaitSeconds max wait if pool empty in seconds. -1 means long time\n * @param defaultMaxWaitSeconds if max wait is needed, and blank, then use this, -1 mean long time\n * @param dbUrl jdbc url of the database\n * @param dbUser user to login to the database\n * @param dbPassword password for the database (unencrypted)\n * @param readOnly if conn should be readonly\n * @param readOnlyDefault default if not specified and needed\n * @param jdbcConfigId if blank or \"grouper\" then its the grouper database, otherwise its the configId\n * in the grouper-loader.properties database entry\n * @throws SourceUnavailableException if something is not right or not available\n */\n public void init(Properties properties, String sourceId, String driver, Integer maxActive, int defaultMaxActive, Integer maxIdle, int defaultMaxIdle,\n Integer maxWaitSeconds, int defaultMaxWaitSeconds, String dbUrl, String dbUser, \n String dbPassword, Boolean readOnly, boolean readOnlyDefault, String jdbcConfigId);\n \n /**\n * get a connection (dont close this when done, just call \"doneWithConnection()\"\n * @return the connection\n * @throws SQLException if there is a problem\n */\n public GcJdbcConnectionBean connectionBean() throws SQLException;\n \n}", "public synchronized static Connection getInstance()\n\t{\n\t\tif(connect == null)\n\t\t{\n\t\t\tnew DAOconnexion();\n\t\t}\n\t\treturn connect;\n\t}", "@Test\n\tpublic void testGetDbInstance(){\n\t\tConnection c = DatabaseConnect.getInstance();\n\t\tassertTrue(c != null);\t\n\t}", "private Connection getConnection() throws ProfileKeyManagerPersistenceException {\n try {\n return getConnectionFactory().createConnection(getConnectionName());\n } catch (DBConnectionException ex) {\n throw new ProfileKeyManagerPersistenceException(\"error creating connection: \" + ex.getMessage(), ex);\n }\n }", "public XMLDatabaseConnector()\n\t{\n\t\t\n\t\tProperties prop = new Properties();\n\t\t\n\t\t InputStream inputStream = this.getClass().getClassLoader()\n\t .getResourceAsStream(\"config.properties\");\n\t\t \n \ttry {\n //load a properties file\n \t\tprop.load(inputStream);\n \n //get the property value and print it out\n \t\tsetURI(prop.getProperty(\"existURI\"));\n \t\tusername = prop.getProperty(\"username\");\n \t\tpassword = prop.getProperty(\"password\");\n \n \t} catch (IOException ex) {\n \t\tex.printStackTrace();\n }\n\t}", "public static Connection getInstance() {\n\t\tConnection conn = null;\n\t\ttry {\n\t\t\tconn = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/restaurant?useSSL=false\", \"root\", \"1234\");\n\t\t} catch (SQLException e) {\n\t\t\te.getStackTrace();\n\t\t}\n\t\treturn conn;\n\t}", "@Override\n public Configuration createConfigurationFT(Connection connection, Configuration configuration) throws SQLException {\n PreparedStatement ps = null;\n try{\n String insertSQL = \"INSERT INTO Configuration (configurationID, displayName, defaultType, defaultArg1, defaultArg2) VALUES (?, ?, ?, ?, ?);\";\n ps = connection.prepareStatement(insertSQL);\n ps.setString(1, configuration.getConfigurationID().toString());\n ps.setString(2, configuration.getDisplayName());\n ps.setString(3, configuration.getDefaultType());\n ps.setString(4, configuration.getDefaultArg1()); \n ps.setString(5, configuration.getDefaultArg2()); \n ps.executeUpdate();\n \n return configuration;\n }\n catch(Exception ex){\n ex.printStackTrace();\n //System.out.println(\"Exception in ConfigurationDaoImpl.create(2 arg)\");\n if (ps != null && !ps.isClosed()){\n ps.close();\n }\n if (connection != null && !connection.isClosed()){\n connection.close();\n }\n }\n return configuration;\n }", "public static Connection createDBConnection() throws ClassNotFoundException, SQLException\r\n\t{\r\n\t\tString strDbUser = properties.getProperty(\"jdbc.username\"); // database login username\r\n String strDbPassword = properties.getProperty(\"jdbc.password\"); // database login password\r\n String remoteHost = properties.getProperty(\"remote.host\"); // remote host url (ie cloud server url\t\r\n String remotePort = properties.getProperty(\"remote.port\"); // remote post number\r\n String databaseName = properties.getProperty(\"databaseName\");\r\n Connection con;\r\n \r\n System.out.println(\"Trying connection \");\r\n \r\n\t\tClass.forName(\"org.postgresql.Driver\");\r\n// \tClass.forName(\"com.mysql.jdbc.Driver\");\r\n// con = DriverManager.getConnection(\"jdbc:mysql://127.0.0.1:\"+tunnelPort+\"/cos420?user=\"+strDbUser+\"&password=\"+strDbPassword);\r\n\t\tString connectString = \"jdbc:postgresql://\" + remoteHost +\":\" + remotePort + \"/\"+databaseName; \r\n\t\tcon = DriverManager.getConnection(connectString , strDbUser,strDbPassword);\r\n\r\n \tif(!con.isClosed())\r\n System.out.println(\"Successfully connected to Postgres server using TCP/IP...\");\r\n\r\n return con;\r\n\t}", "private Database() throws SQLException, ClassNotFoundException {\r\n Class.forName(\"org.postgresql.Driver\");\r\n con = DriverManager.getConnection(\"jdbc:postgresql://localhost:5432/postgres\", \"postgres\", \"kuka\");\r\n }", "private Connection getConnection(String signature) throws LateDeliverablesProcessingException {\r\n try {\r\n if (connectionName == null) {\r\n return this.dbConnectionFactory.createConnection();\r\n } else {\r\n return this.dbConnectionFactory.createConnection(connectionName);\r\n }\r\n } catch (DBConnectionException e) {\r\n throw Helper.logException(log, signature, new LateDeliverablesProcessingException(\r\n \"Fails to create database connection.\", e));\r\n }\r\n }", "protected void createRepository() throws Exception {\r\n\t\t\r\n\t\t//Creating MLSesame Connection object Using MarkLogicRepositoryConfig\r\n\t\t\r\n\t\tMarkLogicRepositoryConfig adminconfig = new MarkLogicRepositoryConfig();\r\n\t\tadminconfig.setHost(host);\r\n\t\tadminconfig.setAuth(\"DIGEST\");\r\n\t\tadminconfig.setUser(\"admin\");\r\n\t\tadminconfig.setPassword(\"admin\");\r\n\t\tadminconfig.setPort(restPort);\r\n\t\tRepositoryFactory factory = new MarkLogicRepositoryFactory();\r\n Assert.assertEquals(\"marklogic:MarkLogicRepository\", factory.getRepositoryType());\r\n try {\r\n\t\t\ttestAdminRepository = (MarkLogicRepository) factory.getRepository(adminconfig);\r\n\t\t} catch (RepositoryConfigException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n try {\r\n\t\t\ttestAdminRepository.initialize();\r\n\t\t\ttestAdminCon = (MarkLogicRepositoryConnection) testAdminRepository.getConnection();\r\n\t\t} catch (RepositoryException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n \r\n // Creating testAdminCon with MarkLogicRepositoryConfig constructor\r\n testAdminCon.close();\r\n testAdminRepository.shutDown();\r\n testAdminRepository = null; \r\n testAdminCon = null; \r\n \r\n adminconfig = new MarkLogicRepositoryConfig(host,restPort,\"admin\",\"admin\",\"DIGEST\");\r\n Assert.assertEquals(\"marklogic:MarkLogicRepository\", factory.getRepositoryType());\r\n testAdminRepository = (MarkLogicRepository) factory.getRepository(adminconfig);\r\n testAdminRepository.initialize();\r\n \r\n testAdminCon = testAdminRepository.getConnection();\r\n Assert.assertTrue(testAdminCon instanceof MarkLogicRepositoryConnection);\r\n \r\n Repository otherrepo = factory.getRepository(adminconfig);\r\n RepositoryConnection conn = null;\r\n try{\r\n \t //try to get connection without initializing repo, will throw error\r\n conn = otherrepo.getConnection();\r\n Assert.assertTrue(false);\r\n }\r\n catch(Exception e){\r\n \tAssert.assertTrue(e instanceof RepositoryException);\r\n \tAssert.assertTrue(conn == null);\r\n \totherrepo.shutDown();\r\n }\r\n \r\n Assert.assertTrue(testAdminCon instanceof MarkLogicRepositoryConnection);\r\n graph1 = testAdminCon.getValueFactory().createURI(\"http://marklogic.com/Graph1\");\r\n graph2 = testAdminCon.getValueFactory().createURI(\"http://marklogic.com/Graph2\");\r\n dirgraph = testAdminCon.getValueFactory().createURI(\"http://marklogic.com/dirgraph\");\r\n dirgraph1 = testAdminCon.getValueFactory().createURI(\"http://marklogic.com/dirgraph1\");\r\n \r\n \r\n //Creating MLSesame Connection object Using MarkLogicRepository overloaded constructor\r\n if(testReaderCon == null || testReaderRepository ==null){\r\n \ttestReaderRepository = new MarkLogicRepository(host, restPort, \"reader\", \"reader\", \"DIGEST\");\r\n\t try {\r\n\t\t\t\ttestReaderRepository.initialize();\r\n\t\t\t\tAssert.assertNotNull(testReaderRepository);\r\n\t\t\t\ttestReaderCon = (MarkLogicRepositoryConnection) testReaderRepository.getConnection();\r\n\t\t\t} catch (RepositoryException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t Assert.assertTrue(testReaderCon instanceof MarkLogicRepositoryConnection);\r\n\t \r\n\t }\r\n \r\n \r\n //Creating MLSesame Connection object Using MarkLogicRepository(databaseclient) constructor\r\n if (databaseClient == null){\r\n \tdatabaseClient = DatabaseClientFactory.newClient(host, restPort, \"writer\", \"writer\", DatabaseClientFactory.Authentication.valueOf(\"DIGEST\"));\r\n }\r\n \t\t\r\n\t\tif(testWriterCon == null || testWriterRepository ==null){\r\n\t\t\ttestWriterRepository = new MarkLogicRepository(databaseClient);\r\n\t\t\tqmgr = databaseClient.newQueryManager();\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\ttestWriterRepository.initialize();\r\n\t\t\t\tAssert.assertNotNull(testWriterRepository);\r\n\t\t\t\ttestWriterCon = (MarkLogicRepositoryConnection) testWriterRepository.getConnection();\r\n\t\t\t} catch (RepositoryException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "public static ConnectionSource cs() {\n String dbName = \"pegadaian\";\n String dbUrl = \"jdbc:mysql://localhost:3306/\" + dbName;\n String user = \"root\";\n String pass = \"catur123\";\n\n //inisiasi sumber koneksi\n ConnectionSource csInit = null;\n try {\n csInit = new JdbcConnectionSource(dbUrl, user, pass);\n } catch (SQLException ex) {\n Logger.getLogger(Koneksi.class.getName()).log(Level.SEVERE, null, ex);\n }\n\n //kembalikan hasil koneksi\n return csInit;\n\n }", "public Connection getConexao() {\t\n\t\ttry {\n\t\t\t\n\t\t\tif (this.conn!=null) {\n\t\t\t\treturn this.conn;\n\t\t\t}\n\t\t\t\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t\tconn = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/\"+this.db,this.user,this.pass);\n\t\t\t\n\t\t} catch(Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t\treturn this.conn;\n\t}", "public ConnectDB(){\r\n\r\n\t}", "private Connection getConnection() throws SQLException { //gets and returns a connection to the database at the file path specified when the object was instantiated\n return DriverManager.getConnection(\"jdbc:sqlite:\" + databasePath); //returns the connection to the specified database\n }", "public Connection getConnection(String dbChosen) throws Exception {\t\t\n\t\t \n\t\t log.info(\"Connecting with Database type: \"+dbChosen);\n\t\t\n\t\t DatabaseConfigurationManager dbConfManager = new DatabaseConfigurationManager();\n\t\t DatabaseConfigurationBean databaseConfigurationBean = dbConfManager.loadDatabaseConfiguration(dbChosen);\n\t\t \n\t\t Class.forName(databaseConfigurationBean.getDbDriver());\n\t\t String urlString = null;\n\t\t Connection conn = null;\t\t \n\t\t \n\t\t if(dbChosen.equalsIgnoreCase(\"SQLITE\")){\n\t\t \t\n\t\t \t urlString = \"jdbc:sqlite\"+\":\"+databaseConfigurationBean.getDbPath()+File.separator+databaseConfigurationBean.getDbName();\n\t\t\t\t log.info(\"Sqlite jdbc connection url: \"+urlString);\n\t\t\t \t\n\t\t\t\t //eg: jdbc:sqlite:C:\\\\SQLite\\\\test.db\n\t\t\t\t conn = DriverManager.getConnection(urlString);\t\t\t\t\t\t\t\t\n\t\t\t\t log.debug(\"Connection with database type: \"+dbChosen+\" Name: \"+databaseConfigurationBean.getDbName()+\" Host: \"+databaseConfigurationBean.getDbHost()+\" established successfully !\");\n\t\t\t\t\t\n\t\t\t\t return conn;\n\t\t \t\n\t\t }else if(dbChosen.equalsIgnoreCase(\"MYSQL\")){\n\t\t \t\n\t\t \turlString = \"jdbc:mysql://\" + databaseConfigurationBean.getDbHost() + \":\" +databaseConfigurationBean.getDbPort()+\"/\"+databaseConfigurationBean.getDbName(); \t\t\t \n\t\t\t conn = DriverManager.getConnection(urlString,databaseConfigurationBean.getDbUser(),databaseConfigurationBean.getDbPassword());\t\n\t\t\t \n\t\t\t log.debug(\"Connection with Database Type: \"+dbChosen+\" Name: \"+databaseConfigurationBean.getDbName()+\" Host: \"+databaseConfigurationBean.getDbHost()+\" established successfully !\");\n\t\t\t \n\t\t\t return conn;\n\t\t\t \n\t\t }else {\n\t\t \tlog.fatal(\"The database type: \"+dbChosen+\" is NOT supported\");\n\t\t \treturn null;\n\t\t }\t\n }", "public abstract Configuration configuration();", "public Connection getConnection() throws ClassNotFoundException, SQLException\n\t{\n\t /* Class.forName(\"org.postgresql.Driver\");*/\n\t\tcon=dataSource.getConnection();\n\t\treturn con;\t\n\t}", "public static DatabaseConnection getInstance() throws SQLException {\n if (instance == null) {//if we didn't create it earlier\n instance = new DatabaseConnection();//we create new one\n }\n return instance;//otherwise it returns old one\n }", "public static ObjectRepository getRepository() {\n\t\tif (_instance == null) {\n\t\t\tsynchronized (ObjectRepository.class) {\n\t\t\t\tif (_instance == null) {\n\t\t\t\t\t_instance = new ObjectRepository();\n\t\t\t\t\tif (config == null) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconfig = new PropertiesConfiguration(\n\t\t\t\t\t\t\t\t\t\"object.properties\");\n\t\t\t\t\t\t} catch (final ConfigurationException e) {\n\t\t\t\t\t\t\tSystem.err\n\t\t\t\t\t\t\t\t\t.println(\"Configuration Exception - Not able to locate object.properties\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn _instance;\n\t}", "private SQLite sqLiteConnect(DatabaseConfig config){\n SQLite result;\n String filePath = String.format(\"database\\\\%s.db\", config.getSqlName());\n result = new SQLite(filePath);\n\n if(result.connect())\n ItemBox.getLogger().info(\"[Database] connect successful \" + filePath);\n\n else{\n ItemBox.getLogger().severe(\"[Database] connect fail \" + filePath);\n return null;\n }\n\n SQLiteTable sqLiteTable = convertToSQLiteTable(config);\n SQLite.Status sqLiteResult = result.createTable(sqLiteTable);\n\n if(sqLiteResult == SQLite.Status.SUCCESS){\n ItemBox.getLogger().info(String.format(\"[Database] add table \\\"%s\\\" to %s\", config.getTableName(), filePath));\n }else{\n ItemBox.getLogger().info(String.format(\"[Database] found table \\\"%s\\\" from %s\", config.getTableName(), filePath));\n }\n\n ItemBox.getLogger().info(String.format(\"[Database] sql \\\"%s\\\" connected\", config.getSqlName()));\n return result;\n }", "public boolean connect(){\n if(isConnect)\n return true;\n\n this.isConnect = true;\n\n this.repository = sqLiteConnect(new Repository().getColumnType());\n\n if(this.repository == null){\n ItemBox.getLogger().severe(\"[Database] \\\"repository\\\" connect fail!\");\n return false;\n }\n\n\n ItemBox.getLogger().info(\"[Database] connect success\");\n return true;\n }", "@Override\n public Configuration createConfiguration(Connection connection, Configuration configuration) throws SQLException {\n PreparedStatement ps = null;\n try{\n String insertSQL = \"INSERT INTO Configuration (displayName, defaultType, defaultArg1, defaultArg2) VALUES (?, ?, ?, ?);\";\n ps = connection.prepareStatement(insertSQL, Statement.RETURN_GENERATED_KEYS);\n ps.setString(1, configuration.getDisplayName());\n ps.setString(2, configuration.getDefaultType());\n ps.setString(3, configuration.getDefaultArg1()); \n ps.setString(4, configuration.getDefaultArg2()); \n ps.executeUpdate();\n \n ResultSet fullConfiguration = ps.getGeneratedKeys();\n fullConfiguration.next();\n int genKey = fullConfiguration.getInt(1);\n configuration.setConfigurationID((long) genKey);\n \n return configuration;\n }\n catch(Exception ex){\n ex.printStackTrace();\n //System.out.println(\"Exception in ConfigurationDaoImpl.create(2 arg)\");\n if (ps != null && !ps.isClosed()){\n ps.close();\n }\n if (connection != null && !connection.isClosed()){\n connection.close();\n }\n }\n return configuration;\n }", "private Connection getDBConnection() {\n\n\t\tConnection dbConnection = null;\n\n\t\ttry {\n\n\t\t\tClass.forName(dbDriver);\n\n\t\t} catch (ClassNotFoundException e) {\n\n\t\t\tLOGGER.error(e.getMessage());\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tdbConnection = DriverManager.getConnection(dbConnectionURL, dbUser, dbPassword);\n\t\t\treturn dbConnection;\n\n\t\t} catch (SQLException e) {\n\n\t\t\tLOGGER.error(e.getMessage());\n\n\t\t}\n\n\t\treturn dbConnection;\n\n\t}", "public Connection getConnection() throws ClassNotFoundException, SQLException {\n logger.info(\"Create DB connection\");\n Class.forName(\"com.mysql.cj.jdbc.Driver\");\n return DriverManager.getConnection(\n \"jdbc:mysql://localhost:3306/prod\",\"root\",\"rootroot\");\n }", "public static Connection getConnection() {\r\n\r\n\t\tConfigLoader loader = new ConfigLoader();\r\n\t\tProperties properties = null;\r\n\t\t;\r\n\t\ttry {\r\n\t\t\tproperties = loader.loadConfigurations();\r\n\t\t} catch (IOException e) {\r\n\t\t\tlogger.error(e.getStackTrace().toString());\r\n\t\t}\r\n\t\tConnection connection = null;\r\n\t\ttry {\r\n\t\t\tString url = properties.getProperty(\"hsqldb.url\");\r\n\t\t\tString user = properties.getProperty(\"hsqldb.user\");\r\n\t\t\tString password = properties.getProperty(\"hsqldb.password\");\r\n\t\t\tlogger.info(\"Connecting to hsqlDB with db:\" + url);\r\n\t\t\tconnection = DriverManager.getConnection(url, user, password);\r\n\t\t} catch (SQLException e) {\r\n\t\t\tlogger.error(e.getStackTrace().toString());\r\n\t\t}\r\n\t\treturn connection;\r\n\t}", "public GcJdbcConnectionBean connectionBean() throws SQLException;", "private static Connection getDBConnection() {\n\n\t\tConnection dbConnection = null;\n\n\t\ttry {\n\n\t\t\tClass.forName(DB_DRIVER);\n\n\t\t} catch (ClassNotFoundException e) {\n\n\t\t\tSystem.out.println(e.getMessage());\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tdbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER,\n\t\t\t\t\tDB_PASSWORD);\n\t\t\treturn dbConnection;\n\n\t\t} catch (SQLException e) {\n\n\t\t\tSystem.out.println(e.getMessage());\n\n\t\t}\n\n\t\treturn dbConnection;\n\n\t}", "public interface ConnectionMaker{\n public Connection makeConnection() throws ClassNotFoundException, SQLException;\n\n\n}", "private DatabaseHandler(){\n createConnection();\n }", "DatabaseController() {\n\n\t\tloadDriver();\n\t\tconnection = getConnection(connection);\n\t}", "public static void init()\n {\n try\n {\n // The newInstance() call is a work around for some broken Java implementations\n Class.forName(\"com.mysql.jdbc.Driver\").newInstance();\n\n // Create a new configuration object\n BoneCPConfig config = new BoneCPConfig();\n\n // Setup the configuration\n config.setJdbcUrl(\"jdbc:mysql://cs304.c0mk5mvcjljr.us-west-2.rds.amazonaws.com/cs304\"); // jdbc url specific to your database, eg jdbc:mysql://127.0.0.1/yourdb\n config.setUsername(\"cs304\");\n config.setPassword(\"ubccs304\");\n config.setConnectionTestStatement(\"SELECT 1\");\n config.setConnectionTimeout(10, TimeUnit.SECONDS);\n config.setMinConnectionsPerPartition(5);\n config.setMaxConnectionsPerPartition(10);\n config.setPartitionCount(1);\n\n // Setup the connection pool\n _pool = new BoneCP(config);\n\n // Log\n LogManager.getLogger(DatabasePoolManager.class).info(\"Database configuration initialized\");\n }\n catch (Exception ex)\n {\n // Log\n LogManager.getLogger(DatabasePoolManager.class).fatal(\"Could not initialize Database configuration\", ex);\n }\n\n }", "public interface IConfigurationDao {\n \n \t/**\n \t * Retrieves a <code>Configuration</code> value from a data source\n \t * \n \t * @param name\n \t * The name of the <code>Configuration</code> option to be queried\n \t * @return The value corresponding to the given <code>Configuration</code> option, or an\n \t * empty string if not set.\n \t */\n \tpublic String getConfigurationValue(String name);\n \n \t/**\n \t * Sets a <code>Configuration</code> option.\n \t * \n \t * @param name\n \t * The name of the <code>Configuration</code> option to be set\n \t * @param value\n \t * The value to be assigned to the given <code>Configuration</code> option\n \t */\n \tpublic void setConfigurationValue(String name, String value);\n \n \t/**\n \t * Removes a <code>Configuration</code> option entirely\n \t * \n \t * @param name\n \t * The name of the <code>Configuration</code> option to be removed (nothing\n \t * will be done if there is no <code>Configuration</code> option by that name)\n \t */\n \tpublic void deleteConfigurationValue(String name);\n \n \t/**\n \t * Checks if a <code>Configuration</code> option is set (i.e. if a <code>Configuration</code> option\n \t * by that name exists)\n \t * \n \t * @param name\n \t * The name of the <code>Configuration</code> option to check\n \t * @return true, iff the <code>Configuration</code> option is set\n \t */\n \tpublic boolean configurationValueExists(String name);\n \n \t// FIXME: do we really need an update method? how about overriding existing \n \t// values.\n \t/**\n \t * Updates the given <code>Configuration</code> Object in the database. Create it if it\n \t * doesn't exist.\n \t * \n \t * @param configuration\n \t * the <code>Configuration</code> object to be updated/created\n \t * @return the <code>Configuration</code> object updated.\n \t */\n \tpublic Configuration update(final Configuration configuration);\n \n \n \t/**\n \t * Returns a <code>List</code> of all known configuration options\n \t * \n \t * @return a <code>List</code> of Configuration options, empty <code>List</code> if no options are available\n \t */\n \tpublic List<Configuration> getAll();\n }", "public Connection connect(){\n Connection con = null; \n try {\n Class.forName(DB_DRIVE_NAME).newInstance();\n con = DriverManager.getConnection(CONNECTION_URL, DB_CONNECTION_USERNAME, DB_CONNECTION_PASSWORD); \n }catch (Exception e) {\n System.err.println(\"Cannot connect to database server\");\n System.err.println(e);\n }\n return con;\n }" ]
[ "0.6850794", "0.6751038", "0.6684874", "0.66790444", "0.6665983", "0.66408396", "0.649857", "0.6405627", "0.63790745", "0.6356681", "0.63350487", "0.6319055", "0.62883216", "0.62774336", "0.6273612", "0.6254534", "0.62407243", "0.62363803", "0.6234892", "0.62064713", "0.6197939", "0.6165408", "0.6160018", "0.6154349", "0.6154001", "0.61407995", "0.61311644", "0.6098489", "0.6092591", "0.6090084", "0.6086544", "0.6084086", "0.6073074", "0.6070426", "0.6069913", "0.6033788", "0.602625", "0.6021077", "0.60151833", "0.6013269", "0.6012528", "0.6005757", "0.6001851", "0.5972517", "0.5968567", "0.5967012", "0.5952091", "0.5946266", "0.59373647", "0.593258", "0.5932324", "0.59176016", "0.5916793", "0.5913382", "0.5910597", "0.59065515", "0.5903347", "0.5897338", "0.5895166", "0.58878994", "0.58714426", "0.5863572", "0.5863459", "0.58630955", "0.58603984", "0.5854203", "0.58511215", "0.58438134", "0.58420324", "0.58338064", "0.58313346", "0.5829924", "0.5822175", "0.5821017", "0.5815755", "0.5803917", "0.5801356", "0.5801105", "0.5799723", "0.57896674", "0.5787459", "0.5787065", "0.57865417", "0.57864386", "0.578307", "0.57818395", "0.5780079", "0.5778266", "0.5772654", "0.5771971", "0.5771019", "0.5770884", "0.57619536", "0.575696", "0.5756783", "0.57560563", "0.5751979", "0.5751297", "0.57470304", "0.5743057", "0.5742127" ]
0.0
-1
the max capacity of this UDP interface is max (10 Gbit/s) / (8bytes/event)
@Override public int getMaxCapacity() { return 156250000; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@java.lang.Override\n public int getMaximumCapacity() {\n return maximumCapacity_;\n }", "@java.lang.Override\n public int getMaximumCapacity() {\n return maximumCapacity_;\n }", "public int getCapacity() {\n\t\treturn this.maxCapacity;\n\t}", "public int getMaximumCapacity() { // get the max capacity\n\t\treturn maximumCapacity;\n\t}", "public int getMaxSize()\n {\n return m_MaxSize;\n }", "private int calcMaxSize(int capacity) {\n // Clip the upper bound so that there will always be at least one available slot.\n int upperBound = capacity - 1;\n return Math.min(upperBound, (int) (capacity * loadFactor));\n }", "public int getMaxSize() {\n return maxSize_;\n }", "public int getMaxSize() {\n return maxSize_;\n }", "public int getMaxSize() {\n return maxSize_;\n }", "public int getMaxSize(){\n return maxSize;\n }", "protected abstract int getMaxDesiredSize();", "public int getMaxSize() {\n return maxSize_;\n }", "public int getMaxSize() {\n return maxSize;\n }", "public int getMaxSize() {\n return maxSize;\n }", "public int getMaxSize() {\n return maxSize;\n }", "private int getMaxSize() {\r\n return PropUtils.getValue(sizeLimitProp, DEFAULT_MAX_SIZE);\r\n }", "public int getMaximumSize() {\n return maximumSize;\n }", "public abstract long getMaxSize();", "public int getMaxBufferSize() {\r\n return maxBufferSize;\r\n }", "public int getMaxBufferSize() {\n return maxBufferSize;\n }", "public int maximumSizeInBytes() {\n return maximumSizeInBytes;\n }", "public long maxSize() {\n\t\treturn maxSize;\n\t}", "private int zzMaxBufferLen() {\n return Integer.MAX_VALUE;\n }", "private int zzMaxBufferLen() {\n return Integer.MAX_VALUE;\n }", "public static int getMaxSize(){\n\t\treturn 2* 4;\n\t}", "Integer backlogCapacity();", "public void setMaxCapacity(int max) {\n\t\tbuffer = new Object[max];\n\t\tbufferSize = 0;\n\t}", "public int maxSize()\n {\n return maxSize;\n }", "public int getMaximalSize() {\n return maximalSize;\n }", "public final int getAllocateLimit() {\n return allocateLimit;\n }", "public synchronized int getAvailableCapacity() {\n \n return (max_capacity-this.capacity);\n }", "public synchronized int getUpperSizeLimit() {\n \t\treturn upper;\n \t}", "int getMaxSize();", "@Override\n\tpublic long maxSize() {\n\t\treturn Main.chunkStoreAllocationSize;\n\t}", "public int getSizeLimit() {\n\t\treturn sizeLimit;\n\t}", "public java.lang.Integer getMaxPorts() {\r\n return maxPorts;\r\n }", "public int getMaxConnections()\n {\n return _maxConnections;\n }", "public final synchronized int getMaximumSize() {\n\t\treturn cacheSize;\n\t}", "pb4server.MaxPrisonBuffAskReq getMaxPrisonBuffAskReq();", "public int getMaxSize(){\n\t\treturn ds.length;\n\t}", "double getMaxTfCapacity();", "public int getMaxConnections() {\n return maxConnections;\n }", "public int canTransferMaxByteNum() {\n if (this.isFlowControlEnable()) {\n long res = Math.max(this.maxTransferByteInSecond() - this.transferredByte.get(), 0);\n return res > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) res;\n }\n return Integer.MAX_VALUE;\n }", "@Override\n\t// Return the maximum size of the frontier \n\tpublic int maxSize() {\n\t\treturn maxSize;\n\t}", "public int getTransactionMaxSize() {\r\n return transactionMaxSize;\r\n }", "public static int size_max() {\n return (8 / 8);\n }", "public int getCapacity();", "public long getMemMax() {\n return memMax;\n }", "@Override\n public int getMaxConnections() throws ResourceException {\n return Integer.MAX_VALUE;\n }", "public int getMaxOverflowConnections()\n {\n return _maxOverflowConnections;\n }", "public Integer getMaxQuota() {\n return (Integer) getAttributeInternal(MAXQUOTA);\n }", "public int freeCapacity() {\n\t\treturn this.capacity - this.flow;\n\t}", "public boolean hasMaxSize() {\n return ((bitField0_ & 0x00000001) == 0x00000001);\n }", "public Integer getMaxLength() {\n\t\treturn maxLength;\n\t}", "public static long getApiMaxRequestBytes() {\n return 10L * 1000L * 1000L; // 10 megabytes (https://en.wikipedia.org/wiki/Megabyte)\n }", "public abstract int getMaxIntermediateSize();", "public boolean hasMaxSize() {\n return ((bitField0_ & 0x00000001) == 0x00000001);\n }", "public Long maxSizeInMegabytes() {\n return this.maxSizeInMegabytes;\n }", "public long getMemUsedMax() {\n return memUsedMax;\n }", "public int getPacketSize(){\r\n\t\treturn 8 + data.length;\r\n\t}", "public final int capacity() {\n return packetCache.getCapacity();\n }", "public int getHighscoreMaxSize() {\n \t\treturn 20;\n \t}", "public Integer maxPort() {\n return this.maxPort;\n }", "private int getMaxReconsumeTimes() {\n if (this.defaultMQPushConsumer.getMaxReconsumeTimes() == -1) {\n return Integer.MAX_VALUE;\n } else {\n return this.defaultMQPushConsumer.getMaxReconsumeTimes();\n }\n }", "@Override\n\tpublic void setWriteQueueMaxSize(int maxSize) {\n\t\t\n\t}", "public int getOutgoingQueueSize();", "long getMemLimit();", "public void setMaxSize(int c) {\n maxSize = c;\n }", "public Long getMax_latency() {\n return max_latency;\n }", "@SuppressWarnings( \"unused\" )\n public int capacity() {\n return buffer.capacity() - buffer.limit();\n }", "private static int getApproximateMaxSize(int maxSizeFromConfig) {\n // because not to exceed the max size much we start eviction early.\n // so decrease the max size with ratio .95 below\n return maxSizeFromConfig * EVICTION_START_THRESHOLD_PERCENTAGE / ONE_HUNDRED_PERCENT;\n }", "final int getQueueSize() {\n // suppress momentarily negative values\n return Math.max(0, sp - base);\n }", "public static int sizeBits_max() {\n return 8;\n }", "public String getPortRangeMax() {\n return portRangeMax;\n }", "public void setMaximumCapacity(int maximumCapacity) { // set the max\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// capacity\n\t\tthis.maximumCapacity = maximumCapacity;\n\t}", "public void setMaxSize(int maxSize) {\n this.maxSize = maxSize;\n }", "public Integer getMaxLength() { \n\t\treturn getMaxLengthElement().getValue();\n\t}", "@Override\n public int getCapacity() {\n return room.getCapacity();\n }", "@java.lang.Override\n public long getMaxEnvelopeQueueSize() {\n return maxEnvelopeQueueSize_;\n }", "public Integer maxMessages();", "public void setMaxBufferSpace(long maxBufferSpace) {\n this.maxBufferSpace = maxBufferSpace;\n }", "@java.lang.Override\n public long getMaxEnvelopeQueueSize() {\n return maxEnvelopeQueueSize_;\n }", "public Long getMaxConcurrentConnection() {\n return this.MaxConcurrentConnection;\n }", "abstract int getMaxMemoryUsage();", "public double getMaxMemUsage() {\n return maxMemory;\n }", "int getWriterMaxQueueSize();", "@Override\n public int getMaxWriteSize() {\n return mMaxWriteSize;\n }", "public int getMaxLength() {\r\n return _maxLength;\r\n }", "public Builder setMaximumCapacity(int value) {\n \n maximumCapacity_ = value;\n onChanged();\n return this;\n }", "String getMaximumRedeliveryDelay();", "public Long getCapacity() {\n return capacity;\n }", "public Long getMaxLatency() {\n return maxLatency;\n }", "public Long getMaximumPersistentDisksSizeGb() {\n return maximumPersistentDisksSizeGb;\n }", "public int getCapacity() {\n switch (getID()) {\n case 5509:\n return 3;\n case 5510:\n case 5511:\n return 6;\n case 5512:\n case 5513:\n return 9;\n case 5514:\n case 5515:\n default:\n return 12;\n }\n }", "public int getCapacity(){\n return eventCapacity;\n }", "long getMaxMemory();", "public org.apache.axis.types.UnsignedInt getMaxconn() {\n return maxconn;\n }", "public double getMaximumAllowedEnergyInRoom() {\n\n\t\treturn this.maximumEnergyConsumptionAllowedInARoom; \n\t}", "public float getMaxIdleTimeoutPercent() {\n return maxIdleShrinkPercent;\n }", "public Integer maxLength() {\n return this.maxLength;\n }" ]
[ "0.7309383", "0.7284623", "0.7223913", "0.71749157", "0.70997953", "0.700019", "0.69756806", "0.69215584", "0.69215584", "0.6895474", "0.68647367", "0.6860261", "0.68422407", "0.68422407", "0.68422407", "0.68113226", "0.6779081", "0.6748368", "0.67021227", "0.6651247", "0.66245675", "0.6614184", "0.66049695", "0.66049695", "0.660152", "0.6593414", "0.65631086", "0.6543414", "0.65148354", "0.6506866", "0.6490853", "0.6472434", "0.64713496", "0.6470006", "0.64574724", "0.6440471", "0.6423709", "0.6390951", "0.6387691", "0.63852704", "0.6352631", "0.63412803", "0.6336944", "0.63281256", "0.6325862", "0.6324498", "0.6309818", "0.62889624", "0.6278859", "0.6261681", "0.6256195", "0.6254393", "0.625377", "0.6247929", "0.62404", "0.62347114", "0.623326", "0.6230712", "0.622909", "0.6227686", "0.62177616", "0.6210567", "0.6205683", "0.6192134", "0.6184263", "0.6181318", "0.61766815", "0.6156675", "0.6153803", "0.61505353", "0.6137396", "0.6134501", "0.6127909", "0.61266375", "0.6125052", "0.61177224", "0.61132574", "0.6105122", "0.61024606", "0.609899", "0.60943764", "0.6088043", "0.60835207", "0.6082076", "0.6081888", "0.608002", "0.6076423", "0.6072835", "0.6071248", "0.6058645", "0.605382", "0.60531855", "0.6044631", "0.6031127", "0.60309947", "0.6029923", "0.6027122", "0.6021636", "0.6015707", "0.60146356" ]
0.77707946
0
start or stops the event acquisition. sends apropriate vendor request to device and starts or stops the AEReader
@Override public void setEventAcquisitionEnabled(boolean enable) throws HardwareInterfaceException { if ( input != null ){ input.setPaused(enable); } if ( isOpen() ){ String s = enable ? "t+\r\n" : "t-\r\n"; byte[] b = s.getBytes(); try{ DatagramPacket d = new DatagramPacket(b,b.length,client); if (socket != null){ socket.send(d); } } catch ( Exception e ){ log.warning(e.toString()); } } eventAcquisitionEnabled = enable; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void startNewEvent() {\n // JCudaDriver.cuEventRecord(cUevent,stream);\n }", "protected void start() {\n\t\thellotv.setText(\"\");\n\t\tMap<String, Object> params = new LinkedHashMap<String, Object>();\n\t\tString event = null;\n\t\tevent = SpeechConstant.ASR_START;\n\t\t\n\t\tif (enableOffline) {\n params.put(SpeechConstant.DECODER, 2);\n }\n\t\t\n\t\tparams.put(SpeechConstant.ACCEPT_AUDIO_VOLUME, false);\n\t\t//params.put(SpeechConstant.PID, 1737);//English\n\t\t\n\t\tString json = null;\n\t\tjson = new JSONObject(params).toString();\n\t\tasr.send(event, json, null, 0, 0);\n\t\t\n\t\tprintresult(\"输入参数\"+ json);\n\t}", "private void handleExternalDevice(final String name, final int type, final int state, final String extra){\n\n mThreadExecutor.execute(new Runnable() {\n\n @Override\n public void run() {\n ArrayList<String> mAudioOutputChannels = mAudioManagerEx.getAudioDevices(AudioManagerEx.AUDIO_OUTPUT_TYPE);\n ArrayList<String> mAudioInputChannels = mAudioManagerEx.getAudioDevices(AudioManagerEx.AUDIO_INPUT_TYPE);\n\n String title = null;\n String message = null;\n\n switch(state){\n case AudioDeviceManagerObserver.PLUG_IN:\n switch(type){\n case AudioDeviceManagerObserver.AUDIO_INPUT_TYPE:\n //auto change to this audio-in channel\n Log.d(TAG, \"audio input plug in\");\n ArrayList<String> audio_in = new ArrayList<String>();\n audio_in.add(name);\n mAudioManagerEx.setAudioDeviceActive(audio_in, AudioManagerEx.AUDIO_INPUT_ACTIVE);\n\n title = mCtx.getResources().getString(R.string.usb_audio_in_plug_in_title);\n //message = mCtx.getResources().getString(R.string.usb_audio_plug_in_message);\n toastPlugInNotification(title, AUDIO_IN_NOTIFY);\n break;\n case AudioDeviceManagerObserver.AUDIO_OUTPUT_TYPE:\n Log.d(TAG, \"audio output plug in\");\n //update devices state\n if(extra != null && extra.equals(AudioDeviceManagerObserver.H2W_DEV)){\n headPhoneConnected = true;\n }\n\n //switch audio output\n final ArrayList<String> audio_out = new ArrayList<String>();\n if(extra != null && extra.equals(AudioDeviceManagerObserver.H2W_DEV)){\n audio_out.add(name);\n mAudioManagerEx.setAudioDeviceActive(audio_out, AudioManagerEx.AUDIO_OUTPUT_ACTIVE);\n title = mCtx.getResources().getString(R.string.headphone_plug_in_title);\n message = mCtx.getResources().getString(R.string.headphone_plug_in_message);\n }else if(name.contains(\"USB\")){\n audio_out.add(name);\n mHandler.post(new java.lang.Runnable() {\n @Override\n public void run() {\n // TODO Auto-generated method stub\n chooseUsbAudioDeviceDialog(audio_out);\n }\n });\n //title = mCtx.getResources().getString(R.string.usb_audio_out_plug_in_title);\n }\n break;\n }\n break;\n case AudioDeviceManagerObserver.PLUG_OUT:\n switch(type){\n case AudioDeviceManagerObserver.AUDIO_INPUT_TYPE:\n Log.d(TAG, \"audio input plug out\");\n title = mCtx.getResources().getString(R.string.usb_audio_in_plug_out_title);\n message = mCtx.getResources().getString(R.string.usb_audio_plug_out_message);\n ArrayList<String> actived = mAudioManagerEx.getActiveAudioDevices(AudioManagerEx.AUDIO_INPUT_ACTIVE);\n if(actived == null || actived.size() == 0 || actived.contains(name)){\n ArrayList<String> ilist = new ArrayList<String>();\n for(String dev:mAudioInputChannels){\n if(dev.contains(\"USB\")){\n ilist.add(dev);\n break;\n }\n }\n if(ilist.size() == 0){\n ilist.add(AudioManagerEx.AUDIO_NAME_CODEC);\n }\n mAudioManagerEx.setAudioDeviceActive(ilist, AudioManagerEx.AUDIO_INPUT_ACTIVE);\n toastPlugOutNotification(title, message, AUDIO_IN_NOTIFY);\n }\n else if(!actived.contains(\"USB\")){\n ArrayList<String> ilist = new ArrayList<String>();\n ilist.add(AudioManagerEx.AUDIO_NAME_CODEC);\n mAudioManagerEx.setAudioDeviceActive(ilist, AudioManagerEx.AUDIO_INPUT_ACTIVE);\n }\n break;\n case AudioDeviceManagerObserver.AUDIO_OUTPUT_TYPE:\n ArrayList<String> olist = new ArrayList<String>();\n Log.d(TAG, \"audio output plug out\");\n if(extra != null && extra.equals(AudioDeviceManagerObserver.H2W_DEV)){\n headPhoneConnected = false;\n for(String dev:mAudioOutputChannels){\n if(dev.contains(\"USB\")){\n olist.add(dev);\n mAudioManagerEx.setAudioDeviceActive(olist,AudioManagerEx.AUDIO_OUTPUT_ACTIVE);\n break;\n }\n }\n if(olist.size() == 0){\n switchAudioDevice(mDisplayOutputManager.getDisplayOutputType(0),false,false);\n }\n title = mCtx.getResources().getString(R.string.headphone_plug_out_title);\n message = mCtx.getResources().getString(R.string.headphone_plug_out_message);\n }else{\n if(headPhoneConnected){\n olist.add(AudioManagerEx.AUDIO_NAME_CODEC);\n }else{\n if(name.contains(\"USB\")){\n Log.d(TAG,\"switchAudioDevice, remove USB Audio device!\");\n if (alertDialog != null && alertDialog.isShowing()) {\n alertDialog.dismiss();\n alertDialog = null;\n }\n switchAudioDevice(mDisplayOutputManager.getDisplayOutputType(0),true,false);\n }else{\n Log.d(TAG,\"switchAudioDevice, NO USB Audio device is connected!\");\n switchAudioDevice(mDisplayOutputManager.getDisplayOutputType(0),false,false);\n }\n }\n title = mCtx.getResources().getString(R.string.usb_audio_out_plug_out_title);\n message = mCtx.getResources().getString(R.string.usb_audio_plug_out_message);\n }\n toastPlugOutNotification(title, message, AUDIO_OUT_NOTIFY);\n break;\n }\n break;\n }\n }\n });\n\n }", "private void activateReader(BluetoothReader reader) {\n if (reader == null) {\n return;\n }\n\n if (reader instanceof Acr3901us1Reader) {\n /* Start pairing to the reader. */\n ((Acr3901us1Reader) mBluetoothReader).startBonding();\n } else if (mBluetoothReader instanceof Acr1255uj1Reader) {\n /* Enable notification. */\n mBluetoothReader.enableNotification(true);\n }\n }", "private void sendAePreTriggerCaptureRequest() {\n // Step 1: Request single frame CONTROL_AF_TRIGGER_START.\n CaptureRequest.Builder builder = mDevice2Requester\n .createAndConfigRequest(mDevice2Requester.getRepeatingTemplateType());\n if (builder == null) {\n LogHelper.w(TAG, \"[sendAePreTriggerCaptureRequest] builder is null\");\n return;\n }\n builder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,\n CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);\n // Step 2: Call repeatingPreview to update mControlAFMode.\n Camera2CaptureSessionProxy sessionProxy = mDevice2Requester.getCurrentCaptureSession();\n LogHelper.d(TAG, \"[sendAePreTriggerCaptureRequest] sessionProxy \" + sessionProxy);\n try {\n if (sessionProxy != null) {\n LogHelper.d(TAG, \"[sendAePreTriggerCaptureRequest] \" +\n \"CONTROL_AE_PRECAPTURE_TRIGGER_START\");\n mAePreTriggerAndCaptureEnabled = false;\n sessionProxy.capture(builder.build(), mPreviewCallback, null);\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void startOldEvent() {\n // JCuda.cudaEventRecord(oldEvent, oldStream);\n }", "public void openReader(){\r\n handle = -1;\r\n try {\r\n cardReader = new ACR120U();\r\n } catch (java.lang.UnsatisfiedLinkError e) {\r\n e.printStackTrace();\r\n System.err.println(\"Are you sure the DLL is installed???\");\r\n message = \"DLL Installation problem.\";\r\n return;\r\n }\r\n handle = cardReader.open(ACR120U.ACR120_USB1); \r\n if (handle < 0){\r\n //message = \"Error opening reader [port may be in use or reader not in binary mode]\";\r\n message = \"No reader found\";\r\n System.err.println(message);\r\n return;\r\n }\r\n message = \"Device opened.\";\r\n }", "public void start() throws BluetoothStateException {\n\t\tDeviceDiscoverer.getInstance().startInquiry(DiscoveryAgent.GIAC, this);\n\t}", "public void serialEvent(SerialPortEvent e)\n {\n System.out.println(\"+++SERIAL EVENT TYPE ++++++++++++++++ : \"+e.getEventType());\n ezlink.info(\"serialEvent() received in \" + SerialConnection.class.getName());\n \t// Create a StringBuffer and int to receive input data.\n\tStringBuffer inputBuffer = new StringBuffer();\n\tint newData = 0;\n\n\t// Determine type of event.\n\tswitch (e.getEventType())\n\t{\n\n\t // Read data until -1 is returned. If \\r is received substitute\n\t // \\n for correct newline handling.\n\t case SerialPortEvent.DATA_AVAILABLE:\n\t byte[] readBuffer = new byte[500];\n\t\tint numBytes = 0;\n\t\tinputdata = null;\n\n\t\ttry {\n\t\t\t\tSystem.out.println(\"Data Received from com Port=\"+is.available());\n ezlink.info(\"Data Received from com Port= \" +is.available() );\n\n\t\t\t\twhile (is.available() > 0)\n\t\t\t\t{\n\t\t\t\t\tnumBytes = is.read(readBuffer);\n\t\t\t\t\tdataHandler.addISOPart(ISOUtil.hexString(readBuffer,0,numBytes));\n\n\t\t\t\t}\n\n\n\t\t\t\tString strResponse=null;\n\t\t\t\tif((strResponse = dataHandler.getNextISO(1)) !=null)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"Response=\"+strResponse);\n ezlink.info(\"Response= : \" +strResponse );\n\t\t\t\t\tinputdata = strResponse;\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"Full data not received from terminal\");\n ezlink.info(\"ull data not received from terminal!! \" );\n\t\t\t\t}\n\n\t\t\t\tdataRec =true;\n\n\t\t} catch (IOException exp) {\n System.out.println(\"serialEvent Exception(): \");\n exp.printStackTrace();\n System.out.println(\"serialEvent Exception(): \");\n ezlink.info(\"serialEvent Exception(): \");\n ezlink.error(new Object(), exp);\n }\n\n\t\tbreak;\n\n\t // If break event append BREAK RECEIVED message.\n\t case SerialPortEvent.BI:\n\t\tSystem.out.println(\"\\n--- BREAK RECEIVED ---\\n\");\n ezlink.info(\"\\n--- BREAK RECEIVED ---\\n \" );\n\t}\n\n }", "private void runAcquisition() {\n class AcqThread extends Thread {\n\n AcqThread(String threadName) {\n super(threadName);\n }\n\n @Override\n public void run() {\n String acq;\n try {\n acq = SAIMCommon.runAcquisition(gui_, prefs_, acqdirRootField_.getText(),\n acqnamePrefixField_.getText(), true, saveImagesCheckBox_.isSelected());\n gui_.closeAcquisition(acq);\n } catch (SAIMException saimEx) {\n ij.IJ.error(saimEx.getMessage());\n } catch (Exception ex) {\n ij.IJ.log(ex.getMessage());\n ij.IJ.error(\"Something went wrong. Aborting!\");\n } finally {\n runButton_.setSelected(false);\n runButton_.setText(\"Run Acquisition\");\n }\n }\n\n }\n AcqThread acqT = new AcqThread(\"SAIM Acquisition\");\n acqT.start();\n\n }", "public void incomingTriggerResourceControlRequest(APDUEvent e)\n {\n LOGGER.finer(\"Incoming triggetResourceControlRequest\");\n }", "private void playEarcon(String earcon, int queueMode,\n ArrayList<String> params) {\n if (queueMode == 0) {\n stop();\n }\n mSpeechQueue.add(new SpeechItem(earcon, params, SpeechItem.EARCON));\n if (!mIsSpeaking) {\n processSpeechQueue();\n }\n }", "public void incomingExtendedServicesRequest(APDUEvent e)\n {\n LOGGER.finer(\"Incoming extendedServicesRequest\");\n }", "public void incomingResourceControlRequest(APDUEvent e)\n {\n LOGGER.finer(\"Incoming resourceControlRequest\");\n }", "@Override\n public void openEvent(){\n rl.lock();\n try{\n log.printFirst();\n System.out.println(\"B : Opening the event...\");\n //change broker state\n// MyThreadBroker broker = (MyThreadBroker) Thread.currentThread();\n// broker.broker_states = MyThreadBroker.Broker_States.OPENING_THE_EVENT;\n //change log\n log.changeLog();\n log.setBrokerState(MyThreadBroker.Broker_States.OPENING_THE_EVENT); \n log.changeLog();\n }finally{\n rl.unlock();\n }\n }", "@Override\n public void run() {\n chooseUsbAudioDeviceDialog(audio_out);\n }", "@Override\n\t\tpublic void onDeviceEventReceived(DeviceEvent ev, String client) {\n\t\t\t\n\t\t}", "@Override\n\tpublic void onClick(View arg0) {\n\t\tswitch (arg0.getId()) {\n\t\tcase R.id.start_speaking:\n\t\t\tLog.e(\"AudioSession\", \"AudioSession is Going to start\");\n\t\t\t\n\t\t\trunOnUiThread(new Runnable() {\n\t\t\t\t\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tqueuePos.setVisibility(View.VISIBLE);\n\t\t\t\t\tqueuePos.setText(\"AUDIO streaming...\");\n\t\t\t\t\tstartsp.setVisibility(View.GONE);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tas = new AudioSession();\t//THIS OBJECT HANDLES ALL ASPECTS OF COMMUNICATION\n\t\t\tas.onRequestPress();\n\n\t\t\tLog.e(\" AudioSession\", \"AudioSession Started\");//START AUDIO MESSAGE\n\t\t\tbreak;\n\t\t\n\t\t\t\n\t\t}\n\t}", "@Override\r\n\tpublic void start() throws Exception {\r\n\t\tserialPort.notifyOnDataAvailable(true);\r\n\t\tserialPort.disableReceiveTimeout();\r\n\t\tserialPort.enableReceiveThreshold(1);\r\n\r\n\t\tserialPort.addEventListener(new SerialPortEventListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void serialEvent(SerialPortEvent event) {\r\n\t\t\t\tswitch (event.getEventType()) {\r\n\t\t\t\tcase SerialPortEvent.DATA_AVAILABLE:\r\n\t\t\t\t\ttry {\r\n\r\n\t\t\t\t\t\tString trame = ComConnexion.this.reader.readLine();\r\n\t\t\t\t\t\tfloat value = TrameDecoder.valeur(trame);\r\n\t\t\t\t\t\tMeteoEventType_E type = TrameDecoder.dataType(trame);\r\n\r\n\t\t\t\t\t\tswitch (type) {\r\n\t\t\t\t\t\tcase ALTITUDE:\r\n\t\t\t\t\t\t\tmeteoServiceCallback.altitudePerformed(value);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase PRESSION:\r\n\t\t\t\t\t\t\tmeteoServiceCallback.pressionPerformed(value);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase TEMPERATURE:\r\n\t\t\t\t\t\t\tmeteoServiceCallback.temperaturePerformed(value);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}", "public void startDetect(){\n\n EventHandle[] start = ECAAgent.getEventHandles(startDetectEventName);\n ECAAgent.raiseEndEvent(start,this);\n }", "private void initAudioIn(){\n ArrayList<String> actived = new ArrayList<String>();\n ArrayList<String> mAudioInputChannels = mAudioManagerEx.getAudioDevices(AudioManagerEx.AUDIO_INPUT_TYPE);\n int i = 0;\n for(i = 0; i < mAudioInputChannels.size(); i++){\n String device = mAudioInputChannels.get(i);\n if(device.contains(\"USB\")){\n actived.add(device);\n break;\n }\n }\n //otherwise use codec by default\n if(i == mAudioInputChannels.size()){\n actived.add(AudioManagerEx.AUDIO_NAME_CODEC);\n }\n mAudioManagerEx.setAudioDeviceActive(actived, AudioManagerEx.AUDIO_INPUT_ACTIVE);\n }", "public void run() {\n if (engine == 0) {\n byte buf[] = new byte[1024];\n AIEngine.aiengine_get_device_id(buf, getApplicationContext());\n\n String deviceId = new String(buf).trim();\n Log.d(TAG, \"deviceId: \" + deviceId);\n\n InputStream is = null;\n String provisionPath = \"\";\n\n try {\n is = getAssets().open(\"aiengine.provision\");\n File provisionFile = new File(AiUtil.externalFilesDir(context), \"aiengine.provision\");\n AiUtil.writeToFile(provisionFile, is);\n is.close();\n provisionPath = provisionFile.getAbsolutePath();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n Log.d(TAG, \"provisionPath:\" + provisionPath);\n\n String cfg = String.format(\"{\\\"appKey\\\": \\\"%s\\\", \\\"secretKey\\\": \\\"%s\\\", \\\"cloud\\\": {\\\"server\\\": \\\"%s\\\"}, \\\"provision\\\": \\\"%s\\\"}\",\n ChivoxOptions.APP_KEY, ChivoxOptions.SECRET_KEY, ChivoxOptions.SERVER, provisionPath);\n\n engine = AIEngine.aiengine_new(cfg, context);\n Log.d(TAG, \"aiengine: \" + engine);\n }\n\t\t\t\t/* create airecorder instance */\n if (recorder == null) {\n recorder = AIRecorder.getInstance();\n Log.d(TAG, \"airecorder: \" + recorder);\n }\n }", "public void start(){\r\n \t\ttry{\r\n \t\t\t_auditorium = new VoteBoxAuditoriumConnector(_mySerial,\r\n \t\t\t\t\tAuditoriumParams.Singleton,\r\n \t\t\t\t\tCommitBallotEvent.getMatcher(),\r\n \t\t\t\t\tCastCommittedBallotEvent.getMatcher(),\r\n \t\t\t\t\tChallengeEvent.getMatcher(),\r\n \t\t\t\t\tAuthorizedToCastWithNIZKsEvent.getMatcher(),\r\n \t\t\t\t\tAdderChallengeEvent.getMatcher()\r\n \t\t\t\t\t);\r\n \t\t}catch(NetworkException e){\r\n \t\t\tthrow new RuntimeException(\"Unable to connect to Auditorium: \"+e.getMessage(), e);\r\n \t\t}//catch\r\n \t\t\r\n \t\t_auditorium.addListener(new VoteBoxEventListener(){\r\n \t\t\tpublic void ballotCounted(BallotCountedEvent e){\r\n \t\t//NO-OP\r\n \t}\r\n \t\t\t\r\n \t\t\tpublic void castBallot(CastBallotEvent e) {\r\n \t\t\t\tforward(e);\r\n \t\t\t}\r\n \t\t\tpublic void challenge(ChallengeEvent e) {\r\n \t\t\t\tforward(e);\r\n \t\t\t}\r\n \t\t\tpublic void commitBallot(CommitBallotEvent e) {\r\n \t\t\t\tforward(e);\r\n \t\t\t}\r\n \t\t\t\r\n \t\t\t//Ignored events\r\n \t\t\tpublic void activated(ActivatedEvent e) {}\r\n \t\t\tpublic void assignLabel(AssignLabelEvent e) {}\r\n \t\t\tpublic void authorizedToCast(AuthorizedToCastEvent e) {}\r\n \t\t\tpublic void ballotReceived(BallotReceivedEvent e) {}\r\n \t\t\tpublic void challengeResponse(ChallengeResponseEvent e) {}\r\n \t\t\tpublic void joined(JoinEvent e) {}\r\n \t\t\tpublic void lastPollsOpen(LastPollsOpenEvent e) {}\r\n \t\t\tpublic void left(LeaveEvent e) {}\r\n \t\t\tpublic void overrideCancel(OverrideCancelEvent e) {}\r\n \t\t\tpublic void overrideCancelConfirm(OverrideCancelConfirmEvent e) {}\r\n \t\t\tpublic void overrideCancelDeny(OverrideCancelDenyEvent e) {}\r\n \t\t\tpublic void overrideCast(OverrideCastEvent e) {}\r\n \t\t\tpublic void overrideCastConfirm(OverrideCastConfirmEvent e) {}\r\n \t\t\tpublic void overrideCastDeny(OverrideCastDenyEvent e) {}\r\n \t\t\tpublic void pollsClosed(PollsClosedEvent e) {}\r\n \t\t\tpublic void pollsOpen(PollsOpenEvent e) {}\r\n \t\t\tpublic void pollsOpenQ(PollsOpenQEvent e) {}\r\n \t\t\tpublic void supervisor(SupervisorEvent e) {}\r\n \t\t\tpublic void votebox(VoteBoxEvent e) {}\r\n public void ballotscanner(BallotScannerEvent e) {}\r\n public void ballotScanned(BallotScannedEvent e) {}\r\n\t\t});\r\n \t\t\r\n \t\ttry{\r\n \t\t\tSystem.out.println(\"Connecting to auditorium...\");\r\n \t\t\t_auditorium.connect();\r\n \t\t}catch(NetworkException e){\r\n \t\t\tthrow new RuntimeException(\"Unable to connect to Auditorium network: \"+e.getMessage(), e);\r\n \t\t}//catch\r\n \t}", "public void incomingInitRequest(APDUEvent e)\n {\n LOGGER.finer(\"Incoming initRequest....\");\n \n /* Impl notes: So the way jzkit works is with this a2j method, \n * asn to java. It can run automatically which is nice, but\n * the objects it generates are a little different. Basically the\n * asn for z3950 is a specification of the various requests, what\n * exactly they are. It looks like this: \n * SearchRequest ::= SEQUENCE{\n * referenceId ReferenceId OPTIONAL,\n * smallSetUpperBound [13] IMPLICIT INTEGER,\n * replaceIndicator [16] IMPLICIT BOOLEAN,\n * resultSetName [17] IMPLICIT InternationalString,\n * etc... The way jzkit deals with this is that a2j generates\n * a bunch of classes, so there is a searchRequest_type and\n * searchRequest_codec class. The type is the useful one, where\n * one can actually work with it. Most of it makes sense, but\n * one confusing part is the choice object. Many of the classes\n * are derived from it, and basically they have two important\n * fields, which and o. Which says which of the choices is stored\n * in the class, and o is the Object of that choice. So to figure\n * out what's in a class, you need to first use which, and then\n * access the object stored based on the which value. Yeah, it's\n * pretty obscure, and jzkit documentation is not that good. But \n * read through the code and it might make a little more sense. I'll\n * try to point out a few examples. */\n InitializeRequest_type init_request = \n \t(InitializeRequest_type) (e.getPDU().o); \n /* Like here, we have to cast the object held in the PDU to the\n * InitializeRequest_type class, so we can use it.*/\n \n for ( int i=0; i<Z3950Constants.z3950_option_names.length; i++ ) {\n \tif ( init_request.options.isSet(i) )\n \t LOGGER.finer(\"Origin requested service: \"\n \t\t\t+Z3950Constants.z3950_option_names[i]);\n }\n \n // Did the origin request scan?\n if ( init_request.options.isSet(7) )\n {\n \t//the geo profile does not require support of scan.\n \tinit_request.options.clearBit(7);\n \t LOGGER.finer(\"Origin requested scan, not supported by\" + \n \t\t\t\"this backend realisation.\");\n }\n \n // If we are talking v2, userInformationField may contain \n //a character Set Negotiation field, if v3, \n //otherInfo may contain a charset/language negotiation feature.\n if ( init_request.userInformationField != null )\n {\n OIDRegisterEntry ent = reg.lookupByOID\n \t (init_request.userInformationField.direct_reference);\n if ( ent != null )\n LOGGER.finer(\"Init Request contains userInformationField oid=\"\n \t\t + ent.getName());\n else\n \t LOGGER.finer(\"Unkown external in userInformationField\");\n // The OID for the external should be found \n //in userInformationField.direct_reference\n }\n \n if ( init_request.otherInfo != null )\n {\n LOGGER.finer(\"Init Request contains otherInfo entries\");\n for ( Enumeration other_info_enum = init_request.otherInfo.elements(); \n \t other_info_enum.hasMoreElements(); )\n {\n \t LOGGER.finer(\"Processing otherInfo entry...\");\n \t // Process the external at other_info_enum.nextElement();\n \t OtherInformationItem43_type oit = \n \t (OtherInformationItem43_type)(other_info_enum.nextElement());\n \n LOGGER.finer(\"Processing OtherInformationItem43_type\");\n \n switch ( oit.information.which )\n {\n case information_inline45_type.externallydefinedinfo_CID:\n EXTERNAL_type et = (EXTERNAL_type)(oit.information.o);\n if ( et.direct_reference != null )\n {\n OIDRegisterEntry ent = reg.lookupByOID(et.direct_reference);\n LOGGER.finer(\"External with direct reference, oid=\"\n \t\t\t +ent.getName());\n \n // Are we dealing with character set negotiation.\n if ( ent.getName().equals(\"z_charset_neg_3\") )\n handleNLSNegotiation((CharSetandLanguageNegotiation_type)\n \t\t\t\t (et.encoding.o));\n }\n break;\n default:\n LOGGER.finer(\"Currently unhandled OtherInformationType\");\n break;\n }\n }\n }\n \n try\n {\n assoc.sendInitResponse(init_request.referenceId,\n init_request.protocolVersion,\n init_request.options,\n init_request.preferredMessageSize.longValue(),\n init_request.exceptionalRecordSize.longValue(),\n true,\n \"174\",\n \"TOPP Geoserver zserver module\",\n \"GeoServer 0.93\",\n null,\n null);\n }\n catch ( java.io.IOException ioe )\n {\n ioe.printStackTrace();\n }\n }", "private void startAdvertising() {\n client.startAdvertising(codeName,getResources().getString(R.string.service_id), connectionLifecycleCallback, new AdvertisingOptions(STRATEGY));\n }", "public void enableReading(){\n active = true;\n registerBroadcastReceiver();\n }", "public void handleEvent(final Event event) {\r\n\t\tIElementManager manager = getManager();\r\n\t\tif (manager == null) return;\r\n\t\tif (event.getSource() == application) {\r\n\t\t\tmanager.run(new Runnable() {\r\n\t\t\t\tpublic void run() {\r\n\t\t\t\t\tif (getDisplay() == null || getDisplay().isDisposed()) return;\r\n\t\t\t\t\tswitch (event.getType()) {\r\n\t\t\t\t\t\tcase Application.EVENT_DEVICE_ADDED: {\r\n\t\t\t\t\t\t\tSystemID systemID = (SystemID)event.getData();\r\n\t\t\t\t\t\t\tDeviceFigure assemblerDevice = (DeviceFigure)assemblerElements.get(systemID);\r\n\t\t\t\t\t\t\tif (assemblerDevice != null) {\r\n\t\t\t\t\t\t\t\tassemblerDevice.setResolved(true);\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Application.EVENT_DEVICE_REMOVED: {\r\n\t\t\t\t\t\t\tSystemID systemID = (SystemID)event.getData();\r\n\t\t\t\t\t\t\tDeviceFigure assemblerDevice = (DeviceFigure)assemblerElements.get(systemID);\r\n\t\t\t\t\t\t\tif (assemblerDevice != null) {\r\n\t\t\t\t\t\t\t\tassemblerDevice.setResolved(false);\r\n\t\t\t\t\t\t\t\tassemblerDevice.setAvailable(false);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Application.EVENT_REQEUST_ADDED: {\r\n\t\t\t\t\t\t\taddRequest((InstanceRequest)event.getData());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Application.EVENT_REQUEST_CHANGED: {\r\n\t\t\t\t\t\t\tchangeRequest((InstanceRequest)event.getData());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Application.EVENT_REQUEST_REMOVED: {\r\n\t\t\t\t\t\t\tremoveRequest((InstanceRequest)event.getData());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Application.EVENT_BINDING_CHANGED: {\r\n\t\t\t\t\t\t\tchangeBinding((InstanceBinding)event.getData());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Application.EVENT_STATE_ADDED: {\r\n\t\t\t\t\t\t\tObject[] data = (Object[])event.getData();\r\n\t\t\t\t\t\t\taddState((Pointer)data[0], (AssemblyState)data[1]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t// nothing to be done here\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tassemblerGraph.updateGraph();\r\n\t\t\t\t\tapplicationGraph.updateGraph();\r\n\t\t\t\t}\t\t\t\r\n\t\t\t});\r\n\t\t\tblock();\r\n\t\t} else if (event.getSource() == registry) {\r\n\t\t\tgetDisplay().asyncExec(new Runnable() {\r\n\t\t\t\tpublic void run() {\r\n\t\t\t\t\tif (getDisplay() == null || getDisplay().isDisposed()) return;\r\n\t\t\t\t\tswitch (event.getType()) {\r\n\t\t\t\t\t\tcase DeviceRegistry.EVENT_DEVICE_ADDED: {\r\n\t\t\t\t\t\t\t// add the device to the panel\r\n\t\t\t\t\t\t\tDeviceDescription description = \r\n\t\t\t\t\t\t\t\t(DeviceDescription)event.getData();\r\n\t\t\t\t\t\t\taddDevice(description);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase DeviceRegistry.EVENT_DEVICE_REMOVED: {\r\n\t\t\t\t\t\t\tDeviceDescription description = \r\n\t\t\t\t\t\t\t\t(DeviceDescription)event.getData();\r\n\t\t\t\t\t\t\t// invalidate the device\r\n\t\t\t\t\t\t\tremoveDevice(description);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t// nothing to be done here\r\n\t\t\t\t\t}\r\n\t\t\t\t\tassemblerGraph.updateGraph();\r\n\t\t\t\t\tapplicationGraph.updateGraph();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n\n /* lets grab the 360 degree position of the MagEncoder's absolute position */\n /* mask out the bottom12 bits, we don't care about the wrap arounds */ \n\t\tint absolutePosition = elevator.getSelectedSensorPosition(0) & 0xFFF;\n \n /* use the low level API to set the quad encoder signal */\n elevator.setSelectedSensorPosition(absolutePosition, Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n\n /* choose the sensor and sensor direction */\n elevator.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, \n Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n\n /* Ensure sensor is positive when output is positive */\n elevator.setSensorPhase(false);\n\n /**\n * Set based on what direction you want forward/positive to be.\n * This does not affect sensor phase. \n */ \n //elevator.setInverted(Constants.kMotorInvert);\n \n /* Config the peak and nominal outputs, 12V means full */\n elevator.configNominalOutputForward(0, Constants.kTimeoutMs);\n elevator.configNominalOutputReverse(0, Constants.kTimeoutMs);\n //elevator.configPeakOutputForward(1, Constants.kTimeoutMs);\n elevator.configNominalOutputForward(0.5);\n //elevator.configPeakOutputForward(1, Constants.kTimeoutMs);\n elevator.configPeakOutputForward(0.5);\n elevator.configPeakOutputReverse(-1, Constants.kTimeoutMs);\n \n /**\n * Config the allowable closed-loop error, Closed-Loop output will be\n * neutral within this range. See Table in Section 17.2.1 for native\n * units per rotation.\n */\n //elevator.configAllowableClosedloopError(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n \n /* Config Position Closed Loop gains in slot0, typically kF stays zero. */\n elevator.config_kF(Constants.kPIDLoopIdx, 0.0, Constants.kTimeoutMs);\n elevator.config_kP(Constants.kPIDLoopIdx, 0.5, Constants.kTimeoutMs);\n elevator.config_kI(Constants.kPIDLoopIdx, 0.0, Constants.kTimeoutMs);\n elevator.config_kD(Constants.kPIDLoopIdx, 0.0, Constants.kTimeoutMs);\n\n\n }", "@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)\n public void onCaptureDeviceDiscoveryChange(DeviceDiscoveryCompleteEvent event) {\n enableManualDiscoveryButton(true);\n if(event.isComplete()) {\n Toast.makeText(getApplicationContext(), \"Manual device discovery is complete\" , Toast.LENGTH_SHORT).show();\n }\n }", "public void start() {\n sensorManager.registerListener(this, gyroscope, SENSOR_DELAY);\n sensorManager.registerListener(this, rotationVector, SENSOR_DELAY);\n //sender = new UDPSender();\n }", "public void requestStart(){\r\n\t\t\r\n\t\tIterator <NavigationObserver> navOb = this.navega.iterator();\r\n\t\twhile ( navOb.hasNext()){\r\n\t\t\tnavOb.next().initNavigationModule(this.navega.getCurrentPlace(), this.direction);\r\n\t\t}\r\n\t\tIterator <RobotEngineObserver> robOb = this.iterator();\r\n\t\twhile (robOb.hasNext()){\r\n\t\t\trobOb.next().robotUpdate(fuel, recycledMaterial);\r\n\t\t}\r\n\t}", "public void fireInquireEvent ()\n\n {\n\tJsimEvent evt = new JsimEvent (this, EventMap.INQUIRE_EVT, null);\n\tfireJsimEvent (evt);\n\n }", "@Subscribe(threadMode = ThreadMode.MAIN)\n public void onDialogEvent(DialogEvent event){\n EventBus.getDefault().post(new ReconizeStatusEvent(\"重新识别\"));\n EventBus.getDefault().post(new ReconizeResultEvent(\"\"));\n EventBus.getDefault().post(new NluEvent(\"\"));\n EventBus.getDefault().post(new AsrTimeEvent(\"\"));\n// LightManager.getInstance().lightWakeup();\n //EventBus.getDefault().post(new ReconizeStatusEvent(\"开始识别\"));\n //开始识别\n // RecordModel.getInstance().startRecord();//sdk mode\n startBaiduAsr();//sdk mode\n\n /*scheduledThreadPool.schedule(new Runnable() {\n\n @Override\n public void run() {\n// RecordModel.getInstance().stopRecord(); //sdk mode\n RecordModel.getInstance().stopBaiduAsr(); //sdk mode\n }\n }, Const.RECONIZE_INTERVAL, TimeUnit.SECONDS);*/\n\n }", "@Override\n public void run() \n {\n while (!Thread.interrupted()) {\n \n //Read from microphone\n if(line==null)break;\n //return;\n if(Thread.interrupted())break;\n int ready = line.available();\n while (ready <320) \n {\n if(Thread.interrupted()){\n // logger.warn(\"input audio device thread is closed\");\n return;}\n try {\n Thread.sleep(1);\n ready = line.available();\n } catch (InterruptedException e) {\n // logger.warn(\"input audio device thread is closed\");\n return;\n }\n \n }\n if(ready>1024)ready=(1024/audioFormat.getFrameSize())*audioFormat.getFrameSize();\n \n byte[] buffer = new byte[320];\n numBytesRead= line.read(buffer, 0, buffer.length);\n if(speakerLine!=null)speakerLine.write(buffer, 0, buffer.length); \n byte[] b= PcmuEncoder.process(buffer);\n if(microphoneLine!=null)session.Send(b); \n }\n //logger.info(\"input audio device thread is closed\");\n \n}", "void openHardware(){\n if(hardware!=null && hardware.isOpen()){\n playMode=PlayMode.LIVE; // in case (like StereoHardwareInterface) where device can be open but not by MotionViewer\n return;\n }\n try{\n hardware=(SiLabsC8051F320_OpticalFlowHardwareInterface)OpticalFlowHardwareInterfaceFactory.instance().getFirstAvailableInterface();\n hardware.setChip(chip);\n chip.setHardwareInterface(hardware);\n hardware.open();\n\n\n \n if(hardware==null) {\n fixLoggingControls();\n fixBiasgenControls();\n return;\n }\n\n fixLoggingControls();\n fixBiasgenControls();\n // note it is important that this openHardware succeeed BEFORE hardware is assigned to biasgen, which immeiately tries to openHardware and download biases, creating a storm of complaints if not sucessful!\n \n// if(hardware instanceof BiasgenHardwareInterface){\n// chip.getBiasgen().sendConfiguration(chip.getBiasgen());\n// chip.setHardwareInterface(hardware); // if we do this, events do not start coming again after reconnect of device\n// biasgen=chip.getBiasgen();\n// if(biasgenFrame==null) {\n// biasgenFrame=new BiasgenFrame(biasgen); // should check if exists...\n// }\n// }\n \n setPlaybackControlsEnabledState(true);\n setPlayMode(PlayMode.LIVE);\n setTitleAccordingToState();\n }catch(Exception e){\n log.warning(e.getMessage());\n if(hardware!= null) hardware.close();\n setPlaybackControlsEnabledState(false);\n fixLoggingControls();\n fixBiasgenControls();\n setPlayMode(PlayMode.WAITING);\n }\n }", "private void setListener2(BluetoothReader reader) {\n mBluetoothReader2\n .setOnAuthenticationCompleteListener(new OnAuthenticationCompleteListener() {\n\n @Override\n public void onAuthenticationComplete(\n BluetoothReader bluetoothReader, final int errorCode) {\n\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n if (errorCode == BluetoothReader.ERROR_SUCCESS) {\n mTxtAuthentication\n .setText(\"Authentication Success!\");\n mEditApdu.setText(\"FF CA 00 00 00\");\n mAuthentication.setEnabled(false);\n } else {\n mTxtAuthentication\n .setText(\"Authentication Failed!\");\n }\n }\n });\n }\n\n });\n\n /* Wait for receiving ATR string. */\n mBluetoothReader2\n .setOnAtrAvailableListener(new OnAtrAvailableListener() {\n\n @Override\n public void onAtrAvailable(BluetoothReader bluetoothReader,\n final byte[] atr, final int errorCode) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n if (atr == null) {\n mTxtATR.setText(getErrorString(errorCode));\n } else {\n mTxtATR.setText(Utils.toHexString(atr));\n }\n }\n });\n }\n\n });\n\n /* Wait for power off response. */\n mBluetoothReader2\n .setOnCardPowerOffCompleteListener(new OnCardPowerOffCompleteListener() {\n\n @Override\n public void onCardPowerOffComplete(\n BluetoothReader bluetoothReader, final int result) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mTxtATR.setText(getErrorString(result));\n }\n });\n }\n\n });\n\n /* Wait for response APDU. */\n mBluetoothReader2\n .setOnResponseApduAvailableListener(new OnResponseApduAvailableListener() {\n\n @Override\n public void onResponseApduAvailable(\n BluetoothReader bluetoothReader, final byte[] apdu,\n final int errorCode) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mTxtResponseApdu.setText(getResponseString(\n apdu, errorCode));\n // InnerTes(\"tes\");\n }\n });\n }\n\n });\n mBluetoothReader2\n .setOnResponseApduAvailableListener(new OnResponseApduAvailableListener() {\n\n @Override\n public void onResponseApduAvailable(\n BluetoothReader bluetoothReader, final byte[] apdu,\n final int errorCode) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mTxtScan.setText(getResponseString(\n apdu, errorCode));\n String uid = mTxtScan.getText().toString();\n uid_final= uid;\n final String uid2=mTxtScan.getText().toString();\n /*** Kirim Variabel String uid ke ChildviewHolder **/\n /** code start here **/\n Tes tes = new Tes() {\n\n\n @Override\n public String onClickTes(String uid) {\n return null;\n }\n\n @Override\n public String getUid() {\n return mTxtScan.getText().toString();\n\n }\n };\n tes.onClickTes(uid);\n uid_final = tes.getUid();\n Log.d(\"uidFinal_listener\",\" \"+uid_final);\n requestUid(tes);\n\n\n //uid_final=\"tes\";\n // InnerTes(\"tes\");\n// rvTxtScan.setText(getResponseString(\n// apdu, errorCode));\n getInfoCard(uid);\n }\n\n\n });\n\n\n\n }\n\n });\n\n\n /* Wait for escape command response. */\n mBluetoothReader2\n .setOnEscapeResponseAvailableListener(new OnEscapeResponseAvailableListener() {\n\n @Override\n public void onEscapeResponseAvailable(\n BluetoothReader bluetoothReader,\n final byte[] response, final int errorCode) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mTxtEscapeResponse.setText(getResponseString(\n response, errorCode));\n }\n });\n }\n\n });\n\n /* Wait for device info available. */\n mBluetoothReader2\n .setOnDeviceInfoAvailableListener(new OnDeviceInfoAvailableListener() {\n\n @Override\n public void onDeviceInfoAvailable(\n BluetoothReader bluetoothReader, final int infoId,\n final Object o, final int status) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n if (status != BluetoothGatt.GATT_SUCCESS) {\n Toast.makeText(ReaderActivity.this,\n \"Failed to read device info!\",\n Toast.LENGTH_SHORT).show();\n return;\n }\n switch (infoId) {\n case BluetoothReader.DEVICE_INFO_SYSTEM_ID: {\n // mTxtSystemId.setText(Utils.toHexString((byte[]) o));\n }\n break;\n case BluetoothReader.DEVICE_INFO_MODEL_NUMBER_STRING:\n // mTxtModelNo.setText((String) o);\n break;\n case BluetoothReader.DEVICE_INFO_SERIAL_NUMBER_STRING:\n // mTxtSerialNo.setText((String) o);\n break;\n case BluetoothReader.DEVICE_INFO_FIRMWARE_REVISION_STRING:\n // mTxtFirmwareRev.setText((String) o);\n break;\n case BluetoothReader.DEVICE_INFO_HARDWARE_REVISION_STRING:\n // mTxtHardwareRev.setText((String) o);\n break;\n case BluetoothReader.DEVICE_INFO_MANUFACTURER_NAME_STRING:\n //mTxtManufacturerName.setText((String) o);\n break;\n default:\n break;\n }\n }\n });\n }\n\n });\n\n /* Wait for battery level available. */\n if (mBluetoothReader2 instanceof Acr1255uj1Reader) {\n ((Acr1255uj1Reader) mBluetoothReader2)\n .setOnBatteryLevelAvailableListener(new OnBatteryLevelAvailableListener() {\n\n @Override\n public void onBatteryLevelAvailable(\n BluetoothReader bluetoothReader,\n final int batteryLevel, int status) {\n Log.i(TAG, \"mBatteryLevelListener data: \" + batteryLevel);\n\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n // mTxtBatteryLevel2.setText(getBatteryLevelString(batteryLevel));\n }\n });\n\n }\n\n });\n }\n\n /* Handle on battery status available. */\n if (mBluetoothReader2 instanceof Acr3901us1Reader) {\n ((Acr3901us1Reader) mBluetoothReader2)\n .setOnBatteryStatusAvailableListener(new OnBatteryStatusAvailableListener() {\n\n @Override\n public void onBatteryStatusAvailable(\n BluetoothReader bluetoothReader,\n final int batteryStatus, int status) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n // mTxtBatteryStatus2.setText(getBatteryStatusString(batteryStatus));\n }\n });\n }\n\n });\n }\n\n /* Handle on slot status available. */\n mBluetoothReader2\n .setOnCardStatusAvailableListener(new OnCardStatusAvailableListener() {\n\n @Override\n public void onCardStatusAvailable(\n BluetoothReader bluetoothReader,\n final int cardStatus, final int errorCode) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n if (errorCode != BluetoothReader.ERROR_SUCCESS) {\n mTxtSlotStatus\n .setText(getErrorString(errorCode));\n } else {\n mTxtSlotStatus\n .setText(getCardStatusString(cardStatus));\n }\n }\n });\n }\n\n });\n\n mBluetoothReader2\n .setOnEnableNotificationCompleteListener(new OnEnableNotificationCompleteListener() {\n\n @Override\n public void onEnableNotificationComplete(\n BluetoothReader bluetoothReader, final int result) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n if (result != BluetoothGatt.GATT_SUCCESS) {\n /* Fail */\n Toast.makeText(\n ReaderActivity.this,\n \"The device is unable to set notification!\",\n Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(ReaderActivity.this,\n \"The device is ready to use!\",\n Toast.LENGTH_SHORT).show();\n }\n }\n });\n }\n\n });\n }", "public void onClickStart(View view) {\n\n HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();\n if (!usbDevices.isEmpty()) {\n boolean keep = true;\n for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {\n device = entry.getValue();\n int deviceVID = device.getVendorId();\n if (deviceVID == 0x2341)//Arduino Vendor ID\n {\n PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);\n usbManager.requestPermission(device, pi);\n keep = false;\n } else {\n connection = null;\n device = null;\n }\n\n if (!keep)\n break;\n }\n }\n\n\n }", "private void startReading() {\r\n\r\n isReading = true;\r\n Thread readingThread = new Thread(new Runnable() {\r\n @Override\r\n public void run() {\r\n while (isReading) {\r\n synchronized (this) {\r\n int ret;\r\n\r\n // Fetch the data here\r\n if(mUsbDeviceConnection != null && mUsbEndpointIn != null){\r\n byte[] bytes = new byte[mUsbEndpointIn.getMaxPacketSize()];\r\n ret = mUsbDeviceConnection.bulkTransfer(mUsbEndpointIn, bytes, bytes.length, 1000);\r\n\r\n if (ret >= 64) {\r\n if(bytes[1] == (byte)0xc8){\r\n // USB_COMMAND_ACK\r\n }\r\n else{\r\n // DATA Frame, bytes[1] should be 0x65\r\n float[] accSensorData = new float[3];\r\n float[] gyroSensorData = new float[3];\r\n float[] magSensorData = new float[3];\r\n\r\n // ACC\r\n accSensorData[0] = byte2float(bytes, 4);\r\n accSensorData[1] = byte2float(bytes, 8);\r\n accSensorData[2] = byte2float(bytes, 12);\r\n\r\n // Gyro\r\n gyroSensorData[0] = byte2float(bytes, 16) * (float)Math.PI / 180.0f;\r\n gyroSensorData[1] = byte2float(bytes, 20) * (float)Math.PI / 180.0f;\r\n gyroSensorData[2] = byte2float(bytes, 24) * (float)Math.PI / 180.0f;\r\n\r\n // Mag, not used so far\r\n magSensorData[0] = (float) (byte2float(bytes, 28) * Math.PI / 180.0f);\r\n magSensorData[1] = (float) (byte2float(bytes, 32) * Math.PI / 180.0f);\r\n magSensorData[2] = (float) (byte2float(bytes, 36) * Math.PI / 180.0f);\r\n\r\n String[] msgData = new String[3];\r\n msgData[0] = String.format(\"%.2f\", accSensorData[0]) + \", \" + String.format(\"%.2f\", accSensorData[1]) + \", \" + String.format(\"%.2f\", accSensorData[2]);\r\n msgData[1] = String.format(\"%.2f\", gyroSensorData[0]) + \", \" + String.format(\"%.2f\", gyroSensorData[1]) + \", \" + String.format(\"%.2f\", gyroSensorData[2]);\r\n msgData[2] = String.format(\"%.2f\", magSensorData[0]) + \", \" + String.format(\"%.2f\", magSensorData[1]) + \", \" + String.format(\"%.2f\", magSensorData[2]);\r\n\r\n Message msg = new Message();\r\n msg.obj = msgData;\r\n msg.what = 0;\r\n mHandler.sendMessage(msg);\r\n }\r\n }\r\n else{\r\n Log.d(TAG, \"No data from USB device.\");\r\n }\r\n }\r\n else{\r\n isReading = false;\r\n Log.d(TAG, \"USB connection is not available.\");\r\n }\r\n }\r\n }\r\n }\r\n });\r\n\r\n Log.d(TAG, \"Start the reading thread here to retrieve sensors(acc, gyro, mag)\");\r\n readingThread.start();\r\n }", "private void setDeviceVendor() {\n addToMobileContext(Parameters.DEVICE_MANUFACTURER, android.os.Build.MANUFACTURER);\n }", "void onBusEvent(Event event);", "@Override\r\n\tpublic void startEvent() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void startEvent() {\n\t\t\r\n\t}", "public void incomingSegmentRequest(APDUEvent e)\n {\n LOGGER.finer(\"Incoming segmentRequest\");\n }", "public boolean setup() {\n\t\tmakeStream(EVENT, EVENT_BUFFER_SIZE);\n\t\t\n\t\tmakeStream(BAROMETER, BAROMETER_BUFFER_SIZE);\n\t\trocket.barometer.setListener(new MS5611.MS5611Listener() {\n\t\t\t@Override\n\t\t\tpublic void onData(int P /* mbar */, int TEMP /* C */) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(BAROMETER);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + BAROMETER + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeInt(P);\n\t\t\t\t\t\t\tstream.writeInt(TEMP);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + BAROMETER + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onError(String message) {}\n\t\t});\n\t\t\n//\t\tmakeStream(GYRO, GYRO_BUFFER_SIZE);\n//\t\trocket.gyro.setListener(new ITG3205.ITG3205Listener() {\n//\t\t\t@Override\n//\t\t\tpublic void onDeviceId(byte deviceId) {}\n//\t\t\t\n//\t\t\t@Override\n//\t\t\tpublic void onData(int x, int y, int z, int temperature) {\n//\t\t\t\tif (enabled) {\n//\t\t\t\t\tDataOutputStream stream = out.get(GYRO);\n//\t\t\t\t\t\n//\t\t\t\t\tif (stream == null) {\n//\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + GYRO + \".\");\n//\t\t\t\t\t} else {\n//\t\t\t\t\t\ttry {\n//\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n//\t\t\t\t\t\t\tstream.writeInt(x);\n//\t\t\t\t\t\t\tstream.writeInt(y);\n//\t\t\t\t\t\t\tstream.writeInt(z);\n//\t\t\t\t\t\t\tstream.writeInt(temperature);\n//\t\t\t\t\t\t} catch (IOException e) {\n//\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + GYRO + \" values to output stream.\");\n//\t\t\t\t\t\t\te.printStackTrace();\n//\t\t\t\t\t\t\treturn;\n//\t\t\t\t\t\t}\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t}\n//\t\t\t\n//\t\t\t@Override\n//\t\t\tpublic void onError(String message) {}\n//\t\t});\n\t\t\n\t\tmakeStream(LOX_PRESSURE, PRESSURE_BUFFER_SIZE);\n\t\trocket.loxPressure.setListener(new P51500AA1365V.P51500AA1365VListener() {\n\t\t\t@Override\n\t\t\tpublic void onVoltage(float voltage) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(LOX_PRESSURE);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + LOX_PRESSURE + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeFloat(voltage);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + LOX_PRESSURE + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tmakeStream(ETHANOL_PRESSURE, PRESSURE_BUFFER_SIZE);\n\t\trocket.ethanolPressure.setListener(new P51500AA1365V.P51500AA1365VListener() {\n\t\t\t@Override\n\t\t\tpublic void onVoltage(float voltage) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(ETHANOL_PRESSURE);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + ETHANOL_PRESSURE + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeFloat(voltage);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + ETHANOL_PRESSURE + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tmakeStream(ENGINE_PRESSURE, PRESSURE_BUFFER_SIZE);\n\t\trocket.enginePressure.setListener(new P51500AA1365V.P51500AA1365VListener() {\n\t\t\t@Override\n\t\t\tpublic void onVoltage(float voltage) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(ENGINE_PRESSURE);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + ENGINE_PRESSURE + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeFloat(voltage);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + ENGINE_PRESSURE + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tmakeStream(ACCELEROMETER, ACCELEROMETER_BUFFER_SIZE);\n\t\trocket.accelerometer.setListener(new ADXL345.ADXL345Listener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onDeviceId(byte deviceId) {}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onMultiplier(float multiplier) {\n\t\t\t\tbyte[] data = new byte[4];\n\t\t\t\tByteBuffer.wrap(data).putFloat(multiplier);\n\t\t\t\tevent(Event.ACCELEROMETER_MULTIPLIER, data);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onData(int x, int y, int z) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(ACCELEROMETER);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + ACCELEROMETER + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeInt(x);\n\t\t\t\t\t\t\tstream.writeInt(y);\n\t\t\t\t\t\t\tstream.writeInt(z);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + ACCELEROMETER + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onError(String message) {}\n\t\t\t\n\t\t});\n\t\t\n\t\tmakeStream(INTERNAL_ACCELEROMETER, ACCELEROMETER_BUFFER_SIZE);\n\t\trocket.internalAccelerometer.setListener(new PhoneAccelerometer.PhoneAccelerometerListener() {\n\t\t\t@Override\n\t\t\tpublic void onPhoneAccelerometer(float x, float y, float z) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(INTERNAL_ACCELEROMETER);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + INTERNAL_ACCELEROMETER + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeFloat(x);\n\t\t\t\t\t\t\tstream.writeFloat(y);\n\t\t\t\t\t\t\tstream.writeFloat(z);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + INTERNAL_ACCELEROMETER + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tmakeStream(LOX_TEMPERATURE, TEMPERATURE_BUFFER_SIZE);\n\t\trocket.loxTemperature.setListener(new MAX31855.MAX31855Listener() {\n\t\t\t@Override\n\t\t\tpublic void onFault(byte fault) {}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onData(float internal, float thermocouple) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(LOX_TEMPERATURE);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + LOX_TEMPERATURE + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeFloat(internal);\n\t\t\t\t\t\t\tstream.writeFloat(thermocouple);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + LOX_TEMPERATURE + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tmakeStream(IGNITOR_TEMPERATURE, TEMPERATURE_BUFFER_SIZE);\n\t\trocket.ignitorTemperature.setListener(new MAX31855.MAX31855Listener() {\n\t\t\t@Override\n\t\t\tpublic void onFault(byte fault) {}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onData(float internal, float thermocouple) {\n\t\t\t\tif (enabled) {\n\t\t\t\t\tDataOutputStream stream = out.get(IGNITOR_TEMPERATURE);\n\t\t\t\t\t\n\t\t\t\t\tif (stream == null) {\n\t\t\t\t\t\tApp.log.e(App.TAG, \"Output stream not available for \" + IGNITOR_TEMPERATURE + \".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstream.writeFloat(App.elapsedTime());\n\t\t\t\t\t\t\tstream.writeFloat(internal);\n\t\t\t\t\t\t\tstream.writeFloat(thermocouple);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tApp.log.e(App.TAG, \"Failed to write \" + IGNITOR_TEMPERATURE + \" values to output stream.\");\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn true;\n\t}", "public void startResourcesThread() {\r\n\t\t\r\n\t\t//Check lock\r\n\t\tif (resourcesThreadRunning)\r\n\t\t\tlogger.log(Level.INFO, \"Resources Thread already running...\\n\");\r\n\t\telse\r\n\t\t\t//Submit to ExecutorService\r\n\t\t\teventsExecutorService.submit(() -> {\r\n\t\t\t\ttry {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Lock\r\n\t\t\t\t\tresourcesThreadRunning = true;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Detect if the microphone is available\r\n\t\t\t\t\twhile (true) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//Is the Microphone Available\r\n\t\t\t\t\t\tif (!AudioSystem.isLineSupported(Port.Info.MICROPHONE))\r\n\t\t\t\t\t\t\tlogger.log(Level.INFO, \"Microphone is not available.\\n\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Sleep some period\r\n\t\t\t\t\t\tThread.sleep(350);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} catch (InterruptedException ex) {\r\n\t\t\t\t\tlogger.log(Level.WARNING, null, ex);\r\n\t\t\t\t\tresourcesThreadRunning = false;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t}", "private void startAdvertising() {\n BluetoothAdapter bluetoothAdapter = mBluetoothManager.getAdapter();\n if (!bluetoothAdapter.isEnabled()) {\n System.out.println(\"does not support\");\n }\n if (!bluetoothAdapter.isMultipleAdvertisementSupported()) {\n //Device does not support Bluetooth LE\n System.out.println(\"does not support\");\n }\n\n mBluetoothLeAdvertiser = bluetoothAdapter.getBluetoothLeAdvertiser();\n if (mBluetoothLeAdvertiser == null) {\n Log.w(TAG, \"Failed to create advertiser\");\n return;\n }\n\n AdvertiseSettings settings = new AdvertiseSettings.Builder()\n .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY)\n .setConnectable(true)\n .setTimeout(0)\n .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH)\n .build();\n\n AdvertiseData data = new AdvertiseData.Builder()\n .setIncludeDeviceName(true)\n .setIncludeTxPowerLevel(false)\n .addServiceUuid(new ParcelUuid(TimeProfile.TIME_SERVICE))\n .build();\n\n mBluetoothLeAdvertiser\n .startAdvertising(settings, data, mAdvertiseCallback);\n }", "public void start() {\n LOG.entering(CLASS_NAME, \"start\");\n if (state.compareAndSet(STOPPING, STARTED)) {\n // Keep same thread running if STOPPING\n }\n else if (state.compareAndSet(STOPPED, STARTED)) {\n new Thread(this, \"XoaEventProcessor\").start();\n }\n }", "@Override\r\n public void onOpened(EMDKManager emdkManager) {\r\n updateStatus(\"EMDK open success!\");\r\n this.emdkManager = emdkManager;\r\n // Acquire the barcode manager resources\r\n initBarcodeManager();\r\n // Enumerate scanner devices\r\n enumerateScannerDevices();\r\n // Set default scanner\r\n spinnerScannerDevices.setSelection(defaultIndex);\r\n }", "public void setReader(ACRReader reader){\r\n this.reader = reader;\r\n }", "@Override\n\tpublic void onEvent(String name, String params, byte[] data, int offset,\n\t\t\tint length) {\n\t\tString result = \"name:\" + name;\n\t\t//if(params != null && !params.isEmpty()){\n\t\t//\tresult+=\";params:\"+params;\n\t\t//}\n\t\tif(name.equals(SpeechConstant.CALLBACK_EVENT_ASR_PARTIAL)){\n\t\t\tif(params.contains(\"\\\"final_result\\\"\")){\n\t\t\t\tresult += \"\\n\"+\"语义解析结果:\" + params.substring(45, 47);\n\t\t\t\tif(result.contains(\"前进\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了前进!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_FORWARD);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"后退\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了后退!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_BACKWARD);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"左转\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了左转!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_LEFT);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"右转\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了右转!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_RIGHT);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"停\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了停止!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_STOP);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"避障\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了避障!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_AVOID);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"跟踪\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了跟踪!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\ttry{\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tsocketWriter= socket.getOutputStream();\n\t\t\t\t\t\tsocketWriter.write(COMM_FOLLOW);\n\t\t\t\t\t\tsocketWriter.flush();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tToast.makeText(MainActivity.this, \"Try to send message to car!\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(result.contains(\"抓取\")){\n\t\t\t\t\tToast.makeText(MainActivity.this,\"识别出了抓取!\",Toast.LENGTH_SHORT).show();\n\t\t\t\t\tIntent intent = new Intent();\n\t\t\t\t\tintent.setClass(MainActivity.this, GraspActivity.class);\n\t\t\t\t\tMainActivity.this.startActivity(intent);\n\t\t\t\t\tfinish();\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}else if(data != null){\n\t\t\tresult += \";data length=\" + data.length;\n\t\t}\n\t\t\n\t\t\n\t\t/*if(name.equals(SpeechConstant.CALLBACK_EVENT_ASR_READY)){\n\t\t\tresult +=\"引擎准备就绪,可以开始说话\";\n\t\t}else if(name.equals(SpeechConstant.CALLBACK_EVENT_ASR_BEGIN)){\n\t\t\tresult += \"检测到用户已经开始说话\";\n\t\t}else if(name.equals(SpeechConstant.CALLBACK_EVENT_ASR_END)){\n\t\t\tresult += \"检测到用户已经停止说话\";\n\t\t\t\n\t\t}else if (data != null) {\n\t\t\tresult += \" ;data length=\" + data.length;\n }*/\n\t\n\t\t//show the result\n\t\tprintresult(result);\n\t\t\n\t}", "private void onCallSetup(int callsetup, byte[] address) {\n StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_CALLSETUP);\n event.valueInt = callsetup;\n event.device = getDevice(address);\n if (DBG) {\n Log.d(TAG, \"onCallSetup: addr \" + address + \" device\" + event.device);\n Log.d(TAG, \"onCallSetup: address \" + address + \" event \" + event);\n }\n HeadsetClientService service = HeadsetClientService.getHeadsetClientService();\n if (service != null) {\n service.messageFromNative(event);\n } else {\n Log.w(TAG, \"onCallSetup: Ignoring message because service not available: \" + event);\n }\n }", "private void onCallSetup(int callsetup, byte[] address) {\n StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_CALLSETUP);\n event.valueInt = callsetup;\n event.device = getDevice(address);\n if (DBG) {\n Log.d(TAG, \"onCallSetup: addr \" + address + \" device\" + event.device);\n Log.d(TAG, \"onCallSetup: address \" + address + \" event \" + event);\n }\n HeadsetClientService service = HeadsetClientService.getHeadsetClientService();\n if (service != null) {\n service.messageFromNative(event);\n } else {\n Log.w(TAG, \"onCallSetup: Ignoring message because service not available: \" + event);\n }\n }", "@Override\n public void start() {\n smDrive.start();\n smArm.start();\n }", "public void start() {\n synchronized (car) {\n LOG.fine(\"Validating APPLY Record\");\n try {\n dir = cas.createChannel(epicsTop.buildEpicsChannelName(name + \".DIR\"), Dir.CLEAR);\n dir.registerListener(new DirListener());\n val = cas.createChannel(epicsTop.buildEpicsChannelName(name + \".VAL\"), 0);\n mess = cas.createChannel(epicsTop.buildEpicsChannelName(name + \".MESS\"), \"\");\n omss = cas.createChannel(epicsTop.buildEpicsChannelName(name + \".OMSS\"), \"\");\n clid = cas.createChannel(epicsTop.buildEpicsChannelName(name + \".CLID\"), 0);\n\n car.start();\n for (CadRecord cad : cads) {\n cad.start();\n cad.getCar().registerListener(new CarListener());\n }\n } catch (CAException e) {\n LOG.log(Level.SEVERE, e.getMessage(), e);\n }\n }\n }", "private void initEngine() {\n // This is our usual steps for joining a channel and starting a call.\n try {\n // Initialize the Agora RtcEngine.\n mRtcEngine = RtcEngine.create(getBaseContext(), getString(R.string.agora_app_id), mRtcEventHandler);\n\n // Set the channel profile to Live Broadcast and role to Broadcaster (in order to be heard by others).\n mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);\n mRtcEngine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);\n\n // Enable video capturing and rendering once at the initialization step.\n // Note: audio recording and playing is enabled by default.\n mRtcEngine.enableVideo();\n\n // Disable the local video capturer.\n mRtcEngine.enableLocalVideo(false);\n\n /*\n // This is only needed if capturing local camera, which we currently are not.\n // Please go to this page for detailed explanation\n // https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#af5f4de754e2c1f493096641c5c5c1d8f\n mRtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(\n VideoEncoderConfiguration.VD_640x360,\n VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_15,\n VideoEncoderConfiguration.STANDARD_BITRATE,\n VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT));\n // This is used to set a local preview.\n // The steps setting local and remote view are very similar.\n // But note that if the local user do not have a uid or do\n // not care what the uid is, he can set his uid as ZERO.\n // The Agora server will assign one and return the uid via the event\n // handler callback function (onJoinChannelSuccess) after\n // joining the channel successfully.\n mLocalView = RtcEngine.CreateRendererView(getBaseContext());\n mLocalView.setZOrderMediaOverlay(true);\n mRemoteCameraContainer.addView(mLocalView);\n mRtcEngine.setupLocalVideo(new VideoCanvas(mLocalView, VideoCanvas.RENDER_MODE_HIDDEN, 0));\n */\n } catch (Exception e) {\n Log.e(TAG, Log.getStackTraceString(e));\n throw new RuntimeException(\"FATAL ERROR! Check rtc sdk init\\n\" + Log.getStackTraceString(e));\n }\n }", "private void startListening() {\n if (mEnabledByEmulator && mEnabledByUser) {\n if (DEBUG) Log.d(TAG, \"+++ Sensor \" + getEmulatorFriendlyName() + \" is started.\");\n mSenMan.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_FASTEST);\n }\n }", "@Override\n\tpublic void robotInit() //starts once when the code is started\n\t{\n\t\tm_oi = new OI(); //further definition of OI\n\t\t\n\t\t// chooser.addObject(\"My Auto\", new MyAutoCommand());\n\t\t//SmartDashboard.putData(\"Auto mode\", m_chooser);\n\t\t\n\t\tnew Thread(() -> {\n\t\t\tUsbCamera camera1 = CameraServer.getInstance().startAutomaticCapture();\n\t\t\tcamera1.setResolution(640, 480);\n\t\t\tcamera1.setFPS(30);\n\t\t\tcamera1.setExposureAuto();\n\t\t\t\n\t\t\tCvSink cvSink = CameraServer.getInstance().getVideo();\n\t\t\tCvSource outputStream = CameraServer.getInstance().putVideo(\"Camera1\", 640, 480); \n\t\t\t//set up a new camera with this name in SmartDashboard (Veiw->Add->CameraServer Stream Viewer)\n\t\t\t\n\t\t\tMat source = new Mat();\n\t\t\tMat output = new Mat();\n\t\t\t\n\t\t\twhile(!Thread.interrupted())\n\t\t\t{\n\t\t\t\tcvSink.grabFrame(source);\n\t\t\t\tImgproc.cvtColor(source, output, Imgproc.COLOR_BGR2RGB);//this will show the video in black and white \n\t\t\t\toutputStream.putFrame(output);\n\t\t\t}\t\t\t\t\t\n\t\t}).start();//definition of camera, runs even when disabled\n\t\t\n\t\tdriveStick = new Joystick(0); //further definition of joystick\n\t\tgyroRotate.gyroInit(); //initializing the gyro - in Rotate_Subsystem\n\t\tultrasonic = new Ultrasonic_Sensor(); //further definition of ultrasonic\n\t\tRobotMap.encoderLeft.reset();\n\t\tRobotMap.encoderRight.reset();\n\t\tdriveToDistance.controllerInit();\n\t}", "protected void initSDK() {\n\t\tSMSSDK.initSDK(this,\"672e0e8c7203\",\"c3728cc22e8e1d75501de2a100b4586c\");\n\t\tEventHandler eventHandler = new EventHandler() {\n\t\t\tpublic void afterEvent(int event, int result, Object data) {\n\t\t\t\tMessage msg = new Message();\n\t\t\t\tmsg.arg1 = event;\n\t\t\t\tmsg.arg2 = result;\n\t\t\t\tmsg.obj = data;\n\t\t\t\thandler.sendMessage(msg);\n\t\t\t}\n\t\t};\n\t\n\t\tSMSSDK.registerEventHandler(eventHandler);\n\t\tready=true;\n\t}", "@Override\n\t\tpublic void loop() throws ConnectionLostException, InterruptedException {\n\t\t\ttry {\n\t\t\t\tif (ExitApp == true) {\n\t\t\t\t\tPStatus.write(false);\n\t\t\t\t\tEN_LE.write(false);\n\t\t\t\t\tExitApp = false;\n\t\t\t\t\tDisplayLabel(\"LATCH ON\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tPStatus.write(true);\n\n\t\t\t\t// Set device enable\n\t\t\t\tEN_Device1.write(cmdDevice1.isChecked());\n\t\t\t\tEN_Device2.write(cmdDevice2.isChecked());\n\t\t\t\tEN_Device3.write(cmdDevice3.isChecked());\n\t\t\t\tEN_Device4.write(cmdDevice4.isChecked());\n\t\t\t\tEN_Device5.write(cmdDevice5.isChecked());\n\n\t\t\t\tif (cmdDevice1.isChecked())\n\t\t\t\t\tDisplayLabel(\"Btn1_Click\");\n\t\t\t\t// Get Amp\n\n\t\t\t\t// Get Watt\n\n\t\t\t\tThread.sleep(10);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\t// PStatus.write(false);\n\t\t\t\t// EN_LE.write(false);\n\t\t\t\tioio_.disconnect();\n\t\t\t} catch (ConnectionLostException ex) {\n\t\t\t\t// PStatus.write(false);\n\t\t\t\t// EN_LE.write(false);\n\t\t\t\tioio_.disconnect();\n\t\t\t}\n\t\t}", "public void activate() throws MMDeviceException;", "public void service_REQ(){\n if ((eccState == index_HasRequest) && (PEExit.value)) state_BagPassedEye();\n else if ((eccState == index_IDLE) && (TokenIn.value)) state_START();\n else if ((eccState == index_IDLE) && (PERequest.value)) state_NoTokenButRequest();\n else if ((eccState == index_NoTokenButRequest) && (TokenIn.value)) state_START();\n else if ((eccState == index_START) && (NoPERequest.value)) state_IDLE();\n }", "private void requestRecord() throws IOException {\n\n String targetCamCode = dis.readUTF();\n\n Cam targetCam = CamRegister.findRegisteredCam(targetCamCode);\n\n try {\n DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream());\n targetDos.writeInt(RECORD_CAM_COMMAND);\n targetDos.flush();\n\n dos.writeInt(SUCCESS_CODE);\n dos.flush();\n } catch (Exception e) {\n dos.writeInt(NOT_FOUND_CODE);\n dos.flush();\n }\n }", "public void resume() {\n mSensorMgr = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);\n if (mSensorMgr == null) {\n throw new UnsupportedOperationException(\"Sensors not supported\");\n }\n mAccelerometer = mSensorMgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);\n if (!mSensorMgr.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_UI)) { // if not supported\n mSensorMgr.unregisterListener(this);\n throw new UnsupportedOperationException(\"Accelerometer not supported\");\n }\n }", "private void handleDriveInput() throws EnhancedIOException {\n\n boolean[] driveButtons = joysticks.getLeftButtons();\n\n //double[] instructions=joysticks.getMovementInstructions();\n\n //comment this out if not using xbox and uncomment above inorder to get correct movement instructions\n //sets overDrive to correspond to the trigger\n\n //changed from using xBox to test encoders and line code\n double[] instructions = joysticks.getMovementInstructions();\n\n\n //Comment one or the other out to set how to control overdrive\n boolean overDrive = driveButtons[0];\n //boolean overDrive = xboxController.getButton(6);\n\n //testing linetracking and encoder\n /*if(driveButtons[2] || xboxController.getButton(7));\n {\n int channel2= 12;\n int channel3 = 13;\n int channel4 = 14;\n driveTask = new LineTrackThread(channel2, channel3, channel4,true,false);\n driveTask.start();\n }\n */\n\n //gets raw speeds\n SpeedSet speedsNew = getRobotDrive().getSpeeds(instructions);\n\n //reduces speeds to correct range;\n speedsNew.reduce();\n\n //handles overDrive\n speedsNew.square();\n\n speedsNew = getRobotDrive().handleOverDrive(speedsNew, overDrive);\n\n //limits acceleration\n speedsNew = getRobotDrive().accelerationLimit(speedsNew);\n\n //sets the processed motor speeds, casted to be a pair\n getRobotDrive().setSpeeds((SpeedPair) speedsNew);\n\n //if button 5 is pressed on the joystick, start line tracking\n\n /*commented out, we don't want line track during teleop\n if (driveButtons[4]) {\n //first create the thread\n driveTask = new WaltLineTrack(false, false);\n\n //then start it WITH THE BEGIN method so that it is immediately set to running = true\n //(begin is IMPORTANT!)\n driveTask.begin();\n\n //tell the driveTrain it is under in automatic control\n driveState = AUTO;\n }\n */\n }", "public void InitAVComCtl(){\n\n\n\t\tmBtnStart = (Button) findViewById(R.id.btn_start);\n\t\tmBtnStop = (Button) findViewById(R.id.btn_stop);\n\t\tmBtnSetting = (Button) findViewById(R.id.btn_setting);\n\t\tmBtnChooseCam = (Button) findViewById(R.id.btn_choosecam);\n\n\t\tonStartClickEvent();\n\t\tonStopClickEvent();\n\t\tonSettingClickEvent();\n\t\tgetStatToDisplay();\n\n\t\tonChooseCamClickEvent();\n\n\t\tconfigInfo = getSharedPreferences(\"AdvideoConfig\", Context.MODE_PRIVATE);\n\t\tinitViewConfig();\n\t}", "protected void setup() {\n DFAgentDescription dfd = new DFAgentDescription();\n dfd.setName(getAID());\n ServiceDescription sd = new ServiceDescription();\n sd.setName(\"Storage Agent\");\n sd.setType(\"Storage\");\n dfd.addServices(sd);\n try {\n DFService.register(this, dfd);\n } catch (FIPAException fe) {\n fe.printStackTrace();\n }\n waitForAgents = new waitAgents();\n receiveAgents = new receiveFromAgents();\n operate = new opMicrogrid();\n decision = new takeDecision();\n\n addBehaviour(waitForAgents);\n\n //add a ticker behavior to monitor PV production, disable PLay button in the meanwhile\n addBehaviour(new TickerBehaviour(this, 5000) {\n protected void onTick() {\n if (AgentsUp == 0) {\n appletVal.playButton.setEnabled(false);\n ACLMessage msg = new ACLMessage(ACLMessage.INFORM);\n msg.addReceiver(new AID(AgentAIDs[2].getLocalName(), AID.ISLOCALNAME));\n msg.setContent(\"Inform!!!\");\n send(msg);\n String stripedValue = \"\";\n msg = receive();\n if (msg != null) {\n // Message received. Process it\n String val = msg.getContent().toString();\n stripedValue = (val.replaceAll(\"[\\\\s+a-zA-Z :]\", \"\"));\n //PV\n if (val.contains(\"PV\")) {\n System.out.println(val);\n PV = Double.parseDouble(stripedValue);\n appletVal.playButton.setEnabled(true);\n appletVal.SetAgentData(PV, 0, 2);\n }\n\n } else {\n block();\n }\n\n }\n }\n });\n\n }", "private void createEdidSwitch(final int inputSource) {\n mProgressDialog = new ProgressDialog(settingActivity);\n mProgressDialog.setTitle(settingActivity.getResources().getString(\n R.string.str_hdmi_edid_version_change));\n mProgressDialog.setMessage(settingActivity.getResources().getString(\n R.string.str_hdmi_edid_version_wait));\n mProgressDialog.setIndeterminate(false);\n mProgressDialog.setCancelable(false);\n\n String[] resList = settingActivity.getResources().getStringArray(R.array.str_arr_hdmi_edid_version);\n String[] edidItemList = new String[resList.length + 1];\n System.arraycopy(resList, 0, edidItemList, 0, resList.length);\n mHdmiEdidAutoSwitchIndex = resList.length;\n edidItemList[mHdmiEdidAutoSwitchIndex] = settingActivity.getResources().getString(R.string.str_edid_auto_switch);\n\n mComboHdmiEdidVersion = new ComboButton(settingActivity, edidItemList,\n R.id.linearlayout_hdmi_edid_version, 1, 2, ComboButton.NEED_SELECTED_BEFORE_SWITCH) {\n @Override\n public void doUpdate() {\n super.doUpdate();\n\n LittleDownTimer.pauseItem();\n LittleDownTimer.pauseMenu();\n mProgressDialog.show();\n\n if (mThreadEdidChange == null\n || mThreadEdidChange.getState() == Thread.State.TERMINATED) {\n mThreadEdidChange = new Thread(new Runnable() {\n @Override\n public void run() {\n Log.d(TAG, \"new thread starting change edid version !\");\n int idx = getIdx();\n if (idx == mHdmiEdidAutoSwitchIndex) {\n if (mTvCommonManager.isSupportModule(TvCommonManager.MODULE_EDID_AUTO_SWITCH)) {\n mTvCommonManager.setHdmiEdidAutoSwitch(true);\n }\n } else {\n if (mTvCommonManager.isSupportModule(TvCommonManager.MODULE_EDID_AUTO_SWITCH)) {\n mTvCommonManager.setHdmiEdidAutoSwitch(false);\n }\n if (mTvCommonManager.setHdmiEdidVersionBySource(\n inputSource, idx) != true) {\n Log.e(TAG, \"setHdmiEdidVersion failed!\");\n }\n }\n\n /* Prepare resuming to menu */\n if (null != mProgressDialog) {\n mProgressDialog.dismiss();\n }\n\n LittleDownTimer.resetItem();\n LittleDownTimer.resetMenu();\n LittleDownTimer.resumeItem();\n LittleDownTimer.resumeMenu();\n }\n });\n mThreadEdidChange.start();\n } else {\n Log.d(TAG,\n \"Abort, another thread is already starting changing edid. the combobutton is not switchable until it finish\");\n }\n }\n };\n\n /* Get the supported HDMI EDIE version list */\n boolean bSupportHdmiEdidVersion;\n int focusIndex = mTvCommonManager.getHdmiEdidVersionBySource(inputSource);\n int[] supportHdmiEdidVersionList = mTvCommonManager\n .getHdmiEdidVersionList();\n for (int i = 0; (i < supportHdmiEdidVersionList.length) && (i < resList.length); i++) {\n Log.d(TAG, \"supportHdmiEdidVersionList[\"+i+\"] = \" + supportHdmiEdidVersionList[i]);\n if (supportHdmiEdidVersionList[i] != TvCommonManager.EDID_VERSION_UNSUPPORT) {\n bSupportHdmiEdidVersion = true;\n } else {\n bSupportHdmiEdidVersion = false;\n }\n mComboHdmiEdidVersion.setItemEnable(i, bSupportHdmiEdidVersion);\n }\n if (mTvCommonManager.isSupportModule(TvCommonManager.MODULE_EDID_AUTO_SWITCH)) {\n mComboHdmiEdidVersion.setItemEnable(mHdmiEdidAutoSwitchIndex, true);\n if (mTvCommonManager.getHdmiEdidAutoSwitch()) {\n focusIndex = mHdmiEdidAutoSwitchIndex;\n }\n } else {\n mComboHdmiEdidVersion.setItemEnable(mHdmiEdidAutoSwitchIndex, false);\n }\n mComboHdmiEdidVersion.setIdx(focusIndex);\n }", "public void serialEvent(SerialPortEvent event) {\n String finalString = \"\";\n\n if(event.getEventType() == SerialPortEvent.DATA_AVAILABLE) {\n sleep(100);\n try {\n byte[] readBuffer = new byte[40];\n while(inputStream.available() > 0) {\n inputStream.read(readBuffer);\n }\n finalString = new String(readBuffer).trim();\n\n if(isSetupCompleted && finalString.equals(\"z\") && !isConnected) {\n isConnected = true;\n out(\"[\" + comport.getName() + \"] found BT Zeppelin!\");\n write(\"p\", false);\n owner.onZeppelinFound(this);\n } else if(finalString.equals(\"p\")) {\n write(\"p\", false);\n out(\"[\" + comport.getName() + \"] responding to ping.\");\n\n // Take note of the last received ping, the GUI will update\n owner.setLastPing(System.currentTimeMillis());\n } else {\n out(\"[\" + comport.getName() + \"] read: '\" + finalString + \"'\");\n }\n } catch (IOException e) {\n \n }\n }\n }", "public void initDevice() {\r\n\t\t\r\n\t}", "@Override\n public void serialEvent(SerialPortEvent oEvent)\n {\n if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {\n try{\n String strIn = br.readLine();\n String[] strPara = strIn.split(\",\");\n if(strPara.length != 2){\n System.out.println(\"[Serial error]: \" + strIn);\n return;\n }\n\n // Check data validaty\n try{\n for(int i=0 ; i<strPara.length ; i++)\n Double.valueOf(strPara[i]);\n }\n catch(Exception e){\n System.out.println(\"[Serial error]: \" + strIn);\n return;\n }\n \n // Update data to window interface\n parent.setEMGData_From_SerialPort(strPara[0], strPara[1]);\n } \n catch (Exception e) {\n e.printStackTrace();\n }\n }\n // Ignore all the other eventTypes, but you should consider the other ones.\n\t}", "public void ResultVoiceIn(EventVoice event);", "@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\t\t//Gionee zhangke modify 20151204 for CR01603467 start\n\t\tnew Thread() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\t//Gionee <GN_BSP_AutoMMI> <chengq> <20170505> modify for ID 129027 begin\n\t\t\t\tString aString = TestUtils.getStreamVoice(\"ToneTest\");\n\t\t\t\tint i = Integer.valueOf(aString).intValue();\n\t\t\t\tDswLog.e(TAG, \"i = \" + i);\n\t\t\t\tif (null != mAudioManager) {\n\t\t\t\t\tint maxVol = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);\n\t\t\t\t\tDswLog.e(TAG, \" set stream = music \");\n\t\t\t\t\tmAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVol - i, 0);\n\t\t\t\t\tDswLog.e(TAG, \"maxVol = \" + maxVol + \" setStreamVolume = \" + (maxVol - i));\n\t\t\t\t}\n\t\t\t\t//Gionee <GN_BSP_AutoMMI> <chengq> <20170505> modify for ID 129027 end\n\t\t\t\tgenTone();\n\t\t\t\tplaySound();\n\t\t\t}\t\n\t\t}.start();\n\t\t//Gionee zhangke modify 20151204 for CR01603467 end\n\n\t}", "public void setup() {\n\n // Initialize the serial port for communicating to a PC\n uartInit(UART6,9600);\n\n // Initialize the Analog-to-Digital converter on the HAT\n analogInit(); //need to call this first before calling analogRead()\n\n // Initialize the MMQ8451 Accelerometer\n try {\n accelerometer = new Mma8451Q(\"I2C1\");\n accelerometer.setMode(Mma8451Q.MODE_ACTIVE);\n } catch (IOException e) {\n Log.e(\"HW3Template\",\"setup\",e);\n }\n }", "@Override\n\t\t\t\tpublic void run() {\n//\t\t\t\t\t\n//\t\t\t\t\tSystem.out.printf(\"Ausgangs-Puffer: \");\n//\t\t\t\t\tfor(int i=0; i<Message.length; i++)\tSystem.out.printf(\"0x%02X \", eeipClient.O_T_IOData[i]);\n//\t\t\t\t\tSystem.out.printf(\"\\n\\n\");\n\t\t\t\t\t\n\t\t\t\t\tStatus_Byte=eeipClient.T_O_IOData[0x7F];\n\t\t\t\t\tTO_Bit=(Status_Byte&(0x20))>>5;\n\t\t\t\t\tAE_Bit=(Status_Byte&(0x04))>>2;\n\t\t\t\t\tAA_Bit=(Status_Byte&(0x02))>>1;\n\t\t\t\t\t\n\t\t\t\t\tif(AE_Bit==1) {\n\t\t\t\t\t\tstate=2;\n\t\t\t\t\t\ttimerflag3=false;\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.cancel();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}", "public EventHandleThread(){\n gson = new Gson();\n producer = KafkaProducerCreator.createProducer();\n this.paymentController = new PaymentController();\n }", "public void enableClient(){\r\n try{\r\n oos.writeObject(new DataWrapper(DataWrapper.CTCODE, new ControlToken(ControlToken.ENABLECODE)));\r\n oos.flush();\r\n } catch(IOException ioe) {\r\n ioe.printStackTrace();\r\n }\r\n }", "public void startEchoCancellerCalibration();", "public void playEarcon(String earcon, int queueMode, String[] params) {\n ArrayList<String> speakingParams = new ArrayList<String>();\n if (params != null) {\n speakingParams = new ArrayList<String>(Arrays.asList(params));\n }\n mSelf.playEarcon(earcon, queueMode, speakingParams);\n }", "public void serialEvent(SerialPortEvent event) {\n\t\ttry {\n\t\t\twhile (inStream.available() > 0) {\n//\t\t\t\tinStream.read(readBuffer);\n\t\t\t\tSerialMonitor.display(String.valueOf((char) inStream.read()));\n\t\t\t}\n//\t\t\tSerialMonitor.display(new String(readBuffer));\n\t\t} catch (IOException ioe) {\n\t\t\tSystem.out.println(\"Exception \" + ioe);\n\t\t\tioe.printStackTrace();\n\t\t} \n\t}", "@Override\n public void teleopInit() {\n if (autonomousCommand != null) \n {\n autonomousCommand.cancel();\n }\n\n new ArcadeDrive().start();\n\n new BackElevatorControl().start();\n\n new IntakeControl().start();\n\n new FrontElevatorManual().start();\n\n new ElevatorAutomatic().start();\n }", "public synchronized void serialEvent(SerialPortEvent oEvent) {\n\t\tif (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {\n\t\t\ttry {\n\t\t\t\tinputLine=input.readLine();\n\t\t\t\tSystem.out.println(inputLine);\n\t\t\t\tthis.sendSignal();\n\t\t\t} catch (Exception e) {\n\t\t\t\t//System.err.println(e.toString());\n\t\t\t}\n\t\t}\n\t\t// Ignore all the other eventTypes, but you should consider the other ones.\n\t}", "@Override\n\tpublic void handleEvent(ActivityStartEvent event) {\n\t\tif (event.getActType().endsWith( UrbanEVModule.PLUGIN_INTERACTION )) {\n\t\t\tId<Vehicle> vehicleId = lastVehicleUsed.get(event.getPersonId());\n\t\t\tif (vehicleId != null) {\n\t\t\t\tId<Vehicle> evId = Id.create(vehicleId, Vehicle.class);\n\t\t\t\tif (electricFleet.getElectricVehicles().containsKey(evId)) {\n\t\t\t\t\tElectricVehicle ev = electricFleet.getElectricVehicles().get(evId);\n\t\t\t\t\tList<Charger> chargers = chargersAtLinks.get(event.getLinkId());\n\t\t\t\t\tCharger charger = chargers.stream()\n\t\t\t\t\t\t\t.filter(ch -> ev.getChargerTypes().contains(ch.getChargerType()))\n\n\t\t\t\t\t\t\t.findAny()\n\t\t\t\t\t\t\t.get();\n\t\t\t\t\tcharger.getLogic().addVehicle(ev, event.getTime());\n\t\t\t\t\tMap<Id<Person>, Tuple<Id<Vehicle>, Id<Charger>>> proceduresOnLink = this.chargingProcedures.get(event.getLinkId());\n\t\t\t\t\tif(proceduresOnLink != null && proceduresOnLink.containsKey(event.getPersonId())){\n\t\t\t\t\t\tthrow new RuntimeException(\"person \" + event.getPersonId() + \" tries to charge 2 vehicles at the same time on link \" + event.getLinkId() +\n\t\t\t\t\t\t\t\t\". this is not supported.\");\n\t\t\t\t\t} else if(proceduresOnLink == null) {\n\t\t\t\t\t\tproceduresOnLink = new HashMap<>();\n\t\t\t\t\t}\n\t\t\t\t\tproceduresOnLink.put(event.getPersonId(), new Tuple<>(vehicleId, charger.getId()));\n\t\t\t\t\tthis.chargingProcedures.put(event.getLinkId(), proceduresOnLink);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new IllegalStateException(\"can not plug in non-registered ev \" + evId + \" of person \" + event.getPersonId());\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new IllegalStateException(\"last used vehicle of person \" + event.getPersonId() + \"is null. should not happen\");\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\t public void onCreate() {\n\t super.onCreate();\r\n\t ACRA.init(this);\r\n\t aaw.start();\r\n\r\n\t }", "public void StartListening()\n\t{\n\t\tif (true == mbHasAccelerometer && false == mbListening)\n\t\t{\n\t\t\tmbListening = true;\n\t\t\t\n\t\t\tfinal AccelerometerNativeInterface accelerometerNI = this;\n\t\t\tRunnable task = new Runnable()\n\t\t\t{ \n\t\t\t\t@Override public void run() \n\t\t\t\t{\n\t\t\t\t\tSensorManager sensorManager = (SensorManager)CSApplication.get().getActivityContext().getSystemService(Activity.SENSOR_SERVICE);\n\t\t\t\t\tsensorManager.registerListener(accelerometerNI, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME);\t\n\t\t\t\t}\n\t\t\t};\n\t\t\tCSApplication.get().scheduleUIThreadTask(task);\n\t\t};\n\t}", "@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)\n public void onCaptureDeviceStateChange(DeviceStateEvent event) {\n DeviceClient device = event.getDevice();\n DeviceState state = event.getState();\n Log.d(TAG, \"device : type : \" + device.getDeviceType() + \" guid : \" + device.getDeviceGuid());\n Log.d(TAG, \"device : name : \" + device.getDeviceName() + \" state: \" + state.intValue());\n\n mDeviceClient = device;\n String type = (DeviceType.isNfcScanner(device.getDeviceType()))? \"NFC\" : \"BARCODE\";\n TextView tv = findViewById(R.id.main_device_status);\n handleColor(tv, state.intValue());\n switch (state.intValue()) {\n case DeviceState.GONE:\n mDeviceClientList.remove(device);\n mAdapter.remove(device.getDeviceName() + \" \" + type);\n mAdapter.notifyDataSetChanged();\n if(!mAdapter.isEmpty()) {\n handleColor(tv, DeviceState.READY);\n }\n break;\n case DeviceState.READY:\n mDeviceClientList.add(device);\n mAdapter.add(device.getDeviceName() + \" \" + type);\n mAdapter.notifyDataSetChanged();\n\n Property property = Property.create(Property.UNIQUE_DEVICE_IDENTIFIER, device.getDeviceGuid());\n mDeviceManager.getProperty(property, propertyCallback);\n\n break;\n default:\n break;\n }\n\n }", "@Override\n public void onClick(DialogInterface dialog, int which) {\n mAudioManagerEx.setAudioDeviceActive(usb_device, AudioManagerEx.AUDIO_OUTPUT_ACTIVE);\n }", "private void initDevice() {\n device = new Device();\n device.setManufacture(new Manufacture());\n device.setInput(new Input());\n device.setPrice(new Price());\n device.getPrice().setCurrency(\"usd\");\n device.setCritical(DeviceCritical.FALSE);\n }", "private void initEventList() {\n\n Calendar calendar = Calendar.getInstance();\n calendar.setTime(new Date());\n calendar.add(Calendar.MINUTE, -1 * 60 * 12);\n startTime = calendar.getTimeInMillis();\n stopTime = System.currentTimeMillis();\n mSearchType = 0;\n eventType = AVIOCTRLDEFs.AVIOCTRL_EVENT_ALL;\n searchEventList(startTime, stopTime, eventType, mCameraChannel);\n }", "void startPumpingEvents();", "public void start() {\n enableEvents = true;\n reset();\n }", "private void recognize() {\n //Setup our Reco transaction options.\n Transaction.Options options = new Transaction.Options();\n options.setDetection(resourceIDToDetectionType(R.id.long_endpoint));\n options.setLanguage(new Language(\"eng-USA\"));\n options.setEarcons(startEarcon, stopEarcon, errorEarcon, null);\n\n //Add properties to appServerData for use with custom service. Leave empty for use with NLU.\n JSONObject appServerData = new JSONObject();\n //Start listening\n recoTransaction = speechSession.recognizeWithService(\"M10253_A3221\", appServerData, options, recoListener);\n }", "public void driverBaseDataReceivedProxy(PeripheralHardwareDataEvent oEvent);", "@Override\n\t\t\t\tpublic void run() {\n//\t\t\t\t\t\n//\t\t\t\t\tSystem.out.printf(\"Ausgangs-Puffer: \");\n//\t\t\t\t\tfor(int i=0; i<Message.length; i++)\tSystem.out.printf(\"0x%02X \", eeipClient.O_T_IOData[i]);\n//\t\t\t\t\tSystem.out.printf(\"\\n\\n\");\n\n\t\t\t\t\tStatus_Byte=eeipClient.T_O_IOData[0x7F];\n\t\t\t\t\tTO_Bit=(Status_Byte&(0x20))>>5;\n\t\t\t\t\tAA_Bit=(Status_Byte&(0x02))>>1;\n\t\t\t\t\tAE_Bit=(Status_Byte&(0x04))>>2;\n\t\t\t\n\t\t\t\t\tif((AA_Bit==0)&&(AE_Bit==0)) {\n\t\t\t\t\t\tstate2=2;\n\t\t\t\t\t\ttimerflag2=false;\n\t\t\t\t\t\tthis.cancel();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}", "@Override\n\t\tpublic void serialEvent(SerialPortEvent evt) {\n\t\t\ttry {\n\t\t\t\tswitch (evt.getEventType()) {\n\t\t\t\tcase SerialPortEvent.DATA_AVAILABLE:\n\t\t\t\t\tif (input == null) {\n\t\t\t\t\t\tinput = new BufferedReader(new InputStreamReader(\n\t\t\t\t\t\t\t\tserialPort.getInputStream()));\n\t\t\t\t\t}\n\t\t\t\t\tString inputLine = input.readLine();\n\t\t\t\t\tSystem.out.println(inputLine);\n\t\t\t\t\tserialReturn = inputLine;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.err.println(e.toString());\n\t\t\t}\n\n\t\t}", "public interface SampleApplicationControl {\n boolean doInitTrackers();\n boolean doLoadTrackersData();\n boolean doStartTrackers();\n boolean doStopTrackers();\n boolean doUnloadTrackersData();\n boolean doDeinitTrackers();\n void onInitARDone(SampleApplicationException e);\n void onQCARupdate(NetworkInfo.State state);\n}", "@Override\n public void run() {\n if (Constants.HF_ReaderStatus.equalsIgnoreCase(\"HF Connected\") || Constants.HF_ReaderStatus.equalsIgnoreCase(\"HF Discovered\")) {\n //BLE Upgrade\n if ((IsHFUpdate.trim().equalsIgnoreCase(\"Y\")) && bleVersionCallCount == 0) {\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n readBLEVersion();\n try {\n Thread.sleep(5000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n\n //Read Fob key\n if (IsHFUpdate.trim().equalsIgnoreCase(\"Y\")) {\n if (bleVersionCallCount != 0) {\n readFobKey();\n }\n } else {\n readFobKey();\n }\n\n }\n }", "TransferInitiateResponse initiateConsumerRequest(DataRequest dataRequest);", "public void onAudioEvent(boolean recording) {\n /*this.WriteLine(\"--- Microphone status change received by onAudioEvent() ---\");\n this.WriteLine(\"********* Microphone status: \" + recording + \" *********\");\n if (recording) {\n this.WriteLine(\"Please start speaking.\");\n }\n\n WriteLine();*/\n if (!recording) {\n this.micClient.endMicAndRecognition();\n this._startButton.setEnabled(true);\n }\n }", "private void enableAccelerometerListening() {\n SensorManager sensorManager =\r\n (SensorManager) this.getSystemService(\r\n Context.SENSOR_SERVICE); //The last parm specifies the type of Sensor we want to monitor\r\n\r\n\r\n //Now that we have a Sensor Handle, let's start \"listening\" for movement (accelerometer).\r\n //3 parms, The Listener, Sensor Type (accelerometer), and Sampling Frequency.\r\n sensorManager.registerListener(sensorEventListener,\r\n sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),\r\n SensorManager.SENSOR_DELAY_NORMAL); //don't set this too high, otw you will kill user's battery.\r\n }", "private void passSensor(SensorEvent e) throws CommandException, InterruptedException {\n if (e.getStatus() == SensorEvent.ACTIVE) {\n boolean station = isStation(e);\n if (!station) {\n boolean atPart;\n\n // Handles leaving first and second into the third as well as leaving the seventh and eighth into the sixth\n // Also traveling into the sections\n if ((atPart = (atSensor(e, 13, 7) || atSensor(e, 13, 8))) || (atSensor(e, 5, 11) || atSensor(e, 5, 13))) {\n int sec = atPart ? 2 : 4;\n int dir = sec == 2 ? SOUTH : NORTH;\n if (direction == dir) {\n if (atPart)\n release(1);\n if (!tryAcc(sec))\n stopWait(sec);\n if (ticket != -1) release(ticket);\n ticket = sec;\n } else if (atPart && direction == NORTH) {\n release(2);\n if (!tryAcc(1))\n stopWait(1);\n } else\n release(sec);\n processTrackSwitch(e);\n\n // Handles the north entry and leaving of the + intersection\n } else if ((atSensor(e, 9, 5)) || atSensor(e, 6, 6)) {\n if (direction == SOUTH && !tryAcc(1))\n stopWait(1);\n else if (direction == NORTH)\n release(1);\n\n // Handles the entry of the fifth and fourth section\n } else if ((atPart = atSensor(e, 16, 9)) || atSensor(e, 3, 9)) {\n int dir = atPart ? SOUTH: NORTH;\n if (direction == dir) {\n if (tryAcc(3))\n ticket = 3;\n else\n ticket = -1;\n processTrackSwitch(e);\n }\n\n // Handles the entry of the first, second, seventh and eighth\n } else if ((atPart = atSensor(e, 18 ,7)) || atSensor(e, 1, 11)){\n int sec = atPart ? 0: 5;\n int dir = sec == 0 ? NORTH: SOUTH;\n if (direction == dir) {\n if (tryAcc(sec))\n ticket = sec;\n else\n ticket = -1;\n }\n processTrackSwitch(e);\n\n // Handles the passing of the middle double track\n } else if ((atPart = (atSensor(e, 6, 9) || atSensor(e, 6, 10))) || atSensor(e, 13, 9) || atSensor(e, 13, 10)) {\n int sec = direction == NORTH ? 4 : 2;\n if ((atPart && direction == NORTH) || (!atPart && direction == SOUTH)) {\n release(sec);\n } else {\n sec = sec == 2 ? 4: 2;\n if (!tryAcc(sec))\n stopWait(sec);\n if (ticket == 3)\n release(3);\n ticket = sec;\n }\n processTrackSwitch(e);\n }\n\n //If a train arrives at a station this handles the stopping and changing of direction\n } else {\n if (DEBUG) System.err.printf(\"Train %d arrived at station\\n\", id);\n TSimInterface.getInstance().setSpeed(id, 0);\n Thread.sleep(1000 + (20 * Math.abs(speed)));\n if (direction == NORTH)\n direction = SOUTH;\n else\n direction = NORTH;\n speed = -speed;\n TSimInterface.getInstance().setSpeed(id, speed);\n }\n }\n }" ]
[ "0.58291054", "0.56114084", "0.5504908", "0.5389107", "0.53865725", "0.535335", "0.5295074", "0.52887446", "0.52707565", "0.5161824", "0.51478386", "0.51473033", "0.5123876", "0.512365", "0.5084191", "0.50810486", "0.5078657", "0.50758225", "0.5070789", "0.5069871", "0.5031533", "0.50128883", "0.49977535", "0.49895394", "0.49876767", "0.497163", "0.49683586", "0.49593785", "0.49579385", "0.49531323", "0.49476746", "0.49470574", "0.49381995", "0.49345902", "0.49215066", "0.49102002", "0.49099764", "0.48979408", "0.4890829", "0.4888403", "0.4886092", "0.4886092", "0.48860177", "0.48796782", "0.48764983", "0.4865109", "0.48618957", "0.48606777", "0.48599452", "0.48400873", "0.4838055", "0.4838055", "0.48377028", "0.48372975", "0.48305893", "0.48287678", "0.4822235", "0.481149", "0.48056868", "0.4797998", "0.47978857", "0.47943318", "0.47827756", "0.47771806", "0.47715706", "0.4764248", "0.4760355", "0.47590414", "0.47585958", "0.4756077", "0.4755414", "0.47514692", "0.47505265", "0.474302", "0.47404626", "0.47365737", "0.47342697", "0.473199", "0.4724894", "0.47146508", "0.47122505", "0.47115394", "0.4710519", "0.47098857", "0.4707421", "0.470705", "0.47044447", "0.47029182", "0.46879902", "0.4687323", "0.46796674", "0.46783656", "0.46768403", "0.46744758", "0.4671466", "0.46626586", "0.46600538", "0.46568987", "0.46529377", "0.46505272" ]
0.5858878
0
set the size of the raw event packet buffer. Default is AE_BUFFER_SIZE. You can set this larger if you have overruns because your host processing (e.g. rendering) is taking too long. This call discards collected events.
@Override public void setAEBufferSize(int size) { if (size < 1000 || size > 1000000) { log.warning("ignoring unreasonable aeBufferSize of " + size + ", choose a more reasonable size between 1000 and 1000000"); return; } this.aeBufferSize = size; prefs.putInt("CypressFX2.aeBufferSize", aeBufferSize); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void setBufferSize(int arg0) {\n\n }", "void setBufferSize(int bufferSize);", "@Override\n\tpublic void setBufferSize(int size) {\n\t}", "void setStreamBuffer(int size) {\r\n\t\tif(size>0)\r\n\t\t\tbuffer = new byte[size];\r\n\t\telse\r\n\t\t\tbuffer = new byte[this.size];\r\n\t}", "@Override\n public int getBufferSize() {\n return 0;\n }", "public void setBufferSize(int bufferSize) {\n this.bufferSize = bufferSize;\n }", "public void setBufferSize(int size) {\n this.response.setBufferSize(size);\n }", "@Override\n\tpublic int getBufferSize() {\n\t\treturn 0;\n\t}", "private void fillReceiveBuffer(final int requestedSize) {\n ByteBuffer readBuffer = receiveBuffer;\n if (requestedSize > receiveBuffer.capacity()) {\n readBuffer = socketService.getByteBuffer(requestedSize);\n readBuffer.put(receiveBuffer).flip();\n socketService.releaseByteBuffer(receiveBuffer);\n }\n receiveBuffer = null;\n socketHandle.read(readBuffer).addDeferrable(this, true);\n }", "public void setMaxBufferSize(int value) {\n this.maxBufferSize = value;\n }", "public void setSendBufferSize(int bufferSize) {\n this.bufferSize = bufferSize;\n }", "public Builder setEventQueueCapacity(int eventQueueCapacity) {\n eventQueueCapacity_ = eventQueueCapacity;\n return this;\n }", "public void setEventLimit(int eventLimit) {\n this.eventLimit = eventLimit;\n }", "public int getBufferSize() {\n\t\treturn 0;\n\t}", "public int getCapacity(){\n return eventCapacity;\n }", "private void resizeBuffer(int size) {\n if (size > m_maxImgBufferSize) {\n if (size > MAX_IMG_SIZE_BYTES) {\n size = MAX_IMG_SIZE_BYTES;\n }\n\n m_maxImgBufferSize = size + 100;\n m_imgBuffer = new byte[m_maxImgBufferSize];\n m_baistream = new ByteArrayInputStream(m_imgBuffer);\n }\n }", "public int eventQueueCapacity() {\n return eventQueueCapacity_;\n }", "public void trimToSize() {\n if (size() != this.buffer.length) {\n this.buffer = toArray();\n }\n }", "public ByteRingBuffer(int maxSize){\n buffer= new byte[maxSize];\n readIndex = 0;\n writeIndex = -1;\n size=0;\n }", "public void setBufferSize(int i) {\n\n\t}", "private void resetBuffer() {\n baos.reset();\n }", "void resetReceivedEventsCount();", "public int getReceiveBufferSize() {\n return soRcvBuf;\n }", "public int getBufferSize() {\n return count;\n }", "protected void setArraySize(int arraySize){\r\n\t \tthis.arraySize = arraySize;\r\n\t }", "public SocketChannelConfig setReceiveBufferSize(int receiveBufferSize)\r\n/* 202: */ {\r\n/* 203: */ try\r\n/* 204: */ {\r\n/* 205:211 */ this.javaSocket.setReceiveBufferSize(receiveBufferSize);\r\n/* 206: */ }\r\n/* 207: */ catch (SocketException e)\r\n/* 208: */ {\r\n/* 209:213 */ throw new ChannelException(e);\r\n/* 210: */ }\r\n/* 211:215 */ return this;\r\n/* 212: */ }", "@Override\n public void sizeChanged(IntBuffer collection) {\n semaphore.release();\n }", "@Override\n public void resetBuffer() {\n\n }", "public Builder clearMaxEnvelopeQueueSize() {\n \n maxEnvelopeQueueSize_ = 0L;\n onChanged();\n return this;\n }", "public int getBufferSize() {\n\t\treturn buffer.length;\n\t}", "public void resetBuffer(){\n bufferSet = false;\n init();\n }", "public Builder setMaxEnvelopeQueueSize(long value) {\n \n maxEnvelopeQueueSize_ = value;\n onChanged();\n return this;\n }", "int getBufferSize();", "public abstract void setBufferMode(int mode);", "public void setMaxBufferSize(int maxBufferSize) {\r\n this.maxBufferSize = maxBufferSize;\r\n }", "public void setCbSize(int cbSize) {\n this.cbSize = cbSize;\n }", "public void setMaxCapacity(int max) {\n\t\tbuffer = new Object[max];\n\t\tbufferSize = 0;\n\t}", "@Override\n\tpublic void resetBuffer() {\n\t}", "@Override\r\n\tpublic void addEvent(NetworkEvent e) {\n\t\tif (e.getType() == NetworkEvent.SEND && buffer_sz > e.getPDU().size) {\r\n\t\t\tTCPBony kid = (TCPBony) e.getTarget();\r\n\t\t\tTCPMessage m = (TCPMessage) e.getPDU();\r\n\t\t\tFlowId fid = new FlowId(m.src, m.dest, m.getSport(), m.getDport());\r\n\t\t\tif (kid.isElephant()) {\r\n\t\t\t\tdard.addElephantFlow(fid);\r\n\t\t\t} else\r\n\t\t\t\tdard.addMiceFlow(fid);\r\n\t\t\t\r\n\t\t\tint i = connections.indexOf(kid);\r\n\t\t\te.setTarget(this);\r\n\t\t\tsend_buffer.get(i).add(e);\r\n\t\t\tbuffer_sz -= e.getPDU().size;\r\n\t\t} else if (e.getType() == NetworkEvent.RECEIVE) {\r\n\t\t\treceived_buffer.add(e);\r\n\t\t} else {\r\n\t\t\t// System.out.println(this.getName() + \" Drop packet due to buffer overflow: \" + buffer_sz + \r\n\t\t\t//\t\" from \" + ((TCPMessage) e.getPDU()).getSport() + \r\n\t\t\t//\t\" Seq: \" + ((TCPMessage) e.getPDU()).getSeq());\r\n\t\t}\r\n\t}", "@Test\n public void testEnsureBufferSizeExpandsToMaxBufferSize() {\n assertEnsureBufferSizeExpandsToMaxBufferSize(false);\n }", "public void setMessageIdBufferSize(int msgIdBufferSize) {\r\n\t\tthis.msgIdBufferSize = msgIdBufferSize;\r\n\t}", "public void resetBuffer() {\n this.response.resetBuffer();\n }", "private int zzMaxBufferLen() {\n return Integer.MAX_VALUE;\n }", "private int zzMaxBufferLen() {\n return Integer.MAX_VALUE;\n }", "public int getBufferSize() {\n return this.response.getBufferSize();\n }", "public void setSampleSize(int value) {\n this.sampleSize = value;\n }", "public void resetBuffer() {\n\n\t}", "public int getMaxBufferSize() {\r\n return maxBufferSize;\r\n }", "public void setMaxBufferSpace(long maxBufferSpace) {\n this.maxBufferSpace = maxBufferSpace;\n }", "public Builder clearServerPayloadSizeBytes() {\n \n serverPayloadSizeBytes_ = 0;\n onChanged();\n return this;\n }", "public int getMaxBufferSize() {\n return maxBufferSize;\n }", "public void resetAnalysisBounds(Size frameSize) {\n this.bounds = new Rectangle(new Point(frameSize.width / 2, frameSize.height / 2), frameSize.width, frameSize.height);\n }", "public int readBufferSize_() {\n return readBufferSize_;\n }", "@Test\n public void testEnsureBufferSizeExpandsToBeyondMaxBufferSize() {\n assertEnsureBufferSizeExpandsToMaxBufferSize(true);\n }", "public EntityBuffer(int bufferCapacity) {\n\t\tbuffer = new DataPostbox<EntityContainer>(bufferCapacity);\n\t}", "public void setEngineSize(int _engineSize)\r\n {\r\n engineSize = _engineSize;\r\n }", "protected int populateBuffer()\n {\n interlock.beginReading();\n // System.out.println(\"populateBuffer: 2\");\n return byteBuffer.limit();\n }", "@Override\n public void onBuffering(int percent) {\n }", "public int getEventLimit() {\n return eventLimit;\n }", "public int size() { return buffer.length; }", "public static void setRecorderVideoSize(Size size){\n\t}", "default void bufferLimit(@Nonnull ByteBuffer buffer) {\n }", "public void bufferedAmountChange() {\n // Webrtc.org fires the bufferedAmountChange event from a different\n // thread (B) while locking the native send call on the current\n // thread (A). This leads to a deadlock if we try to lock this\n // instance from (B). So, this... pleasant workaround prevents\n // deadlocking the send call.\n CompletableFuture.runAsync(() -> {\n synchronized (this) {\n final long bufferedAmount = this.dc.bufferedAmount();\n // Unpause once low water mark has been reached\n if (bufferedAmount <= this.lowWaterMark && !this.readyFuture.isDone()) {\n log.debug(this.dc.label() + \" resumed (buffered=\" + bufferedAmount + \")\");\n this.readyFuture.complete(null);\n }\n }\n });\n }", "public SocketChannelConfig setSendBufferSize(int sendBufferSize)\r\n/* 228: */ {\r\n/* 229: */ try\r\n/* 230: */ {\r\n/* 231:231 */ this.javaSocket.setSendBufferSize(sendBufferSize);\r\n/* 232: */ }\r\n/* 233: */ catch (SocketException e)\r\n/* 234: */ {\r\n/* 235:233 */ throw new ChannelException(e);\r\n/* 236: */ }\r\n/* 237:235 */ return this;\r\n/* 238: */ }", "@MavlinkFieldInfo(\n position = 2,\n unitSize = 4,\n description = \"total data size (set on ACK only).\"\n )\n public final Builder size(long size) {\n this.size = size;\n return this;\n }", "public void clearReceivedEvents() {\n this.receivedEvents.clear();\n }", "public void handleEvent(Event event) {\n\t\t\t event.height = 67;\n\t\t\t event.width = 120;\n\t\t\t }", "@Override\n public void onBufferReceived(byte[] buffer) {\n }", "public void setSampleSize(int size){\r\n\t\tSampleSize = size;\r\n\t}", "public Voice(int brr_buf_size)\r\n\t{\r\n\t\tbuffer = new ModuloArray(brr_buf_size);\r\n\t}", "public com.autodesk.ws.avro.Call.Builder clearObjectSize() {\n object_size = null;\n fieldSetFlags()[6] = false;\n return this;\n }", "public void setLength(int newLength) {\r\n\t\tif (cursor + newLength > buffer.length)\r\n\t\t\tthrow new IllegalArgumentException(\"Can't set new length if it exceeds buffer\");\r\n\t\tlimit = cursor + newLength;\r\n\t}", "public void setFrameSize();", "public void setMaxBufferedPostSize(final int maxBufferedPostSize) {\n this.maxBufferedPostSize = maxBufferedPostSize < 0 ? -1 : maxBufferedPostSize;\n }", "private ByteBuffer resizeApplicationBuffer(ByteBuffer app) {\n if (app.remaining() < appBuffSize) {\r\n ByteBuffer bb = ByteBuffer.allocate(app.capacity() + appBuffSize);\r\n app.flip();\r\n bb.put(app);\r\n return bb;\r\n } else {\r\n return app;\r\n }\r\n }", "protected abstract int getNextBufferSize(E[] paramArrayOfE);", "public static void setOutBufferData(short length) {\n setAPDUBuffer(length);\n SATAccessor.setOutBufferData(length);\n }", "protected final void resetBuffer() {\n buffer.reset();\n }", "public static void setAPDUBuffer(short length) {\n setAPDUBuffer(currentTI.getAPDUBuffer(), length);\n }", "public Builder clearSize() {\n bitField0_ = (bitField0_ & ~0x00000020);\n size_ = 0D;\n onChanged();\n return this;\n }", "int getDefaultBufferSize()\n {\n return getASPManager().isMobileVersion()? configfile.def_mobile_buffer_size: configfile.def_buffer_size;\n }", "public void resetResponseBuffer()\n {\n bufferIndex = 0;\n responseFlag = false;\n }", "protected void ensureBufferSpace(int expectedAdditions) {\n final int bufferLen = (buffer == null ? 0 : buffer.length);\n if (elementsCount + expectedAdditions > bufferLen) {\n final int newSize = resizer.grow(bufferLen, elementsCount, expectedAdditions);\n assert newSize >= elementsCount + expectedAdditions : \"Resizer failed to\" + \" return sensible new size: \"\n + newSize + \" <= \" + (elementsCount + expectedAdditions);\n\n this.buffer = Arrays.copyOf(buffer, newSize);\n }\n }", "public void setKeySize(int keySize) {\n this.keySize = keySize;\n }", "public void bufferPacket(UtpTimestampedPacketDTO pkt) throws IOException {\r\n\t\tint sequenceNumber = pkt.utpPacket().getSequenceNumber() & 0xFFFF;\r\n\t\tint position = sequenceNumber - expectedSequenceNumber;\r\n\t\tdebug_lastSeqNumber = sequenceNumber;\r\n\t\tif (position < 0) {\r\n\t\t\tposition = mapOverflowPosition(sequenceNumber);\r\n\t\t}\r\n\t\tdebug_lastPosition = position;\r\n\t\telementCount++;\r\n\t\ttry {\r\n\t\t\tbuffer[position] = pkt;\t\t\t\r\n\t\t} catch (ArrayIndexOutOfBoundsException ioobe) {\r\n\t\t\tlog.error(\"seq, exp: \" + sequenceNumber + \" \" + expectedSequenceNumber + \" \");\r\n\t\t\tioobe.printStackTrace();\r\n\r\n\t\t\tdumpBuffer(\"oob: \" + ioobe.getMessage());\r\n\t\t\tthrow new IOException();\r\n\t\t}\r\n\r\n\t}", "@Test\n public void setFrameSize_4() {\n final int FRAME_SIZE = 4;\n AudioConfigManager.setFrameSize(FRAME_SIZE);\n assertEquals(AudioFormatConfig.frameSize, FRAME_SIZE);\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "@Override public void onSizeChanged(int w, int h, int oldw, int oldh)\n {\n super.onSizeChanged(w, h, oldw, oldh);\n // Release the buffer, if any and it will be reallocated on the next draw\n mBuffer = null;\n }", "public void setRecordSize(int recordSize)\r\n\t{\r\n\t\tthis.recordSize = recordSize;\r\n\t}", "private static void assertEnsureBufferSizeExpandsToMaxBufferSize(final boolean exceedMaxBufferSize) {\n final int length = 0;\n\n final long presumableFreeMemory = getPresumableFreeMemory();\n // 2GiB + 32 KiB + length\n // 2GiB: Buffer to allocate\n // 32KiB: Some headroom\n // length: Existing buffer\n final long estimatedMemory = (1L << 31) + 32 * 1024 + length;\n assumeTrue(presumableFreeMemory > estimatedMemory, \"Not enough free memory for the test\");\n\n final int max = Integer.MAX_VALUE - 8;\n\n // Check the conservative maximum buffer size can actually be exceeded by the VM\n // otherwise the test is not valid.\n if (exceedMaxBufferSize) {\n assumeCanAllocateBufferSize(max + 1);\n // Free-memory.\n // This may not be necessary as the byte[] is now out of scope\n System.gc();\n }\n\n final BaseNCodec ncodec = new NoOpBaseNCodec();\n final Context context = new Context();\n\n // Allocate the initial buffer\n context.buffer = new byte[length];\n context.pos = length;\n // Compute the extra to reach or exceed the max buffer size\n int extra = max - length;\n if (exceedMaxBufferSize) {\n extra++;\n }\n ncodec.ensureBufferSize(extra, context);\n assertTrue(context.buffer.length >= length + extra);\n }", "public void setPacketSize(BigInteger packetSize) {\n\t\tthis.packetSize = packetSize;\n\t}", "private void resizeArrays() {\r\n//\t\tThread.dumpStack();\r\n\t\t\r\n\t\t// coordinates, colors, 2 texunits\r\n\t\tint size = numElements * (3 + 3 + 2 + 2) * 4;\r\n\t\tSystem.out.println(\"resizeArrays \"+size+\" \"+numElements);\r\n\t\tARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vboVertexId);\r\n\t\tARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, size, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);\r\n\t\t\r\n\t\tuploadBuffer.clear();\r\n\t\tfor (int i=0; i<uploadBuffer.capacity(); i++) {\r\n\t\t\tuploadBuffer.put(i, 1);\r\n\t\t}\r\n\t\t\r\n\t\t// clear the data\r\n\t\tint pos = 0;\r\n\t\twhile (pos < size) {\r\n\t\t\tif (size - pos < uploadBuffer.capacity() * 4) {\r\n\t\t\t\tuploadBuffer.limit((size - pos) / 4);\r\n\t\t\t}\r\n\t\t\tARBVertexBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, pos, uploadBuffer);\r\n\t\t\tUtil.checkGLError();\r\n\t\t\tpos += uploadBuffer.capacity() * 4;\r\n\t\t}\r\n\t\tARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);\r\n\t}", "private int determineCalculatedBufferSize() {\n\n float percentOfASecond = (float) BUFFER_SIZE_IN_MS / 1000.0f;\n int numSamplesRequired = (int) ((float) RATE * percentOfASecond);\n int minBufferSize = determineMinimumBufferSize();\n\n int bufferSize;\n // each sample takes two bytes, need a bigger buffer\n if (ENCODING == AudioFormat.ENCODING_PCM_16BIT) {\n bufferSize = numSamplesRequired * 2;\n } else {\n bufferSize = numSamplesRequired;\n }\n\n if (bufferSize < minBufferSize) {\n Log.w(LOG_TAG, \"Increasing buffer to hold enough samples \"\n + minBufferSize + \" was: \" + bufferSize);\n bufferSize = minBufferSize;\n }\n\n return bufferSize;\n }", "@SuppressWarnings( \"unused\" )\n private void clear() {\n frameOpenDetected = false;\n frameLength = 0;\n buffer.limit( 0 ); // this marks our buffer as empty...\n }", "public synchronized void limitNextBytes() {\n this.limitNextBytes(1);\n }", "@java.lang.Override\n public long getMaxEnvelopeQueueSize() {\n return maxEnvelopeQueueSize_;\n }", "private void set(){\n resetBuffer();\n }", "public Builder clearMaxSize() {\n bitField0_ = (bitField0_ & ~0x00000001);\n maxSize_ = 0;\n onChanged();\n return this;\n }", "void resetPeakServerSocketCount();", "public void resize( final AtomicInteger _newMaxMessageSize ) {\n\n // if we're asking for a smaller (or same) sized buffer, just leave...\n int newMaxMessageSize = _newMaxMessageSize.get();\n if( newMaxMessageSize <= maxMessageSize ) return;\n\n // allocate new buffer of the right size...\n maxMessageSize = newMaxMessageSize;\n ByteBuffer newBuffer = allocateBuffer();\n\n // copy any bytes we already have into the new one...\n newBuffer.put( buffer );\n newBuffer.flip();\n buffer = newBuffer;\n }" ]
[ "0.61427253", "0.608456", "0.608235", "0.5683696", "0.5657185", "0.56316197", "0.55445164", "0.55304193", "0.55159986", "0.54364693", "0.5405284", "0.5344463", "0.5282261", "0.52801114", "0.52572197", "0.5217632", "0.5127827", "0.5122123", "0.5100921", "0.50555855", "0.5023958", "0.502267", "0.5010272", "0.4989847", "0.49867988", "0.49587336", "0.4951618", "0.4944613", "0.49145287", "0.48889577", "0.48748463", "0.48738605", "0.48682055", "0.48630795", "0.48405063", "0.48378235", "0.48359737", "0.48297822", "0.48273847", "0.48211455", "0.4789393", "0.4781774", "0.4772885", "0.4772885", "0.47693193", "0.4768024", "0.47622758", "0.47520515", "0.47410694", "0.47409222", "0.47374126", "0.47320727", "0.47283307", "0.4722053", "0.4711056", "0.46993375", "0.46867532", "0.4683958", "0.4683525", "0.46810904", "0.46787664", "0.46736696", "0.46472043", "0.4644693", "0.46426916", "0.46354148", "0.4629143", "0.4625993", "0.462395", "0.46198863", "0.46102753", "0.4601493", "0.45975333", "0.45919347", "0.45781997", "0.4576437", "0.45748317", "0.4570193", "0.45658275", "0.4556196", "0.45505044", "0.4539992", "0.45338738", "0.45303115", "0.45225438", "0.45045248", "0.4497874", "0.44976577", "0.4494239", "0.44874367", "0.44815922", "0.4475133", "0.44673836", "0.4460846", "0.44557092", "0.44420508", "0.4441574", "0.44398692", "0.44393986", "0.44339994" ]
0.63494974
0
Resets the timestamp unwrap value, resets the USBIO pipe, and resets the AEPacketRawPool.
@Override synchronized public void resetTimestamps() { //TODO call TDS to reset timestamps }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void reset () {\n this.logic = null;\n this.lastPulse = 0;\n this.pulseDelta = 0;\n }", "public void reset(){\n ioTime=0;\n waitingTime=0;\n state=\"unstarted\";\n rem=total_CPU_time;\n ioBurstTime=0;\n cpuBurstTime=0;\n remainingCPUBurstTime=null;\n }", "public void reset()\n {\n this.timeToCook = 0;\n this.startTime = 0;\n }", "public void reset () {\n\t\topen();\n\t\ttry {\n\t\t\tcontainer.setLength(0);\n\t\t\treservedBitMap.setLength(0);\n\t\t\tupdatedBitMap.setLength(0);\n\t\t\tfreeList.setLength(0);\n\t\t\tsize = 0;\n\t\t}\n\t\tcatch (IOException ie) {\n\t\t\tthrow new WrappingRuntimeException(ie);\n\t\t}\n\t}", "public void reset() {\n/* 54 */ this.count = 0;\n/* 55 */ this.totalTime = 0L;\n/* */ }", "private void resetBuffer() {\n baos.reset();\n }", "public void reset() {\n\t\tstartTime = System.nanoTime();\n\t\tpreviousTime = getTime();\n\t}", "public void reset ()\r\n\t{\r\n\t\tsuper.reset();\r\n\t\tlastSampleTime = 0;\r\n\t\tfirstSampleTime = 0;\r\n\t\tlastSampleSize = 0;\r\n\t}", "public void reset() {\n cycles = 0;\n nextHaltCycle = GB_CYCLES_PER_FRAME;\n nextUpdateCycle = 0;\n running = false;\n timer.reset();\n \n cpu.reset();\n ram.reset();\n soundHandler.reset();\n }", "@Override\n\tpublic synchronized void reset() {\n\t\tiOBuffer.reset();\n\t}", "public synchronized void resetTime() {\n }", "public final synchronized void reset() {\r\n\t\tunblocked = false;\r\n\t\tcancelled = null;\r\n\t\terror = null;\r\n\t\tlistenersInline = null;\r\n\t}", "public void reset() {\n\n\t\tazDiff = 0.0;\n\t\taltDiff = 0.0;\n\t\trotDiff = 0.0;\n\n\t\tazMax = 0.0;\n\t\taltMax = 0.0;\n\t\trotMax = 0.0;\n\n\t\tazInt = 0.0;\n\t\taltInt = 0.0;\n\t\trotInt = 0.0;\n\n\t\tazSqInt = 0.0;\n\t\taltSqInt = 0.0;\n\t\trotSqInt = 0.0;\n\n\t\tazSum = 0.0;\n\t\taltSum = 0.0;\n\t\trotSum = 0.0;\n\n\t\tcount = 0;\n\n\t\tstartTime = System.currentTimeMillis();\n\t\ttimeStamp = startTime;\n\n\t\trotTrkIsLost = false;\n\t\tsetEnableAlerts(true);\n\n\t}", "public synchronized void reset() {\n\t\tlisteners.clear();\n\t\tbuffer.clear();\n\t\ttrash.clear();\n\n\t\ttickCount = 1;\n\n\t\tif (log.isInfoEnabled()) {\n\t\t\tlog.info(\"Clock reset\");\n\t\t}\n\t}", "protected void resetIO()\r\n {\r\n // Clear out all the stream history stuff\r\n tcIn = null;\r\n tcOut = null;\r\n tcInBuf = null;\r\n\r\n // Make sure these are history-wrapped\r\n SystemIOUtilities.out().clearHistory();\r\n SystemIOUtilities.err().clearHistory();\r\n SystemIOUtilities.restoreSystemIn();\r\n }", "public void resetClock()\n {\n\tstartTime = System.currentTimeMillis();\n\tpauseTime = startTime;\n\n computeClock = 0;\n\n\tframeNumber = 0;\n }", "public final void reset() {\n\n // Reset the output buffer\n out.reset();\n\n a=0x8000;\n c=0;\n b=0;\n if(b==0xFF)\n cT=13;\n else\n cT=12;\n resetCtxts();\n nrOfWrittenBytes = -1;\n delFF = false;\n\n nSaved = 0;\n }", "public final int ogg_sync_reset() {\r\n\t\tif( ogg_sync_check() != 0 ) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\r\n\t\tfill = 0;\r\n\t\treturned = 0;\r\n\t\tunsynced = false;\r\n\t\theaderbytes = 0;\r\n\t\tbodybytes = 0;\r\n\t\treturn 0;\r\n\t}", "private void reset() {\n // Reset to the inital state.\n command = null;\n headers = new DefaultHeaders();\n body = null;\n currentDecodedByteCount = 0;\n totalDecodedByteCount = 0;\n }", "public void reset()\n {\n current = 0;\n highWaterMark = 0;\n lowWaterMark = 0;\n super.reset();\n }", "protected void reset() {\n\t\tresetChannel();\n\t\tthis.connection = null;\n\t}", "public void reset()\n\t{\n\t\tIterator<Metadata> it = mMetadata.iterator();\n\t\t\n\t\twhile( it.hasNext() )\n\t\t{\n\t\t\tif( it.next().isTemporal() )\n\t\t\t{\n\t\t\t\tit.remove();\n\t\t\t}\n\t\t}\n\n\t\t/* Reset recordable state, identifier and audio call priority levels\n\t\t * and reprocess the metadata */\n\t\tmRecordable = mSourceRecordable;\n\t\tsetIdentifier( mSource );\n\t\tmPriority = Priority.DEFAULT_PRIORITY;\n\t\t\n\t\tfor( Metadata metadata: mMetadata )\n\t\t{\n\t\t\tprocessMetadata( metadata );\n\t\t}\n\t\t\n\t\tmUpdated = true;\n\t}", "public void reset() {\n bytes.reset();\n bytes.readVariableLengthInt();\n }", "private void reset() {\n ms = s = m = h = 0;\n actualizar();\n }", "private void reset() throws ConnectionLostException,\n\t\t\tInterruptedException {\n\t\t\t\tLOG.info(\"Start of the BaseIOIOLooper.reset method\");\n\t\t\t\tfloat prescaleval = 25000000;\n\t\t\t\tprescaleval /= 4096;\n\t\t\t\tprescaleval /= FREQ;\n\t\t\t\tprescaleval -= 1;\n\t\t\t\tbyte prescale = (byte) Math.floor(prescaleval + 0.5);\n\t\t\t\t\n\t\t\t\twrite8(PCA9685_MODE1, (byte) 0x10); // go to sleep... prerequisite to set prescaler\n\t\t\t\twrite8(PCA9685_PRESCALE, prescale); // set the prescaler\n\t\t\t\twrite8(PCA9685_MODE1, (byte) 0x20); // Wake up and set Auto Increment\n\t\t\t}", "public synchronized static void resetTime() {\n\t\ttime = 0;\n\t}", "protected final void resetBuffer() {\n buffer.reset();\n }", "public void reset()\n {\n total_frames = 0;\n total_messages = 0;\n total_size = 0;\n lost_frames = 0;\n lost_segments = 0;\n num_files = 0;\n start_time = System.nanoTime();\n m_lastFrames.clear();\n }", "public void reset() {\n this.metricsSent.set(0);\n this.eventsSent.set(0);\n this.serviceChecksSent.set(0);\n this.bytesSent.set(0);\n this.bytesDropped.set(0);\n this.packetsSent.set(0);\n this.packetsDropped.set(0);\n this.packetsDroppedQueue.set(0);\n this.aggregatedContexts.set(0);\n }", "public void resetBuffer(){\n bufferSet = false;\n init();\n }", "public void reset() {\n setValuesInternal(new Date(clock.getTime()), false, true);\n }", "protected void reset()\n {\n if (_resetTimedEvent != null && !_resetTimedEvent.hasAborted()\n && !_resetTimedEvent.hasFired()) _resetTimedEvent.abort();\n\n clearFlag();\n }", "public final synchronized void resetTime() {\n this.last = System.nanoTime();\n }", "public void reset() {\n\t\tthis.startTime = 0;\n\t\tthis.stopTime = 0;\n\t\tthis.running = false;\n\t}", "public void resetPlayerTime ( ) {\n\t\texecute ( handle -> handle.resetPlayerTime ( ) );\n\t}", "public void reset() {\n actionFlag = true;\n messageFlag = false;\n self.getInputBuffer().clear();\n self.getOutputBuffer().clear();\n self.setCurrentProduct(null);\n self.resetCounters();\n self.getServiceManager().init(getRandom(), template);\n syncUpdate();\n }", "public synchronized void reset()\n\t{\n\t\tm_elapsed = 0;\n\t}", "public void reset()\n {\n a = 0x0123456789ABCDEFL;\n b = 0xFEDCBA9876543210L;\n c = 0xF096A5B4C3B2E187L;\n\n xOff = 0;\n for (int i = 0; i != x.length; i++)\n {\n x[i] = 0;\n }\n\n bOff = 0;\n for (int i = 0; i != buf.length; i++)\n {\n buf[i] = 0;\n }\n\n byteCount = 0;\n }", "public void resetBuffer() {\n\n\t}", "public void reset() {\n\t\tnewBuffer = null;\n\t\treadyBuffer = new StringBuilder();\n\t\tstatus = ConsumptionStatus.EMPTY;\n\t}", "public void reset()\n\t{\n\t\tdelayCount = 0f;\n\t\trepeatCount = 0;\n\t\tenabled = true;\n\t}", "public void resetDataFromLMS();", "public void reset(){\n this.context.msr.setReadyForInput(false);\n emptyAllInputBuffers();\n emptyAllOutputBuffers();\n emptyEngineersConsoleBuffer();\n }", "@Override\n\tpublic void resetBuffer() {\n\t}", "public void reset()\n\t{\n\t\tm_running = false;\n\t\tm_elapsedMs = 0;\n\t\tm_lastMs = 0;\n\t}", "public void reset() { \r\n stop(); \r\n if (midi) \r\n sequencer.setTickPosition(0); \r\n else \r\n clip.setMicrosecondPosition(0); \r\n audioPosition = 0; \r\n progress.setValue(0); \r\n }", "public void resetTime() {\n\t\ttime_passed = 0l;\n\t}", "public void resetPot() {\n m_minRawAngle = getRawAngle();\n }", "protected void reset() {\n LocalDStruct ls = (LocalDStruct)input;\n ls.result = null;\n }", "public static void resetValues() {\r\n\t\t// System.out.println(\"ExPar.resetValues()\");\r\n\t\tString cn = \"de.pxlab.pxl.ExPar\";\r\n\t\ttry {\r\n\t\t\tClass cls = Class.forName(cn);\r\n\t\t\tField[] fld = cls.getFields();\r\n\t\t\tint n2 = fld.length;\r\n\t\t\tfor (int j = 0; j < n2; j++) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tObject p = fld[j].get(null);\r\n\t\t\t\t\tif (p instanceof de.pxlab.pxl.ExPar) {\r\n\t\t\t\t\t\t// System.out.println(\"ExPar.resetValue(): \" +\r\n\t\t\t\t\t\t// fld[j].getName() + \" = \" +\r\n\t\t\t\t\t\t// ((ExPar)p).defaultValue.toString());\r\n\t\t\t\t\t\t((ExPar) p)\r\n\t\t\t\t\t\t\t\t.setValue((ExParValue) (((ExPar) p).defaultValue\r\n\t\t\t\t\t\t\t\t\t\t.clone()));\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (NullPointerException npx) {\r\n\t\t\t\t} catch (IllegalAccessException iax) {\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (ClassNotFoundException cnfe) {\r\n\t\t\tSystem.out.println(\"ExPar.resetValues(): Oh! Class \" + cn\r\n\t\t\t\t\t+ \" not found!\");\r\n\t\t}\r\n\t\tsetDate();\r\n\t\tif (Base.hasDisplayDeviceFrameDuration()) {\r\n\t\t\tVideoFrameDuration.set(Base.getDisplayDeviceFrameDuration());\r\n\t\t}\r\n\t}", "private void reset() {\n //todo test it !\n longitude = 0.0;\n latitude = 0.0;\n IDToday = 0L;\n venVolToday = 0L;\n PM25Today = 0;\n PM25Source = 0;\n DBCanRun = true;\n DBRunTime = 0;\n isPMSearchRunning = false;\n isLocationChanged = false;\n isUploadRunning = false;\n refreshAll();\n locationInitial();\n DBInitial();\n sensorInitial();\n }", "public void reset() {\n started = false;\n flushing = false;\n moreText = true;\n headerCount = 0;\n actualLen = 0;\n }", "private void reset() {\n\t\tdata.clear();\n\t}", "@Override\n public void resetBuffer() {\n\n }", "@Override\n public synchronized void reset() {\n m_accumulatedTime = 0;\n m_startTime = getMsClock();\n }", "void seekReset() {\n discardQueued(false);\n eofCond = false;\n stickyEofCond = false;\n blocked = false;\n sawCR = false;\n // FIXME: Change needed in Tcl\n //needNL = false;\n }", "protected void reset() {\r\n super.reset();\r\n this.ring = null;\r\n }", "@Override\r\n protected final void reset ()\r\n {\r\n super.reset();\r\n\r\n headLocation = null;\r\n tailLocation = null;\r\n startTime = null;\r\n }", "public void reset () {\n if (!this.on) {\n return;\n }\n\n this.currentSensorValue = 0;\n }", "public static void resetData() {\n\t\t// resets all game data\n\t\tbSpeed = 9;\n\t\tbSize = 16;\n\t\tpSize = 100;\n\t\tpSpeed = 7;\n\t\tbSpin = 15;\n\t}", "public synchronized void reset() {\n }", "public static void reset() {\n start = new Date().getTime();\n killed = 0;\n time = 0;\n }", "@Override\r\n\tpublic void reset() {\n\t\tthis.dcn = null;\r\n\t\tthis.pairs.clear();\r\n\t\tthis.successfulCount = 0;\r\n\t\tthis.failedCount = 0;\r\n\t\tthis.metrics.clear();\r\n\t}", "final void reset() {\r\n\t\t\tsp = 0;\r\n\t\t\thp = 0;\r\n\t\t}", "private void clearTime() {\n \n time_ = 0L;\n }", "private void clearTime() {\n \n time_ = 0L;\n }", "private void clearTime() {\n \n time_ = 0L;\n }", "public void reset() {\n gameStatus = null;\n userId = null;\n gameId = null;\n gameUpdated = false;\n selectedTile = null;\n moved = false;\n }", "private void reset() {\n\t\tmVelocityTracker.clear();\n\t\tmSwiping = false;\n\t\tmAbleToSwipe = false;\n\t}", "public void resetTimeout(){\n this.timeout = this.timeoutMax;\n }", "public void reset() {\n\t\tthis.flow = 0;\n\t}", "@Override\n\tpublic void reset() {\n\t\tthis.prepare();\n\t\tsuper.reset();\n\t}", "private void reset()\n {\n // reset everything to zero\n currentTime = 0;\n closingTime = 0;\n totalWaitingTime = 0;\n numCars = 0;\n numOverTen = 0;\n arrayIndex = 0;\n printedAverageWaitTime = 0;\n double arraySize = ((CarWashApplication.DAY_LENGTH) * ((1.0) / CarWashApplication.CHANCE_INT)) + ((CarWashApplication.DAY_LENGTH) * ((1.0) / CarWashApplication.CHANCE_INT)) * ((1.0) / CarWashApplication.CHANCE_INT);\n waitTimeArray = new int[(int) arraySize];\n bay.reset();\n\n // remove all waiting cars\n while ( ! waitingLine.isEmpty() )\n {\n Object o = waitingLine.dequeue();\n }\n }", "private void clearTime() {\n \n time_ = 0L;\n }", "private void clearTime() {\n \n time_ = 0L;\n }", "private void clearTime() {\n \n time_ = 0L;\n }", "private void clearTime() {\n \n time_ = 0L;\n }", "public void reset() {\n\t\tsuper.reset(); // reset the Reportable, too.\n\n\t\tif (_interArrivalTimeActivated && _interArrivalTally != null)\n\t\t\t_interArrivalTally.reset();\n\t\t\n\t\t// really reset the counter value?\n\t\tif (!this.isResetResistant) {\n\t\t\tthis._value = 0;\n \t this._min = this._max = 0;\n\t\t}\n\t}", "public void reset() {\n counters = null;\n counterMap = null;\n counterValueMap = null;\n }", "public void unReset () {\n count = lastSave;\n }", "void resetReceivedEventsCount();", "public void resetVolume() {\n\t\tthis.volume = defaultVolume;\n\t}", "public void reset(){\n\t\topen[0]=false;\n\t\topen[1]=false;\n\t\topen[2]=false;\n\t\tcount = 0;\n\t\t//System.out.println(\"The lock has been reset.\");\n\t}", "@Override\r\n\tpublic void timestampReset(long aStartTimestamp) {\n\t\t\r\n\t}", "public void reset() {\n // stop motors\n Motor.A.stop();\t\n Motor.A.setPower(0);\t\n Motor.B.stop();\n Motor.B.setPower(0);\t\n Motor.C.stop();\n Motor.C.setPower(0);\t\n // passivate sensors\n Sensor.S1.passivate();\n Sensor.S2.passivate();\n Sensor.S3.passivate();\n for(int i=0;i<fSensorState.length;i++)\n fSensorState[i] = false;\n }", "private void clearTime() {\n bitField0_ = (bitField0_ & ~0x00000002);\n time_ = 0L;\n }", "public void resetPingCount() {\n\t\tpingCount = 0;\n\t}", "public void reset() {\n\t\t// Reset the SwipeTile's state data.\n\t\tstartTime = System.nanoTime();\n\t\t// Reset the Tile's State.\n\t\ttileState = defaultTileState;\n\t\t// Reset the opacity\n\t\topacity = 1;\n\t\t// Refresh the arrow's Texture.\n\t\trefreshArrow();\n\t}", "public void reset() {\n monitor.sendReset();\n }", "public void reset() {\n while (getNumTotal() > 0) {\n this.removeNuclei();\n }\n lastModified = Calendar.getInstance().getTimeInMillis(); // record time\n }", "private void switchTimeBase()\n {\n currentFrame.size = 0L;\n currentFrame.completeTimeMs = -1L;\n currentFrame.timestamp = -1L;\n prevFrame.copy(currentFrame);\n }", "public void reset() {\n _valueLoaded = false;\n _value = null;\n }", "private void clean_all() {\n\t\tpkttype=0;\r\n\t\tpacket=new byte[]{0};\r\n\t\tID=new byte[]{0};\r\n\t\tIP=new byte[]{0};\r\n\t\tTTL=0;\r\n\t\tport_no=new byte[]{0};\r\n\t\treqrep=0;\r\n\t\tdata=new byte[]{0};\r\n\t\tpaylength=new byte[]{0};\r\n\t}", "public void reset () {\n lastSave = count;\n count = 0;\n }", "public final void resetDataBuffer() {\n dataBuffer_.resetReaderIndex();\n lastValidBytePosition_ = 0;\n currentRowPosition_ = 0;\n nextRowPosition_ = 0;\n setAllRowsReceivedFromServer(false);\n }", "public void reset() {\r\n bop.reset();\r\n gzipOp = null;\r\n }", "public void resetCumulativeTime()\r\n/* 249: */ {\r\n/* 250:456 */ this.lastCumulativeTime = System.currentTimeMillis();\r\n/* 251:457 */ this.cumulativeReadBytes.set(0L);\r\n/* 252:458 */ this.cumulativeWrittenBytes.set(0L);\r\n/* 253: */ }", "public void reset() {\n\t\tthis.count = 0;\n\t}", "void reset() {\n this.pointer = 0;\n }", "@SuppressWarnings(\"NullAway\")\n\t\tpublic void reset() {\n\t\t\ttrackDoc = null;\n\t\t\tglobalDoc = null;\n\t\t\tpredicted.reset();\n\t\t\tobserved.reset();\n\t\t\tdoc_to_imagePixel.reset();\n\t\t}" ]
[ "0.61313134", "0.6105178", "0.5802899", "0.57695603", "0.57507527", "0.5738989", "0.57373536", "0.57345396", "0.5713779", "0.5684162", "0.5639435", "0.5635394", "0.56329757", "0.56323165", "0.56045955", "0.55926156", "0.55862415", "0.5569956", "0.5564937", "0.555668", "0.5553309", "0.55472684", "0.55461496", "0.5524314", "0.54857683", "0.548208", "0.5477014", "0.5470605", "0.54678404", "0.54589176", "0.54509026", "0.5440908", "0.54360706", "0.54334927", "0.5428156", "0.542777", "0.54237735", "0.54150915", "0.5413989", "0.53905344", "0.5371788", "0.5352903", "0.53360635", "0.5303915", "0.53021115", "0.5300015", "0.528555", "0.5280268", "0.52796125", "0.52710956", "0.5269808", "0.5262639", "0.52310884", "0.5227742", "0.5222971", "0.52194154", "0.5210906", "0.52079946", "0.51997596", "0.51796985", "0.5167274", "0.516697", "0.5164767", "0.51603043", "0.5157589", "0.5157589", "0.5157589", "0.51572216", "0.5156912", "0.51529926", "0.5149237", "0.5139411", "0.5137578", "0.5136485", "0.5136485", "0.5136485", "0.5136485", "0.5134306", "0.5133807", "0.5127697", "0.51249546", "0.51168376", "0.5114886", "0.5111686", "0.51054996", "0.5102272", "0.5092267", "0.5085638", "0.5082316", "0.5077746", "0.50745934", "0.5074545", "0.5073782", "0.5072254", "0.507013", "0.50659037", "0.5054701", "0.50517124", "0.5047891", "0.5045329" ]
0.53192824
43
Ajoute un robot pour l'equipe et le pose sur sa base
public void addRobot(Robot robot) { this.robots.add(robot); this.vue.poserRobot(robot, getCoordBase()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void agregarRobot(Robot robot);", "public abstract void interagir(Robot robot);", "public abstract void interagir (Robot robot);", "public void agregarRobot(String nombre);", "public Atendiendo(Robot robot){\n this.robot = robot;\n }", "boolean insertRobot(Position pos, Robot rob);", "Robot getRobot(Position pos);", "public void addRobot(String name){\n robotNames.add(name);\n int[] initialRobotPose = robotController.getRobot(name).getInitialPosition();\n Pose initialPose = new Pose(initialRobotPose[0], initialRobotPose[1], initialRobotPose[2]);\n MeasurementHandler newHandler = new MeasurementHandler(robotController.getRobot(name), initialPose);\n measurementHandlers.put(name, newHandler);\n int[] initialPosition = {(int)Math.round(initialPose.getPosition().getXValue()), (int)Math.round(initialPose.getPosition().getYValue())};\n robotController.getRobot(name).setPosition(initialPosition);\n robotController.getRobot(name).setRobotOrientation((int)Math.round(initialPose.getHeading().getValue()));\n robotController.getRobot(name).setDestination(initialPosition);\n map.resize(initialPose.getPosition());\n }", "public Robot(Case pos, int vitesse){\n \tthis.position=pos;\n \tthis.vitesse=(int) (vitesse/3.6);\n \tthis.enDeplacement=false; \n \tthis.destination=new LinkedList<Direction>();\n }", "@Override\n public void robotInit() {\n m_driveTrain = new DriveTrain();\n m_oi = new OI(); \n encoder = new Encoder();\n JoystickDrive = new JoystickDrive();\n RoboticArm = new RoboticArm();\n Science = new Science();\n pid = new PID();\n inverse = new Inverse();\n\n // workingSerialCom = new serialComWorking();\n\n\n // while(true){\n // // ros_string = workingSerialCom.read();\n // // System.out.println(ros_string);\n // LeftFront = Robot.m_driveTrain.dr+iveTrainLeftFrontMotor.getSelectedSensorVelocity()*(10/4096);\n // RightFront = Robot.m_driveTrain.driveTrainRightFrontMotor.getSelectedSensorVelocity()*(10/4096);\n // LeftFront_ros = workingSerialCom.floattosString(LeftFront);\n // RigthFront_ros = workingSerialCom.floattosString(RightFront);\n\n // ros_string = workingSerialCom.read();\n // gulce = workingSerialCom.StringConverter(ros_string, 1);\n // System.out.println(gulce);\n // workingSerialCom.write(LeftFront_ros+RigthFront_ros+\"\\n\");\n // }\n // workingSerialCom.write(\"Yavuz\\n\");\n // // RoboticArm.run();\n // // m_driveTrain.run();\n // // workingSerialCom.StringConverter(ros_string, 3);\n }", "public DriveTrain(){\r\n super(\"Drive Train\");\r\n Log = new MetaCommandLog(\"DriveTrain\", \"Gyro\" , \"Left Jaguars,Right Jaguars\");\r\n gyro1 = new Gyro(RobotMap.AnalogSideCar , RobotMap.DriveTrainGyroInput);\r\n lfJag = new Jaguar(RobotMap.frontLeftMotor);\r\n lfRearJag = new Jaguar(RobotMap.rearLeftMotor);\r\n rtJag = new Jaguar(RobotMap.frontRightMotor);\r\n rtRearJag = new Jaguar(RobotMap.rearRightMotor);\r\n drive = new RobotDrive(lfJag, lfRearJag, rtJag, rtRearJag);\r\n \r\n //lfFrontJag = new Jaguar (3);\r\n //rtFrontJag = new Jaguar (4);\r\n \r\n //joystick2 = new Joystick(2);\r\n //sensor1 = new DigitalInput(1);\r\n //sensor2 = new DigitalInput (2);\r\n\r\n }", "public Robot() {\t\n\t\tthis.step = myclass.STD_STEP ; \n\t\tthis.speed = myclass.STD_SPEED ; \n\t\tthis.rightM = new EV3LargeRegulatedMotor(myclass.rightP) ; \n\t\tthis.leftM = new EV3LargeRegulatedMotor(myclass.leftP) ; \n\t}", "@Override\n public void robotInit() {\n\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n drive = new Drive();\n pDP = new PDP();\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n // OI must be constructed after subsystems. If the OI creates Commands\n //(which it very likely will), subsystems are not guaranteed to be\n // constructed yet. Thus, their requires() statements may grab null\n // pointers. Bad news. Don't move it.\n oi = new OI();\n camera1 = CameraServer.getInstance().startAutomaticCapture(0);\n camera2 = CameraServer.getInstance().startAutomaticCapture(1);\n camera1.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n camera2.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n server = CameraServer.getInstance().getServer();\n flipped = true;\n server.setSource(camera1);\n vexGyro = new AnalogGyro(0);\n vexGyro.setSensitivity(.00175);\n //rightEncoder = new Encoder(0, 1, false);\n //leftEncoder = new Encoder(2, 3, true);\n // Add commands to Autonomous Sendable Chooser\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS\n\n chooser.setDefaultOption(\"Autonomous Command\", new AutonomousCommand());\n PixyCamBlock centerBlock = PixyCam2.GetCentermostBlock();\n if(centerBlock == null)\n {\n SmartDashboard.putString(\"target good? \", \"no, is null\");\n }\n else{\n String out = \"Center Block, X: \"+centerBlock.xCenter + \" Y: \"+centerBlock.yCenter;\n SmartDashboard.putString(\"center block data \", out);\n if (centerBlock.yCenter < 200){\n SmartDashboard.putString(\"target good?\", \"YES!!! ycenter less than 200\");\n }\n }\n \n \n\n\n \n \n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS\n SmartDashboard.putData(\"Auto mode\", chooser);\n SmartDashboard.putBoolean(\"isFlipped\", flipped);\n SmartDashboard.putNumber(\"right encoder\", drive.getRightEncoder());\n SmartDashboard.putNumber(\"left encoder\", drive.getLeftEncoder());\n }", "public void go_to_base_position() {\n stop_hold_arm();\n Dispatcher.get_instance().add_job(new JMoveArm(RobotMap.Arm.pot_value_base, 0.9, 0.7, 0.7, 0.2, 0.8, false, false));\n // Extend the arm after getting to the base position\n Dispatcher.get_instance().add_job(new JRunnable(() -> Pneumatics.get_instance().set_solenoids(true), this));\n hold_arm();\n }", "@Override\n\tpublic void robotInit() {\n\t\tdt = new DriveTrain();\n\t\t//Initialize drive Talons\n\t\tRobotMap.vspLeft = new WPI_TalonSRX(RobotMap.dtLeft);\n\t\tRobotMap.vspRight = new WPI_TalonSRX(RobotMap.dtRight);\n\t\t//Initialize drive slave Victors\n\t\t//RobotMap.slaveLeft = new WPI_VictorSPX(RobotMap.slaveDriveLeft);\n\t\t//RobotMap.slaveRight = new WPI_VictorSPX(RobotMap.slaveDriveRight);\n\t\t//Set drive slaves to follower mode\n\t\t//RobotMap.slaveLeft.follow(RobotMap.vspLeft);\n\t\t//RobotMap.slaveRight.follow(RobotMap.vspRight);\n\t\t//Initialize drive train\n\t\tRobotMap.rd = new DifferentialDrive(RobotMap.vspLeft, RobotMap.vspRight);\n\t\t//Initialize drive joystick\n\t\tRobotMap.stick = new Joystick(RobotMap.joystickPort);\n\t\t//Disabled drive safety\n\t\tRobotMap.vspLeft.setSafetyEnabled(false);\n\t\tRobotMap.vspRight.setSafetyEnabled(false);\n\t\tRobotMap.rd.setSafetyEnabled(false);\n\t\t//Initialize lift Talon\n\t\tRobotMap.liftTalon = new WPI_TalonSRX(5);\n\t\t//Initialize operator controller\n\t\tRobotMap.controller = new Joystick(RobotMap.controllerPort);\n\t\t//Initialize intake Victors\n\t\tRobotMap.intakeVictorLeft = new WPI_VictorSPX(RobotMap.intakeMaster);\n\t\tRobotMap.intakeVictorRight = new WPI_VictorSPX(RobotMap.intakeSlave);\n\t\t//Set right intake Victor to follow left intake Victor\n\t\tRobotMap.intakeVictorRight.follow(RobotMap.intakeVictorLeft);\n\t\t\n\t\tRobotMap.climberVictorLeft = new WPI_VictorSPX(RobotMap.climberLeftAddress);\n\t\tRobotMap.climberVictorRight = new WPI_VictorSPX(RobotMap.climberRightAddress);\n\t\t\n\t\tRobotMap.climberVictorRight.follow(RobotMap.climberVictorLeft);\n\t\t\n\t\tRobotMap.piston = new DoubleSolenoid(RobotMap.inChannel, RobotMap.outChannel);\n\t\t\n\t\tRobotMap.intakeLifter = new WPI_VictorSPX(2);\n\t\t\n\t\tRobotMap.liftTalon = new WPI_TalonSRX(RobotMap.liftTalonAddress);\n\t\t\n\t\tautoChooser = new SendableChooser();\n\t\tautoChooser.addDefault(\"Drive to baseline\" , new DriveToBaseline());\n\t\tautoChooser.addObject(\"Null auto\", new NullAuto());\n\t\tautoChooser.addObject(\"Switch from right\", new SwitchFromRight());\n\t\tautoChooser.addObject(\"Switch from left\", new SwitchFromLeft());\n\t\tautoChooser.addObject(\"PID from left\", new PIDfromLeft());\n\t\tautoChooser.addObject(\"PID from right\", new PIDfromRight());\n\t\tautoChooser.addObject(\"Scale from right\", new ScaleAutoRight());\n\t\tautoChooser.addObject(\"Scale from left\", new ScaleAutoLeft());\n\t\tautoChooser.addObject(\"PID tester\", new PIDTESTER());\n\t\tautoChooser.addObject(\"Joe use this one\", new leftOnly());\n\t\tSmartDashboard.putData(\"Autonomous mode chooser\", autoChooser);\n\t\t\n\t\t//RobotMap.liftVictor.follow(RobotMap.climberTalon);\n\t\t\n\t\tRobotMap.vspLeft.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 0);\n\t\tRobotMap.vspRight.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 0);\n\t\t\n\t\tRobotMap.intakeLifted = new DigitalInput(1);\n\t\tRobotMap.isAtTop = new DigitalInput(2);\n\t\tRobotMap.isAtBottom = new DigitalInput(0);\n\t\t\n\t\tRobotMap.vspLeft.configVelocityMeasurementPeriod(VelocityMeasPeriod.Period_100Ms, 1);\n\t\tRobotMap.vspRight.configVelocityMeasurementWindow(64, 1); \n\t\t\n\t\toi = new OI();\n\t}", "@Override\r\n\tpublic void setRobot(Robot r) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\trobot = (BasicRobot) r;\r\n\t\t//robot.setMaze(this.mC);\r\n\t\t\r\n\t}", "public RobotEngine (){\r\n\t\tthis.fuel = 100;\r\n\t\tthis.recycledMaterial = 0;\r\n\t\tthis.container = new ItemContainer ();\r\n\t\tthis.direction = Direction.NORTH;\r\n\t\tthis.navega = new NavigationModule();\r\n\t}", "Lift(final Robot ROBOT)\n {\n _robot = ROBOT;\n }", "public void setRobot(Robot robot) {\n this.robot = robot;\n }", "public OI(){\n driveStick = new Joystick(RobotMap.DRIVE_STICK);\n armStick = new Joystick(RobotMap.ARM_STICK);\n assoc(); \n }", "public AutoScript(Robot robot) {\r\n\t\tthis.robot = robot;\r\n\r\n\t\t//leftEncoder = new DirectionalEncoder(1, 2, RobotTemplate.WHEEL_DIAMETER);\r\n\t\tleftEncoderPIDOut = new PIDOut();\r\n\t\tleftEncoderPIDSauce = new PIDSauce(0);\r\n\t\tleftEncoderPID = new PIDWrapper(RobotTemplate.ENCODER_PID_P, RobotTemplate.ENCODER_PID_I, RobotTemplate.ENCODER_PID_D, RobotTemplate.ENCODER_PID_F, leftEncoderPIDSauce, leftEncoderPIDOut, 0.05);\r\n\r\n\t\t//rightEncoder = new DirectionalEncoder(3, 4, RobotTemplate.WHEEL_DIAMETER);\r\n\t\trightEncoderPIDOut = new PIDOut();\r\n\t\trightEncoderPIDSauce = new PIDSauce(0);\r\n\t\trightEncoderPID = new PIDWrapper(RobotTemplate.ENCODER_PID_P, RobotTemplate.ENCODER_PID_I, RobotTemplate.ENCODER_PID_D, RobotTemplate.ENCODER_PID_F, rightEncoderPIDSauce, rightEncoderPIDOut, 0.05);\r\n\r\n\t\tgyro = robot.chassis.gyro;\r\n\t\tgyroPIDOut = new PIDOut();\r\n\t\tgyroPIDSauce = new PIDSauce(0);\r\n\t\tgyroPID = new PIDWrapper(RobotTemplate.GYRO_PID_P, RobotTemplate.GYRO_PID_I, RobotTemplate.GYRO_PID_D, RobotTemplate.GYRO_PID_F, gyroPIDSauce, gyroPIDOut, 0.05);\r\n\t\tgyroPID.enable();\r\n\t}", "public void robotInit() {\n chooser = new SendableChooser();\n chooser.addDefault(\"Default Auto\", defaultAuto);\n chooser.addObject(\"My Auto\", customAuto);\n SmartDashboard.putData(\"Auto choices\", chooser);\n \n // camera stuff\n robotCamera = CameraServer.getInstance();\n robotCamera.setQuality(50);\n robotCamera.startAutomaticCapture(\"cam0\");\n\n //our robot stuff\n // myChassis\t= new RobotDrive(0,1);\n leftSide\t= new VictorSP(1);\n rightSide\t= new VictorSP(0);\n spinWheels\t= new TalonSRX(2);\n armLifty\t= new TalonSRX(3);\n drivePad\t= new Joystick(0);\n statesPad\t= new Joystick(1);\n LiveWindow.addActuator(\"stud\", \"talonsrx\", armLifty);\n \n //arm position stuff\n armPosition\t\t= new AnalogInput(0);\n armPortSwitch\t= new DigitalInput(0);\n \n //solenoid stuff\n //solenoidThing = new Solenoid(1);\n \n //init button states\n lBPX\t\t\t= false;\n bIPX\t\t\t= false;\n \n //driver buttons\n ballSpitButton\t= 4;\n ballSuckButton\t= 2;\n \n //state machine variables\n defaultState\t\t= 0;\n portState\t\t\t= 1;\n chevellState\t\t= 2;\n ballGrabState\t\t= 10;\n driveState\t\t\t= 11;\n lowBarState\t\t\t= 8;\n rockState\t\t\t= driveState;\n roughState\t\t\t= driveState;\n moatState\t\t\t= driveState;\n rampartState\t\t= driveState;\n drawState\t\t\t= driveState;\n sallyState\t\t\t= driveState;\n liftOverride\t\t= 0.09;\n terrainStates\t\t= 0;\n autoLiftSpeed\t\t= 1.0;\n armLiftBuffer\t\t= 0.01;\n //port state variables\n portPosition1\t\t= 1.7;\n portPosition2\t\t= 0.9;\n portSwitch\t\t\t= 0;\n //chevell state variables\n chevellPosition1\t= 1.135;\n chevellPosition2\t= 2.0;\n chevellSwitch \t\t= 0;\n chevellWheelSpeed\t= 0.3;\n //ball grab state variables\n ballGrabPosition1\t= 1.35;\n ballGrabSwitch\t\t= 0;\n ballGrabWheelSpeed\t= -0.635;\n ballSpitWheelSpeed\t= 1.0;\n //lowbar state variables\n lowBarPosition\t\t= 1.6;\n lowBarSwitch\t\t= 0;\n //drive state variables\n driveSwitch\t\t\t= 1;\n \n }", "@Override\n public void robotInit() {\n }", "@Override\n public void robotInit() {\n }", "@Override\n public void robotInit() {\n }", "@Override\n public void robotInit() {\n // Instantiate our RobotContainer. This will perform all our button bindings, and put our\n // autonomous chooser on the dashboard.\n m_robotContainer = new RobotContainer();\n \n left_motor_1= new CANSparkMax(2,MotorType.kBrushless);\n left_motor_2=new CANSparkMax(3,MotorType.kBrushless);\n right_motor_1=new CANSparkMax(5,MotorType.kBrushless);\n right_motor_2=new CANSparkMax(6,MotorType.kBrushless);\n ball_collection_motor=new CANSparkMax(4,MotorType.kBrushless);\n left_high_eject=new CANSparkMax(1, MotorType.kBrushless);\n right_high_eject=new CANSparkMax(7,MotorType.kBrushless);\n left_belt=new TalonSRX(9);\n right_belt=new TalonSRX(11);\n left_low_eject=new TalonSRX(8);\n right_low_eject=new TalonSRX(12);\n double_solenoid_1=new DoubleSolenoid(0,1);\n joystick=new Joystick(1);\n servo=new Servo(0);\n if_correted=false;\n xbox_controller=new XboxController(0);\n servo_angle=1;\n eject_speed=0;\n go_speed=0;\n turn_speed=0;\n high_eject_run=false;\n clockwise=false;\n left_motor_1.restoreFactoryDefaults();\n left_motor_2.restoreFactoryDefaults();\n right_motor_1.restoreFactoryDefaults();\n right_motor_2.restoreFactoryDefaults();\n \n left_motor_2.follow(left_motor_1);\n right_motor_1.follow(right_motor_2);\n servo.set(0);\n currentServoAngle = 0;\n factor = 0.01;\n pushed = false;\n //right_high_eject.follow(left_high_eject);\n //right_low_eject.follow(left_low_eject);\n\n }", "@Override\n public void giveCommands(Robot robot) {\n super.giveCommands(robot);\n\n arcadeDrive(robot.getDrivetrain());\n\n }", "public void setRobotLocation(Point p);", "public RobotContainer() {\n // Configure the button bindings\n configureButtonBindings();\n\n drivetrain.setDefaultCommand(new RunCommand(\n () -> drivetrain.setTank(Math.pow(-joystick1.getY(), 3), Math.pow(joystick2.getY(), 3)), drivetrain));\n\n }", "void deployRobot(){\n\n //Robot going down\n //Can be omitted if for test purposes\n if(!autonomonTesting) {\n while (robot.mechLiftLeft.getCurrentPosition() < robot.MAX_LIFT_POSITION &&\n robot.mechLiftRight.getCurrentPosition() < robot.MAX_LIFT_POSITION && !isStopRequested()) {\n robot.liftMovement(robot.LIFT_SPEED, false);\n }\n telemetry.addData(\"Lift Position\", robot.mechLiftLeft.getCurrentPosition());\n }\n else{\n telemetry.addLine(\"Tesint mode, without lift\");\n }\n robot.liftMovement(0, false);\n telemetry.update();\n\n\n //tensor activation\n if (tfod != null) {\n tfod.activate();\n }\n\n //moving to get in position for TensorFlow scan\n\n //out of the hook\n robot.setDrivetrainPosition(-300, \"translation\", .6);\n\n //away from the lander\n robot.setDrivetrainPosition(800, \"strafing\", .3);\n\n //back to initial\n robot.setDrivetrainPosition(300, \"translation\", .6);\n\n }", "public void robotInit() {\n\n }", "public void robotInit() {\n\n }", "public void robotInit() \n {\n RobotMap.init();\n\n driveTrain = new DriveTrain();\n gripper = new Gripper();\n verticalLift = new VerticalLift();\n\n // OI must be constructed after subsystems. If the OI creates Commands \n //(which it very likely will), subsystems are not guaranteed to be \n // constructed yet. Thus, their requires() statements may grab null \n // pointers. Bad news. Don't move it.\n\n oi = new OI();\n\n autonomousChooser = new SendableChooser();\n autonomousChooser.addDefault( \"Auto: Do Nothing\" , new DoNothing () );\n autonomousChooser.addObject ( \"Auto: Drive To Auto Zone\" , new DriveToAutoZone () );\n autonomousChooser.addObject ( \"Auto: Drive To Auto Zone (Bump)\" , new DriveToAutoZoneBump () );\n //autonomousChooser.addObject ( \"Auto: Get One (Long)\" , new GetOneLong () );\n //autonomousChooser.addObject ( \"Auto: Get One (Short)\" , new GetOneShort () );\n //autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Bump)\" , new GetOneRecycleBin () );\n autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Side)\" , new GetRecycleBinSide () );\n //autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Backwards)\" , new GetOneRecycleBinBackwards () );\n //autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Backwards, Bump)\", new GetOneRecycleBinBackwardsBump() );\n //autonomousChooser.addObject ( \"Auto: Get Two (Short)\" , new GetTwoShort () );\n //autonomousChooser.addObject ( \"Auto: Get Two Short (Special)\" , new GetTwoShortSpecial () );\n //autonomousChooser.addObject ( \"Auto: Get Two (Long, From left)\" , new TwoLongFromLeft () );\n //autonomousChooser.addObject ( \"Auto: Get Two (Long, From right)\" , new TwoLongFromRight () );\n autonomousChooser.addObject ( \"Auto: Get One Tote and Recycle Bin\" , new OneRecycleBinAndTote () );\n autonomousChooser.addObject ( \"Auto: Get One Tote and Recycle Bin (Bump)\" , new OneRecycleBinAndToteBump () );\n SmartDashboard.putData( \"Autonomous\", autonomousChooser );\n\n // instantiate the command used for the autonomous period\n //autonomousCommand = new RunAutonomousCommand();\n\n m_USBVCommand = new UpdateSBValuesCommand();\n m_USBVCommand.start();\n \n frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);\n /*\n // the camera name (ex \"cam0\") can be found through the roborio web interface\n session = NIVision.IMAQdxOpenCamera(\"cam1\",\n NIVision.IMAQdxCameraControlMode.CameraControlModeController);\n NIVision.IMAQdxConfigureGrab(session);\n \n NIVision.IMAQdxStartAcquisition(session);\n */\n /*\n camServer = CameraServer.getInstance();//.startAutomaticCapture(\"cam1\");\n camServer.setQuality(30);\n \n cam = new USBCamera(\"cam1\");\n cam.openCamera();\n cam.setFPS(60);\n \n cam.setSize(320, 240);\n cam.updateSettings();\n */\n }", "@Override\n public void robotInit() {\n SmartDashboard.putBoolean(\"CLIMB\", false);\n SmartDashboard.putNumber(\"servo\", 0);\n // Instantiate our RobotContainer. This will perform all our button bindings, and put our\n // autonomous chooser on the dashboard.\n m_robotContainer = new RobotContainer();\n //coast.\n if (RobotMap.DRIVE_TRAIN_DRAGON_FLY_IS_AVAILABLE)\n getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(false, RobotMap.DRIVE_TRAIN_MIDDLE_WHEEL_PORT);\n\n getRobotContainer().configureButtonBindings();\n getRobotContainer().getTecbotSensors().initializeAllSensors();\n getRobotContainer().getTecbotSensors().getTecbotGyro().reset();\n\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_MIDDLE_WHEEL_PORT);\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_LEFT_CHASSIS_PORTS);\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_RIGHT_CHASSIS_PORTS);\n\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n\n m_chooser.addOption(\"Move 3 m\", new SpeedReductionStraight(3, .75, 0));\n m_chooser.addOption(\"Rotate 90 degrees\", new SpeedReductionTurn(90, .5));\n m_chooser.setDefaultOption(\"El chido\", new DR01D3K4());\n m_chooser.addOption(\"Collect, go back and shoot\", new CollectPowerCellsGoBackShoot());\n m_chooser.addOption(\"Transport\", new SequentialCommandGroup(new FrontIntakeSetRaw(.75),\n new TransportationSystemSetRaw(.5)));\n m_chooser.addOption(\"Shoot 3PCs n' Move\", new SHOOT_3_PCs_N_MOVE());\n SmartDashboard.putData(\"Auto Mode\", m_chooser);\n\n //camera.setExposureManual(79);\n\n\n }", "public RobotContainer() {\n\nleftJoystick = new Joystick(0);\nrightJoystick = new Joystick(1);\n\ndriveBase = new DriveBase();\ndriveWithJoystick = new DriveWithJoystick();\nCommandScheduler.getInstance().setDefaultCommand(driveBase, driveWithJoystick);\n\n\n // Configure the button bindings\n configureButtonBindings();\n }", "@Override\n public void robotInit() {\n\n rightEnc.reset();\n gyro.reset();\n\n left2.follow(left1);\n left3.follow(left1);\n right2.follow(right1);\n right3.follow(right1);\n\n config = new Trajectory.Config(Trajectory.FitMethod.HERMITE_CUBIC, Trajectory.Config.SAMPLES_HIGH, 0.05, 1.7, 2.0, 50.0);\n trajectory = Pathfinder.generate(points, config);\n\n modifier = new TankModifier(trajectory).modify(0.7);\n\n left = new EncoderFollower(modifier.getLeftTrajectory());\n right = new EncoderFollower(modifier.getRightTrajectory());\n\n left.configureEncoder((int)rightEnc.get(), 1024, 0.1143);\n left.configurePIDVA(0.7, 0.0, 0.0, 0.15, 0.06);\n right.configureEncoder((int)rightEnc.get(), 1024, 0.1143);\n right.configurePIDVA(0.7, 0.0, 0.0, 0.15, 0.06);\n \n }", "public RobotContainer() {\n \n camServer = CameraServer.getInstance();\n driveCam = camServer.startAutomaticCapture(\"Driver View\", 0);\n driveCam.setResolution(160, 120);\n driveCam.setFPS(15);\n driveCam.setBrightness(50);\n // cameraThreader.start();\n\n leftJoy = new Joystick(LEFT_JOY_PORT);\n rightJoy = new Joystick(RIGHT_JOY_PORT);\n xbox = new XboxController(XBOX_PORT);\n\n //Set default drivetrain command to DriveWithJoysticks or xbox\n drivetrain.setDefaultCommand(xboxCommand);\n \n //For testing purposes, this will control simple one- or two-motor subsystems.\n genericSubsystem.setDefaultCommand(genericJoysticksCommand);\n \n //shooter.setDefaultCommand(shootCommand);\n //shooter.setDefaultCommand(turretCommand);\n\n\n // Configure the button bindings\n configureButtonBindings();\n }", "public static void init() {\n driveLeft = new VictorSP(1);\r\n LiveWindow.addActuator(\"Drive\", \"Left\", (VictorSP) driveLeft);\r\n \r\n driveRight = new VictorSP(0);\r\n LiveWindow.addActuator(\"Drive\", \"Right\", (VictorSP) driveRight);\r\n \r\n driveMotors = new RobotDrive(driveLeft, driveRight);\r\n \r\n driveMotors.setSafetyEnabled(false);\r\n driveMotors.setExpiration(0.1);\r\n driveMotors.setSensitivity(0.5);\r\n driveMotors.setMaxOutput(1.0);\r\n\r\n driveEncoderLeft = new Encoder(0, 1, true, EncodingType.k1X);\r\n LiveWindow.addSensor(\"Drive\", \"EncoderLeft\", driveEncoderLeft);\r\n driveEncoderLeft.setDistancePerPulse(0.053855829);\r\n driveEncoderLeft.setPIDSourceType(PIDSourceType.kRate);\r\n driveEncoderRight = new Encoder(2, 3, false, EncodingType.k1X);\r\n LiveWindow.addSensor(\"Drive\", \"EncoderRight\", driveEncoderRight);\r\n driveEncoderRight.setDistancePerPulse(0.053855829);\r\n driveEncoderRight.setPIDSourceType(PIDSourceType.kRate);\r\n driveFrontSonar = new Ultrasonic(4, 5);\r\n LiveWindow.addSensor(\"Drive\", \"FrontSonar\", driveFrontSonar);\r\n \r\n shooterMotor = new VictorSP(3);\r\n LiveWindow.addActuator(\"Shooter\", \"Motor\", (VictorSP) shooterMotor);\r\n \r\n climberMotor = new Spark(2);\r\n LiveWindow.addActuator(\"Climber\", \"Motor\", (Spark) climberMotor);\r\n \r\n gearGrabReleaseSolonoid = new DoubleSolenoid(0, 0, 1);\r\n LiveWindow.addActuator(\"Gear\", \"GrabReleaseSolonoid\", gearGrabReleaseSolonoid);\r\n \r\n powerPanel = new PowerDistributionPanel(0);\r\n LiveWindow.addSensor(\"Power\", \"Panel\", powerPanel);\r\n \r\n cameraMountpan = new Servo(4);\r\n LiveWindow.addActuator(\"CameraMount\", \"pan\", cameraMountpan);\r\n \r\n cameraMounttilt = new Servo(5);\r\n LiveWindow.addActuator(\"CameraMount\", \"tilt\", cameraMounttilt);\r\n \r\n\r\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\r\n\t\tdriveSonarFront = new SonarMB1010(0);\r\n\t\tLiveWindow.addSensor(\"Drive\", \"SonarFront\", driveSonarFront);\r\n\r\n\t\t//driveGyro = new GyroADXRS453();\r\n\t\tdriveGyro = new ADXRS450_Gyro();\r\n\t\tLiveWindow.addSensor(\"Drive\", \"Gyro\", driveGyro);\r\n\t\tdriveGyro.calibrate();\r\n\t}", "@Override\n\tprotected ArrayList<ModulePosition> buildRobot() {\n\t\tArrayList<ModulePosition> mPos = new ArrayList<ModulePosition>();\n\t\tmPos.add(new ModulePosition(\"custom 0\", new VectorDescription(0*ATRON.UNIT, -5*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(0, 0, -eigth)));\n\t\tmPos.add(new ModulePosition(\"custom 1\", new VectorDescription(1*ATRON.UNIT, -5*ATRON.UNIT, 1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 2\", new VectorDescription(1*ATRON.UNIT, -5*ATRON.UNIT, -1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 3\", new VectorDescription(2*ATRON.UNIT, -5*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(0, 0, -eigth)));\n\t\tmPos.add(new ModulePosition(\"custom 4\", new VectorDescription(3*ATRON.UNIT, -5*ATRON.UNIT, 1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 5\", new VectorDescription(3*ATRON.UNIT, -5*ATRON.UNIT, -1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 6\", new VectorDescription(4*ATRON.UNIT, -5*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(0, 0, -eigth)));\n\t\treturn mPos;\t\n\n\t\t\n\t\t/*\n\t\tArrayList<ModulePosition> mPos = new ArrayList<ModulePosition>();\n\t\tdouble x0 = 1;\n\t\tdouble y0 = 0;\n\t\tdouble z0 = 0;\n\t\tdouble angle = Math.PI/2 + Math.PI;\n\t\tVector3f moduleOrientationVector = new Vector3f(0, 0, 1);\n\t\tDouble moduleOrientationAngle = 0d;\n\t\tQuaternion moduleOrientationQuaternion = new Quaternion( (float)(moduleOrientationVector.x*Math.sin((moduleOrientationAngle)/2)), (float)(moduleOrientationVector.y*Math.sin((moduleOrientationAngle)/2)), (float)(moduleOrientationVector.z*Math.sin((moduleOrientationAngle)/2)), (float)(Math.cos((moduleOrientationAngle)/2)));\n\t\t//System.out.println(moduleOrientation.x + \" \" + moduleOrientation.y + \" \" + moduleOrientation.z);\n\t\tQuaternion rotation = new Quaternion( (float)(x0*Math.sin((angle)/2)), (float)(y0*Math.sin((angle)/2)), (float)(z0*Math.sin((angle)/2)), (float)(Math.cos((angle)/2)));\n\t\t//Vector3f newModuleOrientation = rotation.mult(moduleOrientation);\n\t\t//System.out.println(newModuleOrientation.x + \" \" + newModuleOrientation.y + \" \" + newModuleOrientation.z);\n\t\t//mPos.add(new ModulePosition(\"custom 0\", new VectorDescription(0*ATRON.UNIT, 0*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(rotation)));\n\t\tmPos.add(new ModulePosition(\"custom 0\", new VectorDescription(0*ATRON.UNIT, 0*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(new Quaternion( (float)(0), (float)(0), (float)(0), (float)(1)))));\n\t\t//x0 = 1; y0 = 0; z0 = 0; angle = 0;\n\t\t//mPos.add(new ModulePosition(\"custom 1\", new VectorDescription(1*ATRON.UNIT, 1*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(new Quaternion( (float)(x0*Math.sin(angle/2)), (float)(y0*Math.sin(angle/2)), (float)(z0*Math.sin(angle/2)), (float)(Math.cos(angle/2))))));\n\t\treturn mPos;\n*/\n\t}", "@Override\n\tpublic void robotInit() {\n\t\tdrive = new Drive();\n\t\tintake = new Intake();\n\t\tshooter = new Shooter();\n\t\taimShooter = new AimShooter();\n\t\tvision = new Vision();\n\t\tintakeRoller = new IntakeRoller();\n\t\taManipulators = new AManipulators();\n\t\tshooterLock = new ShooterLock();\n\n\t\t// autochooser\n\t\t// autoChooser = new SendableChooser();\n\n\t\toi = new OI();\n\t\t// instantiate the command used for the autonomous period\n\t\tlowGearCommand = new LowGear();\n\n\t\t// auto chooser commands\n\t\t// autoChooser.addDefault(\"FarLeftAuto\", new FarLeftAuto());\n\t\t// autoChooser.addObject(\"MidLeftAuto\", new MidLeftAuto());\n\t\t// autoChooser.addObject(\"MidAuto\", new MidAuto());\n\t\t// autoChooser.addObject(\"MidRightAuto\", new MidRightAuto());\n\t\t// autoChooser.addObject(\"FarRightAuto\", new FarRightAuto());\n\t\t// autoChooser.addObject(\"Uber Auto\", new UberAuto());\n\t\t// autoChooser.addObject(\"Paper Weight\", new PaperWeightAuto());\n\t\t//\n\t\t// SmartDashboard.putData(\"Autonomous\", autoChooser);\n\n\t\t// autonomousCommand = (Command) autoChooser.getSelected();\n\t\tautonomousCommand = new FarLeftAuto();\n\t\t// autonomousCommand = new MidAuto();\n\t\t// CameraServer.getInstance().startAutomaticCapture(\"cam3\");\n\t\t// autonomousCommand = new FarLeftAuto\n\n\t\tpovUpTrigger.whenActive(new MoveActuatorsUp());\n\t\tpovDownTrigger.whenActive(new MoveActuatorsDown());\n\t}", "public void robotInit() {\n RobotMap.init();\n driveWithJoystick = new DriveTrain();\n \n oi = new OI();\n }", "public void setRobot(Robot robot) {\n\t\tthis.robot = robot;\n\t}", "@Override\n\tpublic void robotInit() {\n\t\t\n\t\t//CameraServer.getInstance().startAutomaticCapture(); //Minimum required for camera\n\t\t\n\t\t//new Thread(() -> {\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n camera.setWhiteBalanceAuto();\n camera.setFPS(20);\n \n //CvSink cvSink = CameraServer.getInstance().getVideo();\n //CvSource outputStream = CameraServer.getInstance().putVideo(\"Blur\", 640, 480);\n /* \n Mat source = new Mat();\n Mat output = new Mat();\n \n while(!Thread.interrupted()) {\n cvSink.grabFrame(source);\n Imgproc.cvtColor(source, output, Imgproc.COLOR_BGR2GRAY);\n outputStream.putFrame(output);\n }*/\n //}).start();\n\t\t\n\t\t\n\t\t\n\t\t/**\n\t\t * 7780 long run\n\t\t */\n\t\t\n\t\tdriverStation = DriverStation.getInstance();\n\t\t// Initialize all subsystems\n\t\tm_drivetrain = new DriveTrain();\n\t\tm_pneumatics = new Pneumatics();\n\t\t\n\t\tm_pneumatics.createSolenoid(RobotMap.PNEUMATICS.GEARSHIFT_SOLENOID, \n\n\t\t\t\tRobotMap.PNEUMATICS.SOLENOID_ID_1, \n\n\t\t\t\tRobotMap.PNEUMATICS.SOLENOID_ID_2);\n\t\t\n\t\tm_pneumatics.createSolenoid(RobotMap.PNEUMATICS.FORKLIFT_SOLENOID, RobotMap.PNEUMATICS.SOLENOID_ID_3, RobotMap.PNEUMATICS.SOLENOID_ID_4);\n\t\t\n\t\tm_forklift = new ForkLift();\n\t\tm_intake = new Intake();\n\t\tm_oi = new OI();\n\n\t\t// instantiate the command used for the autonomous period\n\t\tm_autonomousCommand = new Autonomous();\n\t\tdriverXbox = m_oi.getDriverXboxControl();\n\t\toperatorXbox = m_oi.getDriverXboxControl();\n\t\tsetupAutoCommands();\n\t\t\n\t\t//chooser.addDefault(\"Left Long\",new LeftLong());\n\t\t\n\t\t//SmartDashboard.putData(\"Auto\",chooser);\n\n\t\t// Show what command your subsystem is running on the SmartDashboard\n\t\tSmartDashboard.putData(m_drivetrain);\n\t\tSmartDashboard.putData(m_forklift);\n\t\t\n\t}", "@Override\n public void robotInit() {\n\toi = new OI();\n\tgameData = new GameData();\n\tcubeVision.start();\n\n\tinitializeDashboard();\n }", "@Override\n\tpublic void robotInit() {\n\t\toi = new OI();\n\t\tdrivebase.calibrateGyro();\n\t\tSmartDashboard.putData(\"Zero Gyro\", new ZeroGyro());\n\t\tSmartDashboard.putData(\"Calibrate Gyro - WHILE ROBOT NOT MOVING\", new CalibrateGyro());\n\t\tchooser.addDefault(\"Default Prepare Gear Auto\", new PrepareGearManipulator());\n\t\t//shooterModeChooser.addDefault(\"Shooter at Nominal Preset when Pressed\", object);\n\t\t/*chooser.addObject(\"Left Gear Auto\", new LeftGearGroup());\n\t\tchooser.addObject(\"Center Gear Auto\", new CenterGearGroup());*/\n\t//\tchooser.addObject(\"Test Vision Auto\", new TurnTillPerpVision(true));\n\t//\tchooser.addObject(\"Testing turn gyro\", new RotateToGyroAngle(90,4));\n\t\t//chooser.addObject(\"DriveStraightTest\", new GoAndReturn());\n\t\t //UNNECESSARY AUTOS FOR TESTING ^\n\t\tchooser.addObject(\"Center Gear Encoder Auto (place)\", new DriveStraightCenter());\n\t\tchooser.addObject(\"Vision center TESTING!!!\", new TurnTillPerpVision());\n\t\tchooser.addObject(\"Boiler Auto RED\", new BoilerAuto(true));\n\t\tchooser.addObject(\"Boiler Auto BLUE\", new BoilerAuto(false));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t//\tchooser.addObject(\"Center Gear Encoder Auto (do not place )\", new DriveToFace(false, false, false));\n\t\tchooser.addObject(\"Baseline\", new DriveToLeftRightFace(false,false,false,false));\n\t\tchooser.addObject(\"TEST DRIVETANK AUTO\", new DriveTimedTank(0.7,0.7,5));\n\t\tchooser.addObject(\"Side Gear Auto RIGHT (manual straight lineup)(place)(TURN AFTER AND START CYCLE)\", new DriveStraightSide(true,false));\n\n\t\tchooser.addObject(\"Side Gear Auto LEFT (manual straight lineup)(place)(TURN AFTER AND START CYCLE)\", new DriveStraightSide(true,true));\n\t\t//chooser.addObject(\"Side Gear Auto (place)\", new DriveToLeftRightFace(true,false,false,false));\n\t\t//chooser.addObject(\"Test DriveStraight Auto\", new DriveStraightPosition(10,5));\n\t\t//chooser.addObject(\"Center Gear Encoder Auto (place)\", new DriveStraightCenter());\n\t\t/*InterpreterGroup interp = new InterpreterGroup();\n\t\t(interp.init()){\n\t\t\tchooser.addObject(\"Interpreter\",interp);\n\t\t}*/\n\t\t// chooser.addObject(\"My Auto\", new MyAutoCommand());\n\t\tSmartDashboard.putData(\"Auto Chooser\", chooser);\n\n\t\tRobot.drivebase.leftDrive1.setPosition(0);\n \tRobot.drivebase.rightDrive1.setPosition(0);\n \t\n\t\t\n \tRobot.leds.initializei2cBus();\n \tbyte mode = 0;\n \tRobot.leds.setMode(mode);\n \tgearcamera = CameraServer.getInstance();\n\t\t\n \tUsbCamera gearUsb = gearcamera.startAutomaticCapture();\n \tgearUsb.setFPS(25);\n \tgearUsb.setResolution(256, 144);\n\n\t\t//NetworkTable.setClientMode();\n \t//NetworkTable.setIPAddress(\"raspberrypi.local\");\n\t\t\n\t\t\n\t\t/*\n\t\t * new Thread(() -> { UsbCamera goalcamera =\n\t\t * CameraServer.getInstance().startAutomaticCapture();\n\t\t * goalcamera.setResolution(320, 240); goalcamera.setFPS(30);\n\t\t * goalcamera.setBrightness(1); goalcamera.setExposureManual(1);\n\t\t * \n\t\t * CvSink goalCvSink = CameraServer.getInstance().getVideo();\n\t\t * \n\t\t * Mat source = new Mat();\n\t\t * \n\t\t * while(!Thread.interrupted()) { goalCvSink.grabFrame(source);\n\t\t * goaloutputmat = source; } }).start();\n\t\t * goalPipeline.process(goaloutputmat);\n\t\t * \n\t\t * new Thread(() -> { UsbCamera gearcamera =\n\t\t * CameraServer.getInstance().startAutomaticCapture();\n\t\t * gearcamera.setResolution(320, 240); gearcamera.setFPS(30);\n\t\t * gearcamera.setBrightness(1); gearcamera.setExposureManual(1);\n\t\t * \n\t\t * CvSink gearCvSink = CameraServer.getInstance().getVideo();\n\t\t * \n\t\t * Mat source = new Mat();\n\t\t * \n\t\t * while(!Thread.interrupted()) { gearCvSink.grabFrame(source);\n\t\t * gearoutputmat = source; } }).start();\n\t\t * gearPipeline.process(gearoutputmat);\n\t\t */\n\t}", "public void teleopArcadeDrive(){\r\n\t\tmyRobot.arcadeDrive(-m_controls.driver_Y_Axis(), -m_controls.driver_X_Axis());\r\n\t}", "public void robotInit() {\n\t\t//Get preferences from robot flash memory\n\t\tprefs = Preferences.getInstance();\n\t\tarmCalMinPosition = prefs.getDouble(\"armCalMinPosition\", 0);\n\t\tarmCal90DegPosition = prefs.getDouble(\"armCal90DegPosition\", 0);\n\t\tif (armCalMinPosition==0 || armCal90DegPosition==0) {\n\t\t\tDriverStation.reportError(\"Error: Preferences missing from RoboRio for Shooter Arm position calibration. Shooter arm disabled.\", true);\n\t\t\tshooterArmEnabled = false;\n\t\t} else {\n\t\t\tshooterArmEnabled = true;\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tdebugStream = new FileWriter(\"/home/lvuser/debug.log\", true);\n\t\t\tdebugStream.write(\"Robot program started\\n\");\n\t\t\tdebugStream.flush();\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Could not open debug file: \" + e);\n\t\t}\n\n\t\t//Instantiates the subsystems\n\t\tdriveTrain = new DriveTrain();\n\t\tshifter = new Shifter();\n\t\tshooterArm = new ShooterArm();\n\t\tshooter = new Shooter();\n\t\tintake = new Intake();\n\t\tvision = new Vision();\n\t\tpanel = new PowerDistributionPanel();\n\t\tarmPiston = new ArmPiston();\n\n\t\t// OI must be constructed after subsystems. If the OI creates Commands\n\t\t// (which it very likely will), subsystems are not guaranteed to be\n\t\t// constructed yet. Thus, their requires() statements may grab null\n\t\t// pointers. Bad news. Don't move it.\n\t\toi = new OI();\n\n intake.motorCurrentTrigger.whenActive(new IntakeMotorStop());\n\n timerLEDs.start();\n timerTilt.start();\n timerRumble.start();\n \n // instantiate the command used for the autonomous period\n\t\t//autonomousCommand = new AutonomousCommandGroup();\n\t\traiseArm90 = new ShooterArmMoveToSetLocation(90);\n\t\t\n\t\t// Display active commands and subsystem status on SmartDashboard\n\t\tSmartDashboard.putData(Scheduler.getInstance());\n\t\tSmartDashboard.putData(driveTrain);\n\t\tSmartDashboard.putData(shifter);\n\t\tSmartDashboard.putData(shooterArm);\n\t\tSmartDashboard.putData(shooter);\n\t\tSmartDashboard.putData(intake);\n\t\tSmartDashboard.putData(vision);\n\t\tSmartDashboard.putData(armPiston);\n\t}", "public interface RobotConveyor {\n\n Robot createRobot();\n}", "public void robotInit() {\n\t\tmyRobot = new RobotDrive(0,1);\n\t\tteleop = new Teleop(myRobot);\n\t\tauto = new AutonomousDrive(myRobot);\n\t}", "@Override\n\tpublic void robotInit() //starts once when the code is started\n\t{\n\t\tm_oi = new OI(); //further definition of OI\n\t\t\n\t\t// chooser.addObject(\"My Auto\", new MyAutoCommand());\n\t\t//SmartDashboard.putData(\"Auto mode\", m_chooser);\n\t\t\n\t\tnew Thread(() -> {\n\t\t\tUsbCamera camera1 = CameraServer.getInstance().startAutomaticCapture();\n\t\t\tcamera1.setResolution(640, 480);\n\t\t\tcamera1.setFPS(30);\n\t\t\tcamera1.setExposureAuto();\n\t\t\t\n\t\t\tCvSink cvSink = CameraServer.getInstance().getVideo();\n\t\t\tCvSource outputStream = CameraServer.getInstance().putVideo(\"Camera1\", 640, 480); \n\t\t\t//set up a new camera with this name in SmartDashboard (Veiw->Add->CameraServer Stream Viewer)\n\t\t\t\n\t\t\tMat source = new Mat();\n\t\t\tMat output = new Mat();\n\t\t\t\n\t\t\twhile(!Thread.interrupted())\n\t\t\t{\n\t\t\t\tcvSink.grabFrame(source);\n\t\t\t\tImgproc.cvtColor(source, output, Imgproc.COLOR_BGR2RGB);//this will show the video in black and white \n\t\t\t\toutputStream.putFrame(output);\n\t\t\t}\t\t\t\t\t\n\t\t}).start();//definition of camera, runs even when disabled\n\t\t\n\t\tdriveStick = new Joystick(0); //further definition of joystick\n\t\tgyroRotate.gyroInit(); //initializing the gyro - in Rotate_Subsystem\n\t\tultrasonic = new Ultrasonic_Sensor(); //further definition of ultrasonic\n\t\tRobotMap.encoderLeft.reset();\n\t\tRobotMap.encoderRight.reset();\n\t\tdriveToDistance.controllerInit();\n\t}", "public void robotInit() {\n // North.registerCommand(\"setSetpoint\", (params) -> ??, [\"Setpoint\"]);\n // North.registerCondition(\"atSetpoint\", elevator::atSetpoint);\n\n //NOTE: init(name, size, logic provider, drive & nav)\n North.init(/*NorthUtils.readText(\"name.txt\")*/ \"lawn chair\", 24/12, 24/12, drive);\n North.default_drive_controller = HoldController.I;\n\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n }", "public void shape() {\n\t\tSystem.out.println(\"super robot입니다. 팔, 다리, 몸통, 머리가 있습니다.\");\r\n\t}", "public CurrentRobotState() {\r\n currentPos = new RobotCoordinates();\r\n motorState = new Motor();\r\n reInitialize();\r\n }", "public void pushOccupyingRobot(Vector2 pos) {\n IRobot robot = getRobotOnPos(pos);\n Direction dir = getValidDir(pos);\n\n if (dir != null && robot != null) {\n //System.out.println(robot.getName());\n //System.out.println(dir.toString());\n GameScreen.getInstance().unrenderRobot(robot);\n robot.moveOne(dir);\n GameScreen.getInstance().renderRobot(robot);\n }\n }", "public void robotInit() {\n\t\toi = new OI();\n\t\t\n\t\tteleopCommand = new TeleopCommand();\n }", "public OI() {\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n\n xBoxOne = new Joystick(0);\n \n autoRight = new JoystickButton(xBoxOne, 10);\n autoRight.whenPressed(new AutoRight());\n autoLeft = new JoystickButton(xBoxOne, 9);\n autoLeft.whenPressed(new AutoLeft());\n vision = new JoystickButton(xBoxOne, 7);\n vision.whenPressed(new SeekAndDriveTo());\n cameraSwitch = new JoystickButton(xBoxOne, 2);\n cameraSwitch.whenPressed(new CameraSwitch());\n latchCloseManual = new JoystickButton(xBoxOne, 6);\n latchCloseManual.whileHeld(new latchCloseManual());\n latchOpenManual = new JoystickButton(xBoxOne, 5);\n latchOpenManual.whileHeld(new latchOpenManual());\n toggleDirection = new JoystickButton(xBoxOne, 3);\n toggleDirection.whenPressed(new SwitchDirection());\n follow = new JoystickButton(xBoxOne, 8);\n follow.whenPressed(new follow());\n driveBackToDistance = new JoystickButton(xBoxOne, 1);\n driveBackToDistance.whenPressed(new AutoReverse());\n driveToDistance = new JoystickButton(xBoxOne, 4);\n driveToDistance.whenPressed(new AutoDrop());\n\n\n // SmartDashboard Buttons\n SmartDashboard.putData(\"Autonomous Command\", new AutonomousCommand());\n SmartDashboard.putData(\"DriveWithJoystick\", new DriveWithJoystick());\n SmartDashboard.putData(\"driveToDistance\", new driveToDistance());\n SmartDashboard.putData(\"HDriveJoystick\", new HDriveJoystick());\n SmartDashboard.putData(\"driveBackToDistance\", new driveBackToDistance());\n SmartDashboard.putData(\"follow\", new follow());\n SmartDashboard.putData(\"Climb\", new Climb());\n SmartDashboard.putData(\"SwitchDirection\", new SwitchDirection());\n SmartDashboard.putData(\"latchClose\", new latchClose());\n SmartDashboard.putData(\"latchOpen\", new latchOpen());\n SmartDashboard.putData(\"AutoDrop\", new AutoDrop());\n SmartDashboard.putData(\"AutoReverse\", new AutoReverse());\n SmartDashboard.putData(\"latchOpenManual\", new latchOpenManual());\n SmartDashboard.putData(\"latchCloseManual\", new latchCloseManual());\n SmartDashboard.putData(\"autoForwardBack\", new autoForwardBack());\n SmartDashboard.putData(\"kickForward\", new kickForward());\n SmartDashboard.putData(\"CameraSwitch\", new CameraSwitch());\n SmartDashboard.putData(\"Vision\", new Vision());\n SmartDashboard.putData(\"SeekAndDriveTo\", new SeekAndDriveTo());\n SmartDashboard.putData(\"turnRightTimed\", new turnRightTimed());\n SmartDashboard.putData(\"turnLeftTimed\", new turnLeftTimed());\n SmartDashboard.putData(\"driveForwardTimed\", new driveForwardTimed());\n SmartDashboard.putData(\"AutoRight\", new AutoRight());\n SmartDashboard.putData(\"AutoLeft\", new AutoLeft());\n SmartDashboard.putData(\"AutoMiddle\", new AutoMiddle());\n SmartDashboard.putData(\"SeekAndDriveSim\", new SeekAndDriveSim());\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n }", "public void addRobot(SupportRobot robot) {\n\t\tsupportRobots.add(robot);\n\t}", "public Robot getRobot(String nombre);", "@Override\n\tpublic void robotInit() {\n\t\tleftDriveBack = new VictorSP(0); // PWM Port, madke sure this is set correctly.\n\t\tleftDriveFront = new VictorSP(1);\n\t\t\n\t\trightDriveFront = new VictorSP(2);\n\t\trightDriveBack = new VictorSP(3);\n\t\t\n\t\tleftIntake = new Spark(5);\n\t\trightIntake = new Spark(6);\n\t\t\n\t\tarmMotor = new TalonSRX(10);\n\t\tarmMotor.setNeutralMode(NeutralMode.Brake);\n\t\tarmMotor.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Absolute, 0, 0);\n\t\tarmMotor.configPeakCurrentLimit(30, 0);\n\t\tarmMotor.configPeakCurrentDuration(250, 0);\n\t\tarmMotor.configContinuousCurrentLimit(20, 0);\n\t\tarmMotor.configClosedloopRamp(0.25, 0);\n\t\tarmMotor.configOpenloopRamp(0.375, 0);\n\t\tarmMotor.enableCurrentLimit(true);\n\t\t\n\t\tarmMotor.configPeakOutputForward(1.0, 0);\n\t\tarmMotor.configPeakOutputReverse(-1.0, 0);\n\t\t\n\t\tarmMotor.config_kP(0, 0.0, 0);\n\t\t\n\t\tarmSetpoint = armMotor.getSelectedSensorPosition(0);\n\t\t\n\t\tstick = new Joystick(0);\n\t\tstickReversed = false;\n\t\txbox = new XboxController(1); // USB port, set in driverstation.\n\t\t\n\t\tdriveCamera = CameraServer.getInstance().startAutomaticCapture(0);\n\t}", "@Override\n public void robotInit() {\n\t\t// set up logging\n\t\tlogger = EventLogging.getLogger(Robot.class, Level.INFO);\n\n // set up hardware\n RobotMap.init();\n\n // set up subsystems\n //initalized drive subsystem, which control motors to move robot\n driveSubsystem = new DriveSubsystem();\n\t\tbuttonSubstyem = new ButtonSubsystem();\n servoSubsystem = new ServoSubsystem();\n wingSubsystem = new WingSubsystem();\n flagSpinnerSubsystem = new FlagSpinnerSubsystem();\n // OI must be constructed after subsystems. If the OI creates Commands\n //(which it very likely will), subsystems are not guaranteed to be\n // constructed yet. Thus, their requires() statements may grab null\n // pointers. Bad news. Don't move it.\n oi = new OI();\n\n // Add commands to Autonomous Sendable Chooser\n chooser.addDefault(\"Autonomous Command\", new AutonomousCommand());\n SmartDashboard.putData(\"Auto mode\", chooser);\n }", "public MecanumDrive(RobotMap opModeRobot){\n // initialize the hardware(pass in the opMode Robot map(instance) to this class in order to use it here)\n this.robot = opModeRobot;\n // This is all you need to do to initialize your hardware now when you have to call a motor just use robot.objectName.method\n }", "@Override\n public void robotInit()\n {\n System.out.println(\"RoboRIO initializing...\");\n\n // initialize cameras\n camFront = CameraServer.getInstance().startAutomaticCapture(0);\n camBack = CameraServer.getInstance().startAutomaticCapture(1);\n camServForward = CameraServer.getInstance().getServer();\n camServReverse = CameraServer.getInstance().getServer();\n\n camServForward.setSource(camFront);\n //camServReverse.setSource(camBack);\n\n // init joysticks\n Joystick[] joysticks = getControllers();\n\n driveTrain = new DriveTrain();\n hatchArm = new HatchArm();\n cargoArm = new CargoArm();\n ramp = new Ramp();\n\n driver1 = new Buttons(joysticks[0]);\n driver2 = new Buttons(joysticks[1]);\n\n // init gyro\n // try\n // {\n // gyro = new AHRS(I2C.Port.kOnboard);\n // }\n // catch (RuntimeException ex)\n // {\n // // DriverStation.reportError(\"Error instantiating navX-MXP: \" + ex.getMessage(),\n // // true);\n // System.out.println(\"Error initializing gyro!\");\n // }\n\n // // update gyro info on smart dashboard\n // SmartDashboard.putNumber(\"X angle\", gyro.getYaw() + 180);\n // SmartDashboard.putNumber(\"Y angle\", gyro.getPitch() + 180);\n // SmartDashboard.putNumber(\"Z angle\", gyro.getRoll() + 180);\n \n // SmartDashboard.putNumber(\"X vel\", gyro.getVelocityX());\n // SmartDashboard.putNumber(\"Y vel\", gyro.getVelocityY());\n // SmartDashboard.putNumber(\"Z vel\", gyro.getVelocityZ());\n\n // SmartDashboard.putData(gyro);\n updateVars();\n updateShuffleboard();\n\n System.out.println(\"RoboRIO initialization complete.\");\n }", "@Test\n\tpublic void testSetRobot() {\n\t\tController control = new Controller();\n\t\tBasicRobot robot = new BasicRobot();\n\t\tExplorer explorer = new Explorer();\n\t\tcontrol.setBuilder(Order.Builder.DFS);\n\t\tcontrol.setRobotAndDriver(robot, explorer);\n\t\trobot.setMaze(control);\n\t\tcontrol.turnOffGraphics();\n\t\tcontrol.switchFromTitleToGenerating(0);\n\t\tcontrol.waitForPlayingState();\n\t\texplorer.setRobot(robot);\n\t\tassertNotNull(explorer.getRobot());\n\t}", "public Robot(Sensor sensor, DifferentialPilot pilot, Navigator navigator) {\n \t\tthis.sensor = sensor;\n \t\tthis.pilot = pilot;\n \t\tthis.navigator = navigator;\n \t\tthis.fd = new RangeFeatureDetector(sensor.getUltrasonicSensor(),\n\t\t\t\tsensor.getReactonDistanceHori(), RESPONSE_TIME_ULTRASONIC);\n \t\tthis.fd.addListener(this);\n \t\t\n \t\tpilot.setMinRadius(15); // Radius for turns\n \t\t\n \t\t\n \t}", "public static void main(String[] args){\n Robot robot = new DifferentialWheels();\n\n // Get the time step of the current world.\n int timeStep = (int) Math.round(robot.getBasicTimeStep());\n\n // Get references to, and enable, all required devices on the robot.\n Lidar lidar = robot.getLidar(\"lms291\");\n lidar.enable(timeStep);\n lidar.enablePointCloud();\n\n GPS gps = robot.getGPS(\"gps\");\n gps.enable(timeStep);\n\n Emitter emitter = robot.getEmitter(\"emitter\");\n emitter.setChannel(0);\n\n Compass compass = robot.getCompass(\"compass\");\n compass.enable(timeStep);\n\n Motor frontLeft = robot.getMotor(\"front_left_wheel\");\n frontLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor frontRight = robot.getMotor(\"front_right_wheel\");\n frontRight.setPosition(Double.POSITIVE_INFINITY);\n Motor backLeft = robot.getMotor(\"back_left_wheel\");\n backLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor backRight = robot.getMotor(\"back_right_wheel\");\n backRight.setPosition(Double.POSITIVE_INFINITY);\n\n TestTurnPB turnPBController = new TestTurnPB(gps, compass, emitter, frontLeft, frontRight, backLeft, backRight);\n System.out.println(\"current param : \" + turnPBController.toString());\n\n //Initialise Start and Goal Coordinates\n robot.step(timeStep);\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n turnPBController.isRunning = true;\n turnPBController.initMetrics();\n turnPBController.initPositions();\n //potBugController.initAlgorithm();\n turnPBController.runInit();\n\n //Iteration Count\n int itCount = 0;\n\n while (robot.step(timeStep*100) != -1) {\n //Check max iteration\n //while (itCount<DEFAULT_MAX_ITERATION_COUNT){\n //Update Turn Angles\n turnPBController.updateAngles();\n\n //Update Sensor Information\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n\n //Check if goal is reached and terminate as appropriate\n if (turnPBController.isGoalReached()){\n turnPBController.isRunning = false;\n turnPBController.setRobotSpeed(0,0);\n turnPBController.terminatePotBug();\n System.out.println(\"Goal Reached Successfully!\");\n }\n\n if(!turnPBController.isGoalReached() && turnPBController.isRunning){\n //Check for goal direction on forwards semi-circle\n if (!turnPBController.isObstruction()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n //Move 'freely' to the next sample point, towards goal\n turnPBController.updateMetrics();\n\n } else {\n\n if (turnPBController.isClearToLeave()){\n\n if (turnPBController.isProgressAttained() &&\n turnPBController.isClearToLeave()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n turnPBController.updateMetrics();\n\n }\n } else {\n\n if (turnPBController.hitPoint == null){\n\n turnPBController.setHitPoint();\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_CONTOUR);\n turnPBController.updateMetrics();\n\n } else {\n\n // engaged mode\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_ALONG_CONTOUR);\n turnPBController.updateMetrics();\n\n }\n }\n }\n }\n //}\n }\n }", "@Override\n public void robotInit() {\n\n // Motor controllers\n leftMotor = new CANSparkMax(1, MotorType.kBrushless);\n leftMotor.setInverted(false);\n leftMotor.setIdleMode(IdleMode.kBrake);\n\n CANSparkMax leftSlave1 = new CANSparkMax(2, MotorType.kBrushless);\n leftSlave1.setInverted(false);\n leftSlave1.setIdleMode(IdleMode.kBrake);\n leftSlave1.follow(leftMotor);\n\n CANSparkMax leftSlave2 = new CANSparkMax(3, MotorType.kBrushless);\n leftSlave2.setInverted(false);\n leftSlave2.setIdleMode(IdleMode.kBrake);\n leftSlave2.follow(leftMotor);\n\n rightMotor = new CANSparkMax(4, MotorType.kBrushless);\n rightMotor.setInverted(false);\n rightMotor.setIdleMode(IdleMode.kBrake);\n\n CANSparkMax rightSlave1 = new CANSparkMax(5, MotorType.kBrushless);\n rightSlave1.setInverted(false);\n rightSlave1.setIdleMode(IdleMode.kBrake);\n rightSlave1.follow(leftMotor);\n\n CANSparkMax rightSlave2 = new CANSparkMax(6, MotorType.kBrushless);\n rightSlave2.setInverted(false);\n rightSlave2.setIdleMode(IdleMode.kBrake);\n rightSlave2.follow(leftMotor);\n\n // Encoders\n leftEncoder = leftMotor.getEncoder();\n rightEncoder = rightMotor.getEncoder();\n\n // Gyro\n gyro = new ADXRS450_Gyro();\n\n }", "@Override\r\n\tpublic void ship(Robot t) {\n\t\t\r\n\t}", "@Override\n public void runOpMode() {\n hw = new RobotHardware(robotName, hardwareMap);\n rd = new RobotDrive(hw);\n rs=new RobotSense(hw, telemetry);\n /*rd.moveDist(RobotDrive.Direction.FORWARD, .5, .3);\n rd.moveDist(RobotDrive.Direction.REVERSE, .5, .3);\n rd.moveDist(RobotDrive.Direction.FORWARD, .5, 1);\n rd.moveDist(RobotDrive.Direction.REVERSE, .5, 1);*/\n telemetry.addData(\"Ready! \", \"Go Flamangos!\"); \n telemetry.update();\n\n //Starting the servos in the correct starting position\n /*hw.armRight.setPosition(1-.3);\n hw.armLeft.setPosition(.3);\n hw.level.setPosition(.3+.05);*/\n hw.f_servoLeft.setPosition(1);\n hw.f_servoRight.setPosition(0.5);\n \n rd.moveArm(hw.startPos());\n waitForStart();\n while (opModeIsActive()) {\n \n /*Starting close to the bridge on the building side\n Move under the bridge and push into the wall*/\n rd.moveDist(RobotDrive.Direction.LEFT,2,.5);\n rd.moveDist(RobotDrive.Direction.FORWARD, 10, .5);\n break;\n }\n }", "public OI() {\n\n pilotLS.whenPressed(new ShiftGear(Gear.HIGH));\n pilotLS.whenReleased(new ShiftGear(Gear.OFF));\n pilotRS.whenPressed(new ShiftGear(Gear.LOW));\n pilotRS.whenPressed(new ShiftGear(Gear.OFF));\n\n pilotRTrig.whileActive(new CenterBay());\n\n pilotA.whenPressed(new TrackPipeline(Pipeline.OFF));\n pilotB.whenPressed(new FlipLimelight());\n //pilotY.whenPressed(new FollowPath(Path.TO_PERPENDICULAR, false));\n pilotY.whenPressed(new PlayTrajectory(\"Test\"));\n\n pilotDpadNorth.whileHeld(new ManualClimb(1.0));\n pilotDpadSouth.whileHeld(new ManualClimb(-1.0));\n\n pilotDpadEast.whileHeld(new ClimbSequence());\n pilotDpadWest.whenPressed(new PassThrough());\n\n pilotBack.whenPressed(new KillAll());\n copilotBack.whenPressed(new KillAll());\n\n copilotA.whileHeld(new SpinIntake(1.0));\n copilotA.whenReleased(new SpinIntake(0));\n copilotB.whileHeld(new SpinIntake(-1.0));\n copilotB.whenReleased(new SpinIntake(0));\n\n copilotY.whenPressed(new FireHatch(Value.kForward));\n copilotY.whenReleased(new FireHatch(Value.kOff));\n copilotX.whenPressed(new FireHatch(Value.kReverse));\n copilotX.whenReleased(new FireHatch(Value.kOff));\n\n copilotLb.whileHeld(new WristEndGame());\n copilotLb.whenReleased(new SpinIntake(0));\n\n rbGround.whenPressed(new ToHeight(Height.HOME));\n rbHatchLow.whenPressed(new ToHeight(Height.HATCH_LOW));\n rbHatchMid.whenPressed(new ToHeight(Height.HATCH_MID));\n rbHatchHigh.whenPressed(new ToHeight(Height.HATCH_HIGH));\n rbCargoLow.whenPressed(new ToHeight(Height.CARGO_LOW));\n rbCargoMid.whenPressed(new ToHeight(Height.CARGO_MID));\n rbCargoHigh.whenPressed(new ToHeight(Height.CARGO_HIGH));\n\n copilotDpadNorth.whenPressed(new ToHeight(Height.CARGO_LOAD));\n copilotDpadSouth.whenPressed(new ToHeight(Height.CARGO_FLOOR));\n copilotDpadEast.whenPressed(new ToHeight(Height.CARGO_SHIP));\n copilotDpadWest.whenPressed(new ToHeight(Height.HATCH_LOW));\n\n }", "@Override\n public void robotInit() {\n myRobot = new DifferentialDrive(leftfrontmotor, rightfrontmotor);\n leftrearmotor.follow(leftfrontmotor);\n rightrearmotor.follow(rightfrontmotor);\n leftfrontmotor.setInverted(true); // <<<<<< Adjust this until robot drives forward when stick is forward\n\t\trightfrontmotor.setInverted(true); // <<<<<< Adjust this until robot drives forward when stick is forward\n\t\tleftrearmotor.setInverted(InvertType.FollowMaster);\n rightrearmotor.setInverted(InvertType.FollowMaster);\n \n CameraServer.getInstance().startAutomaticCapture();\n\n \n\n comp.setClosedLoopControl(true);\n \n\n /* Set up Dashboard widgets */\n SmartDashboard.putNumber(\"L Stick\", gamepad.getRawAxis(1));\n\t\tSmartDashboard.putNumber(\"R Stick\", gamepad.getRawAxis(5));\n\t\tSmartDashboard.putBoolean(\"Back Button\", gamepad.getRawButton(5));\n\t\tSmartDashboard.putBoolean(\"Fwd Button\", gamepad.getRawButton(6));\n\t\t\n SmartDashboard.putNumber(\"LF\", pdp.getCurrent(leftfrontmotorid));\n\t\tSmartDashboard.putNumber(\"LR\", pdp.getCurrent(leftrearmotorid));\n\t\tSmartDashboard.putNumber(\"RF\", pdp.getCurrent(rightfrontmotorid));\n\t\tSmartDashboard.putNumber(\"RR\", pdp.getCurrent(rightrearmotorid));\n SmartDashboard.putNumber(\"Total\", pdp.getCurrent(0) + pdp.getCurrent(1) + pdp.getCurrent(2) + pdp.getCurrent(3) + pdp.getCurrent(4) + pdp.getCurrent(5) + pdp.getCurrent(6) + pdp.getCurrent(7) + pdp.getCurrent(8) + pdp.getCurrent(9) + pdp.getCurrent(10) + pdp.getCurrent(11) + pdp.getCurrent(12) + pdp.getCurrent(13) + pdp.getCurrent(14) + pdp.getCurrent(15));\n }", "@Override\npublic void teleopPeriodic() {\nm_robotDrive.arcadeDrive(m_stick.getRawAxis(5)* (-0.5), m_stick.getRawAxis(4)*0.5);\n}", "public GuaraKinematics() {\n\t\t// TODO Auto-generated constructor stub\n\t\trob = new GuaraRobot();\n\t\ta2 = rob.a2();\n\t\ta3 = rob.a3();\n\t\ta4 = rob.a4();\n\n\t}", "public Drivetrain(){\r\n LeftSlave.follow(LeftMaster);\r\n RightSlave.follow(RightMaster);\r\n\r\n RightMaster.setInverted(true);\r\n LeftMaster.setInverted(true);\r\n\r\n gyro.reset();\r\n}", "public RobotHardware (LinearOpMode opmode) {\n myOpMode = opmode;\n }", "private static void createParty() {\n\n\n JFrame fenetre = new JFrame(\"Little Thief Auto\");\n\n Route route = new Route();\n User user = new User();\n\n Affichage affichage = new Affichage(fenetre, user, route);\n Controleur ctrl = new Controleur(affichage, user, route);\n //ctrl.setAffichage(affichage);\n //ctrl.setCmds();\n //Deplace deplace = new Deplace(user, route, affichage);\n\n //deplace.start();//Voir qui le lance, en fonction de si il y a une fenetre de demarage ou pas\n Data.initGame();\n\n //fenetre.add(affichage);\n //fenetre.add(affichage.outScreen);\n affichage.switchInteface(false);\n\n //ctrl.startPartie(); //Pas d ecran dacceuil\n /*\n\n Voler fly = new Voler();\n Etat modele = new Etat(fly);\n Controleur ctrl = new Controleur(modele);\n Affichage affichage = new Affichage(ctrl, modele);\n VueBird bird = new VueBird(affichage);\n\n Instant start = Instant.now();\n affichage.setTimer(start);\n\n ctrl.setVue(affichage);\n Avancer avance = new Avancer(affichage, modele.getParcours());\n\n ctrl.enableKeyPad();\n enableReload(fenetre, affichage);\n\n modele.getParcours().setTime(start);\n fly.start();\n avance.start();\n\n\n\n fenetre.add(affichage);\n*/\n\n\n\n\n fenetre.pack();\n fenetre.setVisible(true);\n fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n }", "@Override\n public void robotInit() {\n m_oi = new OI();\n m_chooser.setDefaultOption(\"Default Auto\", new ExampleCommand());\n // chooser.addOption(\"My Auto\", new MyAutoCommand());\n SmartDashboard.putData(\"Auto mode\", m_chooser);\n\n Comp = new Compressor();\n\n //ClimbBack = new DoubleSolenoid(PCM_COMP_24V, 0, 1);\n //ClimbFront = new DoubleSolenoid(PCM_COMP_24V, 2, 3);\n LegFrontL = new VictorSPX(30);\n LegFrontR = new Spark(9);\n LegBackL = new VictorSPX(31);\n LegBackR = new VictorSPX(32);\n\n BackFootMover = new VictorSP(1);\n FrontFootMover = new Spark(2);\n //FeetMovers = new SpeedControllerGroup(BackFootMoverFootMover);\n\n MainRight = new CANSparkMax(9, MotorType.kBrushless);\n AltRight = new CANSparkMax(10, MotorType.kBrushless);\n MainLeft = new CANSparkMax(11, MotorType.kBrushless);\n AltLeft = new CANSparkMax(12, MotorType.kBrushless);\n\n MainRight.setIdleMode(IdleMode.kCoast);\n AltRight.setIdleMode(IdleMode.kCoast);\n MainLeft.setIdleMode(IdleMode.kCoast);\n AltLeft.setIdleMode(IdleMode.kCoast);\n\n AltLeft.follow(MainLeft);\n AltRight.follow(MainRight);\n\n Drive = new DifferentialDrive(MainLeft, MainRight);\n\n Lifter = new TalonSRX(6);\n Lifter.setNeutralMode(NeutralMode.Brake);\n Lifter.enableCurrentLimit(false);\n /*Lifter.configContinuousCurrentLimit(40);\n Lifter.configPeakCurrentLimit(50);\n Lifter.configPeakCurrentDuration(1500);*/\n //Lifter.configReverseSoftLimitEnable(true);\n //Lifter.configReverseSoftLimitThreshold(-27000);\n //Lifter.configForwardLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyOpen);\n //Lifter.configClearPositionOnLimitF(true, 0);\n Lifter.selectProfileSlot(0, 0);\n LiftSetpoint = 0;\n\n LiftFollower = new TalonSRX(5);\n LiftFollower.follow(Lifter);\n LiftFollower.setNeutralMode(NeutralMode.Brake);\n\n ArmExtender = new Solenoid(0);\n ArmOpener = new Solenoid(1);\n ArmGrippers = new Spark(0);\n\n HatchSwitch0 = new DigitalInput(0);\n HatchSwitch1 = new DigitalInput(1);\n\n Accel = new BuiltInAccelerometer(Range.k2G);\n\n //Diagnostics = new DiagnosticsLogger();\n // Uncomment this line to enable diagnostics. Warning: this may\n // cause the robot to be slower than it is supposed to be because of lag.\n //Diagnostics.start();\n\n xbox = new XboxController(0);\n joystick = new Joystick(1);\n \n LiftRamp = new SRamp();\n SpeedRamp = new SRamp();\n\n NetworkTableInstance nt = NetworkTableInstance.getDefault();\n\n VisionTable = nt.getTable(\"ChickenVision\");\n TapeDetectedEntry = VisionTable.getEntry(\"tapeDetected\");\n TapePitchEntry = VisionTable.getEntry(\"tapePitch\");\n TapeYawEntry = VisionTable.getEntry(\"tapeYaw\");\n\n LedTable = nt.getTable(\"LedInfo\");\n LedScript = LedTable.getEntry(\"CurrentScript\");\n LedScriptArgument = LedTable.getEntry(\"ScriptArgument\");\n LedArmsClosed = LedTable.getEntry(\"ArmsClosed\");\n\n UsbCamera cam = CameraServer.getInstance().startAutomaticCapture();\n cam.setPixelFormat(PixelFormat.kMJPEG);\n cam.setResolution(320, 240);\n cam.setFPS(15);\n \n\n LedScript.setString(\"ColorWaves\");\n LedScriptArgument.setString(\"\");\n\n limits = new DigitalInput[8];\n\n for (int i = 0; i < limits.length; i++) {\n limits[i] = new DigitalInput(i + 2);\n }\n }", "public DriveSubsystem() {\n leftFrontMotor = new TalonSRX(RobotMap.leftFrontMotor);\n rightFrontMotor = new TalonSRX(RobotMap.rightFrontMotor);\n leftBackMotor = new TalonSRX(RobotMap.leftBackMotor);\n rightBackMotor = new TalonSRX(RobotMap.rightBackMotor);\n // rightMotor.setInverted(true); \n direction = 0.75;\n SmartDashboard.putString(\"Direction\", \"Shooter side\");\n }", "public static void init() {\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n driveTrainmotor_leftFront = new Talon(1);\n LiveWindow.addActuator(\"DriveTrain\", \"motor_leftFront\", (Talon) driveTrainmotor_leftFront);\n \n driveTrainmotor_leftRear = new Talon(2);\n LiveWindow.addActuator(\"DriveTrain\", \"motor_leftRear\", (Talon) driveTrainmotor_leftRear);\n \n driveTrainmotor_rightFront = new Talon(3);\n LiveWindow.addActuator(\"DriveTrain\", \"motor_rightFront\", (Talon) driveTrainmotor_rightFront);\n \n driveTrainmotor_rightRear = new Talon(4);\n LiveWindow.addActuator(\"DriveTrain\", \"motor_rightRear\", (Talon) driveTrainmotor_rightRear);\n \n driveTrainRobotDrive = new RobotDrive(driveTrainmotor_leftFront, driveTrainmotor_leftRear,\n driveTrainmotor_rightFront, driveTrainmotor_rightRear);\n \n driveTrainRobotDrive.setSafetyEnabled(true);\n driveTrainRobotDrive.setExpiration(0.1);\n driveTrainRobotDrive.setSensitivity(0.5);\n driveTrainRobotDrive.setMaxOutput(1.0);\n\n liftmotor_Lift = new Talon(0);\n LiveWindow.addActuator(\"Lift\", \"motor_Lift\", (Talon) liftmotor_Lift);\n \n liftencoderLiftHeight = new Encoder(1, 2, true, EncodingType.k4X);\n LiveWindow.addSensor(\"Lift\", \"encoder LiftHeight\", liftencoderLiftHeight);\n liftencoderLiftHeight.setDistancePerPulse(1.0);\n liftencoderLiftHeight.setPIDSourceParameter(PIDSourceParameter.kRate);\n liftlimitBottom = new DigitalInput(0);\n LiveWindow.addSensor(\"Lift\", \"limitBottom\", liftlimitBottom);\n \n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n }", "public Juego()\n {\n // crea la ventana principal del juego\n generaVentana();\n \n // genera las naves y los disparos del juego\n generaNaves();\n \n // responde a los eventos de pulsar las teclas de movimiento y disparo\n addKeyListener(new Eventos());\n }", "public void robotInit() {\r\n\r\n shootstate = down;\r\n try {\r\n Components.shootermotorleft.setX(0);\r\n Components.shootermotorleft2.setX(0);\r\n } catch (CANTimeoutException ex) {\r\n ex.printStackTrace();\r\n }\r\n try {\r\n Components.shootermotorright.setX(0);\r\n Components.shootermotorright2.setX(0);\r\n } catch (CANTimeoutException ex) {\r\n ex.printStackTrace();\r\n }\r\n initialpot = Components.ShooterPot.getAverageVoltage();\r\n //shootpotdown +=initialpot;\r\n //shootpotlow+= initialpot;\r\n //shootpotmiddle+= initialpot;\r\n //shootpothigh+=initialpot;\r\n\r\n }", "public interface RobotMap {\n\n /* COMPETITION BOT */\n\n // CAN Talon SRX\n int LEFT_TALON = 7;\n int RIGHT_TALON = 9;\n int LIFT_TALON = 8;\n int CLIMB_TALON = 10;\n\n // CAN Victor SPX\n int LEFT_DRIVE_VICTOR = 1;\n int RIGHT_DRIVE_VICTOR = 3;\n\n // Victor SP PWM ports\n int INTAKE_VICTOR = 0;\n int CLIMB_VICTOR = 1;\n\n // Double Solenoid PCM IDs\n int FORWARD_CHANNEL = 6;\n int REVERSE_CHANNEL = 7;\n\n // Digital Input ports\n int HALL_SENSOR = 0;\n int LIMIT_SWITCH = 1;\n\n // Pneumatics Control Module CAN ID\n int PCM = 0;\n\n\n /* PRACTICE BOT */\n\n /*\n\n // CAN Talon SRX\n int LEFT_TALON = 6;\n int RIGHT_TALON = 1;\n int LIFT_TALON = 2;\n int CLIMB_TALON = 5;\n\n // CAN Victor SPX\n int LEFT_DRIVE_VICTOR = 6;\n int RIGHT_DRIVE_VICTOR = 2;\n\n // Victor SP PWM ports\n int INTAKE_VICTOR = 0;\n int CLIMB_VICTOR = 1;\n\n // Double Solenoid PCM IDs\n int FORWARD_CHANNEL = 6;\n int REVERSE_CHANNEL = 7;\n\n // Digital Input ports\n int HALL_SENSOR = 0;\n int LIMIT_SWITCH = 1;\n\n // Pneumatics Control Module CAN ID\n int PCM = 0;\n\n */\n\n}", "public void robotInit() {\n RobotMap.init();\n initDashboardInput();\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n driveTrain = new DriveTrain();\n power = new Power();\n arm = new Arm();\n sensors = new Sensors();\n ballGrabberSubsystem = new BallGrabberSubsystem();\n winch = new Winch();\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n // OI must be constructed after subsystems. If the OI creates Commands\n //(which it very likely will), subsystems are not guaranteed to be\n // constructed yet. Thus, their requires() statements may grab null\n // pointers. Bad news. Don't move it.\n oi = new OI();\n\n // instantiate the command used for the autonomous period\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS\n\n arcadeDrive = new ArcadeDrive();\n\n readPreferences();\n }", "public RobotContainer() { \n // Configure the button bindings\n configureButtonBindings();\n\n rDrive.setDefaultCommand(manualDrive);\n lift.setDefaultCommand(moveArm);\n }", "public void robotInit() {\n RobotMap.init();\n driveTrain = new DriveTrain();\n oi = new OI();\n flippy = new Flipper();\n flappy = new Flapper();\n autonomousCommand = new AutoFlip();\n \n OI.init();\n CommandBase.init();\n autoChooser = new SendableChooser();\n autoChooser.addDefault(\"Flap Left\", new AutoFlip());\n SmartDashboard.putData(\"Autonomous_Mode\", autoChooser); \n }", "@Override\n protected void execute() {\n headingPID.setSetpoint(-angle); //should be -angle \n Robot.driveBase.DriveAutonomous();\n }", "@Override\n public void robotPeriodic() {\n // m_driveTrain.run(gulce);\n\n\n\n // workingSerialCom.StringConverter(ros_string, 2);\n // RoboticArm.run( workingSerialCom.StringConverter(ros_string, 2));\n }", "public Robot(int orientation, Position pos_ini) {\r\n\t\tthis.pos_courante = pos_ini;\r\n\t\tthis.orientation = orientation;\r\n\t\tderniereAction = AUCUNE_ACTION;\r\n\t}", "public static void init() {\r\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\r\n driveTrainSubsystemleftFront = new Jaguar(1, 1);\r\n\tLiveWindow.addActuator(\"DriveTrainSubsystem\", \"leftFront\", (Jaguar) driveTrainSubsystemleftFront);\r\n \r\n driveTrainSubsystemleftRear = new Jaguar(1, 5);\r\n\tLiveWindow.addActuator(\"DriveTrainSubsystem\", \"leftRear\", (Jaguar) driveTrainSubsystemleftRear);\r\n \r\n driveTrainSubsystemrightFront = new Jaguar(1, 6);\r\n\tLiveWindow.addActuator(\"DriveTrainSubsystem\", \"rightFront\", (Jaguar) driveTrainSubsystemrightFront);\r\n \r\n driveTrainSubsystemrightRear = new Jaguar(1, 7);\r\n\tLiveWindow.addActuator(\"DriveTrainSubsystem\", \"rightRear\", (Jaguar) driveTrainSubsystemrightRear);\r\n \r\n driveTrainSubsystemRobotDrive = new RobotDrive(driveTrainSubsystemleftFront, driveTrainSubsystemleftRear,\r\n driveTrainSubsystemrightFront, driveTrainSubsystemrightRear);\r\n\t\r\n driveTrainSubsystemRobotDrive.setSafetyEnabled(true);\r\n driveTrainSubsystemRobotDrive.setExpiration(0.1);\r\n driveTrainSubsystemRobotDrive.setSensitivity(0.5);\r\n driveTrainSubsystemRobotDrive.setMaxOutput(1.0);\r\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\r\n }", "void removeRobot(Position pos);", "@Override\n public void robotInit() {\n m_robotContainer = new RobotContainer();\n // Initiate the limelight network table\n NetworkTable table = NetworkTableInstance.getDefault().getTable(\"limelight\");\n tx = table.getEntry(\"tx\");\n ty = table.getEntry(\"ty\");\n ta = table.getEntry(\"ta\");\n RobotContainer.turretSub.tsrxTurret.setSelectedSensorPosition(0);\n }", "public RobotControl(Robot r) {\n\t\tthis.r = r;\n\t}", "public void caminar(){\n if(this.robot.getOrden() == true){\n System.out.println(\"Ya tengo la orden, caminare a la cocina para empezar a prepararla.\");\n this.robot.asignarEstadoActual(this.robot.getEstadoCaminar());\n }\n }", "public MotherRobot() {\n Random random = new Random();\n int sepInt = random.nextInt(3);\n if (sepInt == 1)\n setSeparate(true);\n }", "public RobotInit() {\n initComponents();\n }", "public void robotInit() {\n\t\toi = new OI();\n chooser = new SendableChooser();\n chooser.addDefault(\"Default Auto\", new ExampleCommand());\n// chooser.addObject(\"My Auto\", new MyfAutoCommand());\n SmartDashboard.putData(\"Auto mode\", chooser);\n \n //Drive\n //this.DriveTrain = new DriveTrain();\n \t//RobotMap.robotDrive1.arcadeDrive(oi.stickLeft);\n \n //Buttons\n // oi.button1.whenPressed(new SetMaxMotorOutput());\n \n //Ultrasonic\n sonic1 = new Ultrasonic(0,1);\n sonic1.setAutomaticMode(true);\n \n }", "public RobotContainer()\n\t{\n\t\t// Create OI devices:\n\t\tgameController = new XboxController(OIConstants.xboxControllerPort);\n\t\tleftStick = new Joystick(OIConstants.leftJoystickPort);\n\t\trightStick = new Joystick(OIConstants.rightJoystickPort);\n\n\t\t// Create subsystems:\n\t\tdriveTrain = new DriveTrain();\n\t\tshooter = new Shooter(gameController);\n\t\tturret = new Turret(gameController);\n\t\tintake = new Intake();\n\t\tindexer = new Indexer();\n\t\tclimber = new Climber(gameController);\n\n\t\t// Create camera:\n\t\tlimelightCamera = LimelightCamera.getInstance();\n\n\t\t// Configure default commands:\n\t\tdriveTrain.setDefaultCommand(new DriveWithJoysticks(driveTrain, leftStick, rightStick));\n\t\tturret.setDefaultCommand(new RunTurretWithGameController(turret, gameController));\n\t\tclimber.setDefaultCommand(new RunClimberWithGameController(climber, gameController));\n\n\t\t// Configure the button bindings\n\t\tconfigureButtonBindings();\n\n\t\tinitSmartDashboard();\n\t}", "@Override\n\tpublic void execute(Robot robot) {\n\t}", "public void implement(){\n this.rb.moveForward(1);\n \n \n if(this.rb.canPickThing()){\n this.rb.pickThing();\n }\n\n //turn the rb 90 degree to the south\n this.rb.turnLeft();\n\n //move the navigator 1 step ahead per move()\n this.rb.moveForward(1);\n\n //turn the navigator 90 degree to the east\n this.rb.turnRight();\n\n //move the navigator 1 step ahead per move()\n this.rb.moveForward(1);\n\n //turn the navigator 90 degree to the north\n this.rb.turnLeft();\n\n //move the navigator\n this.rb.moveForward(2);\n\n //turn Right the robot\n this.rb.turnRight();\n\n //stop at the starting position per move()\n this.rb.moveForward(1); \n \n this.rb.putThing();\n \n //move the navigator 1 step ahead per move()\n this.rb.moveForward(1);\n \n //turn the navigator 90 degree to the west\n this.rb.turnRight();\n \n this.rb.moveForward(1);\n \n this.rb.turnLeft();\n \n this.rb.moveForward(1);\n \n this.rb.turnRight();\n \n this.rb.moveForward(2);\n \n this.rb.turnLeft();\n }", "public Robot(String nombre,\n Srtring modelo,\n double numeroSerie,\n byte bateria,\n boolean power) {\n this.nombre = nombre;\n this.modelo = modelo;\n this. numeroSerie = numeroSerie;\n this.bateria = bateria;\n }", "@Override\r\n\tpublic void deplacerRobot(ArrayList<Robot> listeRobot) {\n\t\t\r\n\t}" ]
[ "0.7522992", "0.680174", "0.6788308", "0.675746", "0.6657215", "0.6630417", "0.6629632", "0.66161567", "0.64762104", "0.64429086", "0.64353323", "0.64283186", "0.64150107", "0.64139533", "0.63834774", "0.6357062", "0.63247454", "0.62751526", "0.62746435", "0.6257846", "0.62554497", "0.62330866", "0.6212297", "0.6212297", "0.6212297", "0.6206384", "0.6203738", "0.61807865", "0.61784995", "0.61781734", "0.6175597", "0.6175597", "0.61734724", "0.61500645", "0.6144038", "0.61397576", "0.61359155", "0.61289775", "0.61199516", "0.6107818", "0.6100633", "0.6093158", "0.60892314", "0.6076676", "0.60594887", "0.6042567", "0.6030238", "0.5990744", "0.59763354", "0.596936", "0.59633094", "0.59614927", "0.59560186", "0.59292835", "0.5923725", "0.59152603", "0.5878178", "0.5855612", "0.58548975", "0.5852329", "0.5847217", "0.5838154", "0.5813593", "0.58085847", "0.5805239", "0.5792923", "0.5791741", "0.5788622", "0.5788458", "0.57821244", "0.57761943", "0.5768948", "0.5767039", "0.5758794", "0.5738745", "0.5738281", "0.5736222", "0.5733581", "0.5733395", "0.5726584", "0.57230324", "0.57168007", "0.57163733", "0.5713849", "0.5713055", "0.5712842", "0.57112163", "0.5710712", "0.5708525", "0.5706479", "0.56993234", "0.5695114", "0.5693539", "0.5688047", "0.56879663", "0.5687866", "0.5676789", "0.5676238", "0.56755227", "0.56730217" ]
0.67487633
4
Demande a l'utilisateur de choisir un robot parmis ceux de son equipe
public Robot choisitRobot() { List<Robot> indisponibles = new ArrayList<Robot>(); List<Robot> disponibles = new ArrayList<Robot>(); for (Robot robot : robots) { if (robot.initDep().isEmpty()) { indisponibles.add(robot); } else { disponibles.add(robot); } } for (Robot r : indisponibles) { System.out.println(r.toString() + " ne peut pas se deplacer :("); } int i = 1; for (Robot robot : disponibles) { System.out.println("\t" + i + " : " + robot.toString()); i += 1; } i = secureInput(1, i - 1); if (disponibles.isEmpty()) { return null; } return disponibles.get(i - 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Robot getRobot(String nombre);", "public static void tener_Usuario_activo() {\n\t\t\t\tdesktop.<DomTextField>find(\"//BrowserApplication//BrowserWindow//input[@id='username']\").typeKeys(\"ocastro\");\n\t\t\t\tdesktop.<DomTextField>find(\"//BrowserApplication//BrowserWindow//input[@id='password']\").setText(\"bogota2016\");\n\t\t\t\tdesktop.<DomButton>find(\"//BrowserApplication//BrowserWindow//input[@id='loginbtn']\").click();\n\t\t\t\t//end recording\n\t\t\t\tSerenity.takeScreenshot();\n\t}", "public void agregarRobot(Robot robot);", "public String getRobot() {\n return nombre;\n }", "Robot getRobot(Position pos);", "public void agregarRobot(String nombre);", "public void choixduJeu() {\n afficheMessage(\"*- Choisissez le jeu auquel vous voulez jouer : \\n- R pour Recherche +/-\\n- M pour Mastermind\");\n choixJeu = Console.saisieListeDeChoix(\"R|M\");\n afficheMessage(\"*- Choisissez le mode de jeu auquel vous voulez jouer :\\n- C pour Challenger,\\n- U pour Duel\\n- D pour Defense\");\n choixModeJeu = Console.saisieListeDeChoix(\"C|U|D\");\n }", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n SmartDashboard.putData(leftMotor1);\n SmartDashboard.putData(leftMotor2);\n SmartDashboard.putData(rightMotor1);\n SmartDashboard.putData(rightMotor2);\n SmartDashboard.putData(firstMotor);\n SmartDashboard.putData(secondMotor);\n \n\n\n\n }", "public abstract void interagir (Robot robot);", "public void setRobot(Robot robot) {\n this.robot = robot;\n }", "public String interact() {\n return suara;\n }", "public static Individuo seleccionAleatoria(Poblacion pob) {\n Random ran = new Random();\n int pos = ran.nextInt(pob.getIndividuos().size());\n Individuo mejor = new Individuo(pob.getIndividuos().get(pos).getGenotipo());\n return mejor;\n }", "public abstract void interagir(Robot robot);", "public RobotID getRobot() {\n return robot;\n }", "@Override\r\n \tprotected Robot getRobot() {\t\t\r\n \t\treturn null;\r\n \t}", "@Before\n\tpublic void OuvrirNavEtConnexion ()\n\t{\n\t\tdriver = SocleTechnique.OpenNav(adresse, ENav.firefox);\n\t\t// Incorporation d'un Implicit wait \n\t\tdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\n\n\t\tlogin = new LoginPage(driver);\n\t\t// Remplir le champ login et mot de passe, puis cliquer sur le bouton valider\n\t\tSocleTechnique.RemplirLoginMdp(login.champUtilisateur, login.champPassword, login.boutonSeConnecter, User, MDP);\n\t}", "@Override\n\tpublic void robotInit() {\n\t\toi = new OI();\n\t\tdrivebase.calibrateGyro();\n\t\tSmartDashboard.putData(\"Zero Gyro\", new ZeroGyro());\n\t\tSmartDashboard.putData(\"Calibrate Gyro - WHILE ROBOT NOT MOVING\", new CalibrateGyro());\n\t\tchooser.addDefault(\"Default Prepare Gear Auto\", new PrepareGearManipulator());\n\t\t//shooterModeChooser.addDefault(\"Shooter at Nominal Preset when Pressed\", object);\n\t\t/*chooser.addObject(\"Left Gear Auto\", new LeftGearGroup());\n\t\tchooser.addObject(\"Center Gear Auto\", new CenterGearGroup());*/\n\t//\tchooser.addObject(\"Test Vision Auto\", new TurnTillPerpVision(true));\n\t//\tchooser.addObject(\"Testing turn gyro\", new RotateToGyroAngle(90,4));\n\t\t//chooser.addObject(\"DriveStraightTest\", new GoAndReturn());\n\t\t //UNNECESSARY AUTOS FOR TESTING ^\n\t\tchooser.addObject(\"Center Gear Encoder Auto (place)\", new DriveStraightCenter());\n\t\tchooser.addObject(\"Vision center TESTING!!!\", new TurnTillPerpVision());\n\t\tchooser.addObject(\"Boiler Auto RED\", new BoilerAuto(true));\n\t\tchooser.addObject(\"Boiler Auto BLUE\", new BoilerAuto(false));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t//\tchooser.addObject(\"Center Gear Encoder Auto (do not place )\", new DriveToFace(false, false, false));\n\t\tchooser.addObject(\"Baseline\", new DriveToLeftRightFace(false,false,false,false));\n\t\tchooser.addObject(\"TEST DRIVETANK AUTO\", new DriveTimedTank(0.7,0.7,5));\n\t\tchooser.addObject(\"Side Gear Auto RIGHT (manual straight lineup)(place)(TURN AFTER AND START CYCLE)\", new DriveStraightSide(true,false));\n\n\t\tchooser.addObject(\"Side Gear Auto LEFT (manual straight lineup)(place)(TURN AFTER AND START CYCLE)\", new DriveStraightSide(true,true));\n\t\t//chooser.addObject(\"Side Gear Auto (place)\", new DriveToLeftRightFace(true,false,false,false));\n\t\t//chooser.addObject(\"Test DriveStraight Auto\", new DriveStraightPosition(10,5));\n\t\t//chooser.addObject(\"Center Gear Encoder Auto (place)\", new DriveStraightCenter());\n\t\t/*InterpreterGroup interp = new InterpreterGroup();\n\t\t(interp.init()){\n\t\t\tchooser.addObject(\"Interpreter\",interp);\n\t\t}*/\n\t\t// chooser.addObject(\"My Auto\", new MyAutoCommand());\n\t\tSmartDashboard.putData(\"Auto Chooser\", chooser);\n\n\t\tRobot.drivebase.leftDrive1.setPosition(0);\n \tRobot.drivebase.rightDrive1.setPosition(0);\n \t\n\t\t\n \tRobot.leds.initializei2cBus();\n \tbyte mode = 0;\n \tRobot.leds.setMode(mode);\n \tgearcamera = CameraServer.getInstance();\n\t\t\n \tUsbCamera gearUsb = gearcamera.startAutomaticCapture();\n \tgearUsb.setFPS(25);\n \tgearUsb.setResolution(256, 144);\n\n\t\t//NetworkTable.setClientMode();\n \t//NetworkTable.setIPAddress(\"raspberrypi.local\");\n\t\t\n\t\t\n\t\t/*\n\t\t * new Thread(() -> { UsbCamera goalcamera =\n\t\t * CameraServer.getInstance().startAutomaticCapture();\n\t\t * goalcamera.setResolution(320, 240); goalcamera.setFPS(30);\n\t\t * goalcamera.setBrightness(1); goalcamera.setExposureManual(1);\n\t\t * \n\t\t * CvSink goalCvSink = CameraServer.getInstance().getVideo();\n\t\t * \n\t\t * Mat source = new Mat();\n\t\t * \n\t\t * while(!Thread.interrupted()) { goalCvSink.grabFrame(source);\n\t\t * goaloutputmat = source; } }).start();\n\t\t * goalPipeline.process(goaloutputmat);\n\t\t * \n\t\t * new Thread(() -> { UsbCamera gearcamera =\n\t\t * CameraServer.getInstance().startAutomaticCapture();\n\t\t * gearcamera.setResolution(320, 240); gearcamera.setFPS(30);\n\t\t * gearcamera.setBrightness(1); gearcamera.setExposureManual(1);\n\t\t * \n\t\t * CvSink gearCvSink = CameraServer.getInstance().getVideo();\n\t\t * \n\t\t * Mat source = new Mat();\n\t\t * \n\t\t * while(!Thread.interrupted()) { gearCvSink.grabFrame(source);\n\t\t * gearoutputmat = source; } }).start();\n\t\t * gearPipeline.process(gearoutputmat);\n\t\t */\n\t}", "@Override\n public void setUsername() {\n try {\n JCheckBox botCheckBox = (JCheckBox) logIn.getComponent(5);\n bot = botCheckBox.isSelected();\n if(bot) {\n try {\n int thinkingTime = Integer.parseInt((String) JOptionPane.showInputDialog(frame, \"Please enter the AI thinking time in seconds\", \"Thinking time\", JOptionPane.INFORMATION_MESSAGE, null, null, 0));\n client.setThinkintTime(thinkingTime);\n } catch (NumberFormatException e) {\n JOptionPane.showMessageDialog(frame, \"Set thinking time to 0\", \"Illegal input\", JOptionPane.ERROR_MESSAGE);\n client.setThinkintTime(0);\n }\n }\n username = ((JTextField) logIn.getComponent(3)).getText();\n client.setName(username);\n if(serverBrowser == null) {\n serverList();\n } else {\n frame.setContentPane(serverBrowser);\n ((JLabel)((JPanel) serverBrowser.getComponent(0)).getComponent(0)).setText(username);\n }\n } catch (IllegalNameException e) {\n JOptionPane.showMessageDialog(frame, \"Invalid name, please do not use ';' in your name.\", \"Ilegal username\", JOptionPane.ERROR_MESSAGE);\n }\n }", "public abstract String getRobotId();", "@Override\n public void robotInit() {\n SmartDashboard.putBoolean(\"CLIMB\", false);\n SmartDashboard.putNumber(\"servo\", 0);\n // Instantiate our RobotContainer. This will perform all our button bindings, and put our\n // autonomous chooser on the dashboard.\n m_robotContainer = new RobotContainer();\n //coast.\n if (RobotMap.DRIVE_TRAIN_DRAGON_FLY_IS_AVAILABLE)\n getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(false, RobotMap.DRIVE_TRAIN_MIDDLE_WHEEL_PORT);\n\n getRobotContainer().configureButtonBindings();\n getRobotContainer().getTecbotSensors().initializeAllSensors();\n getRobotContainer().getTecbotSensors().getTecbotGyro().reset();\n\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_MIDDLE_WHEEL_PORT);\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_LEFT_CHASSIS_PORTS);\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_RIGHT_CHASSIS_PORTS);\n\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n\n m_chooser.addOption(\"Move 3 m\", new SpeedReductionStraight(3, .75, 0));\n m_chooser.addOption(\"Rotate 90 degrees\", new SpeedReductionTurn(90, .5));\n m_chooser.setDefaultOption(\"El chido\", new DR01D3K4());\n m_chooser.addOption(\"Collect, go back and shoot\", new CollectPowerCellsGoBackShoot());\n m_chooser.addOption(\"Transport\", new SequentialCommandGroup(new FrontIntakeSetRaw(.75),\n new TransportationSystemSetRaw(.5)));\n m_chooser.addOption(\"Shoot 3PCs n' Move\", new SHOOT_3_PCs_N_MOVE());\n SmartDashboard.putData(\"Auto Mode\", m_chooser);\n\n //camera.setExposureManual(79);\n\n\n }", "boolean findRobot();", "public void turnoUsuario(){\r\n System.out.println(\"Turno: \"+ entrenador1.getNombre());\r\n if(evaluarAccion(this.pokemon_activo1, this.pokemon_activo2).equals(\"Cambiar\")){\r\n System.out.println(\"Usuario eligio Cambiar Pokemon\");\r\n pokemon_activo1.setConfuso(false);\r\n pokemon_activo1.setDormido(false);\r\n if(getEquipo1()[0].getDebilitado() == false && getEquipo1()[0]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[0]; \r\n }\r\n else if(getEquipo1()[1].getDebilitado() == false && getEquipo1()[1]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[1]; \r\n }\r\n else if(getEquipo1()[2].getDebilitado() == false && getEquipo1()[2]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[2]; \r\n }\r\n else if(getEquipo1()[3].getDebilitado() == false && getEquipo1()[3]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[3]; \r\n }\r\n else if(getEquipo1()[4].getDebilitado() == false && getEquipo1()[4]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[4]; \r\n }\r\n else if(getEquipo1()[5].getDebilitado() == false && getEquipo1()[5]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[5]; \r\n }\r\n vc.setjL_especie1(pokemon_activo1.getNombre_especie());\r\n vc.setjL_nombrepokemon1(pokemon_activo1.getPseudonimo());\r\n vc.setjL_vida_actual1(pokemon_activo1.getVida_restante(), pokemon_activo1.getVida());\r\n setLabelEstados(0);\r\n setLabelEstados(1);\r\n this.turno = 1;\r\n }\r\n else if(evaluarAccion(this.pokemon_activo1, this.pokemon_activo2).equals(\"Atacar\")){\r\n System.out.println(\"Usuario eligio Atacar\");\r\n inflingirDaño(pokemon_activo1.getMovimientos()[(int)(Math.random()*4)], pokemon_activo2, pokemon_activo1);\r\n if(pokemon_activo2.getVida_restante() <= 0){\r\n pokemon_activo2.setVida_restante(0);\r\n pokemon_activo2.setDebilitado(true);\r\n System.out.println(\"El Pokemon: \"+ pokemon_activo2.getPseudonimo()+\" se ha Debilitado\");\r\n JOptionPane.showMessageDialog(this.vc, \"El Pokemon: \"+ pokemon_activo2.getPseudonimo()+\" se ha Debilitado\", \"Debilitado\", JOptionPane.INFORMATION_MESSAGE);\r\n if(condicionVictoria(getEquipo1(), getEquipo2()) == true){\r\n JOptionPane.showMessageDialog(this.vc, \"El Ganador de este Combate es:\"+ entrenador1.getNombre(), \"Ganador\", JOptionPane.INFORMATION_MESSAGE);\r\n System.out.println(\"El Ganador de este Combate es:\"+ entrenador1.getNombre());\r\n System.out.println(equipo1[0].getVida_restante()+ \" \"+equipo1[1].getVida_restante()+ \" \"+equipo1[2].getVida_restante()+ \" \"+equipo1[3].getVida_restante()+ \" \"+equipo1[4].getVida_restante()+ \" \"+equipo1[5].getVida_restante());\r\n System.out.println(equipo2[0].getVida_restante()+ \" \"+equipo2[1].getVida_restante()+ \" \"+equipo2[2].getVida_restante()+ \" \"+equipo2[3].getVida_restante()+ \" \"+equipo2[4].getVida_restante()+ \" \"+equipo2[5].getVida_restante());\r\n JOptionPane.showMessageDialog(this.vc, equipo1[0].getVida_restante()+ \" \"+equipo1[1].getVida_restante()+ \" \"+equipo1[2].getVida_restante()+ \" \"+equipo1[3].getVida_restante()+ \" \"+equipo1[4].getVida_restante()+ \" \"+equipo1[5].getVida_restante()+\"\\n\"+ equipo2[0].getVida_restante()+ \" \"+equipo2[1].getVida_restante()+ \" \"+equipo2[2].getVida_restante()+ \" \"+equipo2[3].getVida_restante()+ \" \"+equipo2[4].getVida_restante()+ \" \"+equipo2[5].getVida_restante(), \"Estadisticas finales(vida)\", JOptionPane.INFORMATION_MESSAGE);\r\n vc.dispose();\r\n vpc.dispose();\r\n combate.setGanador(entrenador1);\r\n combate.setPerdedor(entrenador2);\r\n this.termino = true;\r\n }\r\n else if(getEquipo1()[0].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[0]; \r\n }\r\n else if(getEquipo1()[1].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[1]; \r\n }\r\n else if(getEquipo1()[2].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[2]; \r\n }\r\n else if(getEquipo1()[3].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[3]; \r\n }\r\n else if(getEquipo1()[4].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[4]; \r\n }\r\n else if(getEquipo1()[5].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[5]; \r\n } \r\n vc.setjL_nombrepokemon1(pokemon_activo2.getPseudonimo());\r\n vc.setjL_especie1(pokemon_activo2.getNombre_especie());\r\n }\r\n vc.setjL_especie2(pokemon_activo2.getNombre_especie());\r\n vc.setjL_nombrepokemon2(pokemon_activo2.getPseudonimo());\r\n vc.setjL_vida_actual2(pokemon_activo2.getVida_restante(), pokemon_activo2.getVida());\r\n setLabelEstados(0);\r\n setLabelEstados(1);\r\n this.turno = 1;\r\n }\r\n \r\n }", "public void menu(){\n System.out.println(\"---------------------------Login------------------------------------\");\n \n System.out.println(\"Usuario:\");\n respuesta = scanner.nextLine();\n System.out.println(\"Contraseña:\");\n respuesta2 = scanner.nextLine();\n Usuario user = new Usuario();\n user.setNombre(respuesta);\n user.setPassword(respuesta2);\n idUser=modelo.validarUsuario(user);\n if(idUser<0){\n System.err.println(\"Usuario invalido\");\n \n }else{\n \n menuInterno();\n \n }\n//\n// menuInterno();\n// \n }", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n \n //Initialize Drive Train Motors/\n LeftFront = new WPI_TalonSRX(11);\n RightFront = new WPI_TalonSRX(13);\n LeftBack = new WPI_TalonSRX(10);\n RightBack = new WPI_TalonSRX(12);\n RobotDT = new MecanumDrive(LeftFront, LeftBack, RightFront, RightBack);\n \n //Initialize Xbox Controller or Joystick/\n xcontroller1 = new XboxController(0);\n xcontroller2 = new XboxController(1);\n \n //Initialize Cameras/\n RoboCam = CameraServer.getInstance();\n FrontCamera = RoboCam.startAutomaticCapture(0);\n BackCamera = RoboCam.startAutomaticCapture(1);\n\n //GPM Init/\n mGPM = new GPM();\n \n }", "@Override\n public void robotInit() {\n\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n drive = new Drive();\n pDP = new PDP();\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n // OI must be constructed after subsystems. If the OI creates Commands\n //(which it very likely will), subsystems are not guaranteed to be\n // constructed yet. Thus, their requires() statements may grab null\n // pointers. Bad news. Don't move it.\n oi = new OI();\n camera1 = CameraServer.getInstance().startAutomaticCapture(0);\n camera2 = CameraServer.getInstance().startAutomaticCapture(1);\n camera1.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n camera2.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n server = CameraServer.getInstance().getServer();\n flipped = true;\n server.setSource(camera1);\n vexGyro = new AnalogGyro(0);\n vexGyro.setSensitivity(.00175);\n //rightEncoder = new Encoder(0, 1, false);\n //leftEncoder = new Encoder(2, 3, true);\n // Add commands to Autonomous Sendable Chooser\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS\n\n chooser.setDefaultOption(\"Autonomous Command\", new AutonomousCommand());\n PixyCamBlock centerBlock = PixyCam2.GetCentermostBlock();\n if(centerBlock == null)\n {\n SmartDashboard.putString(\"target good? \", \"no, is null\");\n }\n else{\n String out = \"Center Block, X: \"+centerBlock.xCenter + \" Y: \"+centerBlock.yCenter;\n SmartDashboard.putString(\"center block data \", out);\n if (centerBlock.yCenter < 200){\n SmartDashboard.putString(\"target good?\", \"YES!!! ycenter less than 200\");\n }\n }\n \n \n\n\n \n \n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS\n SmartDashboard.putData(\"Auto mode\", chooser);\n SmartDashboard.putBoolean(\"isFlipped\", flipped);\n SmartDashboard.putNumber(\"right encoder\", drive.getRightEncoder());\n SmartDashboard.putNumber(\"left encoder\", drive.getLeftEncoder());\n }", "public void choicePersonage() {\n\t\tSystem.out.println(\"souhaitez-vous créer un guerrier ou un magicien ?\");\n\t\tchoice = sc.nextLine().toLowerCase();\t\t\t\n\t\tSystem.out.println(\"Vous avez saisi : \" + choice);\n\t\tif(!(choice.equals(MAGICIEN) || choice.equals(GUERRIER))) {\n\t\t\tchoicePersonage();\n\t\t}\n\t\tsaisieInfoPersonage(choice);\n\t}", "public boolean mueveRobot(String idAgente,Coordenada coord){\n\t\treturn mueveAgente(idAgente,coord,\"Robot\");\n\t}", "public void TipoCliente() {\n\tint cambio=1;\n\tString tipoCliente=\"\";\n\tdo {\n\t\ttry {\n\t\t\ttipoCliente = (JOptionPane.showInputDialog(null, \"Selecciona el tipo de cliente\", null, JOptionPane.PLAIN_MESSAGE,null, new Object[]\n\t\t\t\t\t{ \"Selecciona\",\"Docente\", \"Administrativo\"}, \"Selecciona\")).toString() ;\n\t\t\t\n\t\t\tif(tipoCliente.equalsIgnoreCase(\"Docente\")) {\n\t\t\t\tingresaDocente();\n\t\t\t\tsetTipoCliente(\"Docente\");\n\t\t\t\t\n\t\t\t}else if(tipoCliente.equalsIgnoreCase(\"Administrativo\")) {\n\t\t\t\tingresaAdministrativo();\n\t\t\t\tsetTipoCliente(\"Administrativo\");\n\t\t\t}else{\n\t\t\t\t\n\t\t\t\tJOptionPane.showMessageDialog(null,\"Escoge una de las dos opciones\");\n\t\t\t}\n\t} catch (Exception e) {\n\t\tJOptionPane.showMessageDialog(null, \"Debes escoger una opcion\");\n\t\tcambio=0;\n\t}\n\t} while (tipoCliente==\"Selecciona\"||tipoCliente==null||cambio==0);\t\n}", "public BasicRobot getRobot() {\n\t\treturn robot;\n\t}", "public Atendiendo(Robot robot){\n this.robot = robot;\n }", "public void setRobot(Robot robot) {\n\t\tthis.robot = robot;\n\t}", "@Test\n\tpublic void loginFluxoAlternativo1() throws InterruptedException{\n\t\t\n\t\tthis.abrirPaginaLogin();\n\t\tthis.setElementosDaPagina();\n\t\t\t\t\n\t\t//enviando as mensagens desejadas para as txt's\n\t\tthis.searchLoginTxt.sendKeys(\"mvirtual\");\t\t\n\t\tthis.searchPasswordTxt.sendKeys(\"errado\");\n\t\t//Thread.sleep(1000); //dando 1 segundo(s) para o usuário ver o teste\n\t\tthis.searchLoginBtn.click();\n\t\t\n\t\t//Procedimento correto\n\t\tthis.setElementosDaPagina();\n\t\tthis.searchLoginTxt.sendKeys(\"mvirtual\");\t\t\n\t\tthis.searchPasswordTxt.sendKeys(\"mvirtual\");\n\t\t//Thread.sleep(1000); //dando 1 segundo(s) para o usuário ver o teste\n\t\tthis.searchLoginBtn.click();\n\t\t\n\t\t//Esperando até que todos os elementos da página seguinte sejam carregadas\n\t\tthis.driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);\n\t\t\n\t\t//Validando o teste\n\t\tString validacao = this.driver.findElement(By.id(\"formCabecalho:txtUsuario\")).getText();\n\t\tassertEquals(\"Memoria Virtual\", validacao);\n\t\t\n\t}", "private void consultadadosUtilizador(String username){\n Scanner s = new Scanner(System.in); int opcao = 0;\n try{\n do{\n System.out.println(\"Informações de Conta \");\n System.out.println(b_dados.getUtilizadores().get(username).toString());\n System.out.println(\"1-Mudar localizacao\");\n System.out.println(\"0 - Retroceder\");\n\n opcao = s.nextInt();\n System.out.print(\"\\n\");\n\n switch(opcao){\n case 1:\n mudarLocalizacaoUtilizador(username);\n break;\n default:\n System.out.print(\"Opção inválida\\n\\n\");\n break;\n\n }\n }while(opcao != 0);\n }\n catch(InputMismatchException e){\n System.out.println(\"Entrada inválida\");\n menuCliente(username);\n\n }\n }", "public Robot getRobot(String type) throws Exception {\r\n\t\tint index;\r\n\t\t\r\n\t\tswitch (type.toLowerCase()) {\r\n\t\tcase \"scout\":\r\n\t\t\tindex = 0;\r\n\t\t\tbreak;\r\n\t\tcase \"sniper\":\r\n\t\t\tindex = 1;\r\n\t\t\tbreak;\r\n\t\tcase \"tank\":\r\n\t\t\tindex = 2;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tthrow new Exception(\"Unknown/Invalid robot type.\");\r\n\t\t}\r\n\t\t\r\n\t\treturn this.robots.get(index);\r\n\t}", "@Override\n public void robotInit()\n {\n wireUpOperatorInterface();\n chooser.setDefaultOption(\"Default Auto\", driveCommand);\n // chooser.addOption(\"My Auto\", new MyAutoCommand());\n SmartDashboard.putData(\"Auto mode\", chooser);\n }", "public void mostrarMenuLectura(TomarLectura tomarLectura, Lectura lecturaActual);", "public ActionUtilisateur choisirUneAction() ;", "public void robotInit() {\n chooser = new SendableChooser();\n chooser.addDefault(\"Default Auto\", defaultAuto);\n chooser.addObject(\"My Auto\", customAuto);\n SmartDashboard.putData(\"Auto choices\", chooser);\n \n // camera stuff\n robotCamera = CameraServer.getInstance();\n robotCamera.setQuality(50);\n robotCamera.startAutomaticCapture(\"cam0\");\n\n //our robot stuff\n // myChassis\t= new RobotDrive(0,1);\n leftSide\t= new VictorSP(1);\n rightSide\t= new VictorSP(0);\n spinWheels\t= new TalonSRX(2);\n armLifty\t= new TalonSRX(3);\n drivePad\t= new Joystick(0);\n statesPad\t= new Joystick(1);\n LiveWindow.addActuator(\"stud\", \"talonsrx\", armLifty);\n \n //arm position stuff\n armPosition\t\t= new AnalogInput(0);\n armPortSwitch\t= new DigitalInput(0);\n \n //solenoid stuff\n //solenoidThing = new Solenoid(1);\n \n //init button states\n lBPX\t\t\t= false;\n bIPX\t\t\t= false;\n \n //driver buttons\n ballSpitButton\t= 4;\n ballSuckButton\t= 2;\n \n //state machine variables\n defaultState\t\t= 0;\n portState\t\t\t= 1;\n chevellState\t\t= 2;\n ballGrabState\t\t= 10;\n driveState\t\t\t= 11;\n lowBarState\t\t\t= 8;\n rockState\t\t\t= driveState;\n roughState\t\t\t= driveState;\n moatState\t\t\t= driveState;\n rampartState\t\t= driveState;\n drawState\t\t\t= driveState;\n sallyState\t\t\t= driveState;\n liftOverride\t\t= 0.09;\n terrainStates\t\t= 0;\n autoLiftSpeed\t\t= 1.0;\n armLiftBuffer\t\t= 0.01;\n //port state variables\n portPosition1\t\t= 1.7;\n portPosition2\t\t= 0.9;\n portSwitch\t\t\t= 0;\n //chevell state variables\n chevellPosition1\t= 1.135;\n chevellPosition2\t= 2.0;\n chevellSwitch \t\t= 0;\n chevellWheelSpeed\t= 0.3;\n //ball grab state variables\n ballGrabPosition1\t= 1.35;\n ballGrabSwitch\t\t= 0;\n ballGrabWheelSpeed\t= -0.635;\n ballSpitWheelSpeed\t= 1.0;\n //lowbar state variables\n lowBarPosition\t\t= 1.6;\n lowBarSwitch\t\t= 0;\n //drive state variables\n driveSwitch\t\t\t= 1;\n \n }", "public Robot getRobot() {\n\t\treturn this.robot;\n\t}", "@Basic\r\n\tpublic Robot getRobot()\r\n\t{\r\n\t\treturn this.robot;\r\n\t}", "private void login() {\n AnonimoTO dati = new AnonimoTO();\n String username = usernameText.getText();\n String password = passwordText.getText();\n\n if (isValidInput(username, password)) {\n dati.username = username;\n dati.password = password;\n\n ComplexRequest<AnonimoTO> request =\n new ComplexRequest<AnonimoTO>(\"login\", RequestType.SERVICE);\n request.addParameter(dati);\n\n SimpleResponse response =\n (SimpleResponse) fc.processRequest(request);\n\n if (!response.getResponse()) {\n if (ShowAlert.showMessage(\n \"Username o password non corretti\", AlertType.ERROR)) {\n usernameText.clear();\n passwordText.clear();\n }\n }\n }\n\n }", "private void abrirVentanaChatPublica() {\n\t\tif (!listaUsuarios.isSelectionEmpty()) {\n\t\t\tMenuVentanaChat uiChat = this.seleccionarVentanaChat(listaUsuarios.getSelectedValue());\n\t\t} else\n\t\t\tJOptionPane.showMessageDialog(this, \"Seleccione un elemento de la lista\", \"Seleccionar Usuario\",\n\t\t\t\t\tJOptionPane.INFORMATION_MESSAGE);\n\t}", "public Robot(String nombre,\n Srtring modelo,\n double numeroSerie,\n byte bateria,\n boolean power) {\n this.nombre = nombre;\n this.modelo = modelo;\n this. numeroSerie = numeroSerie;\n this.bateria = bateria;\n }", "public void tener_acceso_a_la_plataforma() {\n\t\tbaseState.setUrl(\"http://km.choucairtesting.com/login/index.php\");\t\n\t\tbaseState.setBrowserType(BrowserType.GoogleChrome);\n\t\tbaseState.execute(desktop);\t\n\t\tSerenity.takeScreenshot();\n\t\t\n\t}", "@Test\n\tpublic void testSetRobot() {\n\t\tController control = new Controller();\n\t\tBasicRobot robot = new BasicRobot();\n\t\tExplorer explorer = new Explorer();\n\t\tcontrol.setBuilder(Order.Builder.DFS);\n\t\tcontrol.setRobotAndDriver(robot, explorer);\n\t\trobot.setMaze(control);\n\t\tcontrol.turnOffGraphics();\n\t\tcontrol.switchFromTitleToGenerating(0);\n\t\tcontrol.waitForPlayingState();\n\t\texplorer.setRobot(robot);\n\t\tassertNotNull(explorer.getRobot());\n\t}", "public void solicitarDatos() {\r\n System.out.println(\"Dime el nombre del cliente: \");\r\n this.setNombre(lector.nextLine());\r\n System.out.println(\"Dime el primer apellido: \");\r\n this.setPrimerApellido(lector.nextLine());\r\n System.out.println(\"Dime el segundo apellido: \");\r\n this.setSegundoApellido(lector.nextLine());\r\n System.out.println(\"Dime la edad: \");\r\n this.setEdad(lector.nextInt());\r\n }", "@Test\n\tpublic void testLecturaSelect(){\n\t\tassertEquals(esquemaEsperado.getExpresionesSelect().toString(), esquemaReal.getExpresionesSelect().toString());\n\t}", "public void robotInit() {\n\t\toi = new OI();\n chooser = new SendableChooser();\n chooser.addDefault(\"Default Auto\", new ExampleCommand());\n// chooser.addObject(\"My Auto\", new MyfAutoCommand());\n SmartDashboard.putData(\"Auto mode\", chooser);\n \n //Drive\n //this.DriveTrain = new DriveTrain();\n \t//RobotMap.robotDrive1.arcadeDrive(oi.stickLeft);\n \n //Buttons\n // oi.button1.whenPressed(new SetMaxMotorOutput());\n \n //Ultrasonic\n sonic1 = new Ultrasonic(0,1);\n sonic1.setAutomaticMode(true);\n \n }", "public abstract boolean interactionPossible(Robot robot);", "public MotherRobot() {\n Random random = new Random();\n int sepInt = random.nextInt(3);\n if (sepInt == 1)\n setSeparate(true);\n }", "@SuppressWarnings(\"deprecation\")\r\n\tprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed\r\n \t//valeur de centre d'inetret\r\n \tString domaine = String.valueOf(jComboBox1.getSelectedItem());\r\n \tSystem.out.println(\"nom \"+jTextField2.getText().toString());\r\n \tSystem.out.println(\"prenom \"+jTextField1.getText());\r\n \tSystem.out.println(\"domaine \"+domaine);\r\n \tSystem.out.println(\"mdp \"+jPasswordField1.getText().toString());\r\n\r\n \t//créer l'utilisateur\r\n \tif(jTextField2.getText().equals(\"\")||jTextField1.getText().equals(\"\")||jPasswordField1.getText().equals(\"\"))\r\n \t{\r\n \t\r\n jLabel6.setText(\"Veuillez remplire tous les champs!!!\");\r\n\r\n \t}\r\n \telse\r\n \t{\r\n \t\tint i=0;\r\n \t\tUtilisateur user=new Utilisateur(jTextField2.getText().toString(),jTextField1.getText().toString(),domaine,jPasswordField1.getText().toString(),new ArrayList<file>());\r\n\r\n \t\tif(!users.getInfo().isEmpty()) {\r\n \t\twhile(i<users.getInfo().size())\r\n \t{\r\n \t\tSystem.out.println(\"user ----> \"+users.getInfo().get(i).getUser().getNom());\r\n \t\tSystem.out.println(\"user ----> \"+nomAgent);\r\n \t\tSystem.out.println(\"user ----> \"+mtpAgent);\r\n\r\n \t\t//vérification\r\n \t\tif(users.getInfo().get(i).getUser().getNom().equalsIgnoreCase(nomAgent)\r\n \t\t\t\t&&(users.getInfo().get(i).getUser().getMot_de_passe().equals(mtpAgent))\r\n \t\t\t\t)\r\n \t\t\t\t{\r\n \t\t\t\r\n \t\t\tSystem.out.println(\"utilisateur modifié trouvé \");\r\n \t\t\t//la modification\r\n\r\n \t\t\tusers.getInfo().get(i).setUser(user);\r\n \t\t\t\r\n \t\t\t/*users.getInfo().get(i).getUser().setNom(nomAgent);\r\n \t\tusers.getInfo().get(i).getUser().setPrenom(prenomAgent);\r\n \t\tusers.getInfo().get(i).getUser().setDomaine(domaineAgent);\r\n \t\tusers.getInfo().get(i).getUser().setMot_de_passe(jPasswordField1.getText());*/\r\n \t\t\tSystem.out.println(\"new name \"+users.getInfo().get(i).getUser().getNom());\r\n \t\t\tSystem.out.println(\"new prenom \"+user.getPrenom());\r\n \t\t\tSystem.out.println(\"new mtp \"+users.getInfo().get(i).getUser().getMot_de_passe());\r\n \t\t\tSystem.out.println(\"new domaine \"+users.getInfo().get(i).getUser().getDomaine());\r\n \t\t\tIndex.récuperation(user.getNom(), user.getPrenom(), user.getDomaine(), user.getMot_de_passe());\r\n \t\t\tIndex.affecterAgentInfo(users.getInfo().get(i),i);\r\n \t\t\t new Index();\r\n \t\t\t this.setVisible(false);\r\n \t\t\t this.dispose();\r\n\r\n \t\t\t\t}\r\n \t\ti++;\r\n \t}\r\n \t}\r\n \t\tif(!users.getMath().isEmpty()) {\r\n \t\twhile(i<users.getMath().size())\r\n \t{\r\n \t\tSystem.out.println(\"user ----> \"+users.getMath().get(i).getUser().getNom());\r\n \t\t//vérification\r\n \t\tif(users.getMath().get(i).getUser().getNom().equalsIgnoreCase(nomAgent)\r\n \t\t\t\t&&(users.getMath().get(i).getUser().getMot_de_passe().equals(mtpAgent))\r\n \t\t\t\t)\r\n \t\t\t\t{\r\n \t\t\t\r\n \t\t\tSystem.out.println(\"utilisateur modifié trouvé \");\r\n \t\t\t//la modification\r\n\r\n \t\t\tusers.getMath().get(i).setUser(user);\r\n \t\t\t\r\n \t\t\t/*users.getInfo().get(i).getUser().setNom(nomAgent);\r\n \t\tusers.getInfo().get(i).getUser().setPrenom(prenomAgent);\r\n \t\tusers.getInfo().get(i).getUser().setDomaine(domaineAgent);\r\n \t\tusers.getInfo().get(i).getUser().setMot_de_passe(jPasswordField1.getText());*/\r\n \t\t\tSystem.out.println(\"new name \"+users.getMath().get(i).getUser().getNom());\r\n \t\t\tSystem.out.println(\"new prenom \"+users.getMath().get(i).getUser().getPrenom());\r\n \t\t\tSystem.out.println(\"new mtp \"+users.getMath().get(i).getUser().getMot_de_passe());\r\n \t\t\tSystem.out.println(\"new domaine \"+users.getMath().get(i).getUser().getDomaine());\r\n \t\t\tIndex.récuperation(user.getNom(), user.getPrenom(), user.getDomaine(), user.getMot_de_passe());\r\n\r\n \t\t\tIndex.affecterAgentMath(users.getMath().get(i));\r\n \t\t\t new Index();\r\n \t\t\t this.setVisible(false);\r\n \t\t\t this.dispose();\r\n\r\n \t\t\t\t}\r\n \t\ti++;\r\n \t}\r\n \t}\r\n \t\t\r\n\r\n \t\t\r\n \t\t\r\n \t\r\n \t\t\t\r\n \t\t\t\r\n \t\t\t}\r\n \t\t\r\n \r\n \t\r\n\r\n \t\r\n \t\r\n \t }", "public void enviaMotorista() {\n\t\tConector con = new Conector();\r\n\t\tString params[] = new String[2];\r\n\r\n\t\tparams[0] = \"op=4\";\r\n\t\tparams[1] = \"email=\" + usuario;\r\n\r\n\t\tcon.sendHTTP(params);\r\n\t}", "public static String WhoAmI() {\r\n\t\treturn(\"Selection Type: Smallest polar angle to the depot\");\r\n\t}", "public static String WhoAmI() {\r\n\t\treturn(\"Selection Type: Smallest polar angle to the depot\");\r\n\t}", "private void getUserRoomChoice() {\n int checkedChipId = mBinding.chipGroupRooms.getCheckedChipId();\n if (checkedChipId == R.id.chip_1_room) {\n mChipRoomsInput = 1;\n } else if (checkedChipId == R.id.chip_2_rooms) {\n mChipRoomsInput = 2;\n } else if (checkedChipId == R.id.chip_3_rooms) {\n mChipRoomsInput = 3;\n } else if (checkedChipId == R.id.chip_4_rooms) {\n mChipRoomsInput = 4;\n } else if (checkedChipId == R.id.chip_5_rooms) {\n mChipRoomsInput = 5;\n } else {\n mChipRoomsInput = 0;\n }\n }", "@Override\r\n\tpublic void jouer() {\r\n\t\t// liste servant a retenir les cartes potentiellement selectionnables\r\n\t\tArrayList<ICarte> listeCartesPossibles = new ArrayList<ICarte>();\r\n\t\t// sert a choisir une carte aleatoirement parmis celles selectionnables\r\n\t\tRandom random = new Random();\r\n\t\t\r\n\t\t//enregistrement des cartes pouvant etre selectionnees\r\n\t\tfor(int i=0 ; i<plateau.getListeCartesMelangees().size() ; i++) {\r\n\t\t\tif (plateau.getListeCartesMelangees().get(i).getSurPlateau() == true) {\r\n\t\t\t\tlisteCartesPossibles.add(plateau.getListeCartesMelangees().get(i));\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// choix aleatoire de la premiere carte\r\n\t\tcarte1 =listeCartesPossibles.get(random.nextInt(listeCartesPossibles.size()));\r\n\t\t\r\n\t\t//choix aleatoire de la seconde carte\r\n\t\tlisteCartesPossibles.remove(carte1);\r\n\t\tcarte2 =listeCartesPossibles.get(random.nextInt(listeCartesPossibles.size()));\r\n\t\t\r\n\t\tplateau.setCartesSelectionnees(true);\r\n\t}", "public String choosenMenu() {\n String value = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(\"menu_id\");\n menu_id = Integer.parseInt(value);\n String user = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();\n if (user == null) {\n return \"choosenMenu\";\n } else {\n return \"chooseMenuUser\";\n }\n }", "public void connexionServeur() {\r\n\r\n\t\tString serverIp = JOptionPane\r\n\t\t\t\t.showInputDialog(\"Entrez le nom du serveur.\");\r\n\t\ttry {\r\n\t\t\tsocket = new Socket(serverIp, 4456);\r\n\t\t\tlogger.info(\"Connexion au socket serveur.\");\r\n\r\n\t\t\tThread t = new Thread(new EnvoiPresence(socket));\r\n\t\t\tt.start();\r\n\r\n\t\t\tThread t2 = new Thread(new ReceptionListUser(socket, mainView));\r\n\t\t\tt2.start();\r\n\r\n\t\t} catch (ConnectException e) {\r\n\t\t\tJOptionPane.showMessageDialog(new Frame(),\r\n\t\t\t\t\t\"Le serveur Draw Me An Idea n'est pas lancé\", \"Erreur\", 1);\r\n\t\t\tSystem.exit(0);\r\n\t\t} catch (UnknownHostException e) {\r\n\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "public void Pedircarnet() {\n\t\tSystem.out.println(\"solicitar carnet para verificar si es cliente de ese consultorio\");\r\n\t}", "public void caminar(){\n if(this.robot.getOrden() == true){\n System.out.println(\"Ya tengo la orden, caminare a la cocina para empezar a prepararla.\");\n this.robot.asignarEstadoActual(this.robot.getEstadoCaminar());\n }\n }", "public void estableceEquipoComputo() {\n\tsetDispositivo(JOptionPane.showInputDialog(\"Ingrese el nombre del dispositivo a adquirir\"));\n\tsetComercio(JOptionPane.showInputDialog(\"Ingrese el nombre del comercio donde lo comprara\"));\n}", "public void connectRobot(View view) {\n Button connectButton = (Button) view;\n LinearLayout robotInfo = (LinearLayout) findViewById(R.id.robotInfo);\n if (networkThread == null || !networkThread.connected()) {\n // Get IP from dropdown list\n Spinner dropdown = (Spinner) findViewById(R.id.robotsDropdown);\n String IP = (String) dropdown.getSelectedItem();\n if (IP == null) {\n return;\n }\n // Start thread with robot connection\n networkThread = NetworkThread.getInstance();\n networkThread.setIP(IP);\n networkThread.setHandler(handler);\n new Thread(networkThread).start();\n\n // Change button text and show robot info if connected\n if (networkThread != null && networkThread.connected()) {\n // Get info from the robot\n JSONObject json = new JSONObject();\n try {\n json.put(\"type\", \"info\");\n } catch (JSONException e) {\n e.printStackTrace();\n }\n networkThread.addToSend(json);\n\n connectButton.setText(\"Disconnect\");\n robotInfo.setVisibility(View.VISIBLE);\n }\n } else {\n // Close thread\n if (networkThread != null) {\n networkThread.closeThread();\n }\n // Change button text and hide robot info\n connectButton.setText(\"Connect\");\n robotInfo.setVisibility(View.INVISIBLE);\n }\n }", "public void chocoContraMunicion(IMunicion municion){}", "public void robotInit() {\n chooser = new SendableChooser();\n chooser.addDefault(\"Default Auto\", defaultAuto);\n chooser.addObject(\"My Auto\", customAuto);\n SmartDashboard.putData(\"Auto choices\", chooser);\n\n initialize();\n }", "public String chooseRole() {\n String[] roles = currentPlayer.getLocation().getRoleStrings();\n String result;\n if (currentPlayer.isComputer()) {\n // choose random role\n Random rand = new Random();\n int randInt = rand.nextInt(roles.length);\n result = roles[randInt];\n }\n else { // if current player is human\n // choose upgrade manually\n if(roles.length <= 0){\n view.showPopUp(currentPlayer.isComputer(), \"There are no more available roles on this card!\");\n result = \"\";\n }\n else{\n result = view.showRolePopUp(roles);\n }\n }\n\n\n return result;\n }", "private void showDetectedPresence(){\n AlertDialog.Builder box = new AlertDialog.Builder(SecurityActivity.this);\n box.setTitle(\"Attention!\")\n .setMessage(\"Le robot a détecté une présence\");\n\n box.setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n\n public void onClick(DialogInterface dialog, int which) {\n presenceDetectee.setValue(false);\n Intent intent = new Intent(SecurityActivity.this, JeuActivity.class);\n intent.putExtra(\"ROBOT\", robotControle);\n startActivity(intent);\n }\n }\n );\n box.show();\n //J'ai un problème de permissions, je la demande mais Android ne la demande pas...\n //Vibrator vib=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);\n //vib.vibrate(10000);\n }", "@Override\n public void teleopInit() {\n Robot.drive.setDefaultCommand(new DriveCommand());\n if (autonomousCommand != null) autonomousCommand.cancel();\n System.out.println(\"teleopInit being called\");\n \n }", "public String chooseNeighbor() {\n String[] neighbors = currentPlayer.getLocation().getNeighborStrings();\n String result;\n if (currentPlayer.isComputer()) {\n // choose random neighbor\n Random rand = new Random();\n int randInt = rand.nextInt(neighbors.length);\n result = neighbors[randInt];\n }\n else { // if current player is human\n // choose upgrade manually\n result = view.showMovePopUp(neighbors);\n }\n return result;\n }", "public InterfazDeUsuario(MotorDeCalculadora motor)\n {\n calc = motor;\n mostrandoAutor = true;\n hacerCuadro();\n frame.setVisible(true);\n }", "@Override\n\tpublic int takeStep() {\n\t\tif (porteroDerecho){\n\t\t\t\n\t\t\t// Si me alejor de la porteria, volver\n\t\t\tif (myRobotAPI.getPosition().x < 0.9)\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getOpponentsGoal().t);\n\t\t\t// Sino, ir a bloquear al portero\n\t\t\telse{\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getClosestOpponent().t);\n\t\t\t\t//myRobotAPI.blockGoalKeeper(); // JA! No bloquea, solo marea los robots!\n\t\t\t\t\n\t\t\t\t// Aņadido para que si tiene la pelota cerca, deje de bloquear e intente chutar\n\t\t\t\tif (myRobotAPI.closestToBall()){\n\t\t\t\t\tmyRobotAPI.setSteerHeading(balon.t);\n\t\t\t\t\tmyRobotAPI.setBehindBall(myRobotAPI.getOpponentsGoal());\n\t\t\t\t\tif (myRobotAPI.alignedToBallandGoal())\n\t\t\t\t\t\tmyRobotAPI.kick();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t// Sino, el portero a bloquear es el del campo izquierdo...\n\t\telse {\n\t\t\t// Si me alejor de la porteria, volver\n\t\t\tif (myRobotAPI.getPosition().x > -0.9)\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getOpponentsGoal().t);\n\t\t\t// Sino, ir a bloquear al portero\n\t\t\telse {\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getClosestOpponent().t);\n\t\t\t\t//myRobotAPI.blockGoalKeeper(); // JA! No bloquea, solo marea los robots!\n\t\t\t\t\n\t\t\t\t// Aņadido para que si tiene la pelota cerca, deje de bloquear e intente chutar\n\t\t\t\tif (myRobotAPI.closestToBall()){\n\t\t\t\t\tmyRobotAPI.setSteerHeading(balon.t);\n\t\t\t\t\tmyRobotAPI.setBehindBall(myRobotAPI.getOpponentsGoal());\n\t\t\t\t\tif (myRobotAPI.alignedToBallandGoal())\n\t\t\t\t\t\tmyRobotAPI.kick();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tmyRobotAPI.setSpeed(1.0);\t\t// Empotramos para bloquear xD\n\t\t\n\t\treturn 0;\n\t}", "public void robotInit() {\n\t\tmyRobot = new RobotDrive(0,1);\n\t\tteleop = new Teleop(myRobot);\n\t\tauto = new AutonomousDrive(myRobot);\n\t}", "public void mostrarLectura(TomarLectura tomarLectura, Lectura lecturaActual);", "public Coordinates choosePath(Actor robot) {\n\t\tCoordinates tempV = null;\n\t\tint tempDist = 0;\n\t\tboolean occupied = false;\n\t\ttempV = robot.getCoords();\n\t\tDirections dir = Directions.getDirection();\n\t\tswitch (dir) {\n\t\tcase RIGHT:\n\t\t\tdo {\n\t\t\t\ttempV = new Coordinates(tempV.getX() + 1, tempV.getY());\n\t\t\t\tif (gameWorld.isTileFree(tempV) == false) {\n\t\t\t\t\toccupied = true;\n\t\t\t\t\ttempV = new Coordinates(tempV.getX() - 1, tempV.getY());\n\t\t\t\t} else {\n\t\t\t\t\ttempDist = robot.getCoords().dst(tempV);\n\t\t\t\t\tif (tempDist == robot.getRange() - 1 || tempDist >= robot.getEnergy()) {\n\t\t\t\t\t\toccupied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} while (occupied != true);\n\t\t\tbreak;\n\t\tcase LEFT:\n\t\t\tdo {\n\t\t\t\ttempV = new Coordinates(tempV.getX() - 1, tempV.getY());\n\t\t\t\tif (gameWorld.isTileFree(tempV) == false) {\n\t\t\t\t\toccupied = true;\n\t\t\t\t\ttempV = new Coordinates(tempV.getX() + 1, tempV.getY());\n\t\t\t\t} else {\n\t\t\t\t\ttempDist = robot.getCoords().dst(tempV);\n\t\t\t\t\tif (tempDist == robot.getRange() - 1 || tempDist >= robot.getEnergy()) {\n\t\t\t\t\t\toccupied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (occupied != true);\n\t\t\tbreak;\n\t\tcase DOWN:\n\t\t\tdo {\n\t\t\t\ttempV = new Coordinates(tempV.getX(), tempV.getY() + 1);\n\t\t\t\tif (gameWorld.isTileFree(tempV) == false) {\n\t\t\t\t\toccupied = true;\n\t\t\t\t\ttempV = new Coordinates(tempV.getX(), tempV.getY() - 1);\n\t\t\t\t} else {\n\t\t\t\t\ttempDist = robot.getCoords().dst(tempV);\n\t\t\t\t\tif (tempDist == robot.getRange() - 1 || tempDist >= robot.getEnergy()) {\n\t\t\t\t\t\toccupied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (occupied != true);\n\t\t\tbreak;\n\t\tcase UP:\n\t\t\tdo {\n\t\t\t\ttempV = new Coordinates(tempV.getX(), tempV.getY() - 1);\n\t\t\t\tif (gameWorld.isTileFree(tempV) == false) {\n\t\t\t\t\toccupied = true;\n\t\t\t\t\ttempV = new Coordinates(tempV.getX(), tempV.getY() + 1);\n\t\t\t\t} else {\n\t\t\t\t\ttempDist = robot.getCoords().dst(tempV);\n\t\t\t\t\tif (tempDist == robot.getRange() - 1 || tempDist >= robot.getEnergy()) {\n\t\t\t\t\t\toccupied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (occupied != true);\n\t\t\tbreak;\n\t\t}\n\n\t\treturn tempV;\n\t}", "@Override\r\n\tpublic void simulate(long diffTime) {\n\t\tif(player1Selecionado && player2Selecionado){\r\n//\t\t\tSystem.out.println(\"passa para proxima tela \");\r\n\t\t\tController.getInstance().goToScreen(new LoadScreen(player1, player2, enderecoImage[player1], enderecoImage[player2]));\r\n\t\t}\r\n\r\n\r\n\t}", "Player getSelectedPlayer();", "public void robotInit() {\n\t\toi = new OI();\n\t\t\n\t\tteleopCommand = new TeleopCommand();\n }", "public abstract String getRobotUri();", "public void subeUsuario() {\n\t\tEditText nicknameText = (EditText) findViewById(R.id.nicknameEditText);\n\t\tstrNickname = nicknameText.getText().toString().trim();\n\t\t\n\t\tif (strNickname.equals(\"\")) {\n\t\t\tToast.makeText(this, \"Nickname no puede estar vacío\",Toast.LENGTH_LONG).show();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tguardarPreferences();\n\t\t\n\t\t//lanzamos un uploadService\n\t\tIntent uploadService = new Intent(getApplicationContext(),UploadUserService.class);\n\t\t\n\t\tuploadService.putExtra(\"id\", userId);\n\t\tuploadService.putExtra(\"nickname\", strNickname);\n\t\tuploadService.putExtra(\"mail\", strEmail);\n\t\tuploadService.putExtra(\"dob\", dayOfBirth);\n\t\tuploadService.putExtra(\"pass\", strPassword);\n\t\tuploadService.putExtra(\"genero\", gender);\n\t\tuploadService.putExtra(\"avatar\", strAvatar);\n\t\t\n\t\tstartService(uploadService);\n\t}", "public void turnoSistema(){\r\n if(tipo_simulacion == 2){\r\n JOptionPane.showMessageDialog(this.vc,\"Simulando acciones. . .\", \"Turno Sistema\", JOptionPane.INFORMATION_MESSAGE);\r\n }\r\n System.out.println(\"Turno: \"+ entrenador2.getNombre());\r\n if(evaluarAccion(this.pokemon_activo2, this.pokemon_activo1).equals(\"Cambiar\")){\r\n System.out.println(\"Sistema eligio Cambiar Pokemon\");\r\n pokemon_activo2.setConfuso(false);\r\n pokemon_activo2.setDormido(false);\r\n if(getEquipo2()[0].getDebilitado() == false && getEquipo2()[0]!=pokemon_activo2){\r\n pokemon_activo2 = getEquipo2()[0]; \r\n }\r\n else if(getEquipo2()[1].getDebilitado() == false && getEquipo2()[1]!=pokemon_activo2){\r\n pokemon_activo2 = getEquipo2()[1]; \r\n }\r\n else if(getEquipo2()[2].getDebilitado() == false && getEquipo2()[2]!=pokemon_activo2){\r\n pokemon_activo2 = getEquipo2()[2]; \r\n }\r\n else if(getEquipo2()[3].getDebilitado() == false && getEquipo2()[3]!=pokemon_activo2){\r\n pokemon_activo2 = getEquipo2()[3]; \r\n }\r\n else if(getEquipo2()[4].getDebilitado() == false && getEquipo2()[4]!=pokemon_activo2){\r\n pokemon_activo2 = getEquipo2()[4]; \r\n }\r\n else if(getEquipo2()[5].getDebilitado() == false && getEquipo2()[5]!=pokemon_activo2){\r\n pokemon_activo2 = getEquipo2()[5]; \r\n }\r\n vc.setjL_especie2(pokemon_activo2.getNombre_especie());\r\n vc.setjL_nombrepokemon2(pokemon_activo2.getPseudonimo());\r\n vc.setjL_vida_actual2(pokemon_activo2.getVida_restante(), pokemon_activo2.getVida());\r\n vc.setjL_Nivel2(pokemon_activo2.getNivel());\r\n setLabelEstados(0);\r\n setLabelEstados(1);\r\n this.turno = 0;\r\n if(tipo_simulacion == 2){\r\n JOptionPane.showMessageDialog(this.vc, \"Turno\"+\" \"+entrenador1.getNombre(), \"Tu Turno\", JOptionPane.INFORMATION_MESSAGE);\r\n }\r\n }\r\n else if(evaluarAccion(this.pokemon_activo2, this.pokemon_activo1).equals(\"Atacar\")){\r\n System.out.println(\"Sistema eligio Atacar\");\r\n inflingirDaño(pokemon_activo2.getMovimientos()[(int)(Math.random()*4)], pokemon_activo1, pokemon_activo2);\r\n if(pokemon_activo1.getVida_restante() <= 0){\r\n pokemon_activo1.setVida_restante(0);\r\n pokemon_activo1.setDebilitado(true);\r\n System.out.println(\"El Pokemon: \"+ pokemon_activo1.getPseudonimo()+\" se ha Debilitado\");\r\n JOptionPane.showMessageDialog(this.vc, \"El Pokemon: \"+ pokemon_activo1.getPseudonimo()+\" se ha Debilitado\", \"Debilitado\", JOptionPane.INFORMATION_MESSAGE);\r\n if(condicionVictoria(getEquipo1(), getEquipo2()) == true){\r\n JOptionPane.showMessageDialog(this.vc, \"El Ganador de este Combate es:\"+ entrenador2.getNombre(), \"Ganador\", JOptionPane.INFORMATION_MESSAGE);\r\n System.out.println(\"El Ganador de este Combate es:\"+ entrenador2.getNombre());\r\n System.out.println(equipo1[0].getVida_restante()+ \" \"+equipo1[1].getVida_restante()+ \" \"+equipo1[2].getVida_restante()+ \" \"+equipo1[3].getVida_restante()+ \" \"+equipo1[4].getVida_restante()+ \" \"+equipo1[5].getVida_restante());\r\n System.out.println(equipo2[0].getVida_restante()+ \" \"+equipo2[1].getVida_restante()+ \" \"+equipo2[2].getVida_restante()+ \" \"+equipo2[3].getVida_restante()+ \" \"+equipo2[4].getVida_restante()+ \" \"+equipo2[5].getVida_restante());\r\n JOptionPane.showMessageDialog(this.vc, equipo1[0].getVida_restante()+ \" \"+equipo1[1].getVida_restante()+ \" \"+equipo1[2].getVida_restante()+ \" \"+equipo1[3].getVida_restante()+ \" \"+equipo1[4].getVida_restante()+ \" \"+equipo1[5].getVida_restante()+\"\\n\"+ equipo2[0].getVida_restante()+ \" \"+equipo2[1].getVida_restante()+ \" \"+equipo2[2].getVida_restante()+ \" \"+equipo2[3].getVida_restante()+ \" \"+equipo2[4].getVida_restante()+ \" \"+equipo2[5].getVida_restante(), \"Estadisticas finales(vida)\", JOptionPane.INFORMATION_MESSAGE);\r\n vc.dispose();\r\n vpc.dispose();\r\n combate.setGanador(entrenador2);\r\n combate.setPerdedor(entrenador1);\r\n this.termino = true;\r\n }\r\n else if(getEquipo1()[0].getDebilitado() == false){\r\n pokemon_activo1 = getEquipo1()[0]; \r\n }\r\n else if(getEquipo1()[1].getDebilitado() == false){\r\n pokemon_activo1 = getEquipo1()[1]; \r\n }\r\n else if(getEquipo1()[2].getDebilitado() == false){\r\n pokemon_activo1 = getEquipo1()[2]; \r\n }\r\n else if(getEquipo1()[3].getDebilitado() == false){\r\n pokemon_activo1 = getEquipo1()[3]; \r\n }\r\n else if(getEquipo1()[4].getDebilitado() == false){\r\n pokemon_activo1 = getEquipo1()[4]; \r\n }\r\n else if(getEquipo1()[5].getDebilitado() == false){\r\n pokemon_activo1 = getEquipo1()[5]; \r\n } \r\n vc.setjL_nombrepokemon1(pokemon_activo1.getPseudonimo());\r\n vc.setjL_especie1(pokemon_activo1.getNombre_especie());\r\n }\r\n vc.setjL_especie1(pokemon_activo1.getNombre_especie());\r\n vc.setjL_nombrepokemon1(pokemon_activo1.getPseudonimo());\r\n vc.setjL_vida_actual1(pokemon_activo1.getVida_restante(), pokemon_activo1.getVida());\r\n vc.setjL_Nivel1(pokemon_activo1.getNivel());\r\n setLabelEstados(0);\r\n setLabelEstados(1);\r\n this.turno = 0;\r\n if(tipo_simulacion == 2){\r\n JOptionPane.showMessageDialog(this.vc, \"Turno\"+\" \"+entrenador1.getNombre(), \"Tu Turno\", JOptionPane.INFORMATION_MESSAGE);\r\n }\r\n }\r\n \r\n }", "public void robotInit() {\n\n }", "public void robotInit() {\n\n }", "@Override\n\tpublic void robotInit() {\n\t\toi = new OI();\n\t\t\n\t\t// chooser.addObject(\"My Auto\", new MyAutoCommand());\n\t\tSmartDashboard.putData(\"Auto mode\", chooser);\n\t\tSystem.out.println(\"I am here\");\n\t\ttopRight = new CANTalon(1);\n\t\tmiddleRight = new CANTalon(3);\n\t\tbottomRight = new CANTalon(2);\n\t\ttopLeft = new CANTalon(5);\n\t\tmiddleLeft = new CANTalon(6);\n\t\tbottomLeft = new CANTalon(7);\n\t\tclimber = new CANTalon(4);\n\t\tshifter = new DoubleSolenoid(2,3);\n\t\tshifter.set(Value.kForward);\n\t\tbucket= new DoubleSolenoid(0, 1);\n\t\tclimber.reverseOutput(true);\n\t\t//Setting Followers\n\t\t//topRight is Right Side Master (TalonSRX #1)0.062, 0.00062, 0.62)\n\t\t//middleRight.reset();\n//\t\tmiddleRight.setProfile(0);\n//\t\tmiddleRight.setPID( 0.0, 0.0, 0.0);//TODO: make multiple profiles\n\t\t\n//\t\tmiddleRight.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Absolute);\n//\t\tmiddleRight.setEncPosition(0);\n//\t\tmiddleRight.setAllowableClosedLoopErr(10);\n\t\tmiddleRight.reverseSensor(true);\n//\t\tmiddleRight.configNominalOutputVoltage(+0f, -0f);\n//\t\tmiddleRight.configPeakOutputVoltage(+12f, -12f);\n\t\ttopRight.changeControlMode(TalonControlMode.Follower);\n\t\ttopRight.set(middleRight.getDeviceID());\n\t\ttopRight.reverseOutput(true);\n\t\tbottomRight.changeControlMode(TalonControlMode.Follower); //TalonSRX #3\n\t\tbottomRight.set(middleRight.getDeviceID());\n//\t\tmiddleRight.setProfile(1);\n//\t\tmiddleRight.setPID( 0.0, 0.0, 0.0);\n\t\t//climber is the climber Motor (TalonSRX #4)\n\t\t//TopLeft is Right Side Master (TalonSRX #5)\n\t\t//middleLeft.reset();\n\t\t//middleLeft.setProfile(0);\n//\t\tmiddleLeft.setPID(0.0, 0.00, 0.0);\n//\t\tmiddleLeft.setEncPosition(0);\n//\t\tmiddleLeft.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Absolute);\n//\t\tmiddleLeft.configNominalOutputVoltage(+0f, -0f);\n//\t\tmiddleLeft.configPeakOutputVoltage(+12f, -12f);\n\t\tmiddleLeft.reverseSensor(false);\n//\t\tmiddleLeft.setAllowableClosedLoopErr(10);\n\t\ttopLeft.changeControlMode(TalonControlMode.Follower); //TalonSRX #6\n\t\ttopLeft.set(middleLeft.getDeviceID());\n\t\ttopLeft.reverseOutput(true);\n\t\tbottomLeft.changeControlMode(TalonControlMode.Follower); //TalonSRX #7\n\t\tbottomLeft.set(middleLeft.getDeviceID());\n//\t\tmiddleLeft.setProfile(1);\n//\t\tmiddleLeft.setPID(0, 0, 0);\n\t\t//Sensors\n\t\timu = new ADIS16448IMU();\n\t\tclimberSubsystem = new ClimberSubsystem();\n\t\tbucketSubsystem = new BucketSubsystem();\n\t\tdriveSubsystem = new DriveSubsystem();\n\t}", "public PreferredRemoteDialog( JFrame owner, Collection< Remote > preferredRemotes )\n {\n super( owner, \"Preferred Remotes\", true );\n createGui( owner, preferredRemotes );\n }", "@Override\n public NativeRobot getNativeRobot(GraphicsDevice screen) {\n return null;\n }", "public Direction getCorrectRobotDirection();", "private void enviarRequisicaoPerguntarNome() {\n try {\n String nome = NomeDialogo.nomeDialogo(null, \"Informe o nome do jogador\", \"Digite o nome do jogador:\", true);\n if (servidor.verificarNomeJogador(nome)) {\n nomeJogador = nome;\n comunicacaoServico.criandoNome(this, nome, \"text\");\n servidor.adicionarJogador(nome);\n servidor.atualizarLugares();\n } else {\n JanelaAlerta.janelaAlerta(null, \"Este nome já existe/inválido!\", null);\n enviarRequisicaoPerguntarNome();\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public interface RobotConnectionManager {\n RobotConnection getConnection();\n}", "public void findRobotPosition(){\n targetVisible = false;\n for (VuforiaTrackable trackable : allTrackables) {\n if (((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()) {\n telemetry.addData(\"Visible Target\", trackable.getName());\n targetVisible = true;\n\n // Get the position of the visible target and put the X & Y position in visTgtX and visTgtY\n // We will use these for determining bearing and range to the visible target\n OpenGLMatrix tgtLocation = trackable.getLocation();\n VectorF tgtTranslation = tgtLocation.getTranslation();\n visTgtX = tgtTranslation.get(0) / mmPerInch;\n visTgtY = tgtTranslation.get(1) / mmPerInch;\n //telemetry.addData(\"Tgt X & Y\", \"{X, Y} = %.1f, %.1f\", visTgtX, visTgtY);\n\n // getUpdatedRobotLocation() will return null if no new information is available since\n // the last time that call was made, or if the trackable is not currently visible.\n OpenGLMatrix robotLocationTransform = ((VuforiaTrackableDefaultListener)trackable.getListener()).getUpdatedRobotLocation();\n if (robotLocationTransform != null) {\n lastLocation = robotLocationTransform;\n }\n break;\n }\n }\n\n // Provide feedback as to where the robot is located (if we know).\n if (targetVisible) {\n // express position (translation) of robot in inches.\n VectorF translation = lastLocation.getTranslation();\n //telemetry.addData(\"Pos (in)\", \"{X, Y, Z} = %.1f, %.1f, %.1f\",\n // translation.get(0) / mmPerInch, translation.get(1) / mmPerInch, translation.get(2) / mmPerInch);\n\n // express the rotation of the robot in degrees.\n Orientation rotation = Orientation.getOrientation(lastLocation, EXTRINSIC, XYZ, DEGREES);\n //telemetry.addData(\"Rot (deg)\", \"{Roll, Pitch, Heading} = %.0f, %.0f, %.0f\", rotation.firstAngle, rotation.secondAngle, rotation.thirdAngle);\n\n // Robot position is defined by the standard Matrix translation (x and y)\n robotX = translation.get(0)/ mmPerInch;\n robotY = translation.get(1)/ mmPerInch;\n\n // Robot bearing (in +vc CCW cartesian system) is defined by the standard Matrix z rotation\n robotBearing = rotation.thirdAngle;\n\n // target range is based on distance from robot position to the visible target\n // Pythagorean Theorum\n targetRange = Math.sqrt((Math.pow(visTgtX - robotX, 2) + Math.pow(visTgtY - robotY, 2)));\n\n // target bearing is based on angle formed between the X axis to the target range line\n // Always use \"Head minus Tail\" when working with vectors\n targetBearing = Math.toDegrees(Math.atan((visTgtY - robotY)/(visTgtX - robotX)));\n\n // Target relative bearing is the target Heading relative to the direction the robot is pointing.\n // This can be used as an error signal to have the robot point the target\n relativeBearing = targetBearing - robotBearing;\n // Display the current visible target name, robot info, target info, and required robot action.\n\n telemetry.addData(\"Robot\", \"[X]:[Y] (Heading) [%5.0fin]:[%5.0fin] (%4.0f°)\",\n robotX, robotY, robotBearing);\n telemetry.addData(\"Target\", \"[TgtRange] (TgtBearing):(RelB) [%5.0fin] (%4.0f°):(%4.0f°)\",\n targetRange, targetBearing, relativeBearing);\n }\n else {\n telemetry.addData(\"Visible Target\", \"none\");\n }\n }", "@Override\r\n\tpublic void seleccionarPersona() {\n\t\t\r\n\t}", "@Test\n\tpublic void loginToMercury() {.withTimeout(7,TimeUnit.SECONDS)\n//\t\t\t\t.pollingEvery(750,TimeUnit.SECONDS)\n//\t\t\t\t.ignoring(NoSuchELementException.class);\n//\t\tWebElement e1 = (WebElement)fwait.until(\n//\t\t\t\tExpectedConditions.visibilityOfElementLocated(By.name(\"bobbert\")));\n//\t\t\t\t\n\t\t\n\t\tdriver.findElement(By.name(\"userName\")).sendKeys(\"bobbert\");\n\t\tdriver.findElement(By.xpath(\"//input[@name='password']\")).sendKeys(\"bobbert\");\n\t\tdriver.findElement(By.name(\"login\")).click();\n\t\tAssert.assertEquals(driver.getTitle(), \"Find a Flight: Mercury Tours:\");\n\t\t\n\t\t//This grabs a collection of elements\n\t\tList<WebElement> els = driver.findElements(By.name(\"tripType\"));\n\t\tfor(WebElement e: els) {\n\t\t\t\te.click();\n\t\t\t}\n\t\tdriver.findElement(By.name(\"findFlights\")).click();\n\t\tels = driver.findElements(By.name(\"outFlight\"));\n\t\tfor(WebElement e: els) {\n\t\t\te.click();\n\t\t}\n\t\tels = driver.findElements(By.name(\"inFlight\"));\n\t\tfor(WebElement e: els) {\n\t\t\te.click();\n\t\t}\n\t\tdriver.findElement(By.name(\"reserveFlights\")).click();\n\t\t//grab all items from a drop down list\n\t\tels = driver.findElements(By.xpath(\"//select[@name='cc_exp_dt_yr']/option\"));\n\t\tfor(WebElement e : els) {\n\t\t\te.click();\n\t\t\t\n\t\t\tif(ExpectedConditions.alertIsPresent().apply(driver)!=null) {\n\t\t\t\tdriver.switchTo().alert().accept();\n\t\t\t}\n\t\t\t\n\t\t\t//driver.getWindowHandles();\tgets unique ids for all open tabss\n\t\t\t//Useful for switching between the two\n\t\t}\n\t\t\n\t}", "public interface RobotConveyor {\n\n Robot createRobot();\n}", "public PreferredRemoteDialog( JDialog owner, Collection< Remote > preferredRemotes )\n {\n super( owner, \"Preferred Remotes\", true );\n createGui( owner, preferredRemotes );\n }", "public MecanumDrive(RobotMap opModeRobot){\n // initialize the hardware(pass in the opMode Robot map(instance) to this class in order to use it here)\n this.robot = opModeRobot;\n // This is all you need to do to initialize your hardware now when you have to call a motor just use robot.objectName.method\n }", "void grabarCliente(){\n RequestParams params = new RequestParams();\n params.put(\"nombre\",edtNombre.getText().toString().trim());\n params.put(\"apellido\",edtApellido.getText().toString().trim());\n params.put(\"correo\", edtCorreo.getText().toString().trim());\n String claveMD5 = edtClave.getText().toString().trim();\n try {\n params.put(\"clave\", ws.getMD5(claveMD5));\n } catch (Exception e) {\n e.printStackTrace();\n }\n params.put(\"id_cargo\",idCargo);\n params.put(\"autoriza\",validarCheckBoxAutoriza());\n crearUsuarioWS(params);\n }", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n //starts the dual cameras\n CameraServer.getInstance().startAutomaticCapture(0);\n CameraServer.getInstance().startAutomaticCapture(1);\n //auto start (disabled atm)\n //pressBoy.setClosedLoopControl(true);\n pressBoy.setClosedLoopControl(false);\n \n \n }", "public void interactuarCon(VehiculoMoto vehiculo) {\r\n Vehiculo nuevoVehiculo = VehiculoAuto.nuevoVehiculo(vehiculo);\r\n this.actualizarMovimiento(nuevoVehiculo, vehiculo);\r\n observador.cambiarVehiculo(nuevoVehiculo);\r\n Logger.instance.log(\"Cambio de vehiculo! Ahora es un auto.\\n\");\r\n }", "public void robotInit() \n {\n RobotMap.init();\n\n driveTrain = new DriveTrain();\n gripper = new Gripper();\n verticalLift = new VerticalLift();\n\n // OI must be constructed after subsystems. If the OI creates Commands \n //(which it very likely will), subsystems are not guaranteed to be \n // constructed yet. Thus, their requires() statements may grab null \n // pointers. Bad news. Don't move it.\n\n oi = new OI();\n\n autonomousChooser = new SendableChooser();\n autonomousChooser.addDefault( \"Auto: Do Nothing\" , new DoNothing () );\n autonomousChooser.addObject ( \"Auto: Drive To Auto Zone\" , new DriveToAutoZone () );\n autonomousChooser.addObject ( \"Auto: Drive To Auto Zone (Bump)\" , new DriveToAutoZoneBump () );\n //autonomousChooser.addObject ( \"Auto: Get One (Long)\" , new GetOneLong () );\n //autonomousChooser.addObject ( \"Auto: Get One (Short)\" , new GetOneShort () );\n //autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Bump)\" , new GetOneRecycleBin () );\n autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Side)\" , new GetRecycleBinSide () );\n //autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Backwards)\" , new GetOneRecycleBinBackwards () );\n //autonomousChooser.addObject ( \"Auto: Get One Recycle Bin (Backwards, Bump)\", new GetOneRecycleBinBackwardsBump() );\n //autonomousChooser.addObject ( \"Auto: Get Two (Short)\" , new GetTwoShort () );\n //autonomousChooser.addObject ( \"Auto: Get Two Short (Special)\" , new GetTwoShortSpecial () );\n //autonomousChooser.addObject ( \"Auto: Get Two (Long, From left)\" , new TwoLongFromLeft () );\n //autonomousChooser.addObject ( \"Auto: Get Two (Long, From right)\" , new TwoLongFromRight () );\n autonomousChooser.addObject ( \"Auto: Get One Tote and Recycle Bin\" , new OneRecycleBinAndTote () );\n autonomousChooser.addObject ( \"Auto: Get One Tote and Recycle Bin (Bump)\" , new OneRecycleBinAndToteBump () );\n SmartDashboard.putData( \"Autonomous\", autonomousChooser );\n\n // instantiate the command used for the autonomous period\n //autonomousCommand = new RunAutonomousCommand();\n\n m_USBVCommand = new UpdateSBValuesCommand();\n m_USBVCommand.start();\n \n frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);\n /*\n // the camera name (ex \"cam0\") can be found through the roborio web interface\n session = NIVision.IMAQdxOpenCamera(\"cam1\",\n NIVision.IMAQdxCameraControlMode.CameraControlModeController);\n NIVision.IMAQdxConfigureGrab(session);\n \n NIVision.IMAQdxStartAcquisition(session);\n */\n /*\n camServer = CameraServer.getInstance();//.startAutomaticCapture(\"cam1\");\n camServer.setQuality(30);\n \n cam = new USBCamera(\"cam1\");\n cam.openCamera();\n cam.setFPS(60);\n \n cam.setSize(320, 240);\n cam.updateSettings();\n */\n }", "@Given(\"^Użytkownik uruchamia strone serwisu$\")\n public void użytkownik_uruchamia_strone_serwisu() throws Throwable {\n\n System.setProperty(\"webdriver.chrome.driver\", \"E:\\\\mvnrepository.com\\\\chromeDriver_Wersja_83\\\\chromedriver.exe\");\n\n\n driver = new ChromeDriver();\n String url = \"https://www.mediaexpert.pl/\";\n driver.navigate().to(url);\n driver.manage().window().maximize();\n }", "public void robotInit() {\n // North.registerCommand(\"setSetpoint\", (params) -> ??, [\"Setpoint\"]);\n // North.registerCondition(\"atSetpoint\", elevator::atSetpoint);\n\n //NOTE: init(name, size, logic provider, drive & nav)\n North.init(/*NorthUtils.readText(\"name.txt\")*/ \"lawn chair\", 24/12, 24/12, drive);\n North.default_drive_controller = HoldController.I;\n\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n }", "private void valider() {\n\n\t\t/**\n\t\t * Renvoie un tableau de caractères qui sera transformé en chaine de caractère\n\t\t **/\n\n\t\tString passewordTraduit = new String(passeword.getPassword());\n\n\t\t/**\n\t\t * login.getText() récupère le contenu de la barre de saisie\n\t\t **/\n\t\t\n\t\tString user = login.getText();\n\t\tString passwd = passewordTraduit;\n\t\t/**\n\t\t *Permettra de savoir si la connexion à la BDD SQL c'est bien passée.\n\t\t */\n\t\tboolean reussite;\n\t\t/**\n\t\t * On va créer la BDD si elle n'existe pas\n\t\t */\n\t\t\n\t\treussite = Initialisation.getInstance().creerBDD(user, passwd);\n\t\t/**\n\t\t * On set le password et l'utilisateur pour que les paramètres de connexion soient les bons\n\t\t */\n\t\tInitialisation.getInstance().setPasswd(passwd);\n\t\tInitialisation.getInstance().setUser(user);\n\t\tModification.getInstance().setPasswd(passwd);\n\t\tModification.getInstance().setUser(user);\n\t\tif(reussite) {\n\t\t\t/**\n\t\t\t *Si tout c'est bien passé on regarde si l'utilisateur existe dans le fichier et dans le cas contraire on le crée.\n\t\t\t */\n\t\t\tif(personnesDejaInscrite.getInstance().getMaListDePersonneInscrite().get(user) == null) {\n\t\t\t\tpersonnesDejaInscrite.getInstance().getMaListDePersonneInscrite().put(user, new CompteAdministrateur(passwd));\n\t\t\t\tpersonnesDejaInscrite.getInstance().sauvegarder();\n\t\t\t}\n\t\t\tFenetreLogin.getInstance().dispose();\n\t\t\tFenetreFond.getInstance().changerFenetre(login.getText());\n\t\t\t/**\n\t\t\t *On remet les champs à nul pour que quand on se déconnecte on est pas le login et le mot de passe de l'utilisateur précédent.\n\t\t\t */\n\t\t\tlogin.setText(\"\");\n\t\t\tpasseword.setText(\"\");\n\t\t}\n\t\n\t}" ]
[ "0.63033044", "0.5788918", "0.57661396", "0.5765985", "0.57523954", "0.56772375", "0.56584436", "0.5628418", "0.5387287", "0.5366041", "0.533058", "0.53085196", "0.52764285", "0.5276126", "0.5267299", "0.5258852", "0.5248387", "0.523751", "0.52346045", "0.52333164", "0.52234787", "0.5219472", "0.5207085", "0.520362", "0.52020806", "0.5201583", "0.5196996", "0.5183666", "0.5171637", "0.51565707", "0.51547134", "0.51506793", "0.5135767", "0.5129892", "0.51192194", "0.5107119", "0.5104703", "0.50928444", "0.5090425", "0.5088496", "0.50808954", "0.50805485", "0.50776726", "0.5076283", "0.50561374", "0.5045233", "0.5026153", "0.5014364", "0.50108886", "0.5004145", "0.5000722", "0.49740273", "0.49709293", "0.49709293", "0.49705702", "0.49674934", "0.4947355", "0.49397", "0.4937352", "0.4934483", "0.4925109", "0.49224496", "0.49221325", "0.4916526", "0.49097052", "0.4904671", "0.4900698", "0.4897636", "0.48945683", "0.4893747", "0.48902023", "0.48867515", "0.48801252", "0.48703697", "0.48609546", "0.48588967", "0.48585796", "0.48574498", "0.48541757", "0.48517358", "0.48517358", "0.48507902", "0.4842869", "0.48424226", "0.4841062", "0.48366117", "0.48296776", "0.48291206", "0.482668", "0.48266187", "0.48206195", "0.4812246", "0.48120418", "0.48107627", "0.48102915", "0.48102275", "0.48088408", "0.4808658", "0.48085776", "0.48056817" ]
0.6799428
0
Retourne le numero de l'equipe.
public int getEquipe() { return this.equipe; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Equipe getEquipe() {\r\n\t\treturn this.equipe;\r\n\t}", "public Equipe getEquipe() {\n return equipe;\n }", "public int getNumero() {\n\t\treturn numero;\n\t}", "public int getNumero() {\n\t\treturn numero;\n\t}", "public int getNumero() {\n\t\treturn numero;\n\t}", "public int getNumEquips() {\n\t\treturn (n_equips);\n\t}", "private int getNumero() {\n\t\treturn numero;\n\t}", "public int getPartieEntier() {\n return partieEntier;\n }", "public int getNumero() {\n return numero;\n }", "public int getNumeroEstudio() { return this.numeroEstudio; }", "public int getNumero() {\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"getNumero() - start\");\n\t\t}\n\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"getNumero() - end\");\n\t\t}\n\t\treturn numero;\n\t}", "public int getIva() {\n\t\treturn producto.getIva();\n\t}", "public int numeroOcupado() {\n int i = 0;\n for (Map.Entry e : lista.entrySet()) {\n Equipamento eq = (Equipamento) e.getValue();\n if (eq.getEstado().equals(\"Ocupado\"))\n i++;\n }\n return i;\n }", "public String getPremierNumeroLibre() {\n\t\tString requete_s = \"SELECT id from LIVRES\";\n\t\tint i = 0;\n\t\tboolean egalite = true;\n\t\t\n\t\ttry{\n\t\t\trequete.execute(requete_s);\n\t\t\t\n\t\t\tResultSet rs = requete.getResultSet();\n\t\t\t\n\t\t\tdo{\n\t\t\t\ti++;\n\t\t\t\trs.next();\n\t\t\t\tegalite = (i ==((Integer) rs.getObject(1)));\n\t\t\t}while(egalite);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tString s = \"\" + i;\n\t\t\n\t\treturn s;\n\t}", "public int getNumer()\n\t{\n\t\treturn numer;\n\t}", "public int getQuantidade() {\r\n\t\treturn quantidade;\r\n\t}", "public int getIncrementoInteligencia() {\n\t\treturn incrementoInteligencia;\n\t}", "private int getNum(EngClass ec) {\n\t\treturn engClassService.getStuNum(ec);\n\t}", "public java.lang.String getCivNo () {\n\t\treturn civNo;\n\t}", "public int getQuantite() {\r\n return quantite;\r\n }", "public int getNumero() { return this.numero; }", "public int getVariete() {\n return repartition.getVariete();\n }", "public int getNum() {\n\t\treturn num;\n\t}", "public int getNum()\n {\n return num;\n }", "public int getNum()\n {\n return num;\n }", "int getEInt();", "public int getPartieFractionnaire() {\n return partieFractionnaire;\n }", "public Integer getNum() {\n return num;\n }", "public Integer getNum() {\n return num;\n }", "public int getNum() {\r\n return num;\r\n }", "public int getNiveau() {\r\n return niveau;\r\n }", "public Integer getIdexpediente() {\r\n return idexpediente;\r\n }", "public java.lang.Integer getNum () {\r\n\t\treturn num;\r\n\t}", "public int getComienza() {\n\t\treturn comienza;\n\t}", "public java.lang.Long getPeti_numero();", "public java.lang.Long getPeti_numero();", "public int getQuantidade() {\r\n return quantidade;\r\n }", "public int getQuantidade() {\r\n return quantidade;\r\n }", "public String getNum() {\r\n return num;\r\n }", "public int getQuantidade() {\n return quantidade;\n }", "public String getNum() {\n return num;\n }", "public String getNum() {\n return num;\n }", "public int getArtikelNummer() {\r\n\t\treturn artikelNummer;\r\n\t}", "public int valeurPiece() {\n return 3;\n }", "public int getCelular() {\n return celular;\n }", "public String getNumeroPiso() {\r\n return numeroPiso;\r\n }", "public int getNumeroVuelos() {\r\n\t\treturn vuelos.size();\r\n\t}", "public static int getVelocidade() {\n return velocidade;\n }", "int getQuantity();", "public int getQuantidade();", "public int getPresentacion() {\n\t\treturn producto.getPresentacion();\n\t}", "public int getNumber(String comm){\n try{\n return comando.get(comm);\n } catch(Exception e){\n return -1;\n }\n }", "public int obtenerSiguienteNumeroOrden() {\n try {\n controlOC = new ControlOrdenCompra();\n bitacora.info(\"Registro OrdenCompra Iniciado correctamente\");\n } catch (IOException ex) {\n bitacora.error(\"No se pudo iniciar el registro OrdenCompra por \" + ex.getMessage());\n }\n return controlOC.obtenerSiguienteNumeroOrden();\n }", "public EquatorialCoordinates equatorialPos() {\n return equatorialPos;\n }", "public Integer getCommodityQuantity() {\n return commodityQuantity;\n }", "public org.hl7.fhir.Integer getQuantity()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.hl7.fhir.Integer target = null;\n target = (org.hl7.fhir.Integer)get_store().find_element_user(QUANTITY$10, 0);\n if (target == null)\n {\n return null;\n }\n return target;\n }\n }", "public int Getoccupe(){\n\t\treturn occupe;\n\t}", "public int getNum() throws RemoteException {\n\t\treturn 0;\r\n\t}", "public int getNumber() {\n\t\treturn i;\r\n\t}", "public int getNumero(int index){\r\n\t\treturn numeros.get(index);\r\n\t}", "@Override\n\tpublic int getQuantidade() {\n\t\treturn hamburguer.getQuantidade();\n\t}", "public BigDecimal getIdExpediente() {\r\n return idExpediente;\r\n }", "public String getInventoryCod() {\n return (String)getAttributeInternal(INVENTORYCOD);\n }", "public int getNum() {\n return this.num;\n }", "public final int getNbVie() {\n return nbVie;\n }", "public int getEquipmentCount() {\r\n\t\tint ret = 0;\r\n\t\tPerson p = model.getData();\r\n\t\tif ( p!=null ) {\r\n\t\t\tret = p.getEquipmentCount();\r\n\t\t}\r\n\t\treturn ret;\r\n\t}", "public static int getSuiteRoomNumber() throws Exception {\n\t\tSystem.out.println (\"Choisissez un numéro de chambre parmis celles proposées\");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint roomNumber = scan.nextInt();\n\t\tBoolean numberExist = null;\n\t\t for(SuiteRoom elem: suiteroom)\n\t {\n\t \t if(roomNumber == elem.getIdRoom()) {\n\t \t\t numberExist = true;\n\t \t\t break;\n\t \t } else {\n\t \t\t numberExist = false;\n\t \t }\n\t \t\n\t }\n\t\t if(!numberExist) {\n\t\t\t System.out.println(\"Le numéro de chambre n'existe pas\");\n\t\t\t throw new Exception();\n\t\t }\n\t\t System.out.println(\"Le numéro de chambre est bien\");\n\t\t return roomNumber;\n\t}", "public int getNumEspacios() {\r\n\t\treturn numEspacios;\r\n\t}", "public int getPosicionCero(){\n\t\tint posicionDelCero = -1;\n\t\tint i = 0;\n\t\twhile(i < celdas.size()){\n\t\t\tif(celdas.get(i).getValor() == 0){\n\t\t\t\tposicionDelCero = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\treturn posicionDelCero;\n\t}", "public String getInumber()\n\t{\n\t\treturn getInumber( getSession().getSessionContext() );\n\t}", "public static String getNum() {\n\tString num;\n\tnum = gameNum.getText();\n\treturn num;\n\n }", "public int getNumero(int index){\n\t\treturn numeros.get(index);\n\t}", "public int getValor() {\n\t\treturn this.valor;\n\t}", "private int obtenerCodigoPieza() {\n\t\tint resultado = 1;\n\t\ttry {\n\t\t\tXPathQueryService consulta = \n\t\t\t\t\t(XPathQueryService) \n\t\t\t\t\tcol.getService(\"XPathQueryService\", \"1.0\");\n\t\t\tResourceSet r = consulta.query(\"string(/piezas/pieza[last()]/@codigo)\");\n\t\t\tResourceIterator i = r.getIterator();\n\t\t\tif(i.hasMoreResources()) {\n\t\t\t\tString numero =i.nextResource().getContent().toString();\n\t\t\t\tif(!numero.equals(\"\"))\n\t\t\t\t\tresultado = Integer.parseInt(numero)+1;\n\t\t\t}\n\t\t} catch (XMLDBException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn resultado;\n\t}", "public int numeroTipo(String tipo) {\n int i = 0;\n for (Map.Entry e : lista.entrySet()) {\n Equipamento eq = (Equipamento) e.getValue();\n if(tipo == eq.getTipo())\n i++;\n }\n return i;\n }", "public int getTiempoEspera() {\n return tiempoEspera;\n }", "@Override\n public int getNbObjets() {\n return _listeEquipement.getNbMaxEq();\n }", "public int getNum();", "public int getIncrementoFuerza() {\n\t\treturn incrementoFuerza;\n\t}", "public int getNum() {\n\treturn this.n;\n }", "public int getEnergie() {\r\n\t\treturn energie;\r\n\t}", "public Number getSolineId() {\n return (Number)getAttributeInternal(SOLINEID);\n }", "public int getNumero()\r\n/* 190: */ {\r\n/* 191:202 */ return this.numero;\r\n/* 192: */ }", "public int getNumero() {\n return dado1;\n }", "public int getValor() {\n\t\treturn valor;\n\t}", "public Integer getQuantity();", "public int dameValor(C carta)\n\t{\n\t\tint n= carta.getNumero();\n\t\tif(n>=2 && n<=9)//el 10 no se usa\n\t\t\treturn n;\n\t\telse\n\t\t\treturn 10;\n\t\t\n\t}", "public int getC_UOM_Volume_ID() {\n\t\tInteger ii = (Integer) get_Value(\"C_UOM_Volume_ID\");\n\t\tif (ii == null)\n\t\t\treturn 0;\n\t\treturn ii.intValue();\n\t}", "public String getEngineNumber() {\n return engineNumber;\n }", "public Integer getIdExperienciaEducativa() {\r\n return idExperienciaEducativa;\r\n }", "Quantity getQuantity();", "long getQuantity();", "long getQuantity();", "public Integer getEquipId() {\n return equipId;\n }", "public Integer getId_inventario() {\r\n return id_inventario;\r\n }", "public int getNumOrdine() {\n\t\t\treturn numOrdine;\n\t\t}", "public int numeroTipoOcupado(String tipo) {\n int i = 0;\n for (Map.Entry e : lista.entrySet()) {\n Equipamento eq = (Equipamento) e.getValue();\n if(tipo == eq.getTipo() && eq.getEstado().equals(\"Ocupado\"))\n i++;\n }\n return i;\n }", "public String getArticleNo() {\n return (String)getAttributeInternal(ARTICLENO);\n }", "public String getArticleNo() {\n return (String)getAttributeInternal(ARTICLENO);\n }", "public java.lang.String getNumEvento() {\n\t\treturn numEvento;\n\t}" ]
[ "0.66064554", "0.63407916", "0.6300834", "0.6300834", "0.6300834", "0.62035984", "0.6191831", "0.6190789", "0.6174877", "0.61740977", "0.615955", "0.6153765", "0.61441827", "0.6001536", "0.59550476", "0.5940426", "0.59373415", "0.5934233", "0.59183365", "0.5916838", "0.5913213", "0.58975565", "0.5885506", "0.5857833", "0.5857833", "0.5856326", "0.5850154", "0.58480877", "0.58480877", "0.5846631", "0.58353627", "0.58310455", "0.5828957", "0.5822348", "0.58030957", "0.58030957", "0.5801815", "0.5801815", "0.5793249", "0.5780658", "0.57735026", "0.57735026", "0.575829", "0.57467455", "0.5742838", "0.57342756", "0.57335055", "0.5732326", "0.57151973", "0.5703807", "0.57032186", "0.5698625", "0.5697917", "0.56948584", "0.56927806", "0.5692384", "0.5691438", "0.56752616", "0.5670165", "0.5668301", "0.5666136", "0.566338", "0.5662503", "0.5653949", "0.5643995", "0.5643642", "0.5643597", "0.5636963", "0.5636514", "0.56363606", "0.563224", "0.5625982", "0.5623144", "0.5616493", "0.5609634", "0.5609488", "0.5608099", "0.56072414", "0.55933696", "0.5590837", "0.558888", "0.55821776", "0.5574732", "0.55691963", "0.5567409", "0.5561866", "0.55618525", "0.55578536", "0.55561256", "0.55493414", "0.55447906", "0.5543202", "0.5543202", "0.5541921", "0.5532996", "0.55307996", "0.55149174", "0.55144536", "0.55144536", "0.5514244" ]
0.764898
0
Retourne vrai si le joueur a perdu (ie n'a plus de robots)
public boolean perdu() { return this.robots.isEmpty(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean tienePapel()\n {\n //COMPLETE\n return this.hojas > 0;\n }", "private void peliLoppuuUfojenTuhoamiseen() {\n if (tuhotut == Ufolkm) {\n ingame = false;\n Loppusanat = \"STEVE HOLT!\";\n }\n }", "@Override\n public boolean isFinished() {\n return Robot.auton && counter > 50;\n }", "public void atrapar() {\n if( una == false) {\n\t\tif ((app.mouseX > 377 && app.mouseX < 591) && (app.mouseY > 336 && app.mouseY < 382)) {\n\t\t\tint aleotoridad = (int) app.random(0, 4);\n\n\t\t\tif (aleotoridad == 3) {\n\n\t\t\t\tSystem.out.print(\"Lo atrapaste\");\n\t\t\t\tcambioEnemigo = 3;\n\t\t\t\tsuerte = true;\n\t\t\t\tuna = true;\n\t\t\t}\n\t\t\tif (aleotoridad == 1 || aleotoridad == 2 || aleotoridad == 0) {\n\n\t\t\t\tSystem.out.print(\"Mala Suerte\");\n\t\t\t\tcambioEnemigo = 4;\n\t\t\t\tmal = true;\n\t\t\t\tuna = true;\n\t\t\t}\n\n\t\t}\n }\n\t}", "public void carroNoAgregado(){\n System.out.println(\"No hay un parqueo para su automovil\");\n }", "public boolean kraj() {\r\n\t\treturn (broj_slobodnih == 0 && !mozeLiSeSpojiti());\r\n\t}", "public boolean takeControl() {\n\t\tif (Squirrel.us.getDistance() <= 30 && Squirrel.notDetected)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}", "public boolean voikoSulkea() {\n handleTallenna();\n return true;\n }", "private boolean correcto() {\r\n return (casillas.size()>numCasillaCarcel); //&&tieneJuez\r\n }", "public static void passerTour(){\n\t\tif(tour<jeu.getJoueurs().length){\n\t\t\ttour++;\n\t\t}\n\t\telse {\n\t\t\ttour = 1;\n\t\t}\n\t\tfor(int i=0;i<joueurElimine;i++){\n\t\t\tif(jeu.getJoueurs()[tour-1].getMonnaie()==0){\n\t\t\t\tif(tour<jeu.getJoueurs().length){\n\t\t\t\t\ttour++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttour = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private static boolean verifTapis(){\n\t\tint compte = 0;\n\t\tfor(int i = 0; i<jeu.getJoueurs().length; i++){\n\t\t\tif(jeu.getJoueurs()[i].getTapisRest()==0 || jeu.getJoueurs()[i].getMonnaie()==0){\n\t\t\t\tcompte++;\n\t\t\t}\n\t\t}\n\t\tif(compte == jeu.getJoueurs().length){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean isGameOverAutomatico() {\n\t\tif(this.getEquipesAtivas().size() == 1)\n\t\t\treturn true;\n\t\t\n\t\tboolean temCosmo = false;\n\t\tfor(Equipe equipe : this.getEquipesAtivas()){\n\t\t\tif(equipe.getCosmo() > 0){\n\t\t\t\ttemCosmo = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn !temCosmo;\n\t}", "boolean findRobot();", "public boolean estaLlena() {\n return (capacidad == top+1); // regresa verdadero si la capacidad es igual al tope (la cima +1)\r\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic boolean canSeeNemesisRobot() {\n\t\tboolean isVisible= false;\n\t\tList<Wall> walls = (List<Wall>) (List<?>) getEngine()\n\t\t\t\t.requestSimObject(simo -> (simo instanceof Wall) && (((Wall) simo).getType() == 2||((Wall) simo).getType() == 3));\n\t\tList<Bounds> bounds = new ArrayList<Bounds>();\n\t\tfor (Wall w : walls) {\n\t\t\tbounds.addAll(w.getBounds());\n\t\t}\n\n\t\t\n\t\tRobot bad = null;\n\t\tList<Robot> objets = (List<Robot>) (List<?>) getEngine().requestSimObject(simo -> (simo instanceof Robot) && (simo != getParent()));\n\n\t\tif (objets.size() == 1) {\n\t\t\tbad = objets.get(0);\n\t\t\t\n\t\t\t//on cr�e donc un cylindre entre les deux positions\n\t\t\t//on pourra afficher le cylindre dans la vue 3D\n\t\t\tCylinder lineOfSight = BorderAndPathGenerator.generateCylinderBetween(bad.getPosition(), Util.rectifi(positionR()));\n\t\t\tlineOfSight.setMaterial(new PhongMaterial(Color.AQUA));\n\n\t\t\t//le robot gentil ne peut pas voire le mauvais robot à plus de 15m \n\t\t\tif(lineOfSight.getHeight() < 10){\n\t\t\t\t\n\t\t\t\tisVisible = BorderAndPathGenerator.intervisibilityBetween(bad.getPosition(), Util.rectifi(positionR()),bounds);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\treturn isVisible;\n\t\t} else\n\t\t\treturn false;\n\n\t}", "public boolean isPerdu() {\n\t\tassert(f.getLevel() != null);\n\t\t\n\t\tLevel l = f.getLevel();\n\t\t\n\t\tif(l.getBall() == null) {//pour le menu principal -> pas de balle\n\t\t\treturn false;\n\t\t}\n\t\tif(l.getType() == Type.INVERSE) {\n\t\t\treturn l.getBall().getPosY()<50;//en haut de l'ecran\n\t\t}else {\n\t\t\treturn l.getBall().getPosY()>f.getHauteurFenetre()-50;//en bas de l'ecran\n\t\t}\n\t}", "@Override\r\n\tpublic boolean lancar(Combativel origem, Combativel alvo) {\r\n DadoVermelho dado = new DadoVermelho();\r\n int valor = dado.jogar();\r\n if(valor < origem.getInteligencia()) {\r\n alvo.defesaMagica(dano);\r\n return true;\r\n }\r\n else {\r\n \tSystem.out.println(\"Voce nao conseguiu usar a magia\");\r\n }\r\n return false;\r\n }", "public boolean PilaLlena()\n {\n if(this.tope == this.max)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public boolean prestamo(){\n boolean prestado = true;\n if (cantPres < cantLibro) {\n cantPres++;\n } else {\n prestado = false;\n }\n return prestado;\n }", "protected boolean isFinished() {\n //\tif(OI.joystickOne.getPOV() == 180){\n \t\t//return true;\n \t//\n \t\t\t\n return false;\n }", "public boolean souvislost(){\n\t\t\n\t\tif(pole.size() != pocetVrcholu){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t\t\n\t}", "public boolean canGameStart() {\n\t\tif (users.getSize() >= quantidadeDeJogadoresMinimos) {\n\t\t\t// Jogo pode comešar\n\t\t\treturn true;\n\n\t\t}\n\t\t// Jogo nao pode comešar\n\t\treturn false;\n\t}", "public boolean jeu() {\n int k;\n\n String compJoueur = \"\";\n String compOrdi = \"\";\n String reponse;\n\n boolean victoireJoueur = false;\n boolean victoireOrdi = false;\n String mystJoueur = challenger.nbMystere(); /**nb que le joueur doit trouver*/\n String mystOrdi = defenseur.nbMystere(); /**nb que l'ordinateur doit trouver*/\n String propOrdi = defenseur.proposition(); /**ordinateur genere un code aleatoire en premiere proposition*/\n log.info(\"Proposition ordinateur : \" + propOrdi); /**afficher proposition ordinateur*/\n String propJoueur = \"\";\n String goodResult = MethodesRepetitives.bonResultat();\n\n\n for (k = 1; !victoireJoueur && !victoireOrdi && k <= nbEssais; k++) { /**si ni le joueur ou l'ordinateur n'ont gagne et si le nombre d'essais n'est pas atteind, relancer*/\n\n compOrdi = MethodesRepetitives.compare(mystOrdi, propOrdi); /**lancer la methode de comparaison du niveau defenseur*/\n log.info(\"Reponse Ordinateur :\" + compOrdi); /**afficher la comparaison*/\n propJoueur = challenger.proposition(); /**demander une saisie au joueur selon le mode challenger*/\n compJoueur = MethodesRepetitives.compare(mystJoueur, propJoueur); /**comparer selon le mode challenger*/\n log.info(\"Reponse Joueur :\" + compJoueur); /**afficher la comparaison*/\n\n if (compOrdi.equals(goodResult)) { /**si l'ordinateur a gagne, changement de la valeur victoireOrdi*/\n victoireOrdi = true;\n }else if(compJoueur.equals(goodResult)) {/**si le joueur a gagne changement de la valeur victoireJoeur*/\n victoireJoueur = true;\n } else if (k < nbEssais) { /**sinon redemander un code a l'ordinateur selon les symboles de comparaison*/\n propOrdi = defenseur.ajuste(propOrdi, compOrdi);\n log.info(\"Proposition Ordinateur :\" + propOrdi);\n }\n }\n\n if (victoireOrdi || !victoireJoueur)/**si l'ordinateur ou le joueur perdent alors perdu sinon gagne*/\n victoireJoueur = false;\n else\n victoireJoueur = true;\n\n return victoireJoueur;\n\n\n }", "public boolean Victoria(){\n boolean respuesta=false;\n if(!(this.palabra.contains(\"-\"))&& this.oportunidades>0 && !(this.palabra.isEmpty())){\n this.heGanado=true;\n respuesta=true;\n }\n return respuesta;\n }", "protected boolean isFinished() {\n \tif(Math.abs(Robot.driveTrain.getHeading() - targetDirection) < 2) {\n \t\treturn true;\n \t} else {\n \t\treturn false;\n \t}\n }", "public boolean tienePrepaga() {\r\n\t\treturn obraSocial != null;\r\n\t}", "@Override\n\tpublic boolean takeControl() {\n\t\treturn (Math.abs(Motor.A.getTachoCount() - Settings.motorAAngle) > 5 || (Motor.A.getTachoCount() == 0 && Settings.motorAAngle == -90));\n\t}", "@Override\n\tpublic boolean paie() {\n\n\t\treturn true;\n\t}", "public boolean exitoRobotReal(){\n\t\tboolean exito = false;\n\t\t\n\t\tif(this.angulo_actual>=this.angulo_final){\n\t\t\texito = true;\n\t\t\tthis.angulo_actual = 0;\n\t\t} else{\n\t\t\t/* Sumar el angulo a razon del factor */\n\t\t\tthis.angulo_actual = this.angulo_actual + this.factor;\n\t\t}\n\t\t\n\t\treturn exito;\n\t}", "public static int isJoueurTour(GroupCreature player) {\n for(int i = 0; i < player.getGroupCreature().size();i++){\n if(player.getGroupCreature().get(i).getTour() >= 100){\n return i;\n }\n }\n return -1;\n }", "public void ispisiSveNapomene() {\r\n\t\tint i = 0;// redni broj napomene\r\n\t\tint brojac = 0;\r\n\t\tfor (Podsjetnik podsjetnik : lista) {\r\n\r\n\t\t\ti++;\r\n\t\t\tSystem.out.println(i + \")\" + podsjetnik);\r\n\t\t\tbrojac = i;\r\n\t\t}\r\n\t\tif (brojac == 0) {\r\n\t\t\tSystem.out.println(\"Nema unesenih napomena!!\");\r\n\t\t}\r\n\r\n\t}", "public boolean PilaVacia()\n {\n if(tope == 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public void hallarPerimetroIsosceles() {\r\n this.perimetro = 2*(this.ladoA+this.ladoB);\r\n }", "@Override\n\tpublic int takeStep() {\n\t\tif (porteroDerecho){\n\t\t\t\n\t\t\t// Si me alejor de la porteria, volver\n\t\t\tif (myRobotAPI.getPosition().x < 0.9)\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getOpponentsGoal().t);\n\t\t\t// Sino, ir a bloquear al portero\n\t\t\telse{\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getClosestOpponent().t);\n\t\t\t\t//myRobotAPI.blockGoalKeeper(); // JA! No bloquea, solo marea los robots!\n\t\t\t\t\n\t\t\t\t// Aņadido para que si tiene la pelota cerca, deje de bloquear e intente chutar\n\t\t\t\tif (myRobotAPI.closestToBall()){\n\t\t\t\t\tmyRobotAPI.setSteerHeading(balon.t);\n\t\t\t\t\tmyRobotAPI.setBehindBall(myRobotAPI.getOpponentsGoal());\n\t\t\t\t\tif (myRobotAPI.alignedToBallandGoal())\n\t\t\t\t\t\tmyRobotAPI.kick();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t// Sino, el portero a bloquear es el del campo izquierdo...\n\t\telse {\n\t\t\t// Si me alejor de la porteria, volver\n\t\t\tif (myRobotAPI.getPosition().x > -0.9)\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getOpponentsGoal().t);\n\t\t\t// Sino, ir a bloquear al portero\n\t\t\telse {\n\t\t\t\tmyRobotAPI.setSteerHeading(myRobotAPI.getClosestOpponent().t);\n\t\t\t\t//myRobotAPI.blockGoalKeeper(); // JA! No bloquea, solo marea los robots!\n\t\t\t\t\n\t\t\t\t// Aņadido para que si tiene la pelota cerca, deje de bloquear e intente chutar\n\t\t\t\tif (myRobotAPI.closestToBall()){\n\t\t\t\t\tmyRobotAPI.setSteerHeading(balon.t);\n\t\t\t\t\tmyRobotAPI.setBehindBall(myRobotAPI.getOpponentsGoal());\n\t\t\t\t\tif (myRobotAPI.alignedToBallandGoal())\n\t\t\t\t\t\tmyRobotAPI.kick();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tmyRobotAPI.setSpeed(1.0);\t\t// Empotramos para bloquear xD\n\t\t\n\t\treturn 0;\n\t}", "public void aumentarMinas(){\n\r\n if(espM==false){\r\n minascerca++;\r\n }\r\n }", "public boolean Llena(){\n return VectorPila.length-1==cima;\n }", "@Override\n public void subida(){\n // si es mayor a la eperiencia maxima sube de lo contrario no\n if (experiencia>(100*nivel)){\n System.out.println(\"Acabas de subir de nivel\");\n nivel++;\n System.out.println(\"Nievel: \"+nivel);\n }else {\n\n }\n }", "public boolean getComingMore() {\n return (comingVehicle+depoVehicle) <= getPart().intValue()+1;\n }", "public static void jouerAuJustePrix() {\n\t\tint nbVies=Tools.inputInt(\"Combien de tentatives voulez-vous ? \");\n\t\tint limite=Tools.inputInt(\"Quel est le nombre maximum à prendre en compte?\");\n\t\tint nbATrouver=Tools.randomint(limite);\n\t\tint nbPropose;\n\t\t\n\t\twhile (nbVies>0){\n\t\t\tnbPropose=Tools.inputInt(\"Saisissez un nombre : \");\n\t\t\tif (afficherResultatProposition(nbPropose, nbATrouver)) {\n\t\t\t\tbreak;\n\t\t\t};\n\t\t\tnbVies=nbVies-1;\n\t\t}\n\t\t\n\t\tif (nbVies==0) {\n\t\t\tSystem.out.println(\"Game Over\");\n\t\t}\n\t}", "protected boolean isFinished() {\n \treturn Robot.lift.isMotionMagicNearTarget() || totalTimer.get() > 5.0;\n }", "private void verificarMuerte() {\n if(vidas==0){\n if(estadoJuego==EstadoJuego.JUGANDO){\n estadoJuego=EstadoJuego.PIERDE;\n //Crear escena Pausa\n if(escenaMuerte==null){\n escenaMuerte=new EscenaMuerte(vistaHUD,batch);\n }\n Gdx.input.setInputProcessor(escenaMuerte);\n efectoGameOver.play();\n if(music){\n musicaFondo.pause();\n }\n }\n guardarPuntos();\n }\n }", "@Override\n protected boolean isFinished() {\n return (!drive.isRunning(Drivetrain.Follower.DISTANCE) && !drive.isRunning(Drivetrain.Follower.ANGLE));\n\n }", "public static boolean getEncerado() {\r\n\treturn (Math.random() >= 0.5);\r\n }", "public boolean isGoal() {\n return (man == 0);\n }", "private static boolean juega() {\r\n\t\tv.setMensaje( \"Empieza el nivel \" + nivel + \". Puntuación = \" + puntuacion + \r\n\t\t\t\". Dejar menos de \" + (tamanyoTablero-2) + \" pelotas de cada color. \" + (tamanyoTablero-1) + \" o más seguidas se quitan.\" );\r\n\t\t// v.setDibujadoInmediato( false ); // Notar la mejoría de \"vibración\" si se hace esto y (2)\r\n\t\twhile (!v.estaCerrada() && !juegoAcabado()) {\r\n\t\t\tPoint puls = v.getRatonPulsado();\r\n\t\t\tif (puls!=null) {\r\n\t\t\t\t// Pelota pelotaPulsada = hayPelotaPulsadaEn( puls, tablero ); // Sustituido por el objeto:\r\n\t\t\t\tPelota pelotaPulsada = tablero.hayPelotaPulsadaEn( puls );\r\n\t\t\t\tif (pelotaPulsada!=null) {\r\n\t\t\t\t\tdouble coordInicialX = pelotaPulsada.getX();\r\n\t\t\t\t\tdouble coordInicialY = pelotaPulsada.getY();\r\n\t\t\t\t\tv.espera(20); // Espera un poquito (si no pasa todo demasiado rápido)\r\n\t\t\t\t\t// Hacer movimiento hasta que se suelte el ratón\r\n\t\t\t\t\tPoint drag = v.getRatonPulsado();\r\n\t\t\t\t\twhile (drag!=null && drag.x>0 && drag.y>0 && drag.x<v.getAnchura() && drag.y<v.getAltura()) { // EN CORTOCIRCUITO - no se sale de los bordes\r\n\t\t\t\t\t\tpelotaPulsada.borra( v );\r\n\t\t\t\t\t\tpelotaPulsada.incXY( drag.x - puls.x, drag.y - puls.y );\r\n\t\t\t\t\t\tpelotaPulsada.dibuja( v );\r\n\t\t\t\t\t\trepintarTodas(); // Notar la diferencia si no se hace esto (se van borrando las pelotas al pintar otras que pasan por encima)\r\n\t\t\t\t\t\t// v.repaint(); // (2)\r\n\t\t\t\t\t\tpuls = drag;\r\n\t\t\t\t\t\tdrag = v.getRatonPulsado();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Recolocar pelota en un sitio válido\r\n\t\t\t\t\trecolocar( pelotaPulsada, coordInicialX, coordInicialY );\r\n\t\t\t\t\tquitaPelotasSiLineas( true );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpuntuacion -= (numMovimientos*PUNTOS_POR_MOVIMIENTO); // Se penaliza por el número de movimientos\r\n\t\tif (v.estaCerrada()) return false; // Se acaba el juego cerrando la ventana\r\n\t\tif (nivelPasado()) return true; // Se ha pasado el nivel\r\n\t\treturn false; // No se ha pasado el nivel\r\n\t}", "public boolean isJam() {\n boolean jam = false;\n if (sensor_door.getDistance(DistanceUnit.CM) < 100) {\n jam = true;\n RobotLog.vv(\"jam?\", \"TRUE\");\n }\n return jam;\n }", "public boolean muerteInesperada() {\n r = new Random();\r\n return Float.compare(r.nextFloat(), probMuerte) <= 0;\r\n }", "protected boolean isFinished() {\n \tif(timer.get()>.7)\n \t\treturn true;\n \tif(Robot.gearX==0)\n \t\treturn true;\n return (Math.abs(173 - Robot.gearX) <= 5);\n }", "public boolean darPerdio(){\r\n\t\treturn perdio;\r\n\t}", "@Override\n\tpublic boolean estPleine() {\n\t\treturn getNbClients()==capacite;\n\t}", "public boolean estPlein() {\n return this.tapis.size() == capacite;\n }", "private boolean jogadorTerminouAVez() {\n return this.terminouVez;\n }", "@Override\n public boolean isFinished() {\n// return false;\n return LightningMath.epsilonEqual(shooter.getFlywheelMotor1Velocity(), shooter.motor1setpoint, Constants.FLYWHEEL_EPSILON) &&\n LightningMath.epsilonEqual(shooter.getFlywheelMotor2Velocity(), shooter.motor2setpoint, Constants.FLYWHEEL_EPSILON) &&\n LightningMath.epsilonEqual(shooter.getFlywheelMotor3Velocity(), shooter.motor3setpoint, Constants.FLYWHEEL_EPSILON);\n }", "private void verificaVencedor(){\n\n // Metodo para verificar o vencedor da partida\n\n if(numJogadas > 4) {\n\n String vencedor = tabuleiro.verificaVencedor();\n\n vencedor = (numJogadas == tabuleiro.TAM_TABULEIRO && vencedor == null) ? \"Deu Velha!\" : vencedor;\n\n if (vencedor != null) {\n\n mostraVencedor(vencedor);\n temVencedor = true;\n\n }\n\n }\n\n }", "public boolean esmenor(){\n //este metodo no aplica en la resolución del caso de uso planteado\n //sólo sirve para determinar si el participante es menor de edad para \n //poner como obligatorio el campo nombreTutor de acuerdo a las reglas\n //del negocio.\n return false;\n }", "private boolean completouVolta(int jogador, int valorDados) {\n\n if ((this.posicoes[jogador] + valorDados) >= 40 && this.posicoes[jogador] != 40) {\n this.listaJogadores.get(jogador).addDinheiro(200);\n this.print(\"\\tGanha $200 por passar pela casa 40.\");\n return true;\n }\n return false;\n\n }", "protected boolean isFinished() {\n\t\tLiquidCrystal lcd = RobotMap.lcd;\n\n\t\tif(talonNum == 2 && Math.abs(RobotMap.chassisfrontLeft.getEncVelocity()) < 30){\n \t\tlcd.home();\n \t\tlcd.print(\"Talon2FL/SIM\");\n \t\tRobotMap.chassisfrontLeft.set(0);\n \t\t\n\t\t\t\n\t\t\treturn false;\n\t\t}else if(talonNum == 3 && Math.abs(RobotMap.chassisfrontRight.getEncVelocity()) < 30){\n\t\t\tlcd.home();\n \t\tlcd.print(\"Talon3FR/SIM\");\n \t\tRobotMap.chassisfrontRight.set(0);\n \t\t\n\t\t\t\n\t\t\treturn false;\n\t\t}else if(talonNum == 4 && Math.abs(RobotMap.chassisrearLeft.getEncVelocity()) < 30){\n \t\tlcd.home();\n \t\tlcd.print(\"Talon4RL/SIM\");\n \t\tRobotMap.chassisrearLeft.set(0);\n \t\t\n\t\t\t\n\t\t\treturn false;\n\t\t}else if(talonNum == 5 && Math.abs(RobotMap.chassisrearRight.getEncVelocity()) < 30){\n \t\tlcd.home();\n \t\tlcd.print(\"Talon5RR/SIM\");\n \t\tRobotMap.chassisrearRight.set(0);\n\t\t\t\n\t\t\treturn false;\n\t\t}else if(talonNum == 11 && RobotMap.climberclimbMotor.getOutputCurrent() < 2){\n \t\tlcd.home();\n \t\tlcd.print(\"Talon11Climber/SIM\");\n \t\tRobotMap.climberclimbMotor.set(0);\n\t\t\t\n\t\t\treturn false;\n\t\t}else if(talonNum == 12 && RobotMap.floorfloorLift.getOutputCurrent() < 2){\n \t\tlcd.home();\n \t\tlcd.print(\"Talon12Floor/SIM\");\n \t\tRobotMap.floorfloorLift.set(0);\n\t\t\t\n\t\t\treturn false;\n\t\t}else if(talonNum == 13 && RobotMap.acquisitionacquisitionMotor.getOutputCurrent() < 2){\n \t\tlcd.home();\n \t\tlcd.print(\"Talon13acq/SIM\");\n \t\tRobotMap.acquisitionacquisitionMotor.set(0);\n\t\t\t\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t\n\t}", "public boolean isRobot() {\n\t\treturn isRobot;\n\t}", "public boolean verRevelado(){\n\r\n return revelado;\r\n }", "@Override\n public boolean isFinished() {\n /* Need to convert distance travelled to degrees. The Standard\n Romi Chassis found here, https://www.pololu.com/category/203/romi-chassis-kits,\n has a wheel placement diameter (149 mm) - width of the wheel (8 mm) = 141 mm\n or 5.551 inches. We then take into consideration the width of the tires.\n */\n //double inchPerDegree = Math.PI * 5.551 / 360;\n // Compare distance travelled from start to distance based on degree turn\n\n if(counter == 4) {\n if(m_degrees != 0) {\n return m_drive.getGyroAngleZ() >= m_degrees - 7 && m_drive.getGyroAngleZ() <= m_degrees + 7;\n } else {\n return true;\n }\n } else {\n return false;\n }\n }", "public void verificar_que_se_halla_creado() {\n\t\t\n\t}", "void nearingTheWallBefore(){\n robot.absgyroRotation(0, \"absolute\");\n\n //alligning with the wall before going for the toy\n while(robot.leftDistanceSensor.getDistance(DistanceUnit.CM) > 15 && !isStopRequested()){\n if(robot.leftDistanceSensor.getDistance(DistanceUnit.CM) < 30)\n robot.mecanumMovement(0, .3, 0);\n else\n robot.mecanumMovement(0, .7, 0);\n\n telemetry.addLine(\"Distance from sensor: \" + robot.leftDistanceSensor.getDistance(DistanceUnit.CM));\n telemetry.update();\n }\n robot.mecanumMovement(0, 0, 0);\n\n robot.absgyroRotation(45, \"absolute\");\n }", "public int getCantidadRobots();", "public boolean estDetecteCoteGauche()\r\n\t{\n\t\treturn !this.detecteurGauche.get();\r\n\t}", "public boolean czyJestWykolejenie(){\r\n int losowy = (int) (Math.random() * 130) ;\r\n if (losowy <= szansaWykolejenia){\r\n System.out.println(\"Nastapilo wykolejenie tramwaju!\");\r\n return true;\r\n }\r\n else {\r\n System.out.println(\"Brak wykolejenia\");\r\n return false;\r\n }\r\n }", "boolean getMovimentoPassante();", "private static void tourJeu(){\n\n\t\twhile(true){\n\t\t\tconsole.afficherEtatJoueurs();\n\t\t\tpasserTour();\n\t\t\tconsole.quelJoueurJoue(tour);\n\t\t\tconsole.afficherJeu();\n\t\t\tconsole.afficherDirectionAssam();\n\n\t\t\tint n;\n\t\t\twhile ((n = console.demanderNbDeplacement()) == -1 );\n\n\t\t\tconsole.afficherDirectionChoisie(n);\n\t\t\tdemanderDeplacerAssam(n);\n\n\n\t\t\tif(joueurElimine == jeu.getJoueurs().length-1){\n\t\t\t\tpasserTour();\n\t\t\t\tconsole.afficherGagnant(tour);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(verifTapis()){\n\t\t\t\tstatistique();\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t}\n\t}", "public boolean podeAtuar() {\n\t\treturn this.ambiente.podeAtuar();\n\t}", "public static void miedo(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n aleatorio = (numeroAleatorio.nextInt(10-5+1)+5);\n \n if(oro>aleatorio){//condicion de finalizar battalla y sus acciones\n oroPerdido= (nivel*2)+aleatorio;\n oro= oro-oroPerdido;\n System.out.println(\"Huiste de la batalla!!!\");\n\t\t System.out.println(\"oro perdido:\"+oroPerdido);\n opcionMiedo=1; //finalizando battalla por huida del jugador \n }\n else{\n System.out.println(\"No pudes huir de la batalla\");\n } \n }", "public boolean estMort() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean isDanger() {\n\t\tSharedPreferences prefs = NotificationStack.context.getSharedPreferences(\"com.app.virtualguardian\", Context.MODE_PRIVATE); \n\t\tint distancia=pingGps(Latitud,Longitud);\n\t\tint distanciaAuto=pingCar();\n\t\tint maxPer = Integer.parseInt(prefs.getString(\"distanciaPersonal\",\"3000\")); \n\t\tint maxCar = Integer.parseInt(prefs.getString(\"distanciaAuto\",\"3000\"));\n\t\tif(distancia<=maxPer){\n\t\t\t//avisaamigos\n\t\t\tavisaAmigos(distancia);\n\t\t}\n\t\tif(distanciaAuto<=maxCar){\n\t\t\t//avisaauto\n\t\t\tavisaAuto(distanciaAuto);\n\t\t}\n\t\tif(distancia<=maxPer || distanciaAuto<=maxCar)return true;\n\t\treturn false;\n\t}", "public boolean verMina(){\n\r\n return espM;\r\n }", "public boolean gameWon(){\n\t\treturn Game.gameWon;\n\t}", "public boolean isGoal() {\n return humming() = 0;\n }", "public boolean mueveRobot(String idAgente,Coordenada coord){\n\t\treturn mueveAgente(idAgente,coord,\"Robot\");\n\t}", "protected boolean isFinished() {\n \n \tif(Math.abs(RobotMap.navx.getAngle() - this.desiredAngle) <=2) {\n \n \t\treturn true;\n \t}\n return false;\n }", "public boolean sucheMitspieler();", "public boolean helpForOne()\n {\n // Booléen de modification de la grille\n boolean update = false;\n \n // Valeurs déjà utilisées\n boolean val1 = false;\n boolean val2 = false;\n boolean val3 = false;\n boolean val4 = false;\n \n boolean retry;\n boolean all = (val1 && val2 && val3 && val4);\n \n Random r = new Random();\n int rand;\n \n\t\t// Tant qu'aucune modification n'a été faite, faire {...}\n while (!update && !all)\n {\n do\n {\n\t\t\t\t// Génération d'un entier aléatoire compris dans [0,4[ puis incrémentation pour obtenir [1,5[ (soit [1,4])\n rand = r.nextInt(4) + 1;\n\t\t\t\t\n // Booléen à vrai si toutes les valeurs sont utilisées\n all = (val1 && val2 && val3 && val4);\n\n // Booléen à vrai s'il existe un conflit (exemple : aléatoire tiré à 1 mais valeur 1 déjà utilisée) et qu'il reste des nombres non utilisés\n retry = !((rand == 1 && !val1) | (rand == 2 && !val2) | (rand == 3 && !val3) | (rand == 4 && !val4) | all);\n } while (retry);\n\t\t\t\n // Choix aléatoire de la direction de l'IA et mouvement dans cette direction\n switch (rand)\n {\n case 1:\n\t\t\t\t\tval1 = true;\n update = this.moveUp();\n break;\n case 2:\n val2 = true;\n update = this.moveDown();\n break;\n case 3:\n val3 = true;\n update = this.moveLeft();\n break;\n case 4:\n val4 = true;\n update = this.moveRight();\n break;\n default:\n break;\n }\n }\n \n\t\t// Ajout d'une case à la grille\n this.addCase();\n \n // Notification de la (non-)modification de la grille\n return update;\n }", "public int checkNoOfRapelPlayerHolds () { return noOfRapels; }", "public int puntoUno() {\n int contador = 0;\n for (int i = 0; i < jugadores.length; i++) {\n if (jugadores[i] != null && jugadores[i].getCantPartidosJugados() > 10) {\n contador++;\n }\n }\n return contador;\n }", "@Override\n protected boolean isFinished() {\n return timeSinceInitialized() > 0.5 && Robot.toteLifterSubsystem.isEjectorExtended();\n }", "boolean puedoHipotecar(Casilla casilla){\n //Para poder hipotecar la casilla tiene que ser propiedad del jugador.\n return this.esDeMipropiedad(casilla);\n }", "protected boolean isFinished() {\n \treturn (Robot.sonar.getDistance() <= distance);\n }", "private Boolean esMejor() {\n if(debug) {\n System.out.println(\"**********************esMejor\");\n }\n \n if(this.solOptima == null || (this.sol.pesoEmparejamiento < this.solOptima.pesoEmparejamiento)) return true;\n else return false;\n }", "@Override\n protected boolean isFinished() {\n if(direction){\n if(leftTarget <= Robot.driveTrain.getLeftEncoderDistanceInches() || rightTarget <= Robot.driveTrain.getRightEncoderDistanceInches()){\n turnPID.resetPID();\n return true;\n } else{\n return false;\n }\n \n } else{\n if(leftTarget >= Robot.driveTrain.getLeftEncoderDistanceInches() || rightTarget >= Robot.driveTrain.getRightEncoderDistanceInches()){\n turnPID.resetPID();\n return true;\n } else{\n return false;\n }\n }\n \n \n }", "public boolean gameWon(){\n return false;\n }", "public void venceuRodada () {\n this.pontuacaoPartida++;\n }", "private static boolean canMove() {\n return GameManager.getCurrentTurn();\r\n }", "private static void statistique(){\n\t\tfor(int i = 0; i<7; i++){\n\t\t\tfor(int j = 0; j<7; j++){\n\t\t\t\tfor(int l=0; l<jeu.getJoueurs().length; l++){\n\t\t\t\t\tif(jeu.cases[i][j].getCouleurTapis() == jeu.getJoueurs()[l].getNumJoueur()){\n\t\t\t\t\t\tjeu.getJoueurs()[l].setTapis(jeu.getJoueurs()[l].getTapisRest()+1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tJoueur j;\n\t\tSystem.out.println(\"// Fin de la partie //\");\n\t\tfor(int i=0; i<jeu.getJoueurs().length; i++) {\n\t\t\tj =jeu.getJoueurs()[i];\n\t\t\tSystem.out.println(\"Joueur \"+ (j.getNumJoueur()+1) + \" a obtenue \"+j.getTapisRest()+j.getMonnaie()+\" points\" );\n\t\t}\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn Math.abs(Robot.lidar.getRange() - range) < 2.0f;\n\t}", "public boolean estaVacia(){\n if(darTamanio==0){\n return true;\n } \n else{\n return false;\n }\n}", "private void inAvanti() {\n\t\tif (Game.getInstance().isOnGround) {\n\t\t\tjump=false;\n\t\t\tGame.getInstance().getPersonaggio().setStato(Protagonista.RUN);\n\t\t\tGraficaProtagonista.getInstance().cambiaAnimazioni(Protagonista.RUN);\n\t\t}\n\t}", "public String getRobot() {\n return nombre;\n }", "public abstract boolean interactionPossible(Robot robot);", "@Override\n\tpublic boolean paie() {\n\t\treturn false;\n\t}", "public void changerJoueur() {\r\n\t\t\r\n\t}", "public boolean Vacia (){\n return cima==-1;\n \n }", "protected boolean isFinished() {\n //return !RobotMap.TOTE_SWITCH.get();\n \treturn false;\n }", "private void nourrireLePeuple() {\n\t\t\tint totalDepense = (int)((population * 1) + (populationColoniale * 0.8) + ((armee + armeeDeployee()) * nourritureParArmee));\r\n\t\t\tnourriture -= totalDepense;\r\n\t\t\tenFamine = (nourriture > 0) ? false : true;\r\n\t\t}", "protected boolean isFinished() {\n\tif(this.motionMagicEndPoint >0) {\n \tif(Math.abs(RobotMap.motorLeftTwo.get() )< 0.09 && Math.abs(RobotMap.motorRightTwo.get() )> -0.09&& Timer.getFPGATimestamp()-starttime > 10) {\n \t\treturn true;\n \t}\n\t}\n\t\n return false;\n }" ]
[ "0.654093", "0.63986224", "0.6390034", "0.6225097", "0.60704106", "0.60651726", "0.60504735", "0.60203534", "0.60174227", "0.5984276", "0.5983541", "0.5973181", "0.5970853", "0.59576356", "0.59151584", "0.5909204", "0.5901821", "0.5883083", "0.5851736", "0.58427525", "0.5826813", "0.58266324", "0.58188164", "0.58113354", "0.5810601", "0.58062726", "0.5800237", "0.5784866", "0.5784692", "0.5779222", "0.57772976", "0.5770745", "0.57695633", "0.57660145", "0.575791", "0.5743336", "0.5740409", "0.57379425", "0.5736923", "0.5728462", "0.5710663", "0.57104814", "0.57035536", "0.5702992", "0.5695192", "0.56939083", "0.5692837", "0.56834394", "0.56819606", "0.56813645", "0.5671695", "0.5657748", "0.5655198", "0.5653866", "0.56438977", "0.56403345", "0.56358975", "0.5622847", "0.5611531", "0.55990714", "0.5598107", "0.5594912", "0.5588815", "0.5581161", "0.5579559", "0.5579531", "0.5578989", "0.55666494", "0.555971", "0.55554545", "0.5547323", "0.5541107", "0.55395746", "0.5531986", "0.5531918", "0.5531041", "0.5525325", "0.55243695", "0.5524209", "0.5519076", "0.5514932", "0.5511729", "0.55116826", "0.55058074", "0.5504993", "0.54977965", "0.54962415", "0.54872185", "0.5481082", "0.5471002", "0.5470303", "0.5466962", "0.546678", "0.5459788", "0.54589206", "0.5454484", "0.5452034", "0.54512596", "0.5447664", "0.5439445" ]
0.6536452
1
Affiche le nom de l'equipe, les noms des robots et les coordonnees de la base.
@Override public String toString() { String ans = this.nom + "\n" + this.coordBase.toString() + " \n Robots : \n"; for (Robot ro : this.robots) { ans += ro.toString() + "\n"; } return ans; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void printName()\n\t{\n\t\tArrayList<Robot> ar=new ArrayList<Robot>();\n\t\tIterator<Robot> it;\n\t\tint i=1;//started index\n\t\t\n\t\tar.addAll(robotHM.values());//adding all\n\t\tCollections.sort(ar);//sort by names\n\t\tit=ar.iterator();\n\t\twhile (it.hasNext())\n\t\t{\n\t\t\tSystem.out.println(i+\". \"+it.next().getName());\n\t\t\ti++;\n\t\t}\n\t}", "public String getRobot() {\n return nombre;\n }", "@Override\n public String toString() {\n return \"name: \"+this.name +\" \"+ this.surname +\" & posiotion: \"+ this.getPosition();\n }", "public String toString() {\n return \"Robot motors\";\n }", "@Override\r\n\tpublic String toString() {\r\n\t\tboolean isRobotPlaced = this.posX != -1 && this.posY != -1 && this.direction != null;\r\n\t\tif (!isRobotPlaced) {\r\n\t\t\treturn \"Output: ROBOT MISSING\";\r\n\t\t}\r\n\t\treturn \"Output: \" + this.posX + \", \" + this.posY + \", \" + this.direction;\r\n\t}", "public String toString() {\n String memory = super.toString();\n return memory + \"(\" + locations + \", \" + vehicles + \")\";\n }", "String getDepotname();", "public String toString() {\n //arena info\n String locations = \"The arena is \" + xSize + \" x \" + ySize;\n //pieces info\n for (Pieces d : drones) {\n locations += \"\\n\";\n locations += d.toString();\n }\n\n return locations;\n }", "@Override\n public String toString() {\n return \"CapteurVitesse(\"+sonRail+\",PositionSurRail:\"+positionSurRail+\")\";\n }", "private String getCords() {\n return current.getLocString();\n\n }", "void getDrivableLocations() {\n\t\t\tSystem.out.print(\"\\nPlaces you can drive to: \");\n\t\t\tfor (int i = 0; i < places.length; i++)\n\t\t\t\tif (places[i].drivable) //looks to see if you can drive there \n\t\t\t\t\tif ((places[i] != this)) //if it's not you're current location.\n\t\t\t\t\t\tSystem.out.print(places[i].locationName + \", \");\t//prints the name of the location\t\n\t\t\tSystem.out.println(\"\\n\");\n\t\t}", "public void torpedoInfo() {\r\n System.out.println(\"[\" + TiePilot.sep + \"]\");\r\n System.out.println(\"Cannon Model: \" + ModelNumber);\r\n System.out.println(\"Max Fire Range: \" + MaxFiringRange);\r\n System.out.println(\"Torpedo Cap: \" + TorpedoCapacity);\r\n System.out.println(\"Current Torpedo Count: \" + this.getCurrentTorpedoCount());\r\n System.out.println(\"[\" + TiePilot.sep + \"]\");\r\n }", "public String toString() {\r\n\t\treturn \"Ogirin=\"+this.getOrigin().toString()+\", Direction=\"+this.getDirection().toString();\r\n\t}", "public static String string() {\n\t\t\tString s = \"\";\n\t\t\ts += \"Locaux :\\n\";\n\t\t\tfor(String key : locaux.keySet()) {\n\t\t\t\tIdent i = locaux.get(key);\n\t\t\t\ts += key+\", \"+i.toString()+\"\\n\";\n\t\t\t}\n\t\t\ts += \"Globaux :\\n\";\n\t\t\tfor(String key : globaux.keySet()) {\n\t\t\t\tIdent i = globaux.get(key);\n\t\t\t\ts += key+\", \"+i.toString()+\"\\n\";\n\t\t\t}\n\n\t\t\treturn s;\n\t\t}", "private String vertexNamesAndCoordsToString() {\n \n //make empty string\n String s = \"\";\n \n //add # of vertices & line break\n s += N + \"\\n\";\n \n //for loop to add names/coords to it\n for (int i = 0; i < arrayOfVertices.length; i++) {\n \n //add vertex name, xcoord, & ycoord separated by spaces \n s += arrayOfVertices[i].getName() + \" \" \n + arrayOfVertices[i].getX() + \" \" \n + arrayOfVertices[i].getY() + \"\\n\"; \n \n }\n \n //return the string\n return s;\n \n }", "@Override\r\n public String toString() {\r\n return \"the car \"+this.id+\"has as size \"+this.size+\r\n \"and is oriented \"+this.orientation+\r\n \" and have a currentPosition in \"+this.currentPosition;\r\n }", "@Override // Inherited from the Object class.\n public String toString() {\n return \"gear: \" + gear + \" cadence: \" + cadence + \" speed: \" + speed +\n \" name: \" + name;\n }", "private String printName() {\n \t\treturn GPSFilterTextUtils.printName( this.getResources(), this.area.getName() );\n \t}", "@Override\n\tpublic String toString() {\n\t\tString out = \"Name: \" + name + \"\\tPosition\" + getPosition();\n\t\treturn out;\n\t}", "public void printLocationInfo()\n {\n System.out.println(currentRoom.getLongDescription());\n System.out.println();\n }", "@Override\n public String toString() {\n String s = shipName + \" located at\";\n\n for (Point p : shipLocation) {\n s += \" (\" + (p.x + 1) + \",\" + (p.y + 1) + \")\";\n }\n\n return s;\n }", "public String getSpawnLocationString(){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tList<Location> locs = getSpawns();\n\t\tfor (int i=0;i<locs.size(); i++ ){\n\t\t\tif (locs.get(i) != null) sb.append(\"[\").append(i + 1).append(\":\").\n append(Util.getLocString(locs.get(i))).append(\"] \");\n\t\t}\n\t\treturn sb.toString();\n\t}", "public Robot getRobot(String nombre);", "@Override\n public String toString() {\n return getAcideAmine()+\", \"+ getCodon() +\", \"+ getNucleotide1()+ \", \"\n + getNucleotide2() +\", \"+ getNucleotide3();\n }", "@Override\r\n\tpublic final String getNombreRaza() {\r\n\t\treturn \"Orco\";\r\n\t}", "@Override\n public String toString() {\n return String.valueOf(position.getX() + \" \" + position.getY() + \" \" + visible + \" \" + speed.getX() + \"\\n\");\n }", "public String[] nombres(){\n return partida.nombres();\n }", "public String topGeneral() {\n return \"city humidity description wind coordination\" + \"\\n\";\n }", "@Override\n public String toString()\n {\n return id + \"*\" + name + \"|\" + lat + \"&\"+lon + \"\\n\";\n }", "public void listarEquipo() {\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\n\t\tfor(Alumno i : alumnos) {\n\t\t\tsb.append(i+\"\\n\");\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}", "public String getName(){\r\n return this.station.getName();\r\n }", "@Override\n public String toString() { \n return super.getName() + getP1().toString() + \", \" + getP2().toString() \n + \", \" + getP3().toString();\n }", "public void mostrarJet(){\r\n \r\n System.out.println(\"clase hija jet de vehiculo con motor \");\r\n System.out.println(\"LA CANTIDAD DE MOTORES ES : \" + this.cantidaddeMotores);\r\n\r\n\r\n System.out.println(\"***************************************************\");\r\n System.out.println(\"*************H**E**R**E**D**A**********************\");\r\n System.out.println(\"|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|\");\r\n }", "public void agregarRobot(String nombre);", "@Override\r\n\tpublic String toString()\r\n\t{\r\n\t\treturn \"Macchina a stati finiti di nome \"+nome+\", nello stato \"+corrente.getNome()+\".\";\r\n\t}", "private void calculateLocation()\r\n\t{\r\n\t\tdouble leftAngleSpeed \t= this.angleMeasurementLeft.getAngleSum() / ((double)this.angleMeasurementLeft.getDeltaT()/1000); //degree/seconds\r\n\t\tdouble rightAngleSpeed \t= this.angleMeasurementRight.getAngleSum() / ((double)this.angleMeasurementRight.getDeltaT()/1000); //degree/seconds\r\n\r\n\t\tdouble vLeft\t= (leftAngleSpeed * Math.PI * LEFT_WHEEL_RADIUS ) / 180 ; //velocity of left wheel in m/s\r\n\t\tdouble vRight\t= (rightAngleSpeed * Math.PI * RIGHT_WHEEL_RADIUS) / 180 ; //velocity of right wheel in m/s\t\t\r\n\t\tdouble w \t\t= (vRight - vLeft) / WHEEL_DISTANCE; //angular velocity of robot in rad/s\r\n\t\t\r\n\t\tDouble R \t= new Double(( WHEEL_DISTANCE / 2 ) * ( (vLeft + vRight) / (vRight - vLeft) ));\t\t\t\t\t\t\t\t\r\n\t\t\r\n\t\tdouble ICCx = 0;\r\n\t\tdouble ICCy = 0;\r\n\r\n\t\tdouble W_xResult \t\t= 0;\r\n\t\tdouble W_yResult \t\t= 0;\r\n\t\tdouble W_angleResult \t= 0;\r\n\t\t\r\n\t\tdouble E_xResult \t\t= 0;\r\n\t\tdouble E_yResult \t\t= 0;\r\n\t\tdouble E_angleResult \t= 0;\r\n\t\t\r\n\t\t//short axe = 0;\r\n\t\t\r\n\t\tdouble deltaT = ((double)this.angleMeasurementLeft.getDeltaT())/1000;\r\n\t\t\r\n\t\t// Odometry calculations\r\n\t\tif (R.isNaN()) \t\t\t\t//robot don't move\r\n\t\t{\r\n\t\t\tW_xResult\t\t= this.pose.getX();\r\n\t\t\tW_yResult\t\t= this.pose.getY();\r\n\t\t\tW_angleResult \t= this.pose.getHeading();\r\n\t\t} \r\n\t\telse if (R.isInfinite()) \t//robot moves straight forward/backward, vLeft==vRight\r\n\t\t{ \r\n\t\t\tW_xResult\t\t= this.pose.getX() + vLeft * Math.cos(this.pose.getHeading()) * deltaT;\r\n\t\t\tW_yResult\t\t= this.pose.getY() + vLeft * Math.sin(this.pose.getHeading()) * deltaT;\r\n\t\t\tW_angleResult \t= this.pose.getHeading();\r\n\t\t} \r\n\t\telse \r\n\t\t{\t\t\t\r\n\t\t\tICCx = this.pose.getX() - R.doubleValue() * Math.sin(this.pose.getHeading());\r\n\t\t\tICCy = this.pose.getY() + R.doubleValue() * Math.cos(this.pose.getHeading());\r\n\t\t\r\n\t\t\tW_xResult \t\t= Math.cos(w * deltaT) * (this.pose.getX()-ICCx) - Math.sin(w * deltaT) * (this.pose.getY() - ICCy) + ICCx;\r\n\t\t\tW_yResult \t\t= Math.sin(w * deltaT) * (this.pose.getX()-ICCx) + Math.cos(w * deltaT) * (this.pose.getY() - ICCy) + ICCy;\r\n\t\t\tW_angleResult \t= this.pose.getHeading() + w * deltaT;\r\n\t\t}\r\n\t\t\r\n\t\tthis.pose.setLocation((float)W_xResult, (float)W_yResult);\r\n\t\tthis.pose.setHeading((float)W_angleResult);\r\n\t\t\r\n\t\t// Conversion to grads\r\n\t\tW_angleResult = W_angleResult/Math.PI*180;\r\n\t\t\r\n\t\t// Get the heading axe\r\n\t\t//axe = getHeadingAxe();\r\n\t\tgetHeadingAxe();\r\n\t\t\r\n\t\t// Verify the coordinates and the heading angle\r\n\t\tif (Po_Corn == 1)\r\n\t\t{\r\n\t\t\tswitch (Po_CORNER_ID)\r\n\t\t\t{\r\n\t\t\t\tcase 0:\r\n\t\t\t\t\tE_xResult = 0;\r\n\t\t\t\t\tE_yResult = 0;\r\n\t\t\t\t\tPo_ExpAng = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\tE_xResult = 1.8;\r\n\t\t\t\t\tE_yResult = 0.11;\r\n\t\t\t\t\tPo_ExpAng = 90;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tE_xResult = 1.6;\r\n\t\t\t\t\tE_yResult = 0.6;\r\n\t\t\t\t\tPo_ExpAng = 180;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tE_xResult = 1.5;\r\n\t\t\t\t\tE_yResult = 0.45;\r\n\t\t\t\t\tPo_ExpAng = 270;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tE_xResult = 1.5;\r\n\t\t\t\t\tE_yResult = 0.3;\r\n\t\t\t\t\tPo_ExpAng = 180;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tE_xResult = 0.3;\r\n\t\t\t\t\tE_yResult = 0.3;\r\n\t\t\t\t\tPo_ExpAng = 90;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 6:\r\n\t\t\t\t\tE_xResult = 0.3;\r\n\t\t\t\t\tE_yResult = 0.6;\r\n\t\t\t\t\tPo_ExpAng = 180;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 7:\r\n\t\t\t\t\tE_xResult = 0;\r\n\t\t\t\t\tE_yResult = 0.6;\r\n\t\t\t\t\tPo_ExpAng = 270;\r\n\t\t\t\t\tbreak;\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tE_angleResult = W_angleResult;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tint block = 0;\r\n\t\t\t// white = 0, black = 2, grey = 1\r\n\t\t\tif ((lineSensorLeft == 0) && (lineSensorRight == 0) && (block == 0)) \t// Robot moves on the black line\r\n\t\t\t{\r\n\t\t\t\tswitch (Po_CORNER_ID)\t\t\t\t\t\t\t\t// Even numbers - x, Odd numbers - y\r\n\t\t\t\t{\r\n\t\t\t\tcase 0: \r\n\t\t\t\t\tif (this.pose.getX() < 1.6)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_yResult = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult;\r\n\t\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 1: \r\n\t\t\t\t\tif (this.pose.getY() < 0.4)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_xResult = 1.8;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult; \r\n\t\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tif (this.pose.getX() > 1.65)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_yResult = 0.6;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult;\r\n\t\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tif (this.pose.getY() > 0.4)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_xResult = 1.5; \r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult; \r\n\t\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 4: \r\n\t\t\t\t\tif (this.pose.getX() > 0.4)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_yResult = 0.3;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult;\r\n\t\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tif (this.pose.getY() < 0.5)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_xResult = 0.3;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult; \r\n\t\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 6: \r\n\t\t\t\t\tif (this.pose.getX() > 0.1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_yResult = 0.6;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult;\r\n\t\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase 7:\r\n\t\t\t\t\tif (this.pose.getY() > 0.1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = Po_ExpAng;\r\n\t\t\t\t\t\tE_xResult = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tE_angleResult = W_angleResult; \r\n\t\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tdefault: \r\n\t\t\t\t\tE_angleResult = W_angleResult;\r\n\t\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(((lineSensorLeft == 0) && (lineSensorRight == 2)) || ((lineSensorLeft == 2) && (lineSensorRight == 0)))\r\n\t\t\t{\r\n\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\r\n\t \tif (W_angleResult >= TRSH_W)\r\n\t \t{\r\n\t \t\tE_angleResult = TRSH_W;\r\n\t \t}\r\n\t \telse if (W_angleResult >= (360 - TRSH_W))\r\n\t \t{\r\n\t \t\tE_angleResult = 360 - TRSH_W;\r\n\t \t}\r\n\t \telse\r\n\t \t{\r\n\t \t\tE_angleResult = W_angleResult;\r\n\t \t}\r\n\t \t\r\n\t \t// test\r\n\t \tE_angleResult = W_angleResult;\r\n\t\t\t}\r\n\t\t\telse if(((lineSensorLeft == 0) && (lineSensorRight == 1)) || ((lineSensorLeft == 1) && (lineSensorRight == 0)))\r\n\t\t\t{\r\n\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\t\r\n\t \tif (W_angleResult >= TRSH_G)\r\n\t \t{\r\n\t \t\tE_angleResult = TRSH_G;\r\n\t \t}\r\n\t \telse if (W_angleResult >= (360 - TRSH_G))\r\n\t \t{\r\n\t \t\tE_angleResult = 360 - TRSH_G;\r\n\t \t}\r\n\t \telse\r\n\t \t{\r\n\t \t\tE_angleResult = W_angleResult;\r\n\t \t}\r\n\t \t\r\n\t \t// test\r\n\t \tE_angleResult = W_angleResult;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tE_xResult = W_xResult;\r\n\t\t\t\tE_yResult = W_yResult;\r\n\t\t\t\tE_angleResult = W_angleResult;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tLCD.drawString(\"AngRs: \" + (E_angleResult), 0, 7);\r\n\t\t\r\n\t\t// Conversion to rads\r\n\t\tW_angleResult = W_angleResult*Math.PI/180;\r\n\t\tE_angleResult = E_angleResult*Math.PI/180;\r\n\t\t\r\n\t\tif ((Po_CORNER_ID == 3) && (100*this.pose.getY() < 45))\r\n\t\t{\r\n\t\t\tE_angleResult = 3*Math.PI/180;;\r\n\t\t}\r\n\t\t\r\n\t\tthis.pose.setLocation((float)E_xResult, (float)E_yResult);\r\n\t\tthis.pose.setHeading((float)E_angleResult);\r\n\t\t\r\n\t\t/*\r\n\t\t// Integration deviation correction\r\n\t\tthis.pose.setLocation((float)(W_xResult), (float)(W_yResult + (0.01*22.4)/175));\r\n\t\tthis.pose.setHeading((float)((W_angleResult + 14/175)*Math.PI/180));\r\n\t\t*/\r\n\t}", "public String toString() {\n\t\treturn geoCoordinate.toString() + \" | \" + name + \" | \" + description;\n\t}", "@Override\n\tpublic void getCoordinates() {\n\t\tSystem.out.println(\"Your Coordinates: 18.1124° N, 79.0193° E \");\n\t}", "private static void setSubsystems()\n {\n //Components\n //Talons\n frontLeftTalon.setName(\"DrivetrainSubsystem\", \"FrontLeftDriveTalon\");\n frontRightTalon.setName(\"DrivetrainSubsystem\", \"FrontRightDriveTalon\");\n rearLeftTalon.setName(\"DrivetrainSubsystem\", \"RearLeftDriveTalon\");\n rearRightTalon.setName(\"DrivetrainSubsystem\", \"RearRightDriveTalon\");\n //Sensors\n //navX.setName(\"SensorSubsystem\", \"NavX\");\n System.out.print(pigeon.getAbsoluteCompassHeading());\n \n //Subsystems\n drivetrainSubsystem.setName(\"DrivetrainSubsystem\", \"DrivetrainSubsystem\");\n sensorSubsystem.setName(\"SensorSubsystem\", \"SensorSubsystem\");\n }", "@Override\r\n\tpublic String getFormatedCoordinates() {\n\t\treturn \"Drone position: (\"+x+\",\"+y+\",\"+z+\")\";\r\n\t}", "void printPos() {\n\n System.out.println(\"\\nMoving vehicles....\\n\");\n for (int v = 0; v < roads.size(); v++) {\n System.out.println(\"\\n__________________ Vehicles on Road: \" + v + \"______________________________\");\n if (roads.get(v).lightAtStart()) {\n if (roads.get(v).getStartLight().isGreen()) {\n System.out.println(\"|Start light is green|\\n\");\n } else System.out.println(\"|Start light red|\\n\");\n\n } else if (roads.get(v).lightAtEnd()) {\n if (roads.get(v).getEndLight().isGreen()) {\n System.out.println(\"|End light green|\\n\");\n } else System.out.println(\"|End light red|\\n\");\n }\n\n if (roads.get(v).vehicles.size() == 0) {\n System.out.println(\"No vehicles are currently on this road...\");\n }\n for (int x = 0; x < roads.get(v).vehicles.size(); x++) {\n if (roads.get(v).vehicles.get(x).getType().equals(\"Motorbike\")) {\n System.out.println(\"Type: \" + roads.get(v).vehicles.get(x).getType() + \" |Direction: \" +\n roads.get(v).vehicles.get(x).getDirection()\n + \" |X Position: \" + roads.get(v).vehicles.get(x).getXpos() + \" |Y Position: \"\n + roads.get(v).vehicles.get(x).getYpos() + \" |Speed: \" + roads.get(v).vehicles.get(x).getSpeed());\n\n\n } else {\n\n System.out.println(\"Type: \" + roads.get(v).vehicles.get(x).getType() + \" |Direction: \" +\n roads.get(v).vehicles.get(x).getDirection()\n + \" |X Position: \" + roads.get(v).vehicles.get(x).getXpos() + \" |Y Position: \"\n + roads.get(v).vehicles.get(x).getYpos() + \" |Speed: \" + roads.get(v).vehicles.get(x).getSpeed());\n }\n }\n\n }\n }", "public String toString() {\n\t\treturn position\n\t\t\t+ \" between \"\n\t\t\t+ worldOrigin\n\t\t\t+ \" and \"\n\t\t\t+ worldEnd;\n\t}", "@Override\n\tprotected ArrayList<ModulePosition> buildRobot() {\n\t\tArrayList<ModulePosition> mPos = new ArrayList<ModulePosition>();\n\t\tmPos.add(new ModulePosition(\"custom 0\", new VectorDescription(0*ATRON.UNIT, -5*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(0, 0, -eigth)));\n\t\tmPos.add(new ModulePosition(\"custom 1\", new VectorDescription(1*ATRON.UNIT, -5*ATRON.UNIT, 1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 2\", new VectorDescription(1*ATRON.UNIT, -5*ATRON.UNIT, -1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 3\", new VectorDescription(2*ATRON.UNIT, -5*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(0, 0, -eigth)));\n\t\tmPos.add(new ModulePosition(\"custom 4\", new VectorDescription(3*ATRON.UNIT, -5*ATRON.UNIT, 1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 5\", new VectorDescription(3*ATRON.UNIT, -5*ATRON.UNIT, -1*ATRON.UNIT), ATRON.ROTATION_EW));\n\t\tmPos.add(new ModulePosition(\"custom 6\", new VectorDescription(4*ATRON.UNIT, -5*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(0, 0, -eigth)));\n\t\treturn mPos;\t\n\n\t\t\n\t\t/*\n\t\tArrayList<ModulePosition> mPos = new ArrayList<ModulePosition>();\n\t\tdouble x0 = 1;\n\t\tdouble y0 = 0;\n\t\tdouble z0 = 0;\n\t\tdouble angle = Math.PI/2 + Math.PI;\n\t\tVector3f moduleOrientationVector = new Vector3f(0, 0, 1);\n\t\tDouble moduleOrientationAngle = 0d;\n\t\tQuaternion moduleOrientationQuaternion = new Quaternion( (float)(moduleOrientationVector.x*Math.sin((moduleOrientationAngle)/2)), (float)(moduleOrientationVector.y*Math.sin((moduleOrientationAngle)/2)), (float)(moduleOrientationVector.z*Math.sin((moduleOrientationAngle)/2)), (float)(Math.cos((moduleOrientationAngle)/2)));\n\t\t//System.out.println(moduleOrientation.x + \" \" + moduleOrientation.y + \" \" + moduleOrientation.z);\n\t\tQuaternion rotation = new Quaternion( (float)(x0*Math.sin((angle)/2)), (float)(y0*Math.sin((angle)/2)), (float)(z0*Math.sin((angle)/2)), (float)(Math.cos((angle)/2)));\n\t\t//Vector3f newModuleOrientation = rotation.mult(moduleOrientation);\n\t\t//System.out.println(newModuleOrientation.x + \" \" + newModuleOrientation.y + \" \" + newModuleOrientation.z);\n\t\t//mPos.add(new ModulePosition(\"custom 0\", new VectorDescription(0*ATRON.UNIT, 0*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(rotation)));\n\t\tmPos.add(new ModulePosition(\"custom 0\", new VectorDescription(0*ATRON.UNIT, 0*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(new Quaternion( (float)(0), (float)(0), (float)(0), (float)(1)))));\n\t\t//x0 = 1; y0 = 0; z0 = 0; angle = 0;\n\t\t//mPos.add(new ModulePosition(\"custom 1\", new VectorDescription(1*ATRON.UNIT, 1*ATRON.UNIT, 0*ATRON.UNIT), new RotationDescription(new Quaternion( (float)(x0*Math.sin(angle/2)), (float)(y0*Math.sin(angle/2)), (float)(z0*Math.sin(angle/2)), (float)(Math.cos(angle/2))))));\n\t\treturn mPos;\n*/\n\t}", "public String toString()\n\t{\n\t\tint poleSize = pole.size();\n\t\tString s = \"\";\n\t\tfor(int i = 0; i < poleSize; i++)\n\t\t\ts += pole.get(i).getSize() + (i < poleSize - 1 ? \", \" : \"\");\n\t\treturn s;\n\t}", "protected String garments() {\n StringBuilder sb = new StringBuilder();\n System.out.println(\"Cuts Made:\");\n sb.append('[');\n coordinateToString(sb, 0);\n sb.deleteCharAt(sb.length() - 1);\n sb.deleteCharAt(sb.length() - 1);\n sb.append(']');\n return sb.toString();\n }", "public static void vehicleInfo() {\n\t\n\tSystem.out.println(\"numberOfVehicles: \"+numberOfVehicles);\n\tint count=getNumberOfVehicles();\n\tString make=\"Kia\";\n\tmake=make.toUpperCase();\n\tSystem.out.println(\"make\"+make);\n\t\n}", "@Override\n public String toString(){\n return Nombre + \", \" + Clave + \", de \" + horario + \", \" + Maestro;\n }", "public String toString()\n\t{\n\t\treturn \"Current Floor: \" + currentFloor +\" Total passangers on board: \" + totalPassengers + \" Direction: \" + currentDirection;\n\t}", "public void findRobotPosition(){\n targetVisible = false;\n for (VuforiaTrackable trackable : allTrackables) {\n if (((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()) {\n telemetry.addData(\"Visible Target\", trackable.getName());\n targetVisible = true;\n\n // Get the position of the visible target and put the X & Y position in visTgtX and visTgtY\n // We will use these for determining bearing and range to the visible target\n OpenGLMatrix tgtLocation = trackable.getLocation();\n VectorF tgtTranslation = tgtLocation.getTranslation();\n visTgtX = tgtTranslation.get(0) / mmPerInch;\n visTgtY = tgtTranslation.get(1) / mmPerInch;\n //telemetry.addData(\"Tgt X & Y\", \"{X, Y} = %.1f, %.1f\", visTgtX, visTgtY);\n\n // getUpdatedRobotLocation() will return null if no new information is available since\n // the last time that call was made, or if the trackable is not currently visible.\n OpenGLMatrix robotLocationTransform = ((VuforiaTrackableDefaultListener)trackable.getListener()).getUpdatedRobotLocation();\n if (robotLocationTransform != null) {\n lastLocation = robotLocationTransform;\n }\n break;\n }\n }\n\n // Provide feedback as to where the robot is located (if we know).\n if (targetVisible) {\n // express position (translation) of robot in inches.\n VectorF translation = lastLocation.getTranslation();\n //telemetry.addData(\"Pos (in)\", \"{X, Y, Z} = %.1f, %.1f, %.1f\",\n // translation.get(0) / mmPerInch, translation.get(1) / mmPerInch, translation.get(2) / mmPerInch);\n\n // express the rotation of the robot in degrees.\n Orientation rotation = Orientation.getOrientation(lastLocation, EXTRINSIC, XYZ, DEGREES);\n //telemetry.addData(\"Rot (deg)\", \"{Roll, Pitch, Heading} = %.0f, %.0f, %.0f\", rotation.firstAngle, rotation.secondAngle, rotation.thirdAngle);\n\n // Robot position is defined by the standard Matrix translation (x and y)\n robotX = translation.get(0)/ mmPerInch;\n robotY = translation.get(1)/ mmPerInch;\n\n // Robot bearing (in +vc CCW cartesian system) is defined by the standard Matrix z rotation\n robotBearing = rotation.thirdAngle;\n\n // target range is based on distance from robot position to the visible target\n // Pythagorean Theorum\n targetRange = Math.sqrt((Math.pow(visTgtX - robotX, 2) + Math.pow(visTgtY - robotY, 2)));\n\n // target bearing is based on angle formed between the X axis to the target range line\n // Always use \"Head minus Tail\" when working with vectors\n targetBearing = Math.toDegrees(Math.atan((visTgtY - robotY)/(visTgtX - robotX)));\n\n // Target relative bearing is the target Heading relative to the direction the robot is pointing.\n // This can be used as an error signal to have the robot point the target\n relativeBearing = targetBearing - robotBearing;\n // Display the current visible target name, robot info, target info, and required robot action.\n\n telemetry.addData(\"Robot\", \"[X]:[Y] (Heading) [%5.0fin]:[%5.0fin] (%4.0f°)\",\n robotX, robotY, robotBearing);\n telemetry.addData(\"Target\", \"[TgtRange] (TgtBearing):(RelB) [%5.0fin] (%4.0f°):(%4.0f°)\",\n targetRange, targetBearing, relativeBearing);\n }\n else {\n telemetry.addData(\"Visible Target\", \"none\");\n }\n }", "public String locationToString(Location loc) {\n return loc.getWorld().getName() + \"|\" + loc.getBlockX() + \"|\" + loc.getBlockY() + \"|\" + loc.getBlockZ();\n }", "@Override\n\tString getName() {\n\t\treturn \"Planet\"+\": \"+name;\n\t}", "@Override\n\t\t\tpublic String toString() {\n\t\t\t\treturn nome;\n\t\t\t}", "@Override\n\tpublic String toString() {\n\t\treturn \"Apart N°\"+Nombre;\n\t}", "String getMapName() {\n try {\n fd world = getWorld();\n Class<?> worldclass = world.getClass();\n Field worlddatafield = null;\n while (true) { //\n\n try {\n worlddatafield = worldclass.getDeclaredField(\"x\");\n break;\n } catch (NoSuchFieldException e) {\n worldclass = worldclass.getSuperclass();\n continue;\n }\n }\n if (worlddatafield == null)\n return null;\n worlddatafield.setAccessible(true);\n\n ei worldata;\n\n worldata = (ei) worlddatafield.get(world);\n return worldata.j();\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "@Override\n public String toString() {\n return String.format(\"[%s,%s]\"\n , pawnOne.getPositionNr(), pawnTwo.getPositionNr());\n }", "public String listarSensores(){\r\n String str = \"\";\r\n for(PacienteNuvem x:pacientes){//Para cada paciente do sistema ele armazena uma string com os padroes do protocolo de comunicação\r\n str += x.getNick()+\"-\"+x.getNome()+\"#\";\r\n }\r\n return str;\r\n }", "@Override\n public String toString() {\n return \"\\tMunicipio: \" + municipio + \"\\t\" + \"Habitantes: \" + habitantes + \".\";\n }", "public String toString()\n {\n // If the direction is one of the compass points for which we have\n // a name, provide it; otherwise report in degrees. \n int regionWidth = FULL_CIRCLE / dirNames.length;\n if (dirInDegrees % regionWidth == 0)\n return dirNames[dirInDegrees / regionWidth];\n else\n return dirInDegrees + \" degrees\";\n }", "public String toString()\n {\n return \"(\"+getType()+\")\"+getLocation(); \n }", "@Override//overring a library function\n public String toString() {\n return shape + \" \" + name;//toString() is called everytime printing is done\n }", "public String toString(){\n\t\treturn topleft.x + \",\"+topleft.y+\",\"+bottomright.x+\",\"+bottomright.y;\n\t}", "@Override\r\n\tpublic String toString() {\r\n\t\treturn getLocation();\r\n\t}", "public String toString(){\n return \"Neo[\"+getName()+\"]: CRS:\"+getCRS()+\" Bounds:\"+getBounds();\n }", "public String toString()\n\t{\n\t\treturn getArea() + \".\" + getLine() + \".\" + getDevice();\n\t}", "public String toString() {\n // DecimalFormat class is used to format the output\n DecimalFormat df = new DecimalFormat(\".0\");\n return \"\\nCoordinates of Parallelogram are:\\n\"\n + super.toString()\n + \"\\nWidth is :\"\n + df.format(width)\n + \"\\nHeight is :\"\n + df.format(height)\n + \"\\nArea is :\"\n + df.format(area());\n }", "@Override\n\tpublic String toString() {\n\t\treturn getName()+\" , \"+getMobile()+\" , \"+getAddress();\n\t}", "public String getPilotName() {\n return pilot.getName();\n }", "@Override\r\n public String toString() {\r\n return \"Datos de Jugador: \"\r\n + \"\\n\" + \"Alias : \" + this.getAlias()\r\n + \"\\n\" + \"Nombre: \" + this.getNombre()\r\n + \"\\n\" + \"Edad : \" + this.getEdad()\r\n + \"\\n\" + \"Partidas Ganadas: \" + this.getPartidasGanadasToString()\r\n + \"\\n\" + \"Partidas Perdidas: \" + this.getPartidasPerdidasToString()\r\n + \"\\n\" + \"Partidas Empatadas: \" + this.getPartidasEmpatadasToString();\r\n }", "public String toString(){\n return\"Name \"+name+ \"Address \" +address+ \"Floor \" +floor;\n }", "@SimpleProperty(description = \"The motor ports that are used for driving: the left wheel's \" +\n \"motor port followed by the right wheel's motor port.\",\n category = PropertyCategory.BEHAVIOR, userVisible = false)\n public String DriveMotors() {\n return driveMotors;\n }", "@Override\n\tpublic String toString() {\n\t\treturn super.toString() + \" Corrente :\"+ super.getNumero();\n\t}", "public String toString() {\n return\n getLatitude(\"\") + \"|\" +\n getLongitude(\"\") + \"|\" +\n getDepth(\"\") + \"|\" +\n getTemperatureMin(\"\") + \"|\" +\n getTemperatureMax(\"\") + \"|\" +\n getSalinityMin(\"\") + \"|\" +\n getSalinityMax(\"\") + \"|\" +\n getOxygenMin(\"\") + \"|\" +\n getOxygenMax(\"\") + \"|\" +\n getNitrateMin(\"\") + \"|\" +\n getNitrateMax(\"\") + \"|\" +\n getPhosphateMin(\"\") + \"|\" +\n getPhosphateMax(\"\") + \"|\" +\n getSilicateMin(\"\") + \"|\" +\n getSilicateMax(\"\") + \"|\" +\n getChlorophyllMin(\"\") + \"|\" +\n getChlorophyllMax(\"\") + \"|\";\n }", "private void calcNames() {\n final AddressBook addressBook = platform.getAddressBook();\n numColumns = addressBook.getSize();\n if (numColumns != numMembers) {\n numMembers = numColumns;\n names = new String[numColumns];\n for (int i = 0; i < numColumns; i++) {\n final NodeId nodeId = addressBook.getNodeId(i);\n names[i] = addressBook.getAddress(nodeId).getNickname();\n }\n }\n }", "public String toString(){\n return \"+-----------------------+\\n\" +\n \"| Boleto para el metro |\\n\" +\n \"|derjere0ranfeore |\\n\" +\n \"+-----------------------+\\n\" ;\n }", "public String getName() {\n return this.id + \", \" + this.nom + \" \" + this.prenom + \", \" + this.cin;\n }", "protected static String getRoomName() {\n System.out.println(\"Room Name?\");\n return keyboard.next();\n }", "java.lang.String getHotelName();", "public static void main (String[] args){\n objetos = new City(\"Field.txt\");\n\t objetos.showThingCounts(true);\n \n \n // Thing a1 = new Thing( objetos, 1, 6);\n// Thing a2 = new Thing( objetos, 1, 7);\n int yRelativa = 0;\n int xRelativa = 0;\n \n for (int i = 0; i < 10; i++) {\n new Wall(objetos, -i, xRelativa, Direction.WEST);\n }\n for (int i = 1; i < 10; i++) {\n new Wall(objetos, -i, xRelativa+9, Direction.EAST);\n }\n \n for (int i = 0; i < 10; i++) {\n new Wall(objetos, yRelativa, i, Direction.SOUTH);\n }\n \n for (int i = 0; i < 10; i++) {\n new Wall(objetos, yRelativa-9, i, Direction.NORTH);\n }\n \n //Direction.NORTH, EAST, SOUTH, WEST\n //Definicion de la ubicacion del robot, Ciudad, posicion, Direccion, Numero things en el bolso.\n //ascensor3 = new Robot(City aCity, int aStreet, int anAvenue, Direction aDirection) \n ascensor1 = new Ascensor(objetos, yRelativa,xRelativa, Direction.EAST,0);\n ascensor2 = new Ascensor(objetos, yRelativa,xRelativa+1, Direction.EAST,0);\n //portero = new Ascensor(objetos, yRelativa,xRelativa+2, Direction.EAST,0);\n \n createUsuarioPrimerPiso(objetos, yRelativa, xRelativa+2,6);\n createUsuarioPrimerPiso(objetos, yRelativa, xRelativa+3,6);\n \n createUsuarioPrimerPiso(objetos, yRelativa, xRelativa+6,6);\n \n// Usuario u1 = new Usuario (objetos, yRelativa, xRelativa+2,6);\n// Usuario u2 = new Usuario (objetos, yRelativa, xRelativa+3,6);\n// Usuario u3 = new Usuario (objetos, yRelativa, xRelativa+4,6);\n// Usuario u4 = new Usuario (objetos, yRelativa, xRelativa+5,6);\n// Usuario u5 = new Usuario (objetos, yRelativa, xRelativa+6,6);\n// Usuario u6 = new Usuario (objetos, yRelativa, xRelativa+7,6);\n// Usuario u7 = new Usuario (objetos, yRelativa, xRelativa+8,6);\n// Usuario u8 = new Usuario (objetos, yRelativa, xRelativa+9,6);\n// Usuario u9 = new Usuario (objetos, yRelativa, xRelativa+10,6);\n// Usuario u10 = new Usuario (objetos, yRelativa, xRelativa+11,6);\n\n cargarPasajeros(ascensor1);\n\n// while(ascensor1.getAvenue()!=xRelativa){\n// ascensor1.move();\n// }\n// //turnRight(ascensor1);\n\n \n\n while (ascensor1.getDirection()!=Direction.NORTH){\n ascensor1.turnLeft();\n }\n //******DESDE ESTE PUNTO (LINEA 160) HASTA LA LINEA 204 SE HACE EL MOVIMIENTO DE UN USUARIO DE MANERA EXPLICITA\n // Los usuarios que usa están contenidos en las líneas (134-143)\n \n// while((ascensor1.getStreet()*-1)!= u1.getPisoDeseado()){\n// ascensor1.move(); \n// }\n// turnRight(ascensor1);\n// ascensor1.move();\n// ascensor1.move();\n// while(ascensor1.canPickThing()==true){\n// ascensor1.move();\n// }\n// if(ascensor1.canPickThing()==false){\n// ascensor1.putThing();\n// }\n// regresarAlOrigen(ascensor1);\n// \n// while (ascensor1.getDirection()!=Direction.NORTH){\n// ascensor1.turnLeft();\n// }\n// \n// while((ascensor1.getStreet()*-1)!= u2.getPisoDeseado()){\n// ascensor1.move(); \n// }\n// turnRight(ascensor1);\n// ascensor1.move();\n// ascensor1.move();\n// while(ascensor1.canPickThing()==true){\n// ascensor1.move();\n// }\n// if(ascensor1.canPickThing()==false){\n// ascensor1.putThing();\n// }\n// regresarAlOrigen(ascensor1);\n// \n// while((ascensor1.getStreet()*-1)!= u3.getPisoDeseado()){\n// ascensor1.move(); \n// }\n// turnRight(ascensor1);\n// ascensor1.move();\n// ascensor1.move();\n// while(ascensor1.canPickThing()==true){\n// ascensor1.move();\n// }\n// if(ascensor1.canPickThing()==false){\n// ascensor1.putThing();\n// }\n// regresarAlOrigen(ascensor1);\n \n //************************\n \n //public synchronized void\n\t //Mover una interseccion en el sentido al cual este apuntando el objeto.\n// for (int i = 0; i < 8; i++) {\n// if(portero.canPickThing()==false){\n// \n// new Thing (objetos, portero.getStreet() , portero.getAvenue());\n// }\n// \n// \n// portero.move();\n// }\n// portero.move();\n// portero.move();\n \n \n \n\n \n \n \n// //Tomando decisiones, Si puedo tomar un Thing\n// boolean puedeTomar = estudiante.canPickThing();\n// \n// //Tomar un Thing\n// if(puedeTomar == true)\n// estudiante.pickThing();\n// \n// //Especifica el numero de Thing que tiene en robot en el bolso\n// int numeroThings = estudiante.countThingsInBackpack();\n// \n// //Poner Thing, se debe validar que tenga things en el bolso\n// estudiante.putThing();\n// \n// //Si el frente esta libre de Wall\n// estudiante.frontIsClear();\n// \n// //Invocando una funcion\n// creacionFuncion(4);\n// \n// //Toman un Thing\n// estudiante.pickThing();\n// \n// \n\t}", "@GetMapping(\"ElementWebService/getAllCoords\")\n\tpublic String getAllHQCoords() {\n\t\tList<Element> elementList = elementService.getAll();\n\t\tList<Coord> coordList = new ArrayList<Coord>();\n\t\tfor(Element element: elementList) {\n\t\t\tcoordList.add(element.getLocation());\n\t\t}\n\t\treturn Tools.toJsonString(coordList);\n\t}", "public static ArrayList<String> getReglesNoms() throws IOException{\n return ctrl_Persistencia.llistaFitxers(\"@../../Dades\",\"regles\");\n }", "java.lang.String getRoomName();", "public String GeneralFormForId_Coord() {\n return \"==================================================================================================================\" + \"\\n\" +\n \"city humidity description temprature coordination\" + \"\\n\" +\n \"==================================================================================================================\";\n\n }", "public Point getRobotLocation();", "public void afficherPlateau(Robot r) {\r\n\t\tfor(int i=0; i<plateau.length; i++) {\r\n\t\t\tfor (int j=0; j<plateau[0].length; j++) {\r\n\t\t\t\tSystem.out.print(\"|\");\r\n\t\t\t\tif(plateau[i][j].contientMine() > 0) {\r\n\t\t\t\t\tif (plateau[i][j].contientMine() != r.getEquipe())\r\n\t\t\t\t\t\tSystem.out.print(plateau[i][j]);\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\tSystem.out.print(\" \");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t\tSystem.out.print(plateau[i][j]);\r\n\r\n\t\t\t}\r\n\t\t\tSystem.out.print(\"|\");\r\n\t\t\tif(i == 2)\r\n\t\t\t\tSystem.out.print(\"\tDeplacement = d et Attaque = a\");\r\n\t\t\tif(i == 3)\r\n\t\t\t\tSystem.out.print(\"\t\ta=haut-gauche, z=haut, e=haut-droite\");\r\n\t\t\tif(i == 4)\r\n\t\t\t\tSystem.out.print(\"\t\tq=gauche, d=droite\");\r\n\t\t\tif(i == 5){\r\n\t\t\t\tSystem.out.print(\"\t\tw=bas-gauche, s=bas, c=bas-droite\");\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\r\n\t\tSystem.out.println();\r\n\t}", "public String toString(){\n return this.tileType.toString() + this.position + this.orientation;\n }", "public String toString() {\n\t\treturn (\n\t\t\t\t\"PlayerCyborg: loc=\" + Math.round(this.getX()*10)/10 + \",\" + Math.round(this.getY()*10)/10 +\n\t\t\t\t\" color=\" + this.getColorToString() + \" heading=\" + this.getHeading() + \n\t\t\t\t\" speed=\" + this.getSpeed() + \"\\n size=\" + this.getSize() + \n\t\t\t\t\" maxSpeed=\" +this.getMaximumSpeed() + \" steeringDegree=\"+ this.getSteeringDirection() + \n\t\t\t\t\" energyLevel=\" + this.getEnergyLevel() + \" damageLevel=\" + this.getDamageLevel()\n\t\t\t\t);\n\t}", "@Override\r\n\tpublic String toString()\r\n\t{\r\n\t\tString s = new String(\"\");\r\n\t\tfor (int i = 0; i < maze.length; i++) {\r\n\t\t\ts+= \"\\n\";\r\n\t\t\ts+= \"Floor #\";\r\n\t\t\ts+= (i+1);\r\n\t\t\ts+= \":\";\r\n\t\t\ts+= \"\\n\";\r\n\t\t\tfor (int j = 0; j < maze[0].length; j++) {\r\n\t\t\t\ts+= \"\\n\";\r\n\t\t\t\tfor (int j2 = 0; j2 < maze[0][0].length; j2++) {\r\n\t\t\t\t\ts += this.maze[i][j][j2];\r\n\t\t\t\t\ts += \" \";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ts+= \"\\n\";\r\n\t\t}\r\n\t\treturn s;\r\n\t}", "public String toString()\n {\n return id() + location().toString() + direction().toString();\n }", "public void mostrarVariablesForrester(){\n System.out.println(\"\");\n for (int i = 0; i < tam; i++) {\n if(matrizTipos[i][i].equals(\"P\")){\n System.out.println(\"[\"+i+\"] es un parametro\"); // parametro = constante\n }\n else if(matrizTipos[i][i].equals(\"V\")){\n System.out.println(\"[\"+i+\"] es un auxiliar\"); // auxiliar = constante * auxiliar (?) ó constante +/- auxiliar\n }\n else if(matrizTipos[i][i].equals(\"R\")){\n System.out.println(\"[\"+i+\"] es un flujo\"); // flujo = constante * auxiliar * nivel\n }\n else if(matrizTipos[i][i].equals(\"X\")){\n System.out.println(\"[\"+i+\"] es un nivel\");// xi(t + Δt) = xi(t) + Δt{rj - rk} rj = entrada y rk = salida, \"el - es por la salida\" (creo) \n }\n }\n }", "@Override\n\tpublic String toString() {\n\t\treturn \"Station: \"+ name+ \", Adresse: \" + address + \", Wiki: Velos: \" + UVelosDispos + \", Places: \"\n\t\t\t\t+ UPlacesDispos + \", CB: \" + ((banking) ? \"oui\" : \"non\" ) + \", bonus: \" + ((bonus) ? \"oui\" : \"non\" )\n\t\t\t\t+ \", Etat: \" + ((status) ? \"OK\" : \"Fermé\" ) +\", Places libres: \" + available_bike_stands\n\t\t\t\t+ \", Velos disponibles: \" + available_bikes;\n\t}", "public String getLocationName(){\n return myLoc;\n }", "@Override\n public String toString() {\n return String.format(\"position X is='%s' ,position Y is='%s'\" , positionX , positionY);\n }", "@Override public String toString() {\n String toReturn = \"\";\n for (Rotor rotor : rotors)\n toReturn = rotor.getPositionString() + (toReturn.isEmpty() ? \"\" : \" \") + toReturn;\n return toReturn;\n }", "private String describeLocation() {\n\t\tSWLocation location = this.world.getEntityManager().whereIs(this);\n\t\treturn this.getShortDescription() + \" [\" + this.getHitpoints() + \"] is at \" + location.getShortDescription();\n\t}", "@Override\n public String toString() {\n return \"Car \" + this.id + \". Size : \" + this.size\n + \".\\nOrientation :\" + this.orientation\n + \". Current position : \" + this.currentPosition;\n }", "public void getInfo () {\n int[] info = elevator.getInfo ();\n currFloor = info[0];\n maxCap = info[2];\n numFloors = info[3];\n currCap = info[5];\n state = info[6];\n }", "@Override\n public String getDescription() {\n return \"List all of the geometry commands.\";\n }", "public abstract String getRoomName();", "public String mostrarVentas() {\n String ventas = \"\";\n for (int i = 0; i < posicionActual; i++) { //Recorre el vector hasra la poscion actual, y almacena toda la informacion de estos en una variable String la cual se retornara \n ventas += mostrarCliente(i);\n }\n return ventas;\n }", "@Override\r\n public String toString() {\n String output = \"open melds: \";\r\n \r\n for (Tile[] meld : openMelds) {\r\n output.concat(\"[\");\r\n for (Tile t : meld) {\r\n output.concat(t.toString() + \", \");\r\n }\r\n output.concat(\"], \");\r\n }\r\n \r\n output.concat(\"\\n\");\r\n \r\n for (Tile t : hiddenHand) {\r\n output.concat(t.toString() + \", \");\r\n }\r\n \r\n return output;\r\n }" ]
[ "0.6098402", "0.597995", "0.59122163", "0.58958477", "0.57284117", "0.56705046", "0.5592448", "0.55842423", "0.55516106", "0.5545346", "0.5533574", "0.55157775", "0.5511943", "0.55069214", "0.5494729", "0.5477211", "0.5448351", "0.5411638", "0.54071856", "0.5403565", "0.5400779", "0.5396738", "0.5387413", "0.5378271", "0.5347038", "0.5344201", "0.5321942", "0.53212726", "0.5318692", "0.53149873", "0.53045356", "0.5298202", "0.5283515", "0.5282784", "0.5273523", "0.52579486", "0.52579343", "0.52529085", "0.525275", "0.52526104", "0.52424604", "0.52256006", "0.5219403", "0.52177924", "0.5213641", "0.52099955", "0.5208307", "0.52082175", "0.5208205", "0.52002877", "0.51993716", "0.5197431", "0.5196314", "0.5193755", "0.51927143", "0.51913863", "0.5188444", "0.5188148", "0.51777333", "0.5173632", "0.51726556", "0.51724505", "0.5169005", "0.51647055", "0.51639485", "0.5161662", "0.5161339", "0.515461", "0.5154445", "0.5151593", "0.5144518", "0.5141439", "0.5140942", "0.514042", "0.5137919", "0.5132503", "0.5130101", "0.51279014", "0.51272905", "0.51251394", "0.5120074", "0.511956", "0.5117531", "0.5109257", "0.51058626", "0.51036656", "0.51035327", "0.5091442", "0.5089322", "0.5087937", "0.5079641", "0.50794923", "0.50791454", "0.5069336", "0.506639", "0.5063223", "0.50612146", "0.50602424", "0.5059412", "0.50574034" ]
0.71348345
0
Demande a l'utilisateur d'entre un nombre entre min et max ou renvoie un random entre min et max si l'equipe est une IA
public int secureInput(int min, int max) { if (estIa) { if (max - min <= 0) { return min; } return new Random().nextInt(max - min) + min; } return Constante.secureInput(min, max); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static int aleatorio(int minimo, int maximo) {\n int aleatorio = (int) Math.floor(Math.random() * (maximo - minimo + 1) + minimo);\n return aleatorio;\n }", "private int alea(final int valeurMin,\n final int valeurMax) {\n Random r = new Random();\n return valeurMin + r.nextInt(valeurMax - valeurMin);\n }", "public static int LlenadoRandom(int IMinimo, int IMaximo){\n return((int)Math.floor(Math.random()*(IMaximo-IMinimo+1)+IMinimo));//regresa el valor random\n }", "public static int generarNumeroAleatorio(int limite){ //Entre 0 y limite - 1\n return (int) (Math.random()*limite);\n }", "private int generateWholoeNumInRange( int min, int max ) {\r\n\r\n // Evaluate random number from min to max including min and max\r\n return (int)(Math.random()*(max - min + 1) + min);\r\n\r\n }", "static int createInjection(int min, int max){\n\t\t\tint myInjection = (int)(Math.random() * 10 * (Math.random() > 0.5 ? max : min));\t\n\t\t\treturn myInjection;\n\t\t\t}", "private int _getRandomFromRange(int min, int max) {\n\t \n return min + random_.nextInt(max - min + 1);\n }", "private Integer randomHemoglobina(){\n\t\t\tint Min = 9, Max = 23;\n\t\t\treturn Min + (int)(Math.random() * ((Max - Min) + 1));\n\t\t}", "private static int generateRandom(int min, int max) {\n // max - min + 1 will create a number in the range of min and max, including max. If you don´t want to include it, just delete the +1.\n // adding min to it will finally create the number in the range between min and max\n return r.nextInt(max-min+1) + min;\n }", "public static void miedo(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n aleatorio = (numeroAleatorio.nextInt(10-5+1)+5);\n \n if(oro>aleatorio){//condicion de finalizar battalla y sus acciones\n oroPerdido= (nivel*2)+aleatorio;\n oro= oro-oroPerdido;\n System.out.println(\"Huiste de la batalla!!!\");\n\t\t System.out.println(\"oro perdido:\"+oroPerdido);\n opcionMiedo=1; //finalizando battalla por huida del jugador \n }\n else{\n System.out.println(\"No pudes huir de la batalla\");\n } \n }", "private int randomRange(int min, int max) {\n\t\tRandom random = new Random();\n\t\treturn random.nextInt((max - min) + 1) + min;\n\t}", "private static int randomBetween(Random r, int min, int max) {\n return r.nextInt(max - min) + min;\n }", "public int aleatorioSeis(){\n\t\t\n\t\treturn (int)(Math.random() * 6) + 1;\n\t}", "protected int random(int min, int max) {\n\t\treturn this.rand.nextInt(max-min) + min;\n\t}", "private Integer randomBilirrubina(){\n\t\t\tint Min = 0, Max = 14;\n\t\t\treturn Min + (int)(Math.random() * ((Max - Min) + 1));\n\t\t}", "private static int random(int min, int max) {\r\n\t\tRandom rand = java.util.concurrent.ThreadLocalRandom.current();\r\n\t\treturn min + (int) (rand.nextDouble()*(max-min));\r\n\t}", "public void genererchemin() {\r\n\t\tRandom hauteur1 = new Random();\r\n\t\tRandom longueur2 = new Random();\r\n\t\tRandom choix = new Random();\r\n\t\tArrayList chemin = new ArrayList();\r\n\t\tSystem.out.println(this.getHauteur());\r\n\t\tSystem.out.println(this.getLargeur());\r\n\t\tint milieu = getLargeur() / 2;\r\n\t\t//System.out.println(milieu);\r\n\t\tCoordonnees c = new Coordonnees(milieu, hauteur1.nextInt(\r\n\t\t\t\tgetLargeur()));\r\n\t\tchemin.add(c);\r\n\t\tchemin.add(new Coordonnees(0, 0));\r\n\t\tchemin.add(new Coordonnees(getLargeur() - 1, getHauteur() - 1));\r\n\t\tCoordonnees droite = new Coordonnees(milieu + 1, c.getHauteur());\r\n\t\tchemin.add(droite);\r\n\t\tCoordonnees gauche = new Coordonnees(milieu - 1, c.getHauteur());\r\n\t\tchemin.add(gauche);\r\n\t\tCoordonnees base1 = new Coordonnees(0, 0);\r\n\t\tCoordonnees base2 =new Coordonnees(getLargeur() - 1, getHauteur() - 1);\r\n\r\n\t\twhile (!gauche.equals(base1)) {\r\n\t\t\tif (gauche.getLargeur() == 0) {\r\n\t\t\t\tgauche = new Coordonnees(0, gauche.getHauteur() - 1);\r\n\t\t\t\tchemin.add(gauche);\r\n\t\t\t} else if (gauche.getHauteur() == 0) {\r\n\t\t\t\tgauche = new Coordonnees(gauche.getLargeur() - 1, 0);\r\n\t\t\t\tchemin.add(gauche);\r\n\t\t\t}\r\n\t\t\telse if (choix.nextInt(2) == 0) {\r\n\t\t\t\tgauche = new Coordonnees(gauche.getLargeur() - 1, \r\n\t\t\t\t\t\tgauche.getHauteur());\r\n\t\t\t\tchemin.add(gauche);\r\n\t\t\t} else {\r\n\t\t\t\tgauche = new Coordonnees(gauche.getLargeur(), \r\n\t\t\t\t\t\tgauche.getHauteur() - 1);\r\n\t\t\t\tchemin.add(gauche);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\twhile (!droite.equals(base2)) {\r\n\t\t\tif (droite.getLargeur() == (this.largeur -1)) {\r\n\t\t\t\tdroite = new Coordonnees(droite.getLargeur(), \r\n\t\t\t\t\t\tdroite.getHauteur() + 1);\r\n\t\t\t\tchemin.add(droite);\r\n\r\n\t\t\t} else if (droite.getHauteur() == (this.hauteur -1)) {\r\n\t\t\t\tdroite = new Coordonnees(droite.getLargeur() + 1, \r\n\t\t\t\t\t\tdroite.getHauteur());\r\n\t\t\t\tchemin.add(droite);\r\n\t\t\t\t//System.out.println(\"fais chier\");\r\n\t\t\t}\r\n\t\t\telse if (choix.nextInt(2) == 0) {\r\n\t\t\t\tdroite = new Coordonnees(droite.getLargeur() + 1, \r\n\t\t\t\t\t\tdroite.getHauteur());\r\n\t\t\t\tchemin.add(droite);\r\n\t\t\t} else {\r\n\t\t\t\tdroite = new Coordonnees(droite.getLargeur(), \r\n\t\t\t\t\t\tdroite.getHauteur() + 1);\r\n\t\t\t\tchemin.add(droite);\r\n\t\t\t}\r\n\t\t}\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tSystem.out.println(\"Quel est le pourcentage d'obstacle souhaite :\");\r\n\t\tint pourcentage = sc.nextInt();\r\n\t\tint ctp = getHauteur() * getLargeur() * pourcentage / 100;\r\n\t\twhile(ctp >0){\r\n\t\t\tCoordonnees obstacle = new Coordonnees(longueur2.nextInt(getLargeur()), \r\n\t\t\t\t\thauteur1.nextInt(getHauteur()));\r\n\t\t\t//System.out.println(!chemin.contains(obstacle));\r\n\t\t\tif (!chemin.contains(obstacle)) {\r\n\t\t\t\tthis.plateau[obstacle.getHauteur()][obstacle.getLargeur()] = new Obstacle(\r\n\t\t\t\t\t\tobstacle.getHauteur(), obstacle.getLargeur());\r\n\t\t\t\tctp--;\r\n\t\t\t} else {\r\n\t\t\t\t//System.out.println(obstacle + \"est sur le chemin\");\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private static int randInt(final int min, final int max) {\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n return rand.nextInt((max - min) + 1) + min;\n }", "private static int getRandomNumber(int min, int max) \n { //generates a random number within a range\n return (min + rand.nextInt((max - min) + 1));\n }", "private static int getRandomNumberInRange(int min, int max) {\n\n if (min >= max) {\n throw new IllegalArgumentException(\"max must be greater than min\");\n }\n Random r = new Random();\n return r.nextInt((max - min) + 1) + min;\n }", "private static int randInt(int min, int max) {\n Random rand = new Random();\n\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n int randomNum = rand.nextInt((max - min) + 1) + min;\n\n return randomNum;\n }", "private static int randomInt(int min, int max) {\n if (min >= max) {\n throw new IllegalArgumentException(\"max must be greater than min\");\n }\n\n Random r = new Random();\n return r.nextInt(max - min) + min;\n }", "private int getRandomNumberInRange(int min, int max) {\r\n\r\n\t\tRandom r = new Random();\r\n\t\treturn ((r.nextInt(max - min) + 1) + min)*40;\r\n\t}", "private int getRandomNumberInRange(int min, int max) {\n Random rand = new Random();\n return rand.nextInt((max - min) + 1) + min;\n }", "static int getRandint(int min, int max) {\r\n\t\tRandom r = new Random();\r\n\t\treturn r.nextInt((max - min) + 1) + min;\r\n\t}", "protected static int randBetween(int min, int max) {\n\t\tRandom rand = new Random();\n\t\treturn rand.nextInt(max - (min + 1)) + min;\n\t}", "public static void main(String[] args) {\n\t\tint numberRandom = (int)((Math.random() * 10) + 1);\n\t\t\n\t\t// creer un scanner, et rentrer une chiffre\n\t\tScanner scan = new Scanner(System.in);\n\t\tSystem.out.println(\"entrez un nombre\");\n\t\tint numberUser = scan.nextInt();\n\t\t\n\t\t//tant que le nombre est faux, on en essaye un autre\n\t\twhile (numberUser != numberRandom) {\n\t\t\tSystem.out.println(\"entrez de nouveau un nombre\");\n\t\t\tnumberUser = scan.nextInt();\n\t\t}\n\t\t\n\t\tSystem.out.println(\"vous avez gagne!\");\n\n\t}", "public int generarNombreAleatori() {\n\t\tRandom random = new Random();\n\t\treturn random.nextInt((9) - 1) + 1;\n\t}", "private static int generateRandomNumber(int min, int max) {\n return (int)Math.floor(Math.random() * (max - min + 1)) + min;\n }", "public static int getRandomNumber(int min, int max){\r\n Random r = new Random();\r\n return r.nextInt((max - min) +1) + min;\r\n }", "public void randomDestino(){\n\t\tRandom aleatorio = new Random();\n\t\tint numero = aleatorio.nextInt(2);\n\t\tif (numero == 0)\n\t\t\tsetGiro(90);\n\t\telse \n\t\t\tsetGiro(270);\n\t}", "public int randint(int max, int min)\n {\n Random rand = new Random();\n int randomNum = rand.nextInt((max - min) + 1) + min;\n return randomNum;\n }", "public static void atacar(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n int ataqueJugador;\n //acciones de la funcion atacar sobre vida del enemigo\n aleatorio = (numeroAleatorio.nextInt(20-10+1)+10);\n ataqueJugador= ((nivel+1)*10)+aleatorio;\n puntosDeVidaEnemigo= puntosDeVidaEnemigo-ataqueJugador;\n \n }", "public static int createRandom(int min, int max){\n\t\tif (min == max){\n\t\t\treturn min;\n\t\t}\n\t\telse{\t\t\t\n\t\t\treturn (int)(Math.random() * (max - min) + min); \n\t\t}\n\t}", "private static int newSecretNumber(int min, int max)\n {\n Random rnd = new Random();\n return rnd.nextInt((max + 1 - min) + min);\n }", "public int randomGenerator(int min, int max) {\n int random = (int) ((Math.random()*((max-min)+1))+min);\n return random;\n }", "public static int getRandom(int min, int max){\n\t int x = (int)(Math.random()*((max-min)+1))+min;\n\t return x;\n\t}", "public static int RandomNumber(int min, int max){\n Random random = new Random();\n int randomNum = random.nextInt((max - min)+1)+min;\n return randomNum;\n }", "public final int arvoRivinAihe() {\r\n return super.getRandom().nextInt(super.aiheetPerusmuoto().length);\r\n }", "private int saisiePersoInt(String typeChoice, int min, int max) { \n\t\tint persoInt; \n\t\ttry {\n\t\t\tSystem.out.println(\"choisissez \"+ typeChoice+\" entre \"+min+\" et \"+max); \n\t\t\tpersoInt=sc.nextInt();\n\t\t\tsc.nextLine();\n\t\t\tif(persoInt<min || persoInt>max) {\n\t\t\t\tsaisiePersoInt(typeChoice, min, max);\n\t\t\t}; \n\t\t\treturn persoInt; \n\t\t} catch (InputMismatchException e) { \n\t\t\tSystem.out.println(\"vous n'avez pas rentré un monbre entier\"); \n\t\t\tsc.nextLine();\n\t\t\treturn saisiePersoInt(typeChoice, min, max); \n\t\t} catch (NoSuchElementException e) {\n\t\t\tSystem.out.println(\"vous n'avez rien rentré\"); \n\t\t\tsc.nextLine();\n\t\t\treturn saisiePersoInt(typeChoice, min, max);\n\t\t}\n\t}", "public static int getRandomInt(int min, int max) {\n return getInstance().rand.nextInt((max - min) + 1) + min;\n }", "public int randomInt(int min, int max) {\n\t\t\t\t // NOTE: Usually this should be a field rather than a method\n\t\t\t\t // variable so that it is not re-seeded every call.\n\t\t\t\t Random rand = new Random();\n\t\t\t\t // nextInt is normally exclusive of the top value,\n\t\t\t\t // so add 1 to make it inclusive\n\t\t\t\t int randomNum = rand.nextInt((max - min) + 1) + min;\n\t\t\t\t return randomNum;\n\t\t\t\t}", "private int aleatorizarNaipe() {\n\t\tint aux;\n\t\taux = r.getIntRand(4);\n\t\treturn aux;\n\t}", "private static int getRandomNumberOfRooms(){\r\n return r.nextInt(50)+1;\r\n }", "public static int estraiIntero(int minimo, int massimo) {\n int range = massimo + 1 - minimo;\n int casual = rand.nextInt(range);\n\n return casual + minimo;\n }", "public int coordinateGenerator(int max, int min) {\n\t\tRandom r = new Random();\n\t\tint a =r.nextInt(max - min) + min;\n\t\treturn a;\n\t}", "public static int numero_aleatorio(int max) {\n // Al numero maximo le sumamos 1 para que se incluye\n int numeroAleatorio = new Random().nextInt((max + 1));\n \n return numeroAleatorio;\n }", "public Instructor(String name, int maxHP, int minAtk,int maxAtk, int timeToAtk){\r\n this.name = name;\r\n this.maxHP = maxHP;\r\n this.minAtk = minAtk;\r\n this.maxAtk = maxAtk;\r\n this.timeToAtk = timeToAtk;\r\n this.currHP = maxHP;\r\n }", "public int compete() {\r\n\t\tint max = 20;\r\n\t\tint min = 10;\r\n\t\tRandom Rand = new Random();\r\n\t\tint ranNum = Rand.nextInt(max - min) + min;\r\n\t\treturn ranNum;\r\n\t}", "public static int generatRandomPositiveNegitiveValue(int max , int min) {\n\t int ii = -min + (int) (Math.random() * ((max - (-min)) + 1));\n\t return ii;\n\t}", "public static int randomabin(int semilla){ \n Random r = new Random();\n int valor = r.nextInt(2); // Entre 0 y 1.\n return valor;\n }", "public int randInt(int min, int max) {\n\t Random rand = new Random();\n\n\t // nextInt is normally exclusive of the top value,\n\t // so add 1 to make it inclusive\n\t int randomNum = rand.nextInt((max - min) + 1) + min;\n\n\t return randomNum;\n\t }", "public static String randNum(int min, int max){\n return String.valueOf(rand.nextInt(max - min + 1) + min);\n }", "int randomIntInRange(int min, int max) {\n\t\tRandom rand = new Random();\n\t\treturn rand.nextInt(max + 1 - min) + min;\n\t}", "public void randomize() {\r\n\t\tif(randomizzatoreVariazione > 0.5)\r\n\t\t\tandamentoCurva.setVariazione(\r\n\t\t\t\t\tandamentoCurva.getVariazione() * randomizzatoreVariazione\r\n\t\t\t\t\t+ andamentoCurva.getMIN_VARIAZIONE()\r\n\t\t\t\t\t+ Math.random() * (andamentoCurva.getMAX_VARIAZIONE() - andamentoCurva.getMIN_VARIAZIONE())\r\n\t\t\t);\r\n\t\telse if(randomizzatoreVariazione < 0.5)\r\n\t\t\tandamentoCurva.setVariazione(\r\n\t\t\t\t\tandamentoCurva.getVariazione()\r\n\t\t\t\t\t- andamentoCurva.getMIN_VARIAZIONE()\r\n\t\t\t\t\t+ Math.random() * (andamentoCurva.getMAX_VARIAZIONE() - andamentoCurva.getMIN_VARIAZIONE() * randomizzatoreVariazione)\r\n\t\t\t);\r\n\t}", "private static double randomGenerator(double min, double max) {\n return (double)java.lang.Math.random() * (max - min +1) + min;\n }", "public int originalgetRandomPositiveInt(int min, int max){\r\n int number = getRandomPositiveInt(); \r\n return (int)number%(max - min + 1)+min;\r\n }", "public int randInt(int min, int max) {\n Random rand = new Random();\n\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n int randomNum = rand.nextInt((max - min) + 1) + min;\n\n return randomNum;\n}", "public static int randInt(int min, int max) {\n\n // Usually this can be a field rather than a method variable\n Random rand = new Random();\n\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n int randomNum = rand.nextInt((max - min) + 1) + min;\n\n return randomNum;\n }", "public User getRandom () {\n\t\treturn User.find(\n\t\t \"user_id != ? and online = ? order by rand()\", this.user_id, true\n\t\t).first();\n\t}", "private int randomIntRange(int min, int max) {\r\n Random random = new Random();\r\n if (min < 0 || max < 0) {\r\n return (random.nextInt(Math.abs(max - min)) + Math.abs(min) + 1) * -1;\r\n }\r\n return random.nextInt(max - min) + min + 1;\r\n }", "public int getNumber(int min, int max) {\n return (int)(Math.random()* (max-min+1)) + min;\n }", "public final int arvoSarakkeenAihe() {\r\n while (true) {\r\n int aihe = super.getRandom()\r\n .nextInt(super.aiheetPerusmuoto().length);\r\n if (aihe != this.riviMuuttujaAihe) {\r\n return aihe;\r\n }\r\n }\r\n }", "public User getUser(String nombre) throws TimeLimitExceptions;", "public static int randInt(int min, int max) {\n int randomNum = random.nextInt((max - min) + 1) + min;\n return randomNum;\n }", "public static String randomEmail(int min, int max) {\n\n\t\tString allowedChars = \"abcdefghiklmnopqrstuvwxyz\";\n\t\tString randommail = \"\";\n\t\tint num = (int) (Math.floor(Math.random() * (max - min)) + min);\n\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tint rnum = (int) Math.floor(Math.random() * allowedChars.length());\n\t\t\trandommail = randommail + allowedChars.subSequence(rnum, rnum + 1);\n\t\t}\n\n\t\trandommail += \"@gmail.com\";\n\t\t// System.out.println(randomstring);\n\t\treturn randommail;\n\n\t}", "public static int random(int min, int max) {\r\n\t\tint diff = max - min + 1;\r\n\t\treturn ((int) (Math.random() * diff)) + min;\r\n\t}", "public static int randInt(int min, int max) {\n\n // NOTE: Usually this should be a field rather than a method\n // variable so that it is not re-seeded every call.\n Random rand = new Random();\n\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n int randomNum = rand.nextInt((max - min) + 1) + min;\n\n return randomNum;\n }", "public int randomInt(int min, int max) {\r\n\t\treturn (int)(Math.random()*(max-min))+min;\r\n\t}", "private void generarNombre() {\r\n\t\tthis.nombre = NOMBRES[(int) (Math.random() * NOMBRES.length)];\r\n\t}", "public static int randInt(int min, int max) {\r\n\t Random rand = new Random();\r\n\t int randomNum = rand.nextInt((max - min) + 1) + min;\r\n\t return randomNum;\r\n\t}", "public RangeRandom(final float min, final float max) {\n this.max = max;\n this.min = min;\n this.random = new Random(System.nanoTime());\n }", "@Override\r\n\tpublic int randOfMax(int max) {\n\t\tRandom r = new Random();\r\n\t\t\r\n\t\tint i = r.nextInt(max);\r\n\t\twhile(0==i){//the restriction of the Random Number\r\n\t\t\ti = r.nextInt(max);\r\n\t\t}\r\n\t\treturn i;\r\n\t}", "private int rand(int lower, int upper) {\n return lower + (int)(Math.random() * ((upper - lower) + 1));\n }", "public static void Random() {\n\t\tRandom ran =new Random();\r\n\t\trandom=ran.nextInt(6)+1;\r\n\t\t//random=1;\r\n\t\twho=A1063307_GUI.who2;\r\n\t\tif((ch[who].status)>0) {\r\n\t\t\tch[who].location=(ch[who].location)+random;\r\n\t\t\tch[who].status=(ch[who].status)-1;\r\n\t\t\t\r\n\t\t}else {\r\n\t\t\t\treturn;\r\n\t\t\t}\t\t\r\n\t}", "private void generatePopularHours() {\r\n double h = Math.random() * 10;\r\n String hrs = ((int)h) + \"\";\r\n }", "public SpriteIndexRandom(int min, int max) {\n\n this.min = min;\n this.max = max;\n }", "public static void main(String[] args) {\n int min=100;\n int max=999;\n int random = (int) (min + Math.random() * (max - min));\n int a=random%10;\n int a1=(random/10)%10;\n int a2=(random/100)%10;\n System.out.println(\"Число = \" +random +\" наибольшее число = \" +Math.max(a, Math.max(a1,a2)));\n}", "public static String randomID(char type, int randMin, int randMax) {\n\t\tRandom random = new Random();\r\n\t\treturn Character.toUpperCase(type) + Integer.toString(random.nextInt(randMax) + randMin);\r\n\t}", "public static int randInt(int incMin, int incMax){\n\n int rand=incMin+rng.nextInt((incMax-incMin)-1);\n return rand;\n }", "T getRandomAllowedValue();", "public static void main(String[] args) {\n \n int maximo = 0; //Asi siempre habra un valor mayor que el\n int minimo = 500; //Asi siempre habra un valor menor que el\n String destacar;\n int [] lista = new int [100];\n \n for (int i = 0; i < 100; i++) { //Introducir valores en el array\n lista[i] = (int)(Math.random()*501); //Crear valores entre 0 y 500\n System.out.print(lista[i] + \" \");\n if (lista[i] > maximo) { //Saber cual es el valor mayor\n maximo = lista[i];\n }\n if (lista[i] < minimo) { //Saber cual es el valor menor\n minimo = lista[i];\n }\n }\n System.out.println(\"\");\n System.out.print(\"¿Cual quieres destacar el valor maximo o minimo?: \");\n destacar = System.console().readLine();\n switch (destacar) { //Opciones para que destacar\n case \"maximo\": //Si la opcion elegida es el maximo\n for (int i = 0; i < 100; i++) {\n if (lista[i] == maximo) { //Cuando el valor sea el maximo le añade **\n System.out.print(\" **\" + lista[i] + \"** \");\n } else { //Cuando no es pone espacio\n System.out.print(lista[i] + \" \");\n }\n }\n break;\n case \"minimo\": //Si la opcion elegida es el minimo\n for (int i = 0; i < 100; i++) {\n if (lista[i] == minimo) { //Cuando el valor sea el minimo le añade **\n System.out.print(\" **\" + lista[i] + \"** \");\n } else { //Cuando no pone espacio\n System.out.print(lista[i] + \" \");\n }\n }\n break;\n default:\n }\n }", "public static int randInt(int min, int max) {\r\n\r\n\t\t\t// Usually this can be a field rather than a method variable\r\n\t\t\tRandom rand = new Random();\r\n\r\n\t\t\t// nextInt is normally exclusive of the top value,\r\n\t\t\t// so add 1 to make it inclusive\r\n\t\t\tint randomNum = rand.nextInt((max - min) + 1) + min;\r\n\r\n\t\t\treturn randomNum;\r\n\t\t}", "public static void curar(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n int curador;\n //condicion de puntos de mana para ejecutar la curacion del jugador\n if(puntosDeMana>=1){\n //acciones de la funcion curar en el jugador\n aleatorio = (numeroAleatorio.nextInt(25-15+1)+15);\n curador= ((nivel+1)*5)+aleatorio;\n puntosDeVida= puntosDeVida+curador;\n puntosDeMana=puntosDeMana-1;\n }\n else{//imprimiendo el mensaje de curacion fallada\n System.out.println(\"no cuentas con Puntos De mana (MP) para curarte\");\n }\n }", "public static void main(String[] args) {\n\t\tint MAX = 20;\r\n\t\tint MIN = 1;\r\n\t\tScanner number = new Scanner(System.in);\r\n\t\tSystem.out.println(\"Guess a number between 1 and 20 \");\r\n\t\tint input = number.nextInt();\r\n\t\tint random = MIN + (int)(Math.random() * MAX);\r\n\t\tif(input == random)\r\n\t\tSystem.out.println(\"You were correct! The number was :\" + random);\r\n\t\t\r\n\t\telse\r\n\t\t\tSystem.out.println(\"You were incorrect! The number was :\" + random);\r\n\t\t\r\n\t\tif(input >= 21 )\r\n\t\t\tSystem.out.println(\"The range is 1 to 20. Please try again.\");\r\n\t}", "public static int generate(int min, int max) {\n\t\n\treturn min + (int) (Math.random() * ((max - min) + 1));\n\t\n\t}", "public final int random(int min, int max) {\n return Utils.random(min, max);\n }", "private int randomAge() {\n \tint low = 18;\n \tint high = 100;\n \tint offset = high - low;\n \tRandom r = new Random();\n \treturn r.nextInt(offset) + low;\n \t\n }", "public static int randInt(int min, int max) {\n Random rand = new Random();\n return rand.nextInt((max - min) + 1) + min;\n }", "private int randBetween(int start, int end) {\n\t\treturn start + (int)Math.round(Math.random() * (end - start));\n\t}", "private int generateRandomNb(int min, int max) {\n Random random = new Random();\n\n return random.nextInt((max - min) + 1) + min;\n }", "public static int randInt(int min, int max) {\n Random rand = new Random();\n\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n int randomNum = rand.nextInt((max - min) + 1) + min;\n\n return randomNum;\n }", "public static int randInt(int min, int max) {\n Random rand = new Random();\n\n // nextInt is normally exclusive of the top value,\n // so add 1 to make it inclusive\n int randomNum = rand.nextInt((max - min) + 1) + min;\n\n return randomNum;\n }", "int getRandom(int max);", "public int cantidadPersonas() {\n ran = new Random();\n cantidadPeople = ran.nextInt(4) + 1;\n return cantidadPeople;\n }", "public static int randInt(int min, int max) {\n\t Random rand = new Random();\n\n\t // nextInt is normally exclusive of the top value,\n\t // so add 1 to make it inclusive\n\t int randomNum = rand.nextInt((max - min) + 1) + min;\n\n\t return randomNum;\n\t}", "public static int randInt(int min, int max) {\n\t Random rand = new Random();\n\n\t // nextInt is normally exclusive of the top value,\n\t // so add 1 to make it inclusive\n\t int randomNum = rand.nextInt((max - min) + 1) + min;\n\n\t return randomNum;\n\t}", "public static int randInt(int min, int max) {\n\t Random rand = new Random();\n\n\t // nextInt is normally exclusive of the top value,\n\t // so add 1 to make it inclusive\n\t int randomNum = rand.nextInt((max - min) + 1) + min;\n\n\t return randomNum;\n\t}", "public static int randomInt(int min, int max) {\n Random rand = new Random();\n int randomNum = rand.nextInt((max - min) + 1) + min;\n return randomNum;\n }", "public Individu selection() {\n\t\t// Pioche au hasard deux individus differents\n\t\tRandom rand = new Random();\n\t\tint index1 = 0, index2 = 0;\n\t\tindex1 = rand.nextInt(this.individus.size());\n\t\twhile(index1 == index2) {\n\t\t\tindex2 = rand.nextInt(this.individus.size());\n\t\t}\n\n\t\t//double fitness1 =\n\t\tdouble fitness1 = this.individus.get(index1).fitness();\n\t\tdouble fitness2 = this.individus.get(index2).fitness();\n\n\t\t// Determine le meilleur du moins bon\n\t\tIndividu better, worse;\n\t\tif(fitness1 > fitness2) {\n\t\t\tbetter = this.individus.get(index1);\n\t\t\tworse = this.individus.get(index2);\n\t\t} else {\n\t\t\tworse = this.individus.get(index1);\n\t\t\tbetter = this.individus.get(index2);\n\t\t}\n\n\t\t// Dans 75% des cas, onp rend le meilleur des deux\n\t\tif(rand.nextDouble() <= 0.75) {\n\t\t\treturn better;\n\t\t} else {\n\t\t\treturn worse;\n\t\t}\n\t}" ]
[ "0.7050477", "0.65338963", "0.6385424", "0.63413167", "0.63022584", "0.6252846", "0.6230989", "0.6199048", "0.61607367", "0.6140905", "0.6083298", "0.6040076", "0.60339665", "0.60281384", "0.59965897", "0.5992834", "0.5970781", "0.59613556", "0.5954616", "0.59496987", "0.5903064", "0.58949184", "0.5885125", "0.5879079", "0.58714557", "0.58580303", "0.5856665", "0.5820003", "0.5787685", "0.57821345", "0.5771045", "0.5749538", "0.5739728", "0.5739537", "0.5719481", "0.5719234", "0.5710073", "0.5697665", "0.56881016", "0.5687392", "0.5656284", "0.5654102", "0.5614481", "0.56020486", "0.56014574", "0.5585876", "0.55695224", "0.55650926", "0.55607086", "0.55423266", "0.5535252", "0.5524194", "0.55178", "0.5511422", "0.5501088", "0.5490604", "0.5486228", "0.54852206", "0.54750603", "0.5474197", "0.54582006", "0.5447906", "0.54474443", "0.54374653", "0.5433273", "0.54328996", "0.5431399", "0.54204094", "0.5413681", "0.5412991", "0.53998345", "0.53891134", "0.537884", "0.5366289", "0.53475183", "0.5343945", "0.53432494", "0.53419423", "0.53371483", "0.5332305", "0.532917", "0.53260744", "0.5319486", "0.5317207", "0.5316467", "0.53054565", "0.5297642", "0.52945465", "0.5288204", "0.5285358", "0.52795756", "0.52750397", "0.52750397", "0.5272057", "0.52698874", "0.52641755", "0.52641755", "0.52641755", "0.52608687", "0.5258338" ]
0.6000224
14
Renvoie le nombre de factory que possede l'equipe
public int getNbFacto() { return this.factories.size(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract ProductFactory getFactory();", "Demo1Factory getDemo1Factory();", "PlanningFactory getFactory();", "protected String getFactoryID( String id ){\n return id;\n }", "public String getName() {\n return (\"Regular Factory\");\n }", "public interface UnitFactory {\n Gui_Unit createUnit(String name, int team);\n Gui_Unit copy(Gui_Unit guiUnit);\n\n static UnitFactory getUnitFactory(UnitClassNames name){\n UnitFactory factory = null;\n\n switch (name){\n case ARTILLERY:{\n factory = new ArtilleryFactory();\n break;\n }\n case VEHICLE:{\n factory = new VehicleFactory();\n break;\n }\n case LIGHT_INFANTRY:{\n factory = new LightInfantryFactory();\n break;\n }\n case MELEE_INFANTRY:{\n factory = new MeleeInfantryFactory();\n break;\n }\n case HEAVY_INFANTRY:{\n factory = new HeavyInfantryFactory();\n break;\n }\n }\n return factory ;\n }\n}", "public interface FruitFactory {\n\n Fruit getApple();\n\n Fruit getBanana();\n}", "@Override\n public String getName() {\n return \"factoryName: \"+ mFactoryName + \" product :ComplexProductB\";\n }", "@Test\n public void testCreateFactory() {\n setFactory(\"ThaiMoneyFactory\");\n assertEquals(ThaiMoneyFactory.class, moneyFactory.getClass());\n assertNotEquals(MalayMoneyFactory.class, moneyFactory.getClass());\n assertEquals(currency, \"Baht\");\n setFactory(\"MalayMoneyFactory\");\n assertEquals(MalayMoneyFactory.class, moneyFactory.getClass());\n assertNotEquals(ThaiMoneyFactory.class, moneyFactory.getClass());\n assertEquals(currency, \"Ringgit\");\n }", "public static String getFactoryName() {\n\n return FACTORY_CLASS.getName();\n }", "public interface IFactory {\n IProductA getProductA();\n IProductB getProductB();\n}", "@Override\n public String getName() {\n return \"LibVirt Service Factory\";\n }", "public abstract Product productFactory(String type);", "public interface Factory {\r\n}", "Sticker.Factory getStickerFactory();", "GamesFactory getGamesFactory();", "QuestionarioFactory getQuestionarioFactory();", "public ObjectifyFactory factory() {\n return ofy().factory();\n }", "public interface Factory {\n LeiFeng createLeiFeng();\n}", "public OBStoreFactory getFactory();", "public interface Factory {\n Cup productCup();\n Cover productCover();\n}", "public static AbstractStackFactory getFactory(String factorial){\n if(factorial.equalsIgnoreCase(\"Lista\")){\n return new StackListFactory();\n\n }else if(factorial.equalsIgnoreCase(\"Vector\")){\n return new StackVectorFactory();\n\n }else if(factorial.equalsIgnoreCase(\"ArrayList\")){\n return new StackArrayListFactory();\n }\n\n return null;\n }", "public interface ICarFactory {\n\t\n\tpublic ICar produce(String carType);\n\t\n\t \n\t\n}", "public AoDai chooseFactory(){\n\t\treturn new ModernAoDai();\n\t}", "public interface Factory {\n Product create();\n}", "StoriesFactory getStoriesFactory();", "public interface AbstractFactory {\n /**\n * Create cpu cpu.\n *\n * @return the cpu\n */\n Cpu createCpu();\n\n /**\n * Create main board main board.\n *\n * @return the main board\n */\n MainBoard createMainBoard();\n}", "SubTitle.Factory getSubTitleFactory();", "public interface IFactory {\n Operation CreateOperation();\n\n}", "@Override\n public String classFactoryName() {\n return Mirrors.findAnnotationMirror(element(), Factory.class)\n .flatMap(Mirrors::findAnnotationValue)\n .map(value -> value.getValue().toString()).orElse(null);\n }", "QuestionnaireFactory getQuestionnaireFactory();", "public final Method getFactoryMethod() {\n\treturn factoryMethod;\n }", "public interface IFactory {\n IUser createUser();\n IDepartment createDepartment();\n}", "public interface DrinksFactory {\n //饮料\n Drinks dBuild();\n\n //面包\n Bread bBuild();\n\n void buyWhat();\n}", "UsageevolutionFactory getUsageevolutionFactory();", "Class<?> getFactoryClass();", "public void printFactory(String name) {\n\t\tboolean found = false;\n\t\tServiceReference[] refs;\n\t\ttry {\n\t\t\tout.println(\"iPOJO Factory\");\n\t\t\tout.println(\"-------------------\");\n\t\t\trefs = bundleContext.getServiceReferences(Factory.class.getName(), null);\n\n\t\t\tfor (int i = 0; i < refs.length; i++) {\n\t\t\t\tFactory factory = (Factory) bundleContext.getService(refs[i]);\n\t\t\t\tif (factory.getName().equalsIgnoreCase(name)) {\n\t\t\t\t\tif (found) {\n\t\t\t\t\t\tout.println(\"\");\n\t\t\t\t\t}\n\t\t\t\t\tout.println(factory.getDescription().toString().replace(\"\\n\", \"\\r\\n\"));\n\t\t\t\t\tfound = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!found) {\n\t\t\t\tout.println(\"Factory \" + name + \" not found\");\n\t\t\t}\n\t\t} catch (InvalidSyntaxException e) {\n\n\t\t}\n\n\t}", "public interface XxxFactory<T> {\n T createAaXxxProduct();\n T createBbXxxProduct();\n}", "EzlemurFactory getEzlemurFactory();", "protected String getAdjacentFactoryID( String id ){\n return id;\n }", "public interface PersonFactory {\n\n public Boy getBoy();\n\n public Gril getGril();\n\n}", "FactoryBean getFactoryBean();", "IotdslFactory getIotdslFactory();", "public interface ReviewServiceFactory extends ServiceFactory {\n}", "GoatInfrastructureFactory getGoatInfrastructureFactory();", "public interface ICarFactory {\n}", "opmodelFactory getopmodelFactory();", "public interface ProductFactory {\n Product createProduct();\n}", "public interface IFactory {\n\n public IUser createUser();\n\n public IDepartment addDepartment();\n}", "Factory getFactory()\n {\n return configfile.factory;\n }", "@Override\n IDeviceFactory getFactory();", "private MultibinderFactory() { }", "public void setUniqueFactoryMethodName(String name)\n/* */ {\n/* 276 */ Assert.hasText(name, \"Factory method name must not be empty\");\n/* 277 */ setFactoryMethodName(name);\n/* 278 */ this.isFactoryMethodUnique = true;\n/* */ }", "public ProyectoFactoryImpl() {\r\n\t\tsuper();\r\n\t}", "public interface ServicesFactory extends EFactory {\n\t/**\n\t * The singleton instance of the factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @generated\n\t */\n\tServicesFactory eINSTANCE = org.cylio.project.domain.editor.services.impl.ServicesFactoryImpl.init();\n\n\t/**\n\t * Returns a new object of class '<em>Provider</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Provider</em>'.\n\t * @generated\n\t */\n\tProvider createProvider();\n\n\t/**\n\t * Returns a new object of class '<em>Feature</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Feature</em>'.\n\t * @generated\n\t */\n\tFeature createFeature();\n\n\t/**\n\t * Returns a new object of class '<em>Stub</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Stub</em>'.\n\t * @generated\n\t */\n\tStub createStub();\n\n\t/**\n\t * Returns the package supported by this factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return the package supported by this factory.\n\t * @generated\n\t */\n\tServicesPackage getServicesPackage();\n\n}", "public interface IFactory {\n ICustomer getCustomer(CustomerType type);\n IAccount getAccount(Enum type);\n// IEntry getEntry(EntryType type);\n DAO getDAO(Enum type);\n\n}", "public interface RepositoryFactory extends EFactory {\n /**\n * The singleton instance of the factory.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @generated\n */\n RepositoryFactory eINSTANCE = io.fixprotocol._2020.orchestra.repository.impl.RepositoryFactoryImpl.init();\n\n /**\n * Returns a new object of class '<em>Action Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Action Type</em>'.\n * @generated\n */\n ActionType createActionType();\n\n /**\n * Returns a new object of class '<em>Actors Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Actors Type</em>'.\n * @generated\n */\n ActorsType createActorsType();\n\n /**\n * Returns a new object of class '<em>Actor Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Actor Type</em>'.\n * @generated\n */\n ActorType createActorType();\n\n /**\n * Returns a new object of class '<em>Annotation</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Annotation</em>'.\n * @generated\n */\n Annotation createAnnotation();\n\n /**\n * Returns a new object of class '<em>Appinfo</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Appinfo</em>'.\n * @generated\n */\n Appinfo createAppinfo();\n\n /**\n * Returns a new object of class '<em>Block Assignment Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Block Assignment Type</em>'.\n * @generated\n */\n BlockAssignmentType createBlockAssignmentType();\n\n /**\n * Returns a new object of class '<em>Categories Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Categories Type</em>'.\n * @generated\n */\n CategoriesType createCategoriesType();\n\n /**\n * Returns a new object of class '<em>Category Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Category Type</em>'.\n * @generated\n */\n CategoryType createCategoryType();\n\n /**\n * Returns a new object of class '<em>Code Sets Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Code Sets Type</em>'.\n * @generated\n */\n CodeSetsType createCodeSetsType();\n\n /**\n * Returns a new object of class '<em>Code Set Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Code Set Type</em>'.\n * @generated\n */\n CodeSetType createCodeSetType();\n\n /**\n * Returns a new object of class '<em>Code Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Code Type</em>'.\n * @generated\n */\n CodeType createCodeType();\n\n /**\n * Returns a new object of class '<em>Component Ref Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Component Ref Type</em>'.\n * @generated\n */\n ComponentRefType createComponentRefType();\n\n /**\n * Returns a new object of class '<em>Component Rule Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Component Rule Type</em>'.\n * @generated\n */\n ComponentRuleType createComponentRuleType();\n\n /**\n * Returns a new object of class '<em>Components Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Components Type</em>'.\n * @generated\n */\n ComponentsType createComponentsType();\n\n /**\n * Returns a new object of class '<em>Component Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Component Type</em>'.\n * @generated\n */\n ComponentType createComponentType();\n\n /**\n * Returns a new object of class '<em>Concepts Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Concepts Type</em>'.\n * @generated\n */\n ConceptsType createConceptsType();\n\n /**\n * Returns a new object of class '<em>Concept Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Concept Type</em>'.\n * @generated\n */\n ConceptType createConceptType();\n\n /**\n * Returns a new object of class '<em>Datatypes Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Datatypes Type</em>'.\n * @generated\n */\n DatatypesType createDatatypesType();\n\n /**\n * Returns a new object of class '<em>Datatype Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Datatype Type</em>'.\n * @generated\n */\n DatatypeType createDatatypeType();\n\n /**\n * Returns a new object of class '<em>Documentation</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Documentation</em>'.\n * @generated\n */\n Documentation createDocumentation();\n\n /**\n * Returns a new object of class '<em>Document Root</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Document Root</em>'.\n * @generated\n */\n DocumentRoot createDocumentRoot();\n\n /**\n * Returns a new object of class '<em>Extension Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Extension Type</em>'.\n * @generated\n */\n ExtensionType createExtensionType();\n\n /**\n * Returns a new object of class '<em>Field Ref Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Field Ref Type</em>'.\n * @generated\n */\n FieldRefType createFieldRefType();\n\n /**\n * Returns a new object of class '<em>Field Rule Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Field Rule Type</em>'.\n * @generated\n */\n FieldRuleType createFieldRuleType();\n\n /**\n * Returns a new object of class '<em>Fields Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Fields Type</em>'.\n * @generated\n */\n FieldsType createFieldsType();\n\n /**\n * Returns a new object of class '<em>Field Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Field Type</em>'.\n * @generated\n */\n FieldType createFieldType();\n\n /**\n * Returns a new object of class '<em>Flow Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Flow Type</em>'.\n * @generated\n */\n FlowType createFlowType();\n\n /**\n * Returns a new object of class '<em>Group Ref Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Group Ref Type</em>'.\n * @generated\n */\n GroupRefType createGroupRefType();\n\n /**\n * Returns a new object of class '<em>Groups Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Groups Type</em>'.\n * @generated\n */\n GroupsType createGroupsType();\n\n /**\n * Returns a new object of class '<em>Group Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Group Type</em>'.\n * @generated\n */\n GroupType createGroupType();\n\n /**\n * Returns a new object of class '<em>Identifiers Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Identifiers Type</em>'.\n * @generated\n */\n IdentifiersType createIdentifiersType();\n\n /**\n * Returns a new object of class '<em>Identifier Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Identifier Type</em>'.\n * @generated\n */\n IdentifierType createIdentifierType();\n\n /**\n * Returns a new object of class '<em>Mapped Datatype</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Mapped Datatype</em>'.\n * @generated\n */\n MappedDatatype createMappedDatatype();\n\n /**\n * Returns a new object of class '<em>Message Ref Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Message Ref Type</em>'.\n * @generated\n */\n MessageRefType createMessageRefType();\n\n /**\n * Returns a new object of class '<em>Messages Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Messages Type</em>'.\n * @generated\n */\n MessagesType createMessagesType();\n\n /**\n * Returns a new object of class '<em>Message Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Message Type</em>'.\n * @generated\n */\n MessageType createMessageType();\n\n /**\n * Returns a new object of class '<em>Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Type</em>'.\n * @generated\n */\n RepositoryType createRepositoryType();\n\n /**\n * Returns a new object of class '<em>Responses Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Responses Type</em>'.\n * @generated\n */\n ResponsesType createResponsesType();\n\n /**\n * Returns a new object of class '<em>Response Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Response Type</em>'.\n * @generated\n */\n ResponseType createResponseType();\n\n /**\n * Returns a new object of class '<em>Sections Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Sections Type</em>'.\n * @generated\n */\n SectionsType createSectionsType();\n\n /**\n * Returns a new object of class '<em>Section Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Section Type</em>'.\n * @generated\n */\n SectionType createSectionType();\n\n /**\n * Returns a new object of class '<em>State Machine Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>State Machine Type</em>'.\n * @generated\n */\n StateMachineType createStateMachineType();\n\n /**\n * Returns a new object of class '<em>State Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>State Type</em>'.\n * @generated\n */\n StateType createStateType();\n\n /**\n * Returns a new object of class '<em>Structure Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Structure Type</em>'.\n * @generated\n */\n StructureType createStructureType();\n\n /**\n * Returns a new object of class '<em>Timer Schedule</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Timer Schedule</em>'.\n * @generated\n */\n TimerSchedule createTimerSchedule();\n\n /**\n * Returns a new object of class '<em>Timer Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Timer Type</em>'.\n * @generated\n */\n TimerType createTimerType();\n\n /**\n * Returns a new object of class '<em>Transition Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Transition Type</em>'.\n * @generated\n */\n TransitionType createTransitionType();\n\n /**\n * Returns a new object of class '<em>Trigger Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Trigger Type</em>'.\n * @generated\n */\n TriggerType createTriggerType();\n\n /**\n * Returns a new object of class '<em>Unique Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Unique Type</em>'.\n * @generated\n */\n UniqueType createUniqueType();\n\n /**\n * Returns the package supported by this factory.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return the package supported by this factory.\n * @generated\n */\n RepositoryPackage getRepositoryPackage();\n\n}", "public interface IFactory {\n\t/**\n\t * créer un service transactionel (un proxy de service) gérant les Users\n\t * \n\t * @param caller\n\t * objet transactionel appelant ce service. null si début de\n\t * transaction\n\t * @return\n\t */\n\tpublic abstract IUserService createUserService(ITransactional caller);\n\n\t/**\n\t * créer un dao transactionel dédié à la table utilisateur (un proxy de dao)\n\t * \n\t * @param caller\n\t * objet transactionel appelant ce service. null si début de\n\t * transaction\n\t * @return\n\t */\n\tpublic abstract IUtilisateurDAO createUserDAO(ITransactional caller);\n\n\t/**\n\t * créer un dao transactionel dédié à la table cursus (un proxy de dao)\n\t * \n\t * @param caller\n\t * objet transactionel appelant ce service. null si début de\n\t * transaction\n\t * @return\n\t */\n\tpublic abstract ICursusDAO createCursusDAO(ITransactional caller);\n\n\t/**\n\t * créer un dao transactionel dédié à la table competence (un proxy de dao)\n\t * \n\t * @param caller\n\t * objet transactionel appelant ce service. null si début de\n\t * transaction\n\t * @return\n\t */\n\tpublic abstract ICompetenceDAO createCompetenceDAO(ITransactional caller);\n\n\tpublic abstract INiveauxDAO createNiveauDAO(ITransactional caller);\n\n\tpublic abstract IProfilDAO createProfilDAO(ITransactional caller);\n\n\tpublic abstract IGroupeDAO createGroupeDAO(ITransactional caller);\n\n\tpublic abstract IFenetreDAO createFenetreDAO(ITransactional caller);\n\n\tpublic abstract IFonctionDAO createFonctionDAO(ITransactional caller);\n\n\tpublic abstract INatureDAO createNatureDAO(ITransactional caller);\n\n\tpublic abstract IDroitDAO createDroitDAO(ITransactional caller);\n\n\tpublic abstract ISecurityService createSecurityService(ITransactional caller);\n\n\tpublic abstract IProjectService createProjectService(ITransactional caller);\n\n\tpublic abstract IKeywordDAO createKeywordDAO(ITransactional caller);\n\n\tpublic abstract IStatutDAO createStatutDAO(ITransactional caller);\n\n\tpublic abstract IAdresseDAO createAdresseDAO(ITransactional caller);\n\t\n}", "public PedidoFactoryImpl() {\n\t\tsuper();\n\t}", "public ProductoCreable newInstance(int codigo, String nombre){\r\n \r\n }", "TestModelFactory getTestModelFactory();", "@DISPID(1610940422) //= 0x60050006. The runtime will prefer the VTID if present\n @VTID(28)\n Factory shapeFactory();", "private ServiceFactory() {}", "public interface TypeFactory {\n int type(Meizi m);\n\n int type(String string);\n\n BaseViewHolder creatViewHolder(int viewType, View view);\n}", "public static gestionVoeu.EtudiantFactory read(org.omg.CORBA.portable.InputStream istream)\n {\n return(gestionVoeu.EtudiantFactory)istream.read_Object(gestionVoeu._EtudiantFactoryStub.class);\n }", "UberFactory getUberFactory();", "ModelsFactory getModelsFactory();", "NetworkFactory getNetworkFactory();", "public interface SOSFactory {\n SOS getSOS();\n}", "public interface EnemyShipPartsFactory {\n ESWeapon addESGun();\n ESEngine addESEngine();\n}", "MakeflowFactory getMakeflowFactory();", "@Override\n\tpublic IProduct factoryMethod() {\n\t\treturn new Toy();\n\t}", "public NoodleShop(SimpleNoodleFactory noodleFactory) {\n this.noodleFactory = noodleFactory;\n }", "@Override\n\t\tpublic Object[] getFactoryParameters() {\n\t\t\treturn null;\n\t\t}", "public abstract ServiceLocator create(String name);", "public interface AbstractFactory {\n Bmw produceBmw();\n Benz produceBenz();\n}", "GramaticaFactory getGramaticaFactory();", "Schueler createSchueler();", "public interface AliciaTest5Factory extends EFactory {\n\t/**\n\t * The singleton instance of the factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @generated\n\t */\n\tAliciaTest5Factory eINSTANCE = aliciaTest5.impl.AliciaTest5FactoryImpl.init();\n\n\t/**\n\t * Returns a new object of class '<em>Alicia Lab</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Alicia Lab</em>'.\n\t * @generated\n\t */\n\tAliciaLab createAliciaLab();\n\n\t/**\n\t * Returns a new object of class '<em>Project</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Project</em>'.\n\t * @generated\n\t */\n\tProject createProject();\n\n\t/**\n\t * Returns a new object of class '<em>Student</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Student</em>'.\n\t * @generated\n\t */\n\tStudent createStudent();\n\n\t/**\n\t * Returns the package supported by this factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return the package supported by this factory.\n\t * @generated\n\t */\n\tAliciaTest5Package getAliciaTest5Package();\n\n}", "public PiviFactoryImpl() {\r\n\t\tsuper();\r\n\t}", "public interface HumanFactory {\n\n Human createYellow();\n\n Human createBlack();\n}", "public StyleAbstractFactory getStyleFactory() {\r\n\t\t// Leggo da file esterno quale Factory utilizzare\r\n String stile = ULeggiDaFile.getStileInterfaccia();\r\n // Factory da restituire\r\n StyleAbstractFactory styleAbstractFactory;\r\n switch (stile) {\r\n\t\tcase \"light\":\r\n\t\t\tstyleAbstractFactory = LightStyleFactory.getInstance();\r\n\t\t\tbreak; \r\n\t\tcase \"dark\":\r\n\t\t\tstyleAbstractFactory = DarkStyleFactory.getInstance();\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// Di default fornisco la factory \"light\"\r\n\t\t\tstyleAbstractFactory = LightStyleFactory.getInstance();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\treturn styleAbstractFactory;\r\n\t}", "@Override\r\n\tpublic Product factory() {\n\t\treturn new ConcreteProduct2();\r\n\t}", "public static void main(String[] args) {\n System.out.println(\"Creating Honda\");\n System.out.println(\"\\n\\nAdding new Factories\");\n Manufacturer honda = new Manufacturer(\"Honda\");\n System.out.println(\"Adding Hybrid Factory Trade:cheap\");\n honda.addNewFactory(CarType.HYBRID, \"cheap\");\n System.out.println(\"Adding Truck Factory Trade:heavy\");\n honda.addNewFactory(CarType.TRUCK, \"heavy\");\n System.out.println(\"Adding Sport Factory Trade:fast\");\n honda.addNewFactory(CarType.SPORT, \"fast\");\n System.out.println(\"Adding Hybrid Factory Trade:zippy\");\n honda.addNewFactory(CarType.HYBRID, \"zippy\");\n System.out.println(\"Adding Truck Factory Trade:deadly\");\n honda.addNewFactory(CarType.TRUCK, \"deadly\");\n System.out.println(\"Adding Sport Factory Trade:SUPERFAST\");\n honda.addNewFactory(CarType.SPORT, \"SUPERFAST\");//I Don't know cars\n \n System.out.println(\"\\n\\nAdding Factory Owners\");\n System.out.println(\"Adding Factory Owner Employee Bob\");\n honda.addFactoryOwner(\"Bob\");\n System.out.println(\"Adding Factory Owner Employee Tob\");\n honda.addFactoryOwner(\"Tob\");\n System.out.println(\"Adding Factory Owner Employee Rob\");\n honda.addFactoryOwner(\"Rob\");\n System.out.println(\"Adding Factory Owner Employee Cob\");\n honda.addFactoryOwner(\"Cob\");\n System.out.println(\"Adding Factory Owner Employee Fob\");\n honda.addFactoryOwner(\"Fob\");\n \n System.out.print(\"Setting the Factory Owner Pay \");\n honda.changeFactoryOwnerPay(new GoodPaying());\n System.out.println(honda.getFactoryOwners().getStrategy().getPayStrat());\n List<Employee> employees = honda.getFactoryOwners().getAllEmployees();\n for (Employee obs : employees) {\n System.out.println(obs.getEmployeeName() + \" \" + obs.getPayStrat().getPayStrat());\n \n }\n System.out.println(\"\\n\\nAdding Factory Employess\");\n System.out.println(\"Adding Factory Employee Brob\");\n honda.addFactoryWorker(\"Borb\");\n System.out.println(\"Adding Factory Employee Trob\");\n honda.addFactoryWorker(\"Torb\");\n System.out.println(\"Adding Factory Employee Rrob\");\n honda.addFactoryWorker(\"Rorb\");\n System.out.println(\"Adding Factory Employee Crob\");\n honda.addFactoryWorker(\"Corb\");\n System.out.println(\"Adding Factory Employee Frob\");\n honda.addFactoryWorker(\"Forb\");\n honda.changeFactoryWorkerPay(new BadPaying());\n System.out.print(\"Setting the Factory Employee Pay \");\n System.out.println(honda.getFactoryEmployees().getStrategy().getPayStrat());\n \n employees = honda.getFactoryEmployees().getAllEmployees();\n \n for (Employee obs : employees) {\n \n System.out.println(obs.getEmployeeName() + \" \" + obs.getPayStrat().getPayStrat());\n \n }\n \n \n System.out.println(\"\\n\\nCreating some cars\");\n Car carHolder = honda.getCar(CarType.HYBRID);\n System.out.println(carHolder.getTrade() + \" \" + carHolder.getType());\n carHolder = honda.getCar(CarType.SPORT);\n System.out.println(carHolder.getTrade() + \" \" + carHolder.getType());\n carHolder = honda.getCar(CarType.TRUCK);\n System.out.println(carHolder.getTrade() + \" \" + carHolder.getType());\n \n \n carHolder = honda.getCar(CarType.HYBRID, \"zippy\");\n System.out.println(carHolder.getTrade() + \" \" + carHolder.getType());\n carHolder = honda.getCar(CarType.TRUCK, \"deadly\");\n System.out.println(carHolder.getTrade() + \" \" + carHolder.getType());\n carHolder = honda.getCar(CarType.SPORT, \"SUPERFAST\");\n System.out.println(carHolder.getTrade() + \" \" + carHolder.getType());\n \n System.out.println(\"\\n\\nCreating a couple car models\");\n Model modelHolder = honda.getCarModel(CarType.HYBRID, \"Fit\");\n System.out.println(modelHolder.getTrade() + \" \" + modelHolder.getType() + \" \" \n + modelHolder.getModelName() + \" \" + modelHolder.getCreator()); \n modelHolder = honda.getCarModel(CarType.SPORT, \"Element\");\n System.out.println(modelHolder.getTrade() + \" \" + modelHolder.getType() + \" \" \n + modelHolder.getModelName() + \" \" + modelHolder.getCreator());\n modelHolder = honda.getCarModel(CarType.TRUCK, \"Odysee\");\n System.out.println(modelHolder.getTrade() + \" \" + modelHolder.getType() + \" \" \n + modelHolder.getModelName() + \" \" + modelHolder.getCreator());\n \n modelHolder = honda.getCarModel(CarType.HYBRID, \"Fit\", \"zippy\");\n System.out.println(modelHolder.getTrade() + \" \" + modelHolder.getType() + \" \" \n + modelHolder.getModelName() + \" \" + modelHolder.getCreator()); \n modelHolder = honda.getCarModel(CarType.SPORT, \"Element\", \"SUPERFAST\");\n System.out.println(modelHolder.getTrade() + \" \" + modelHolder.getType() + \" \" \n + modelHolder.getModelName() + \" \" + modelHolder.getCreator());\n modelHolder = honda.getCarModel(CarType.TRUCK, \"Odysee\", \"deadly\");\n System.out.println(modelHolder.getTrade() + \" \" + modelHolder.getType() + \" \" \n + modelHolder.getModelName() + \" \" + modelHolder.getCreator());\n \n \n \n \n }", "public interface SealFactory extends EFactory\n{\n /**\n * The singleton instance of the factory.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @generated\n */\n SealFactory eINSTANCE = unifi.marcotinacci.thesis.seal.seal.impl.SealFactoryImpl.init();\n\n /**\n * Returns a new object of class '<em>Program</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Program</em>'.\n * @generated\n */\n Program createProgram();\n\n /**\n * Returns a new object of class '<em>Range</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Range</em>'.\n * @generated\n */\n Range createRange();\n\n /**\n * Returns a new object of class '<em>Action</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Action</em>'.\n * @generated\n */\n Action createAction();\n\n /**\n * Returns a new object of class '<em>Module Define</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Module Define</em>'.\n * @generated\n */\n ModuleDefine createModuleDefine();\n\n /**\n * Returns a new object of class '<em>Variable Declaration</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Variable Declaration</em>'.\n * @generated\n */\n VariableDeclaration createVariableDeclaration();\n\n /**\n * Returns a new object of class '<em>Type</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Type</em>'.\n * @generated\n */\n Type createType();\n\n /**\n * Returns a new object of class '<em>Rule</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Rule</em>'.\n * @generated\n */\n Rule createRule();\n\n /**\n * Returns a new object of class '<em>ND Case</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>ND Case</em>'.\n * @generated\n */\n NDCase createNDCase();\n\n /**\n * Returns a new object of class '<em>Case</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Case</em>'.\n * @generated\n */\n Case createCase();\n\n /**\n * Returns a new object of class '<em>Update</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Update</em>'.\n * @generated\n */\n Update createUpdate();\n\n /**\n * Returns a new object of class '<em>Environment</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Environment</em>'.\n * @generated\n */\n Environment createEnvironment();\n\n /**\n * Returns a new object of class '<em>Expression</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Expression</em>'.\n * @generated\n */\n Expression createExpression();\n\n /**\n * Returns a new object of class '<em>No Action</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>No Action</em>'.\n * @generated\n */\n NoAction createNoAction();\n\n /**\n * Returns a new object of class '<em>Assign</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Assign</em>'.\n * @generated\n */\n Assign createAssign();\n\n /**\n * Returns a new object of class '<em>And</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>And</em>'.\n * @generated\n */\n And createAnd();\n\n /**\n * Returns a new object of class '<em>Or</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Or</em>'.\n * @generated\n */\n Or createOr();\n\n /**\n * Returns a new object of class '<em>Leq</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Leq</em>'.\n * @generated\n */\n Leq createLeq();\n\n /**\n * Returns a new object of class '<em>Less</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Less</em>'.\n * @generated\n */\n Less createLess();\n\n /**\n * Returns a new object of class '<em>Eq</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Eq</em>'.\n * @generated\n */\n Eq createEq();\n\n /**\n * Returns a new object of class '<em>Neq</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Neq</em>'.\n * @generated\n */\n Neq createNeq();\n\n /**\n * Returns a new object of class '<em>Geq</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Geq</em>'.\n * @generated\n */\n Geq createGeq();\n\n /**\n * Returns a new object of class '<em>Gtr</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Gtr</em>'.\n * @generated\n */\n Gtr createGtr();\n\n /**\n * Returns a new object of class '<em>Plus</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Plus</em>'.\n * @generated\n */\n Plus createPlus();\n\n /**\n * Returns a new object of class '<em>Minus</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Minus</em>'.\n * @generated\n */\n Minus createMinus();\n\n /**\n * Returns a new object of class '<em>Multi</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Multi</em>'.\n * @generated\n */\n Multi createMulti();\n\n /**\n * Returns a new object of class '<em>Div</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Div</em>'.\n * @generated\n */\n Div createDiv();\n\n /**\n * Returns a new object of class '<em>Not</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Not</em>'.\n * @generated\n */\n Not createNot();\n\n /**\n * Returns a new object of class '<em>Literal</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Literal</em>'.\n * @generated\n */\n Literal createLiteral();\n\n /**\n * Returns a new object of class '<em>Quantifier</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Quantifier</em>'.\n * @generated\n */\n Quantifier createQuantifier();\n\n /**\n * Returns a new object of class '<em>External Reference</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>External Reference</em>'.\n * @generated\n */\n ExternalReference createExternalReference();\n\n /**\n * Returns a new object of class '<em>Local Reference</em>'.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return a new object of class '<em>Local Reference</em>'.\n * @generated\n */\n LocalReference createLocalReference();\n\n /**\n * Returns the package supported by this factory.\n * <!-- begin-user-doc -->\n * <!-- end-user-doc -->\n * @return the package supported by this factory.\n * @generated\n */\n SealPackage getSealPackage();\n\n}", "public interface Factory {\n /* renamed from: a */\n Call mo35727a(Request request);\n }", "protected String getID( DockElement element ){\r\n return element.getFactoryID();\r\n }", "public interface CommunicationsprogramsFactory extends EFactory {\n\t/**\n\t * The singleton instance of the factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @generated\n\t */\n\tCommunicationsprogramsFactory eINSTANCE = es.udima.cesarlaso.tfm.communicationsprograms.impl.CommunicationsprogramsFactoryImpl.init();\n\n\t/**\n\t * Returns a new object of class '<em>Program Event Event</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Program Event Event</em>'.\n\t * @generated\n\t */\n\tProgramEventEvent createProgramEventEvent();\n\n\t/**\n\t * Returns a new object of class '<em>Program Actuator Service</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Program Actuator Service</em>'.\n\t * @generated\n\t */\n\tProgramActuatorService createProgramActuatorService();\n\n\t/**\n\t * Returns a new object of class '<em>Remote Event</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Remote Event</em>'.\n\t * @generated\n\t */\n\tRemoteEvent createRemoteEvent();\n\n\t/**\n\t * Returns a new object of class '<em>Remote Actuator</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Remote Actuator</em>'.\n\t * @generated\n\t */\n\tRemoteActuator createRemoteActuator();\n\n\t/**\n\t * Returns a new object of class '<em>Remote Event Identifier</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Remote Event Identifier</em>'.\n\t * @generated\n\t */\n\tRemoteEventIdentifier createRemoteEventIdentifier();\n\n\t/**\n\t * Returns a new object of class '<em>Remote Actuator Identifier</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Remote Actuator Identifier</em>'.\n\t * @generated\n\t */\n\tRemoteActuatorIdentifier createRemoteActuatorIdentifier();\n\n\t/**\n\t * Returns the package supported by this factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return the package supported by this factory.\n\t * @generated\n\t */\n\tCommunicationsprogramsPackage getCommunicationsprogramsPackage();\n\n}", "public interface EncoreFactory extends EFactory {\n\t/**\n\t * The singleton instance of the factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @generated\n\t */\n\tEncoreFactory eINSTANCE = Encore.impl.EncoreFactoryImpl.init();\n\n\t/**\n\t * Returns a new object of class '<em>Concierto</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Concierto</em>'.\n\t * @generated\n\t */\n\tConcierto createConcierto();\n\n\t/**\n\t * Returns a new object of class '<em>Cancion</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Cancion</em>'.\n\t * @generated\n\t */\n\tCancion createCancion();\n\n\t/**\n\t * Returns a new object of class '<em>Secuencia</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Secuencia</em>'.\n\t * @generated\n\t */\n\tSecuencia createSecuencia();\n\n\t/**\n\t * Returns a new object of class '<em>Foco</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Foco</em>'.\n\t * @generated\n\t */\n\tFoco createFoco();\n\n\t/**\n\t * Returns a new object of class '<em>Strobo</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Strobo</em>'.\n\t * @generated\n\t */\n\tStrobo createStrobo();\n\n\t/**\n\t * Returns a new object of class '<em>Union Cancion Secuencia</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Union Cancion Secuencia</em>'.\n\t * @generated\n\t */\n\tUnionCancionSecuencia createUnionCancionSecuencia();\n\n\t/**\n\t * Returns a new object of class '<em>Union Secuencia Luz</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Union Secuencia Luz</em>'.\n\t * @generated\n\t */\n\tUnionSecuenciaLuz createUnionSecuenciaLuz();\n\n\t/**\n\t * Returns the package supported by this factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return the package supported by this factory.\n\t * @generated\n\t */\n\tEncorePackage getEncorePackage();\n\n}", "public interface ParkingFactory extends EFactory {\n\t/**\n\t * The singleton instance of the factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @generated\n\t */\n\tParkingFactory eINSTANCE = com.tum.vsms.Parking.Parking.impl.ParkingFactoryImpl.init();\n\n\t/**\n\t * Returns a new object of class '<em>Parking</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Parking</em>'.\n\t * @generated\n\t */\n\tParking createParking();\n\n\t/**\n\t * Returns a new object of class '<em>Vehicle</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Vehicle</em>'.\n\t * @generated\n\t */\n\tVehicle createVehicle();\n\n\t/**\n\t * Returns a new object of class '<em>Customer</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Customer</em>'.\n\t * @generated\n\t */\n\tCustomer createCustomer();\n\n\t/**\n\t * Returns a new object of class '<em>Location</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Location</em>'.\n\t * @generated\n\t */\n\tLocation createLocation();\n\n\t/**\n\t * Returns a new object of class '<em>Traditional</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Traditional</em>'.\n\t * @generated\n\t */\n\tTraditional createTraditional();\n\n\t/**\n\t * Returns a new object of class '<em>Charging Station</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Charging Station</em>'.\n\t * @generated\n\t */\n\tChargingStation createChargingStation();\n\n\t/**\n\t * Returns a new object of class '<em>Fueling Station</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Fueling Station</em>'.\n\t * @generated\n\t */\n\tFuelingStation createFuelingStation();\n\n\t/**\n\t * Returns a new object of class '<em>Anywhere</em>'.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return a new object of class '<em>Anywhere</em>'.\n\t * @generated\n\t */\n\tAnywhere createAnywhere();\n\n\t/**\n\t * Returns the package supported by this factory.\n\t * <!-- begin-user-doc -->\n\t * <!-- end-user-doc -->\n\t * @return the package supported by this factory.\n\t * @generated\n\t */\n\tParkingPackage getParkingPackage();\n\n}", "public String getInitialFactory() {\r\n return initialFactory;\r\n }", "public interface DaifuWayFactory {\n TwoStepDaifu createTwoStepDaifu();\n}", "default Factory<T> toFactory() {\n throw new UnsupportedOperationException();\n }", "public interface Factory {\n Animal createAnimal();\n}", "@objid (\"0078ca26-5a20-10c8-842f-001ec947cd2a\")\n GenericFactory getGenericFactory();", "public interface MissionFactory extends EFactory {\r\n\t/**\r\n\t * The singleton instance of the factory.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @generated\r\n\t */\r\n\tMissionFactory eINSTANCE = it.univaq.flyaq.mission.impl.MissionFactoryImpl.init();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Mission</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Mission</em>'.\r\n\t * @generated\r\n\t */\r\n\tMission createMission();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Swarm</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Swarm</em>'.\r\n\t * @generated\r\n\t */\r\n\tSwarm createSwarm();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Drone</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Drone</em>'.\r\n\t * @generated\r\n\t */\r\n\tDrone createDrone();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Fork</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Fork</em>'.\r\n\t * @generated\r\n\t */\r\n\tFork createFork();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Join</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Join</em>'.\r\n\t * @generated\r\n\t */\r\n\tJoin createJoin();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Task Dependency</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Task Dependency</em>'.\r\n\t * @generated\r\n\t */\r\n\tTaskDependency createTaskDependency();\r\n\r\n\t/**\r\n\t * Returns a new object of class '<em>Coordinate</em>'.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return a new object of class '<em>Coordinate</em>'.\r\n\t * @generated\r\n\t */\r\n\tCoordinate createCoordinate();\r\n\r\n\t/**\r\n\t * Returns the package supported by this factory.\r\n\t * <!-- begin-user-doc -->\r\n\t * <!-- end-user-doc -->\r\n\t * @return the package supported by this factory.\r\n\t * @generated\r\n\t */\r\n\tMissionPackage getMissionPackage();\r\n\r\n}", "public static QuizFactory getFactoryInstance(){\n\t\tif (defQuizFactory == null)\n\t\t\tdefQuizFactory = new DefaultQuizFactory();\n\t\t\n\t\treturn defQuizFactory;\n\t}", "public static CarFactory makeFactory(String color, String marca, String placa, String cil, String trans, String puesto, int type) {\n \n switch (type) {\n case 0:\n return new FamiliarFactory(color, marca, placa, cil, trans, puesto);\n case 1:\n return new SportFactory(color, marca, placa, cil, trans, puesto);\n case 2:\n return new StandarFactory(color, marca, placa, cil, trans, puesto);\n default:\n throw new IllegalArgumentException(\"No existe esta categoria de carro\");\n }\n }", "Factory<? extends T> buildPersonFactory(String type);", "public Factory getFactory()\r\n {\r\n if( m_factory != null ) return m_factory;\r\n m_factory = FactoryHelper.narrow( m_primary );\r\n return m_factory;\r\n }", "public static SpeciesCarnivorousFactory getInstance() {\n\t\treturn uniqueInstance;\n\t}" ]
[ "0.66826236", "0.6674382", "0.65102446", "0.648053", "0.64678717", "0.6414196", "0.6376343", "0.6314889", "0.629965", "0.6288432", "0.6285364", "0.62441236", "0.6240559", "0.6239596", "0.62350357", "0.62028027", "0.61884826", "0.6150896", "0.61321026", "0.6129066", "0.6088197", "0.6060598", "0.6024796", "0.60199654", "0.6016474", "0.59934795", "0.5989689", "0.5974599", "0.5971338", "0.59574705", "0.5936337", "0.59327227", "0.5909861", "0.5905324", "0.5890426", "0.5866636", "0.5857887", "0.58532137", "0.5852943", "0.58315516", "0.58264345", "0.5823496", "0.5819387", "0.58189136", "0.5809114", "0.5786865", "0.57750124", "0.57736826", "0.576411", "0.5746488", "0.5737929", "0.57321143", "0.5712519", "0.57123065", "0.57062715", "0.57048434", "0.56939536", "0.56862146", "0.5667138", "0.5657912", "0.5654166", "0.5643148", "0.5629279", "0.5628161", "0.56279546", "0.56273085", "0.5625426", "0.56211555", "0.56167096", "0.56078726", "0.56003267", "0.5599516", "0.5593053", "0.55884343", "0.55883235", "0.5584078", "0.55727077", "0.55645376", "0.5557551", "0.5550362", "0.555022", "0.5543409", "0.5541949", "0.552798", "0.5527727", "0.5519401", "0.5518361", "0.5514146", "0.55083513", "0.55059355", "0.55017996", "0.54900205", "0.548864", "0.54755104", "0.5466176", "0.54587245", "0.54485285", "0.54383487", "0.5436304", "0.5435832", "0.543068" ]
0.0
-1
Fait perdre 5 energies a un robot aleatoire
public void perdEnergieRandom() { Random rd = new Random(); robots.get(rd.nextInt(robots.size() - 1)).perdEnergie(5); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void calculerAire() {\r\n\t\taire = Math.PI * rayonV * rayonH;\r\n\t\t\r\n\t}", "public void kast() {\n\t\t// vaelg en tilfaeldig side\n\t\tdouble tilfaeldigtTal = Math.random();\n\t\tvaerdi = (int) (tilfaeldigtTal * 6 + 1);\n\t}", "public void train() {\r\n\t\texp += 2;\r\n\t\tenergy -= 5;\r\n\t\tSystem.out.println(\"Gained 2 experience.\");\t\r\n\t}", "@Override\n public void cantidad_Ataque(){\n ataque=5+2*nivel+aumentoT;\n }", "public logicaEnemigos(){\n\t\t//le damos una velocidad inicial al enemigo\n\t\tsuVelocidad = 50;\n\t\tsuDireccionActual = 0.0;\n\t\tposX = 500 ;\n\t\tposY = 10;\n\t}", "public void setEnergie(int energie) {\r\n\t\tthis.energie = energie;\r\n\t}", "public void raise(){\r\n elevatorTalon1.set(basePWM);\r\n elevatorTalon2.set(basePWM * pwmModifier);\r\n }", "public double getEnergia() { return energia; }", "public void cal_AdjustedFuelMoist(){\r\n\tADFM=0.9*FFM+0.5+9.5*Math.exp(-BUO/50);\r\n}", "public void speedRange5()\n\t{\n\t\trange = (gen.nextInt(upper5 - lower5)+1) + lower5;\n\t\tspeedBalloonY5 = range;\n\t}", "public void gearBoxTest(){\n\t\tif (counter < 6) {\n\t\t\ttimerTest.start();\n\t\t\tif (480 >= timerTest.get()) {\n\t\t\t\tmotorRB.set(1);\n\t\t\t\tmotorRF.set(1);\n\t\t\t\tmotorLB.set(1);\n\t\t\t\tmotorLF.set(1);\n\t\t\t}\n\t\t\telse if (timerTest.get() > 480 && 600 >= timerTest.get()) {\n\t\t\t\tmotorRB.set(0);\n\t\t\t\tmotorRF.set(0);\n\t\t\t\tmotorLB.set(0);\n\t\t\t\tmotorLF.set(0);\n\t\t\t}\n\t\t\telse if (timerTest.get() > 600) {\n\t\t\t\ttimerTest.reset();\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t}", "public void TeleopCode() {\n\t\tMLeft.set(-Controls.joy2.getRawAxis(5)+ 0.06); //(Controls.joy2.getRawAxis5 + 0.06);\n\t}", "@Override\n public void setExperiencia(){\n experiencia1=Math.random()*50*nivel;\n experiencia=experiencia+experiencia1;\n subida();\n }", "@Test\n\tpublic void testGetEnergyConsumption() {\n\t\tController control = new Controller();\n\t\tBasicRobot robot = new BasicRobot();\n\t\tExplorer explorer = new Explorer();\n\t\tcontrol.setBuilder(Order.Builder.DFS);\n\t\tcontrol.setRobotAndDriver(robot, explorer);\n\t\trobot.setMaze(control);\n\t\tcontrol.turnOffGraphics();\n\t\tcontrol.setSkillLevel(0);\n\t\tcontrol.switchFromTitleToGenerating(0);\n\t\tcontrol.waitForPlayingState();\n\t\texplorer.setRobot(robot);\n\t\tassertTrue(explorer.getEnergyConsumption() == 0);\n\t\tif(robot.distanceToObstacle(Direction.FORWARD) > 0) {\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getEnergyConsumption() == 6);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.RIGHT) > 0) {\n\t\t\trobot.rotate(Turn.RIGHT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getEnergyConsumption() == 10);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.LEFT) > 0) {\n\t\t\trobot.rotate(Turn.LEFT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getEnergyConsumption() == 11);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.BACKWARD) > 0) {\n\t\t\trobot.rotate(Turn.AROUND);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getEnergyConsumption() == 15);\n\t\t}\n\t\tassertTrue(explorer.getEnergyConsumption() > 0);\n\t}", "public static void miedo(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n aleatorio = (numeroAleatorio.nextInt(10-5+1)+5);\n \n if(oro>aleatorio){//condicion de finalizar battalla y sus acciones\n oroPerdido= (nivel*2)+aleatorio;\n oro= oro-oroPerdido;\n System.out.println(\"Huiste de la batalla!!!\");\n\t\t System.out.println(\"oro perdido:\"+oroPerdido);\n opcionMiedo=1; //finalizando battalla por huida del jugador \n }\n else{\n System.out.println(\"No pudes huir de la batalla\");\n } \n }", "public void setEnergy(double energy) { this.energy = energy; }", "@Test\n public void getEnergyModifierATest() {\n \n assertEquals(0.6, hawthorn1.getEnergyModifierA(), 0.1);\n }", "@Override\r\n\tpublic double getEnergy(Robot robot)\r\n\t{\r\n\t\treturn robot.getEnergy(EnergyUnit.WATTSECOND);\r\n\t}", "public void action() {\n\t\tsuppressed = false;\r\n\t\tpilot.setLinearSpeed(8);\r\n\t\tpilot.setLinearAcceleration(4);\r\n\t\tColorThread.updatePos = false;\r\n\t\tColorThread.updateCritical = false;\r\n\t\t//create a array to save the map information\r\n\t\tfor (int a = 0; a < 8; a++) {\r\n\t\t\tfor (int b = 0; b < 8; b++) {\r\n\t\t\t\trobot.probability[a][b] = -1;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int a = 0; a < 8; a++) {\r\n\t\t\tfor (int b = 0; b < 8; b++) {\r\n\t\t\t\tif (a == 0 || a == 7 || b == 0 || b == 7) {\r\n\t\t\t\t\trobot.probability[a][b] = 100;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int a = 0; a < 6; a++) {\r\n\t\t\tfor (int b = 0; b < 6; b++) {\r\n\t\t\t\tif (robot.map[a][b].getOccupied() == 1) {\r\n\t\t\t\t\trobot.probability[a + 1][b + 1] = 100;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Step1: use ArrayList to save all of the probability situation.\r\n\t\tfloat front, left, right, back;\r\n\t\tfront = USThread.disSample[0];\r\n\t\trobot.setmotorM(90);\r\n\t\tDelay.msDelay(1000);\r\n\t\tleft = USThread.disSample[0];\r\n\t\trobot.setmotorM(-180);\r\n\t\tDelay.msDelay(1000);\r\n\t\tright = USThread.disSample[0];\r\n\t\trobot.setmotorM(90);\r\n\t\tDelay.msDelay(1000);\r\n\t\trobot.correctHeading(180);\r\n\t\tDelay.msDelay(1000);\r\n\t\tback = USThread.disSample[0];\r\n\t\trobot.correctHeading(180);\r\n\t\tfor (int a = 1; a < 7; a++) {\r\n\t\t\tfor (int b = 1; b < 7; b++) {\r\n\t\t\t\tif (robot.probability[a][b] == -1) {\r\n\t\t\t\t\tif (((robot.probability[a][b + 1] == 100 && front < 0.25)\r\n\t\t\t\t\t\t\t|| (robot.probability[a][b + 1] == -1 && front > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a + 1][b] == 100 && right < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a + 1][b] == -1 && right > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a][b - 1] == 100 && back < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a][b - 1] == -1 && back > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a - 1][b] == 100 && left < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a - 1][b] == -1 && left > 0.25))) {\r\n\t\t\t\t\t\t//direction is north\r\n\t\t\t\t\t\trobot.listOfPro.add(new ProPoint(0, 0, a, b));\r\n\t\t\t\t\t\t//System.out.println(\"0 \"+a+\" \"+b);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (((robot.probability[a + 1][b] == 100 && front < 0.25)\r\n\t\t\t\t\t\t\t|| (robot.probability[a + 1][b] == -1 && front > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a][b - 1] == 100 && right < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a][b - 1] == -1 && right > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a - 1][b] == 100 && back < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a - 1][b] == -1 && back > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a][b + 1] == 100 && left < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a][b + 1] == -1 && left > 0.25))) {\r\n\t\t\t\t\t\t// direction is east\r\n\t\t\t\t\t\trobot.listOfPro.add(new ProPoint(1, 0, a, b));\r\n\t\t\t\t\t\t//System.out.println(\"1 \"+a+\" \"+b);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (((robot.probability[a][b - 1] == 100 && front < 0.25)\r\n\t\t\t\t\t\t\t|| (robot.probability[a][b - 1] == -1 && front > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a - 1][b] == 100 && right < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a - 1][b] == -1 && right > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a][b + 1] == 100 && back < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a][b + 1] == -1 && back > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a + 1][b] == 100 && left < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a + 1][b] == -1 && left > 0.25))) {\r\n\t\t\t\t\t\t// direction is sourth\r\n\t\t\t\t\t\trobot.listOfPro.add(new ProPoint(2, 0, a, b));\r\n\t\t\t\t\t\t//System.out.println(\"2 \"+a+\" \"+b);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (((robot.probability[a - 1][b] == 100 && front < 0.25)\r\n\t\t\t\t\t\t\t|| (robot.probability[a - 1][b] == -1 && front > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a][b + 1] == 100 && right < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a][b + 1] == -1 && right > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a + 1][b] == 100 && back < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a + 1][b] == -1 && back > 0.25))\r\n\t\t\t\t\t\t\t&& ((robot.probability[a][b - 1] == 100 && left < 0.25)\r\n\t\t\t\t\t\t\t\t\t|| (robot.probability[a][b - 1] == -1 && left > 0.25))) {\r\n\t\t\t\t\t\t// direction is west\r\n\t\t\t\t\t\trobot.listOfPro.add(new ProPoint(3, 0, a, b));\r\n\t\t\t\t\t\t//System.out.println(\"3 \"+a+\" \"+b);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Step 2: use loop to take control of robot walk and check the location correction\r\n\t\tboolean needLoop = true;\r\n\t\tint loopRound = 0;\r\n\t\twhile (needLoop) {\r\n\t\t\t// One of way to leave the loop is at the hospital\r\n\t\t\tif ((ColorThread.leftColSample[0] >= 0.2 && ColorThread.leftColSample[1] < 0.2\r\n\t\t\t\t\t&& ColorThread.leftColSample[1] >= 0.14 && ColorThread.leftColSample[2] <= 0.8)\r\n\t\t\t\t\t&& (ColorThread.rightColSample[0] >= 0.2 && ColorThread.rightColSample[1] < 0.2\r\n\t\t\t\t\t\t\t&& ColorThread.rightColSample[1] >= 0.11 && ColorThread.rightColSample[2] <= 0.08)) {\r\n\t\t\t\trobot.updatePosition(0, 0);\r\n\t\t\t\tint numOfAtYellow = 0;\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif (robot.listOfPro.get(i).getNowX() == 1 && robot.listOfPro.get(i).getNowY() == 1) {\r\n\t\t\t\t\t\tnumOfAtYellow++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(numOfAtYellow == 1) {\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif (robot.listOfPro.get(i).getNowX() == 1 && robot.listOfPro.get(i).getNowY() == 1) {\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\trobot.setDirection(false);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 3) {\r\n\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// do not to set the heading, because the default value is 0.\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t}else {\r\n\t\t\t\t\t//have two way to go to the yellow part\r\n\t\t\t\t\tfront = USThread.disSample[0];\r\n\t\t\t\t\trobot.setmotorM(90);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tleft = USThread.disSample[0];\r\n\t\t\t\t\trobot.setmotorM(-180);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tright = USThread.disSample[0];\r\n\t\t\t\t\trobot.setmotorM(90);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\trobot.correctHeading(180);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tback = USThread.disSample[0];\r\n\t\t\t\t\trobot.correctHeading(180);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tif(front<0.25 && right<0.25 && left>0.25 && back>0.25) {\r\n\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t}else if(front<0.25 && right>0.25 && back>0.25 && left<0.25) {\r\n\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t}else if(front>0.25 && right>0.25 && back<0.25 && left<0.25) {\r\n\t\t\t\t\t\t// do not to set the heading, because the default value is 0.\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\trobot.setDirection(false);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tneedLoop = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t//Another way to leave the loop is the robot arrive the green cell.\r\n\t\t\tif ((ColorThread.leftColSample[0] <= 0.09 && ColorThread.leftColSample[1] >= 0.17\r\n\t\t\t\t\t&& ColorThread.leftColSample[2] <= 0.09)\r\n\t\t\t\t\t&& (ColorThread.rightColSample[0] <= 0.09 && ColorThread.rightColSample[1] >= 0.014\r\n\t\t\t\t\t\t\t&& ColorThread.rightColSample[2] <= 0.11)) {\r\n\t\t\t\trobot.updatePosition(5, 0);\r\n\t\t\t\tint numOfAtGreen = 0;\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif (robot.listOfPro.get(i).getNowX() == 6 && robot.listOfPro.get(i).getNowY() == 1) {\r\n\t\t\t\t\t\tnumOfAtGreen++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(numOfAtGreen==1) {\r\n\t\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowX() == 6 && robot.listOfPro.get(i).getNowY() == 1) {\r\n\t\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\t\trobot.setDirection(false);\r\n\t\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 3) {\r\n\t\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// do not to set the heading, because the default value is 0.\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}else {\r\n\t\t\t\t\tfront = USThread.disSample[0];\r\n\t\t\t\t\trobot.setmotorM(90);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tleft = USThread.disSample[0];\r\n\t\t\t\t\trobot.setmotorM(-180);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tright = USThread.disSample[0];\r\n\t\t\t\t\trobot.setmotorM(90);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\trobot.correctHeading(180);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tback = USThread.disSample[0];\r\n\t\t\t\t\trobot.correctHeading(180);\r\n\t\t\t\t\tDelay.msDelay(1000);\r\n\t\t\t\t\tif(front<0.25 && right<0.25 && left>0.25 && back>0.25) {\r\n\t\t\t\t\t\trobot.setDirection(false);\r\n\t\t\t\t\t}else if(front<0.25 && right>0.25 && back>0.25 && left<0.25) {\r\n\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t}else if(front>0.25 && right>0.25 && back<0.25 && left<0.25) {\r\n\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t// do not to set the heading, because the default value is 0.\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tneedLoop = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t//The third way of leave the loop is the robot have already know his position and direction.\r\n\t\t\tint maxStepNumber = 0;\r\n\t\t\tint numberOfMaxSteps = 0;\r\n\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\tif (robot.listOfPro.get(i).getSteps() > maxStepNumber) {\r\n\t\t\t\t\tmaxStepNumber = robot.listOfPro.get(i).getSteps();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\tif (robot.listOfPro.get(i).getSteps() == maxStepNumber) {\r\n\t\t\t\t\tnumberOfMaxSteps++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (numberOfMaxSteps == 1) {\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif (robot.listOfPro.get(i).getSteps() == maxStepNumber) {\r\n\t\t\t\t\t\trobot.updatePosition(robot.listOfPro.get(i).getNowX() - 1,\r\n\t\t\t\t\t\t\t\trobot.listOfPro.get(i).getNowY() - 1);\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\trobot.setDirection(false);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 3) {\r\n\t\t\t\t\t\t\trobot.setDirection(true);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// do not to set the heading, because the default value is 0.\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tneedLoop = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t//The below part are the loops.\r\n\t\t\tfront = USThread.disSample[0];\r\n\t\t\trobot.setmotorM(90);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tleft = USThread.disSample[0];\r\n\t\t\trobot.setmotorM(-180);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tright = USThread.disSample[0];\r\n\t\t\trobot.setmotorM(90);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\trobot.correctHeading(180);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tback = USThread.disSample[0];\r\n\t\t\trobot.correctHeading(180);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\t// move\r\n\t\t\t\r\n\t\t\tif (front > 0.25) {\r\n\t\t\t\trobot.getPilot().travel(25);\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif(robot.listOfPro.get(i).getSteps()==loopRound) {\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 0) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() + 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() + 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() - 1);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() - 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if (left > 0.25) {\r\n\t\t\t\trobot.correctHeading(-90);\r\n\t\t\t\trobot.getPilot().travel(25);\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif(robot.listOfPro.get(i).getSteps()==loopRound) {\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 0) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(3);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() - 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(0);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() + 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(1);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() + 1);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(2);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() - 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if (right > 0.25) {\r\n\t\t\t\trobot.correctHeading(90);\r\n\t\t\t\trobot.getPilot().travel(25);\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif(robot.listOfPro.get(i).getSteps()==loopRound) {\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 0) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(1);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() + 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(2);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() - 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(3);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() - 1);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(0);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() + 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\trobot.correctHeading(180);\r\n\t\t\t\trobot.getPilot().travel(25);\r\n\t\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t\tif(robot.listOfPro.get(i).getSteps()==loopRound) {\r\n\t\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 0) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(2);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() - 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(3);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() - 1);\r\n\t\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(0);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowY(robot.listOfPro.get(i).getNowY() + 1);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowHeading(1);\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setNowX(robot.listOfPro.get(i).getNowX() + 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// It time to check the around situation\r\n\t\t\tfront = USThread.disSample[0];\r\n\t\t\trobot.setmotorM(90);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tleft = USThread.disSample[0];\r\n\t\t\trobot.setmotorM(-180);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tright = USThread.disSample[0];\r\n\t\t\trobot.setmotorM(90);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\trobot.correctHeading(180);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tback = USThread.disSample[0];\r\n\t\t\trobot.correctHeading(180);\r\n\t\t\tDelay.msDelay(1000);\r\n\t\t\tfor (int i = 0; i < robot.listOfPro.size(); i++) {\r\n\t\t\t\t//System.out.println(robot.listOfPro.get(i).getSteps());\r\n\t\t\t\t\tif (robot.listOfPro.get(i).getNowHeading() == 0) {\r\n\t\t\t\t\t\tif (((front < 0.25\r\n\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro.get(i).getNowY()\r\n\t\t\t\t\t\t\t\t\t\t+ 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (front > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() + 1] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((left < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t- 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (left > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() - 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((right < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t+ 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (right > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() + 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((back < 0.25 && robot.probability[robot.listOfPro.get(i)\r\n\t\t\t\t\t\t\t\t\t\t\t\t.getNowX()][robot.listOfPro.get(i).getNowY() - 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (back > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() - 1] == -1))) {\r\n\t\t\t\t\t\t\t//It is correct when the robot have the same data information with estimate information\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setSteps(robot.listOfPro.get(i).getSteps() + 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 1) {\r\n\t\t\t\t\t\tif (((left < 0.25\r\n\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro.get(i).getNowY()\r\n\t\t\t\t\t\t\t\t\t\t+ 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (left > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() + 1] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((back < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t- 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (back > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() - 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((front < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t+ 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (front > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() + 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((right < 0.25 && robot.probability[robot.listOfPro.get(i)\r\n\t\t\t\t\t\t\t\t\t\t\t\t.getNowX()][robot.listOfPro.get(i).getNowY() - 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (right > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() - 1] == -1))) {\r\n\t\t\t\t\t\t\t//It is correct when the robot have the same data information with estimate information\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setSteps(robot.listOfPro.get(i).getSteps() + 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (robot.listOfPro.get(i).getNowHeading() == 2) {\r\n\t\t\t\t\t\tif (((back < 0.25\r\n\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro.get(i).getNowY()\r\n\t\t\t\t\t\t\t\t\t\t+ 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (back > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() + 1] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((right < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t- 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (right > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() - 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((left < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t+ 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (left > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() + 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((front < 0.25 && robot.probability[robot.listOfPro.get(i)\r\n\t\t\t\t\t\t\t\t\t\t\t\t.getNowX()][robot.listOfPro.get(i).getNowY() - 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (front > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() - 1] == -1))) {\r\n\t\t\t\t\t\t\t//It is correct when the robot have the same data information with estimate information\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setSteps(robot.listOfPro.get(i).getSteps() + 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (((right < 0.25\r\n\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro.get(i).getNowY()\r\n\t\t\t\t\t\t\t\t\t\t+ 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (right > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() + 1] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((front < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t- 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (front > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() - 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((back < 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()\r\n\t\t\t\t\t\t\t\t\t\t\t\t+ 1][robot.listOfPro.get(i).getNowY()] == 100)\r\n\t\t\t\t\t\t\t\t|| (back > 0.25\r\n\t\t\t\t\t\t\t\t\t\t&& robot.probability[robot.listOfPro.get(i).getNowX() + 1][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get(i).getNowY()] == -1))\r\n\t\t\t\t\t\t\t\t\t\t&& ((left < 0.25 && robot.probability[robot.listOfPro.get(i)\r\n\t\t\t\t\t\t\t\t\t\t\t\t.getNowX()][robot.listOfPro.get(i).getNowY() - 1] == 100)\r\n\t\t\t\t\t\t\t\t|| (left > 0.25 && robot.probability[robot.listOfPro.get(i).getNowX()][robot.listOfPro\r\n\t\t\t\t\t\t\t\t\t\t.get(i).getNowY() - 1] == -1))) {\r\n\t\t\t\t\t\t\t//It is correct when the robot have the same data information with estimate information\r\n\t\t\t\t\t\t\trobot.listOfPro.get(i).setSteps(robot.listOfPro.get(i).getSteps() + 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tloopRound++;\r\n\t\t}\r\n\t\t// if is out the while loop, it will find the heading and the position of robot right now.\r\n\t\t//Step 3: It is time to use wavefront to come back to the hospital\r\n\t\trobot.restoreDefault();\r\n\t\trobot.RunMode = 1;\r\n\t\tColorThread.updatePos = true;\r\n\t\tColorThread.updateCritical = true;\r\n\t}", "@Override\r\n\tpublic int evaluateSens(Robot robot) {\n\t\treturn robot.getFuel();\r\n\t}", "public void addEnergy(int e){\n if(e + energy < 0)\n energy = 0;\n else if(e + energy > MAX_ENERGY)\n energy = MAX_ENERGY;\n else\n energy += e;\n }", "public void cheat() {\r\n\t\t\t\tnourriture += population*10;\r\n\t\t\t\tarmee += population/2;\r\n\t\t\t\tpopulation += armee*tailleArmee;\r\n\t\t\t}", "@Override\n\tpublic double CalcularFuel() {\n\t\tdouble consumo=this.getCargaActual()*30+2*numEje;\n\t\treturn consumo;\n\t}", "public Clorus (double e) {\n super(\"clorus\");\n if (e < 0) {\n energy = 0;\n }else { energy = e;}\n r = 0;\n g = 0;\n b = 0;\n }", "public static void curar(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n int curador;\n //condicion de puntos de mana para ejecutar la curacion del jugador\n if(puntosDeMana>=1){\n //acciones de la funcion curar en el jugador\n aleatorio = (numeroAleatorio.nextInt(25-15+1)+15);\n curador= ((nivel+1)*5)+aleatorio;\n puntosDeVida= puntosDeVida+curador;\n puntosDeMana=puntosDeMana-1;\n }\n else{//imprimiendo el mensaje de curacion fallada\n System.out.println(\"no cuentas con Puntos De mana (MP) para curarte\");\n }\n }", "public void autonomous() {\n robot.drive(0.5); //Drives in a square\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n robot.drive(0.5);\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n robot.drive(0.5);\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n robot.drive(0.5);\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n }", "public void reserveer() {\n System.out.println(\"de eigenaar van de auto is: \" + i.eigenaar());\n\n }", "int getEnergy();", "public void init() {\n //De leden mogen niet extreem obesitas hebben. Onder of gelijk aan 180kg.\n Valerie= 40;\n Jeroen=100;\n Hans=80;\n\n // Teller begint bij 0. Stel: staaf is 80 hoog.\n // 180 is waar de grafiek begint.\n nulpunt=180; //Dit is het nulpunt van de staaf\n som_v = nulpunt - Valerie;\n som_j = nulpunt - Jeroen;\n som_h = nulpunt - Hans;\n }", "@Override\r\n\tpublic float getEnergyConsumption() {\r\n\t\treturn 2500 - robot.getBatteryLevel();\r\n\t}", "void object_on_eyes_level_calc(){\n down_angle=Math.abs(down_angle);\n up_angle=Math.abs(up_angle);\n angle_with_ground=90-angle_with_ground;\n distance_from_object=human_length*Math.tan(Math.toRadians(angle_with_ground));\n double part_down=distance_from_object*Math.tan(Math.toRadians(down_angle));\n double part_up=distance_from_object*Math.tan(Math.toRadians(up_angle));\n length_of_object=part_down+part_up;\n object_height_from_ground=human_length-part_down;\n ORI.setText(\"length_of_object :\\n\" +String.valueOf(String.format(\"%.2f\",(length_of_object/100)))\n +\" M\"+ \"\\n\" + \"distance_from_object :\\n\" + String.valueOf(String.format(\"%.2f\",(distance_from_object/100)))+\n \" M\" + \"\\n\"+\"height_from_ground :\\n\" + String.valueOf(String.format(\"%.2f\",(object_height_from_ground/100)))+\" M\");\n ORI.setVisibility(View.VISIBLE);\n }", "public void toilette() {\n if (!autoriseOperation()) {\n return;\n }\n incrSale(-3);\n incrHumeur(1);\n incrXp(1);\n\n setChanged();\n notifyObservers();\n }", "public void mostrarJet(){\r\n \r\n System.out.println(\"clase hija jet de vehiculo con motor \");\r\n System.out.println(\"LA CANTIDAD DE MOTORES ES : \" + this.cantidaddeMotores);\r\n\r\n\r\n System.out.println(\"***************************************************\");\r\n System.out.println(\"*************H**E**R**E**D**A**********************\");\r\n System.out.println(\"|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|\");\r\n }", "public void eisagwgiGiatrou() {\n\t\t// Elegxw o arithmos twn iatrwn na mhn ypervei ton megisto dynato\n\t\tif(numOfDoctors < 100)\n\t\t{\n\t\t\tSystem.out.println();\n\t\t\tdoctor[numOfDoctors] = new Iatros();\n\t\t\tdoctor[numOfDoctors].setFname(sir.readString(\"DWSTE TO ONOMA TOU GIATROU: \")); // Pairnei apo ton xristi to onoma tou giatrou\n\t\t\tdoctor[numOfDoctors].setLname(sir.readString(\"DWSTE TO EPWNYMO TOU GIATROU: \")); // Pairnei apo ton xristi to epitheto tou giatrou\n\t\t\tdoctor[numOfDoctors].setAM(rnd.nextInt(1000000)); // To sistima dinei automata ton am tou giatrou\n\t\t\tSystem.out.println();\n\t\t\t\n\t\t\t// Elegxos monadikotitas tou am tou giatrou\n\t\t\th = rnd.nextInt(1000000);\n\t\t\tfor(int i = 0; i < numOfDoctors; i++)\n\t\t\t{\n\t\t\t\tif(doctor[i].getAM() == h)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\tSystem.out.println(\"O KWDIKOS AUTOS YPARXEI HDH!\");\n\t\t\t\t\th = rnd.nextInt(1000000);\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t}\n\t\t\t}\n\t\t\tnumOfDoctors++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"DEN MPOREITE NA EISAGETE ALLOUS GIATROUS!\");\n\t\t\tSystem.out.println(\"EXEI SYMPLHRWTHEI O PROVLEPOMENOS ARITHMOS!\");\n\t\t}\n\t}", "void object_upper_eyes_level_calc(){\n down_angle=Math.abs(down_angle);\n up_angle=Math.abs(up_angle);\n\n angle_with_ground=90-angle_with_ground;\n distance_from_object=human_length*Math.tan(Math.toRadians(angle_with_ground));\n double part=distance_from_object*Math.tan(Math.toRadians(down_angle));\n double all=distance_from_object*Math.tan(Math.toRadians(up_angle));\n length_of_object=all-part;\n object_height_from_ground=human_length+part;\n ORI.setText(\"length_of_object :\\n\" +String.valueOf(String.format(\"%.2f\",(length_of_object/100))) +\" M\"+ \"\\n\" + \"distance_from_object :\\n\" + String.valueOf(String.format(\"%.2f\",(distance_from_object/100)))+\" M\" + \"\\n\"+\"height_from_ground :\\n\" + String.valueOf(String.format(\"%.2f\",(object_height_from_ground/100)))+\" M\");\n ORI.setVisibility(View.VISIBLE);\n }", "public void Caracteristicas(){\n System.out.println(\"La resbaladilla tiene las siguientes caracteristicas: \");\r\n if (escaleras==true) {\r\n System.out.println(\"Tiene escaleras\");\r\n }else System.out.println(\"No tiene escaleras\");\r\n System.out.println(\"Esta hecho de \"+material);\r\n System.out.println(\"Tiene una altura de \"+altura);\r\n }", "public static void atacar(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n int ataqueJugador;\n //acciones de la funcion atacar sobre vida del enemigo\n aleatorio = (numeroAleatorio.nextInt(20-10+1)+10);\n ataqueJugador= ((nivel+1)*10)+aleatorio;\n puntosDeVidaEnemigo= puntosDeVidaEnemigo-ataqueJugador;\n \n }", "public void variation() {\r\n\t\t\r\n\t\tSystem.out.println(\"Line & Score\");\r\n\t\tSystem.out.println(\"Elevator Up\");\r\n\t\tElevator.setTargetPos(TeleopHandler.ElevatorStates.SCALE_POSITION_L);\r\n\t\tElevator.run(0);\r\n\t\tif(time.get()<5)\r\n\t\t\tDrive.runAt(0.25, 0.25);\r\n\t\telse {\r\n\t\t\tDrive.runAt(0, 0);\r\n\t\t\tSystem.out.println(\"Outtaking Cube\");\r\n\t\t\tIntake.run(TeleopHandler.IntakeStates.SLOW_OUTTAKING);\r\n\t\t}\r\n\t\t\t\r\n\t}", "public void changeRobot(int numR) \r\n\t{\r\n\t\t//\tgame.addRobot(4);\r\n\r\n\t\tedge_data e=new EdgeData();\r\n\t\tint numans=0;\r\n\t\tint i=0;\r\n\t\tdouble x=0;\r\n\t\tdouble y=Double.MAX_VALUE;\r\n\r\n\t\twhile(i<numR) {\r\n\r\n\t\t\tdouble c=0; \r\n\t\t\tfor(Fruit f: fru) {\r\n\t\t\t\te=f.e;\r\n\t\t\t\tx=f.value/e.getWeight();\r\n\t\t\t\tif(x>c && x<y) {\r\n\r\n\t\t\t\t\tc=x; \r\n\t\t\t\t\tnumans=e.getSrc();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ty=c;\r\n\t\t\tgame.addRobot(numans);\r\n\t\t\ti++;\r\n\t\t}\r\n\t}", "@Override\n\tpublic void onRed() {\n\t\taddSequential(new DriveStraightByDistance(PEG_STRAIGHT - ROBOT_LENGTH / 2), 3.5);\n\t\t//TODO: might need to change to a little less\n\t\taddSequential(new TurnDegrees(90), 2.5);\n\t\taddSequential(new DriveStraightByDistance(EXTRA_DIS), 4);\n\t\taddSequential(new OpenPlacer2());\n\t\taddSequential(new ArcadeDriveByValues(-0.5, -0.5), 1);// TODO change commad\n\t\taddSequential(new ClosePlacer());\n\t}", "static void sueldo7diasl(){\nSystem.out.println(\"Ejemplo estructura Condicional Multiple 1 \");\nString descuenta=\"\";\n//datos de entrada xd\nint ganancias= teclado.nextInt();\nif(ganancias<=150){\ndescuenta=\"0.5\";\n}else if (ganancias>150 && ganancias<300){\n descuenta=\"0.7\";}\n else if (ganancias>300 && ganancias<450){\n descuenta=\"0.9\";}\n //datos de salida:xd\n System.out.println(\"se le descuenta : \"+descuenta);\n}", "public void rodaAleatorio()\r\n {\r\n // Carrega os dados\r\n String ArqBD = \"Dados/Base\" + NUM_DB + \"/DADOS\" + NUM_PROV + \"x\" + NUM_PIS + \".txt\";\r\n String ArqReq = \"Requisicoes/Base\" + NUM_DB + \"/REQ\" + NUM_REQ + \"_\" + NUM_PIS + \".txt\";\r\n AvaliaFitness af = new AvaliaFitness(ArqBD, ArqReq);\r\n //af.imprime();\r\n \r\n // Variaveis\r\n int i, numIt, NUM_VARS = af.getBase_dados().getNumProvedores();\r\n long tempoInicial, tempoFinal;\r\n IndividuoBin atual;\r\n IndividuoBin melhor; \r\n IndividuoBin[] eleitos = new IndividuoBin[MAX_EXECUCOES]; \r\n double[] tempoExecusao = new double[MAX_EXECUCOES];\r\n \r\n System.out.println(\"# # # # # Algoritmo de Busca Aleatoria # # # # #\\n\"); \r\n //System.out.println(\"Espaço de busca: \" + (long)(Math.pow(2, NUM_VARS) - 1));\r\n System.out.println(\"NumProv: \" + NUM_PROV + \"\\nNumReq: \" + NUM_REQ + \"\\nNumPIs: \" + NUM_PIS + \"\\nNumDB: \" + NUM_DB);\r\n \r\n // Inicia as execuções\r\n int execucao = 1;\r\n // LOOP DE EXECUÇÕES\r\n while(execucao <= MAX_EXECUCOES)\r\n {\r\n numIt = 0; \r\n melhor = new IndividuoBin(NUM_VARS);\r\n // Inicia o cronômetro\r\n tempoInicial = System.currentTimeMillis(); \r\n // LOOP DE ITERAÇÕES\r\n while(numIt < MAX_ITERACOES)\r\n {\r\n atual = new IndividuoBin(NUM_VARS);\r\n atual.geraCodRand();\r\n //atual.imprimeCodificacao();\r\n af.fitness(atual);\r\n if(atual.getFitness() > melhor.getFitness())\r\n melhor = atual;\r\n \r\n numIt++;\r\n }\r\n // Interrompe o cronômetro\r\n tempoFinal = (System.currentTimeMillis() - tempoInicial);\r\n //System.out.println(\"\\nTempo de execução: \" + tempoFinal + \" ms ou \" + (tempoFinal/1000.0) + \" seg\\n\");\r\n \r\n // Guarda o melhor individuo e o tempo dessa execução\r\n eleitos[execucao - 1] = melhor;\r\n tempoExecusao[execucao - 1] = tempoFinal;\r\n \r\n // Imprime o melhor individuo\r\n System.out.println(\"\\nExecução \" + execucao + \": \");\r\n // Resposta\r\n if(!melhor.isPenalizado())\r\n {\r\n System.out.println(\"Melhor fitness: \" + melhor.getFitness());\r\n //System.out.print(\"Codificação: \");\r\n //melhor.imprimeCod();\r\n melhor.imprimeProvCod(); \r\n }\r\n else\r\n {\r\n System.out.println(\"Não foi encontrado um individuo valido com \" + MAX_ITERACOES + \" iterações.\"); \r\n System.out.println(\"Melhor fitness: \" + melhor.getFitness());\r\n //System.out.print(\"Codificação: \");\r\n //melhor.imprimeCod();\r\n melhor.imprimeProvCod(); \r\n }\r\n \r\n //System.out.println(\"\\nTempo da execução \" + execucao + \": \" + tempoFinal + \" ms ou \" + (tempoFinal/1000.0) + \" seg\");\r\n // Próxima execucao\r\n execucao++;\r\n } // Fim das execucoes\r\n \r\n // # # # # Estatisticas pós execuções do Aleatorio # # # #\r\n estatisticaFinais(eleitos, tempoExecusao);\r\n }", "void addFuel ( double mmbtu_input) {\n fuel += mmbtu_input;\r\n }", "private void doAlts() {\n\t\tdouble rpri1 = ( -this.c + Math.sqrt(Constants.square(this.c) - 4d * (1d - this.c) * (- Constants.square(Math.sin(this.launchBurnAng))))) / (2d * (1d - this.c));\n\t\tdouble rpri2 = ( -this.c - Math.sqrt(Constants.square(this.c) - 4d * (1d - this.c) * (- Constants.square(Math.sin(this.launchBurnAng))))) / (2d * (1d - this.c));\n\t\tif (rpri1 > rpri2) {\n\t\t\tthis.launchPerAlt = rpri2 * this.launchBurnAlt;\n\t\t\tthis.launchApoAlt = rpri1 * this.launchBurnAlt;\n\t\t} else {\n\t\t\tthis.launchPerAlt = rpri1 * this.launchBurnAlt;\n\t\t\tthis.launchApoAlt = rpri2 * this.launchBurnAlt;\n\t\t}\n\t}", "public void move()\n {\n daysSurvived+=1;\n\n energy -= energyLostPerDay;\n\n Random generator = new Random();\n\n //losowo okreslony ruch na podstawie genomu\n int turnIndex = generator.nextInt((int)Math.ceil(Genome.numberOfGenes));\n int turn = genome.getGenome().get(turnIndex);\n\n //wywolujemy metode obrotu - dodaje odpowiednio liczbe do aktualnego kierunku\n direction.turn(turn);\n\n //zmieniamy pozycje zwierzaka przez dodanie odpowiedniego wektora\n position = position.add(direction.move());\n //walidacja pozycji tak, by wychodzac za mape byc na mapie z drugiej strony\n position.validatePosition(map.getWidth(),map.getHeight());\n\n moveOnSimulation();\n\n //jesli po ruchu zwierzaczek nie ma juz energii na kolejny ruch\n if(energy < energyLostPerDay )\n {\n this.animalHungry = true;\n }\n }", "public void atrapar() {\n if( una == false) {\n\t\tif ((app.mouseX > 377 && app.mouseX < 591) && (app.mouseY > 336 && app.mouseY < 382)) {\n\t\t\tint aleotoridad = (int) app.random(0, 4);\n\n\t\t\tif (aleotoridad == 3) {\n\n\t\t\t\tSystem.out.print(\"Lo atrapaste\");\n\t\t\t\tcambioEnemigo = 3;\n\t\t\t\tsuerte = true;\n\t\t\t\tuna = true;\n\t\t\t}\n\t\t\tif (aleotoridad == 1 || aleotoridad == 2 || aleotoridad == 0) {\n\n\t\t\t\tSystem.out.print(\"Mala Suerte\");\n\t\t\t\tcambioEnemigo = 4;\n\t\t\t\tmal = true;\n\t\t\t\tuna = true;\n\t\t\t}\n\n\t\t}\n }\n\t}", "public static void IAmFalconBot() {\n // How many encoder clicks per revolution (change to 2048 for falcon 500\n // encoders)\n encoderUnitsPerShaftRotation = 2048;\n // with 6 in wheels estimate 10 feet = 13038 encoder ticks\n\n // The difference between the left and right side encoder values when the robot\n // is rotated 180 degrees\n encoderUnitsPerRobotRotation = 3925;// thats the SUM of the two (this is just a rough guess)\n //these values are just guesses at the moment\n cruiseVelocity = 2250;\n acceleration = 2250;\n // Allowable error to exit movement methods\n defaultAcceptableError = 250;\n\n shooterPanMotorEncoderTicksPerRotation = 3977;\n //TODO: may need to be negative if turns the wrong way\n shooterPanSpeed = 1;\n System.out.println(\"I AM FALCONBOT! CACAW! CACAAAAAWWWWW!\");\n }", "public void avvio_gioco(){\n\n punti = 3;\n //Posizione iniziale della x\n for (short i = 0; i < punti; i++) {\n x[i] = 150 - i*10;\n y[i] = 150;\n }\n posiziona_bersaglio();\n\n //Attivazione del timer\n timer = new Timer(RITARDO, this);\n timer.start();\n }", "public static void main(String[] args) {\n System.out.println(\"Test de la partie 1:\");\n System.out.println(\"--------------------\");\n\n Position position1 = new Position(0, 1);\n Position position2 = new Position(1, 0);\n Position position3 = new Position(1, 1);\n\n Neurone neuron1 = new Neurone(position1, 0.5);\n Neurone neuron2 = new Neurone(position2, 1.0);\n Neurone neuron3 = new Neurone(position3, 2.0);\n\n neuron1.connexion(neuron2);\n neuron2.connexion(neuron3);\n neuron1.recoitStimulus(10);\n\n System.out.println(\"Signaux : \");\n System.out.println(neuron1.getSignal());\n System.out.println(neuron2.getSignal());\n System.out.println(neuron3.getSignal());\n\n System.out.println();\n System.out.println(\"Premiere connexion du neurone 1\");\n System.out.println(neuron1.getConnexion(0));\n\n\n // FIN TEST DE LA PARTIE 1\n\n // TEST DE LA PARTIE 2\n System.out.println(\"Test de la partie 2:\");\n System.out.println(\"--------------------\");\n\n Position position5 = new Position(0, 0);\n NeuroneCumulatif neuron5 = new NeuroneCumulatif(position5, 0.5);\n neuron5.recoitStimulus(10);\n neuron5.recoitStimulus(10);\n System.out.println(\"Signal du neurone cumulatif -> \" + neuron5.getSignal());\n\n // FIN TEST DE LA PARTIE 2\n\n // TEST DE LA PARTIE 3\n System.out.println();\n System.out.println(\"Test de la partie 3:\");\n System.out.println(\"--------------------\");\n Cerveau cerveau = new Cerveau();\n\n // parametres de construction du neurone:\n // la position et le facteur d'attenuation\n cerveau.ajouterNeurone(new Position(0,0), 0.5);\n cerveau.ajouterNeurone(new Position(0,1), 0.2);\n cerveau.ajouterNeurone(new Position(1,0), 1.0);\n\n // parametres de construction du neurone cumulatif:\n // la position et le facteur d'attenuation\n cerveau.ajouterNeuroneCumulatif(new Position(1,1), 0.8);\n cerveau.creerConnexions();\n cerveau.stimuler(0, 10);\n\n System.out.println(\"Signal du 3eme neurone -> \" + cerveau.sonder(3));\n System.out.println(cerveau);\n // FIN TEST DE LA PARTIE 3\n }", "public void gagne()\r\n\t{\r\n\t\tthis.nbVictoires++;\r\n\t}", "public double getEnergy() { return energy; }", "public void init_erup() {\n\t\tchange=5;\n\t\tfor(int x=x_max-change ; x <= x_max+change ; x++) {\n\t\t\tfor(int y=y_max-change ; y <= y_max+change ; y++) {\n\t\t\t\tif(x>=0 && x<w.getX() && y>=0 && y<w.getY() ) {\n\t\t\t\t\tif(w.n.alti[x][y]==9)\n\t\t\t\t\t\tliquide[x][y]=10;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t}", "public void nourrir() {\n if (!autoriseOperation()) {\n return;\n }\n\n incrFaim(-2);\n incrPoids(1);\n incrHumeur(1);\n incrXp(1);\n\n System.out.println(tamagoStats.getXp());\n setChanged();\n notifyObservers();\n\n }", "public int getEnergie() {\r\n\t\treturn energie;\r\n\t}", "@Override\n\tpublic double mangeLegumes() {\n\t\treturn quantiteLegumes*this.getPoids();\n\t}", "public void azzera() { setEnergia(0.0); }", "@Test\n\tpublic void testWithWeight0KgAndTravel3_5Test() {\n\t\trobot = new Robot(0,3.5);\n\t\tAssert.assertEquals(30.0, robot.calculateRemainingBattery(),0);\n\t}", "private void doVels() {\n\t\tthis.launchPerVel = Math.sqrt((2d * body.getGm() * this.launchApoAlt) / (this.launchPerAlt * this.a));\n\t\tthis.launchApoVel = Math.sqrt((2d * body.getGm() * this.launchPerAlt) / (this.launchApoAlt * this.a));\n\t}", "private String buildEnergy() {\r\n List<Integer> emptyCellsPos0 = new ArrayList<Integer>();\r\n List<Integer> emptyCellsPos1 = new ArrayList<Integer>();\r\n for(int i = 0; i < gameHeight; i++) {\r\n if (myLaneInfo.get(i).get(4).isEmpty()) {\r\n if (myLaneInfo.get(i).get(3).contains(0)) {\r\n emptyCellsPos0.add(i);\r\n }\r\n if (myLaneInfo.get(i).get(3).contains(1)) {\r\n emptyCellsPos1.add(i);\r\n }\r\n }\r\n }\r\n if (!emptyCellsPos0.isEmpty()) {\r\n return ENERGY.buildCommand(0,getRandomElementOfList(emptyCellsPos0));\r\n } else if (!emptyCellsPos1.isEmpty()) {\r\n return ENERGY.buildCommand(1,getRandomElementOfList(emptyCellsPos1));\r\n } else if (canBuy(ATTACK)) {\r\n return buildTurret();\r\n } else {\r\n return doNothingCommand();\r\n }\r\n }", "public void sueldo(){\n if(horas <= 40){\n sueldo = horas * cuota;\n }else {\n if (horas <= 50) {\n sueldo = (40 * cuota) + ((horas - 40) * (cuota * 2));\n } else {\n sueldo = ((40 * cuota) + (10 * cuota * 2)) + ((horas - 50) + (cuota * 3));\n }\n }\n\n }", "public void timePasses() {\r\n\t\tfor(Meter a: appMeters){\r\n\t\t\t//incremnts electric use each timepPasses as the fridge is always on\r\n\t\t\tif (a.getType().equals(\"Electric\")){\r\n\t\t\t\ta.incrementConsumed();\r\n\t\t}\r\n\t}\r\n\t}", "void updateSensors() {\n\t\tint visionDim = ninterface.affectors.getVisionDim();\n\t\tdouble distance;\n\n\t\t/* Update food vision variables. */\n\t\tfor (int i = 0; i < visionDim; i++) {\n\t\t\t/* Food sensory neurons. */\n\t\t\tdistance = viewingObjectOfTypeInSegment(i,\n\t\t\t\t\tCollision.TYPE_FOOD);\n\t\t\tninterface.affectors.vFood[i]\n\t\t\t\t\t= distance < 0.0 ? 1.0 : 1.0 - distance;\n\n\t\t\t/* Ally sensory neurons. */\n\t\t\tdistance = viewingObjectOfTypeInSegment(i,\n\t\t\t\t\tCollision.TYPE_AGENT);\n\t\t\tninterface.affectors.vAlly[i]\n\t\t\t\t\t= distance < 0.0 ? 1.0 : 1.0 - distance;\n\n\t\t\t/* Enemy sensory neurons. */\n\t\t\tdistance = viewingObjectOfTypeInSegment(i,\n\t\t\t\t\tCollision.TYPE_ENEMY);\n\t\t\tninterface.affectors.vEnemy[i]\n\t\t\t\t\t= distance < 0.0 ? 1.0 : 1.0 - distance;\n\n\t\t\t/* Wall sensory neurons. */\n\t\t\tdistance = viewingObjectOfTypeInSegment(i,\n\t\t\t\t\tCollision.TYPE_WALL);\n\t\t\tninterface.affectors.vWall[i]\n\t\t\t\t\t= distance < 0.0 ? 1.0 : 1.0 - distance;\n\t\t}\n\t}", "private double hitungLuas(){\r\n return super.getLuas() + PHI*super.getRadius()*this.hitungG_pelukis();\r\n }", "protected void execute() {\n \tRobot.gearIntake.setGearRollerSpeed(-.7);\n }", "public static int getEnergyValueRandomLimit() {\r\n\t\treturn 50;\r\n\t}", "public void daiGioco() {\n System.out.println(\"Scrivere 1 per giocare al PC, al costo di 200 Tam\\nSeleziona 2 per a Calcio, al costo di 100 Tam\\nSeleziona 3 per Disegnare, al costo di 50 Tam\");\n\n switch (creaturaIn.nextInt()) {\n case 1 -> {\n puntiFelicita += 60;\n puntiVita -= 30;\n soldiTam -= 200;\n }\n case 2 -> {\n puntiFelicita += 40;\n puntiVita -= 20;\n soldiTam -= 100;\n }\n case 3 -> {\n puntiFelicita += 30;\n puntiVita -= 10;\n soldiTam -= 50;\n }\n }\n checkStato();\n }", "public void run() {\n PopulationFGA<Integer> poblacionActual = new PopulationFGA<>(funcionBorn,\n funcionFitness,\n problema.getDimension(),\n 1);\n poblacionActual.incializa(200);\n while(!condTerminacion.conditionReached(poblacionActual)) {\n System.out.println(\"Generacion Actual: \" + poblacionActual.getGeneracion());\n poblacionActual = iteration(poblacionActual);\n }\n ArrayList<IndividualFGA<Integer>> individuos = poblacionActual.generaIndividuos();\n IndividualFGA<Integer> mejor = individuos.get(0);\n for (IndividualFGA<Integer> e : individuos) {\n if (mejor.getFitness() <= e.getFitness())\n mejor = e;\n }\n System.out.println(\"Mejor solucion \" + '\\n' + mejor.toString());\n //System.out.println(\"Fitness \" + mejor.getFitness());\n int dim = problema.getDimension();\n int costo = 0;\n int obj1;\n int obj2;\n Phenotype<Integer> fenotipo = mejor.getRepActual();\n for (int i = 0; i < (dim - 1); i++) {\n obj1 = fenotipo.getAllele(i).intValue() - 1;\n for (int j = i + 1; j < dim; j++) {\n obj2 =fenotipo.getAllele(j).intValue() - 1; \n costo = costo + problema.getDistanciaEntre(i,j) * problema.getFlujoEntre(obj1,obj2);\n }\n }\n System.out.println(\"Costo de la solucion: \" + costo);\n\n }", "protected void tourne() {\n\t\tint direction = ev3.getDirection();\n\t\twhile (seenColor != ev3.SUIVRE) {\n\t\t\tev3.tourne(direction);\n\t\t\tev3.setCourbe(ev3.getCourbe() + 1);\n\t\t\tseenColor = find.whatColor(ev3.lireColor());\n\t\t\tif (ev3.getCourbe() % 10 == 0) {\n\t\t\t\tgeorges = 0;\n\t\t\t}\n\t\t}\n\t}", "public void ferdig(){\n antallTelegrafister--;\n }", "@Override\n public void robotPeriodic() {\n /*count++;\n\n if (count < 0) {\n count = 0;\n }\n\n int scriptIdx = count / SCRIPT_LENGTH;\n\n String[] script = LED_SCRIPTS[scriptIdx % (LED_SCRIPTS.length)];\n\n LedScript.setString(script[0]);\n \n if (script.length > 1) {\n LedScriptArgument.setString(script[1]);\n }*/\n\n // Hatch 0 has to be inverted because it is normally closed\n //SmartDashboard.putBoolean(\"HatchSwitch0\", !HatchSwitch0.get());\n //SmartDashboard.putBoolean(\"HatchSwitch1\", HatchSwitch1.get());\n\n //for (int i = 0; i < limits.length; i++) {\n // SmartDashboard.putBoolean(\"Switch\" + (i + 2), limits[i].get());\n //}\n\n\n final int MAX_TEMP = 100;\n if (MainLeft.getMotorTemperature() >= MAX_TEMP || AltLeft.getMotorTemperature() >= MAX_TEMP) {\n xbox.setRumble(RumbleType.kLeftRumble, 0.5);\n } else {\n xbox.setRumble(RumbleType.kLeftRumble, 0);\n }\n \n if (MainRight.getMotorTemperature() >= MAX_TEMP || AltRight.getMotorTemperature() >= MAX_TEMP) {\n xbox.setRumble(RumbleType.kRightRumble, 0.5);\n } else {\n xbox.setRumble(RumbleType.kRightRumble, 0);\n }\n\n //SmartDashboard.putNumber(\"DaTa\", NetworkTableInstance.getDefault().getTable(\"VisionTable\").getEntry(\"THIS IS A RANDOM NUMBER\").getNumber(-1).doubleValue());\n //SmartDashboard.putNumber(\"LiftSetpoint\", LiftSetpoint);\n //SmartDashboard.putNumber(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n //SmartDashboard.putNumber(\"LiftVoltageOut\", Lifter.getMotorOutputVoltage());\n //SmartDashboard.putNumber(\"LiftCurrentOut\", Lifter.getOutputCurrent());\n //SmartDashboard.putString(\"ControlMode\", Lifter.getControlMode().toString());\n //SmartDashboard.putNumber(\"ClosedLoopError\", Lifter.getClosedLoopError());\n //SmartDashboard.putNumber(\"LiftRampOutput\", liftRamp.getOutput());\n\n /*Diagnostics.writeDouble(\"DrivePosLeft\", MainLeft.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosRight\", MainRight.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosLeftAlt\", AltLeft.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosRightAlt\", AltRight.getEncoder().getPosition());\n Diagnostics.writeDouble(\"LiftVoltageOut\", Lifter.getMotorOutputVoltage());\n Diagnostics.writeDouble(\"LiftCurrentOut\", Lifter.getOutputCurrent());\n Diagnostics.writeInteger(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n Diagnostics.writeInteger(\"LiftSetpoint\", LiftSetpoint);\n Diagnostics.writeInteger(\"LiftRampOutput\", liftRamp.getOutput());\n \n Diagnostics.timestamp();*/\n }", "int range(){\n return fuelcap*mpg;\n }", "protected void ligneDroite() {\n\t\tboolean accelerer = true;\n\t\twhile (ev3.SUIVRE == seenColor) {\n\t\t\tev3.begSync();\n\t\t\tev3.avance();\n\t\t\tev3.endSync();\n\t\t\tif (ev3.getLigne() < 15 && accelerer) {\n\t\t\t\tev3.accelerer();\n\t\t\t\tev3.setLigne(ev3.getLigne() + 1);\n\t\t\t} else if (ev3.getLigne() == 30 && accelerer) {\n\t\t\t\taccelerer = false;\n\t\t\t} else if (ev3.getLigne() == 7) {\n\t\t\t\taccelerer = true;\n\t\t\t} else if (accelerer == false) {\n\t\t\t\tev3.decelerer();\n\t\t\t\tev3.setLigne(ev3.getLigne() - 1);\n\t\t\t}\n\t\t\tseenColor = find.whatColor(ev3.lireColor());\n\t\t}\n\t}", "@Override\r\n public void hallarPerimetro() {\r\n this.perimetro = this.ladoA*3;\r\n }", "private void calculerChemin() {\n suiteDeDeplacement.clear();\n int[][] empreinte = lab.getEmpreinte();\n lee(empreinte, x / Case.TAILLE, y / Case.TAILLE, cibleX, cibleY);\n }", "public void pos60() throws InterruptedException{\r\n bucketOverSweeper();\r\n sleep(2500);\r\n motorShoulder.setTargetPosition(-1160);\r\n motorElbow.setTargetPosition(2271);\r\n motorElbow.setPower(POWER_ELBOW_FAST);\r\n motorShoulder.setPower(POWER_SHOULDER_FAST);\r\n sleep(1000);\r\n\r\n servoBucket.setPosition(0.5);\r\n sleep(500);\r\n\r\n motorElbow.setTargetPosition(3075);\r\n motorShoulder.setTargetPosition(-1300);\r\n motorElbow.setPower(POWER_ELBOW_FAST);\r\n motorShoulder.setPower(POWER_SHOULDER_FAST);\r\n sleep(1000);\r\n\r\n motorElbow.setTargetPosition(3500);\r\n motorElbow.setPower(POWER_ELBOW_SLOW);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(MAX_BUCKET);\r\n sleep(500);\r\n\r\n motorElbow.setTargetPosition(3600);\r\n motorElbow.setPower(POWER_ELBOW_FAST);\r\n sleep(1000);\r\n\r\n servoBucket.setPosition(0.85);\r\n\r\n servoBucket.setPosition(0.80);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.70);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.65);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.60);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.55);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.50);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.40);\r\n sleep(500);\r\n\r\n servoBucket.setPosition(0.30);\r\n sleep(500);\r\n\r\n motorElbow.setTargetPosition(3000);\r\n motorElbow.setPower(POWER_ELBOW_FAST);\r\n sleep(500);\r\n\r\n posBucket = MAX_BUCKET;\r\n posElbow = 3000;\r\n posShoulder = -1275;\r\n sleep(3000);\r\n returnBucket();\r\n\r\n }", "public void sleutelWaarde(){\n if(sleutel100.getX() == speler.getX() && sleutel100.getY() == speler.getY() && veld[speler.getY()][speler.getX()] == 1){\n speler.setSleutelWaarde(sleutel100.getWaarde());\n }\n else if(sleutel1002.getX() == speler.getX() && sleutel1002.getY() == speler.getY() && veld[speler.getY()][speler.getX()] == 1){\n speler.setSleutelWaarde(sleutel1002.getWaarde());\n }\n else if(sleutel200.getX() == speler.getX() && sleutel200.getY() == speler.getY() && veld[speler.getY()][speler.getX()] == 1){\n speler.setSleutelWaarde(sleutel200.getWaarde());\n }\n else if(sleutel300.getX() == speler.getX() && sleutel300.getY() == speler.getY() && veld[speler.getY()][speler.getX()] == 1){\n speler.setSleutelWaarde(sleutel300.getWaarde());\n }\n }", "protected void execute() {\n//\t\tRobot.chassis.drive(0, .5, 0);\n//\t\tRobotMap.chassisfrontLeft.set(50);\n\t\tLiquidCrystal lcd = RobotMap.lcd;\n\n\t\t\n\t\t\n\n\t\t\n\t\tif(talonNum == 2){\n\t\t\tRobotMap.chassisfrontLeft.set(150);\n\t\t\tlcd.setCursor(0, 1);\n\t\t\tlcd.print(\"\" + RobotMap.chassisfrontLeft.getEncVelocity());\n\t\t\tlcd.setCursor(0, 2);\n\t\t\tlcd.print(\"\" + RobotMap.chassisfrontLeft.getEncPosition());\n\t\t\t\n\t\t\t\n\n\t\t}else if(talonNum == 3){\n\t\t\tRobotMap.chassisfrontRight.set(150);\n\t\t\tlcd.setCursor(0, 1);\n\t\t\tlcd.print(\"\" + RobotMap.chassisfrontRight.getEncVelocity());\n\t\t\tlcd.setCursor(0, 2);\n\t\t\tlcd.print(\"\" + RobotMap.chassisfrontRight.getEncPosition());\n\t\t\t\n\n\t\t}else if(talonNum == 4){\n\t\t\tRobotMap.chassisrearLeft.set(150);\t\n\t\t\tlcd.setCursor(0, 1);\n\t\t\tlcd.print(\"\" + RobotMap.chassisrearLeft.getEncVelocity());\n\t\t\tlcd.setCursor(0, 2);\n\t\t\tlcd.print(\"\" + RobotMap.chassisrearLeft.getEncPosition());\n\n\t\t}else if(talonNum == 5){\n\t\t\tRobotMap.chassisrearRight.set(150);\t\n\t\t\tlcd.setCursor(0, 1);\n\t\t\tlcd.print(\"\" + RobotMap.chassisrearRight.getEncVelocity());\n\t\t\tlcd.setCursor(0, 2);\n\t\t\tlcd.print(\"\" + RobotMap.chassisrearRight.getEncPosition());\n\n\t\t}else if(talonNum == 11){\n\t\t\tRobotMap.climberclimbMotor.set(.5);\t\n\n\t\t}else if(talonNum == 12){\n\t\t\tRobotMap.floorfloorLift.set(.75);\t\n\n\t\t}else if(talonNum == 13){\n\t\t\tRobotMap.acquisitionacquisitionMotor.set(.25);\t\n\n\t\t}\n\t\t\n\t\t\n\t}", "public void actionPerformed(ActionEvent e) {\r\n fen.setDelayAffiche();\r\n Princip.setTempsPrec();\r\n temps = temps + getdelay();\r\n boucle_principale();\r\n //testTimer();\r\n\r\n afficheTemps();\r\n }", "public void operateTheBoatForAmountOfTime(double time){// pass 1 as a time\n\t\t if(time > 0.0 && time <= 5.0 ){\n \tdouble fuelUsage = EfficiencyOfTheBoatMotor*currentSpeedOfTheBoat*currentSpeedOfTheBoat*time;\n \tfuelUsage = fuelUsage/10000;//since we have hp, and miles we have to divide by 10000 to get result in gallons \n double realTime; \n // Determine if we run out of fuel\n\t if(fuelUsage > amountOfFuelInTheTank){ \n\t realTime = time * (amountOfFuelInTheTank/fuelUsage); \n\t amountOfFuelInTheTank=0.0 ;\n\t }else{\n\t \tamountOfFuelInTheTank-=fuelUsage; \n\t realTime = time;\n\t }\n\t DistanceTraveled +=currentSpeedOfTheBoat * realTime; \n\t }\n\t }", "@Override\n public int calculerPerimetre() {\n return (int)(rayon * 2 * Math.PI);\n }", "public double getCurrentFuel();", "void object_below_eyes_level_calc(){\n down_angle=Math.abs(down_angle);\n up_angle=Math.abs(up_angle);\n angle_with_ground=90-angle_with_ground;\n distance_from_object=human_length*Math.tan(Math.toRadians(angle_with_ground));\n double all=distance_from_object*Math.tan(Math.toRadians(down_angle));\n double part=distance_from_object*Math.tan(Math.toRadians(up_angle));\n length_of_object=all-part;\n object_height_from_ground=human_length-all;\n ORI.setText(\"length_of_object :\\n\" +String.valueOf(String.format(\"%.2f\",(length_of_object/100))) +\" M\"+ \"\\n\" + \"distance_from_object :\\n\" + String.valueOf(String.format(\"%.2f\",(distance_from_object/100)))+\" M\" + \"\\n\"+\"height_from_ground :\\n\" + String.valueOf(String.format(\"%.2f\",(object_height_from_ground/100)))+\" M\");\n ORI.setVisibility(View.VISIBLE);\n }", "public void actionPerformed(ActionEvent e) {\n\t\t\t\tventilationFactor.setFloorArea(Double.parseDouble(txtFloorArea.getText()));\n\t\t\t\tventilationFactor.setVentilationArea(Double.parseDouble(txtVentilationArea.getText()));\n\t\t\t\tventilationFactor.setHeightOfVentilationOpening(Double.parseDouble(txtHeightOfVentilationOpening.getText()));\n\t\t\t\tventilationFactor.setHeightOfCompartment(Double.parseDouble(txtHeightOfCompartment.getText()));\n\t\t\t\tventilationFactor.setAreaOfHorizontalOpening(Double.parseDouble(txtAreaOfHorizontalOpening.getText()));\n\t\t\t\t\n\t\t\t\tVentilationFactorController ventilationFactorCalculator = new VentilationFactorController();\n\t\t\t\tventilationFactorCalculator.ventilationFactor(ventilationFactor);\n\t\t\t\ttxtVentilationFactorValue.setText(String.valueOf(ventilationFactor.getVentilationFactorValue()));\n\t\t\t}", "public void actionPerformed(ActionEvent e) {\n\t\t\t\tventilationFactor.setFloorArea(Double.parseDouble(txtFloorArea.getText()));\n\t\t\t\tventilationFactor.setVentilationArea(Double.parseDouble(txtVentilationArea.getText()));\n\t\t\t\tventilationFactor.setHeightOfVentilationOpening(Double.parseDouble(txtHeightOfVentilationOpening.getText()));\n\t\t\t\tventilationFactor.setHeightOfCompartment(Double.parseDouble(txtHeightOfCompartment.getText()));\n\t\t\t\tventilationFactor.setAreaOfHorizontalOpening(Double.parseDouble(txtAreaOfHorizontalOpening.getText()));\n\t\t\t\t\n\t\t\t\tVentilationFactorController ventilationFactorCalculator = new VentilationFactorController();\n\t\t\t\tventilationFactorCalculator.ventilationFactor(ventilationFactor);\n\t\t\t\ttxtVentilationFactorValue.setText(String.valueOf(ventilationFactor.getVentilationFactorValue()));\n\t\t\t}", "public abstract double emissionFunction(double oilamount);", "public abstract double emissionFunction(double oilamount);", "public void setEnergy (double energy) {\n\t this.energy = energy;\n\t}", "public double getEnergy(){\n\t\t return energy;\n\t}", "void AddExcavation(int fuel, String ore, int mass) {\n ore_values v = FindOreValue(ore);\n double value = mass * v.value;\n ore_excavation o = new ore_excavation(fuel, ore, mass, value);\n oe.add(o);\n ++num_excavations;\n }", "public void precio4e(){\n precioHabitaciones = precioHabitaciones + (cantidadHabitaciones * numeroCamas);\n\n //Restaurante\n if(capacidadRestaurant < 30){\n precioHabitaciones = precioHabitaciones + 10;\n } else if (capacidadRestaurant > 29 && capacidadRestaurant < 51){\n precioHabitaciones = precioHabitaciones + 30;\n } else if (capacidadRestaurant > 50){\n precioHabitaciones = precioHabitaciones + 50;\n }\n\n //Gimnasio\n switch (gimnasio){\n case \"A\":\n precioHabitaciones = precioHabitaciones + 50;\n break;\n case \"B\":\n precioHabitaciones = precioHabitaciones + 30;\n break;\n }\n\n }", "public void calibrated() {\n weaponDamage = weaponDamage + 10;\r\n }", "private void orange(){\n\t\tthis.arretes_fO();\n\t\tthis.coins_fO();\n\t\tthis.coins_a1O();\n\t\tthis.coins_a2O();\n\t\tthis.aretes_aO();\n\t\tthis.cube[40] = \"O\";\n\t}", "private double hitungG_pelukis(){\r\n return Math.sqrt(Math.pow(super.getRadius(),2)+Math.pow(tinggi,2));\r\n }", "public void mo5968e() {\n this.f5416fa.setVisibility(0);\n this.f5416fa.setImageBitmap(C1413m.f5711i);\n ObjectAnimator duration = ObjectAnimator.ofFloat(this.f5416fa, \"translationY\", new float[]{-((float) C1413m.f5711i.getHeight()), 0.0f}).setDuration(240);\n ObjectAnimator duration2 = ObjectAnimator.ofFloat(this.f5416fa, \"alpha\", new float[]{0.0f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f}).setDuration(240);\n duration.start();\n duration2.start();\n long j = (long) 160;\n ObjectAnimator.ofFloat(this.f5436pa, \"alpha\", new float[]{1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f, 0.0f}).setDuration(j).start();\n ObjectAnimator.ofFloat(this.f5438qa, \"alpha\", new float[]{1.0f, 0.0f}).setDuration(j).start();\n duration.addListener(new C1302Xa(this));\n }", "public void eat(){\n if (threshold<=0 && !lapar) revLapar();\n if (lapar && Common.gamemap.get(getX()).get(getY()).showSymbol()=='@'){\n Common.gamemap.get(getX()).get(getY()).ungrowGrass();\n revLapar();\n threshold = 12;\n }\n }", "double energy() {\n\n // brightness values\n double brU = 0;\n double brD = 0;\n double brR = 0;\n double brL = 0;\n double brDR = 0;\n double brTR = 0;\n double brDL = 0;\n double brTL = 0;\n if (this.up != null) {\n brU = this.up.brightness;\n }\n if (this.down != null) {\n brD = this.down.brightness;\n }\n\n if (this.right != null) {\n brR = this.right.brightness;\n }\n\n if (this.left != null) {\n brL = this.left.brightness;\n }\n\n if (this.downRight() != null) {\n brDR = this.downRight().brightness;\n }\n\n if (this.downLeft() != null) {\n brDL = this.downLeft().brightness;\n }\n\n if (this.topLeft() != null) {\n brTL = this.topLeft().brightness;\n }\n\n if (this.topRight() != null) {\n brTR = this.topRight().brightness;\n }\n\n\n double vertEnergy = (brTL + brL + brDL) - (brTR + brR + brDR);\n double horizEnergy = (brTL + brU + brTR) - (brDL + brD + brDR);\n\n return Math.sqrt((vertEnergy * vertEnergy) + (horizEnergy * horizEnergy));\n\n }", "public void einde(){\n if(veld[speler.getY()][speler.getX()] == 6){\n System.exit(0);\n }\n }", "public void ejercicio05() {\r\n\t\tcabecera(\"05\",\"\");\r\n\r\n\t\tint a=2, b=5, c=1; //Modificar los valores para realizar pruebas o leerlos por teclado\r\n\t\t\r\n\t\t// Ecuacion2Grado ecuacion=new Ecuacion2Grado(a,b,c);\r\n\t\t// Inicio modificacion\r\n\r\n\t\tSystem.out.println(\"Introduce el numero que multiplica a x²\");\r\n\t\ta = Teclado.readInteger();\r\n\t\tSystem.out.println(\"Introduce el numero que multiplica a x\");\r\n\t\tb = Teclado.readInteger();\r\n\t\tSystem.out.println(\"Introduce el termino independiente\");\r\n\t\tc = Teclado.readInteger();\r\n\r\n\t\tEcuacion2Grado ecuacion = new Ecuacion2Grado(a,b,c);\r\n\r\n\t\tSystem.out.println(ecuacion);\r\n\r\n // Fin modificacion\r\n\t}", "private static void statistique(){\n\t\tfor(int i = 0; i<7; i++){\n\t\t\tfor(int j = 0; j<7; j++){\n\t\t\t\tfor(int l=0; l<jeu.getJoueurs().length; l++){\n\t\t\t\t\tif(jeu.cases[i][j].getCouleurTapis() == jeu.getJoueurs()[l].getNumJoueur()){\n\t\t\t\t\t\tjeu.getJoueurs()[l].setTapis(jeu.getJoueurs()[l].getTapisRest()+1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tJoueur j;\n\t\tSystem.out.println(\"// Fin de la partie //\");\n\t\tfor(int i=0; i<jeu.getJoueurs().length; i++) {\n\t\t\tj =jeu.getJoueurs()[i];\n\t\t\tSystem.out.println(\"Joueur \"+ (j.getNumJoueur()+1) + \" a obtenue \"+j.getTapisRest()+j.getMonnaie()+\" points\" );\n\t\t}\n\t}", "private int FindGold() {\n VuforiaLocalizer vuforia;\n\n /**\n * {@link #tfod} is the variable we will use to store our instance of the Tensor Flow Object\n * Detection engine.\n */\n TFObjectDetector tfod;\n \n VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();\n\n parameters.vuforiaLicenseKey = VUFORIA_KEY;\n parameters.cameraDirection = CameraDirection.BACK;\n\n // Instantiate the Vuforia engine\n vuforia = ClassFactory.getInstance().createVuforia(parameters);\n\n // Loading trackables is not necessary for the Tensor Flow Object Detection engine.\n \n\n /**\n * Initialize the Tensor Flow Object Detection engine.\n */\n if (ClassFactory.getInstance().canCreateTFObjectDetector()) {\n int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(\n \"tfodMonitorViewId\", \"id\", hardwareMap.appContext.getPackageName());\n TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);\n tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);\n tfod.loadModelFromAsset(TFOD_MODEL_ASSET, LABEL_GOLD_MINERAL, LABEL_SILVER_MINERAL);\n tfod.activate();\n } else {\n telemetry.addData(\"Sorry!\", \"This device is not compatible with TFOD\");\n return 3;\n }\n\n int Npos1=0;\n int Npos2=0;\n int Npos3=0;\n int NposSilver1=0;\n int NposSilver2=0;\n int NposSilver3=0;\n double t_start = getRuntime();\n\n\n while (opModeIsActive()) {\n \n if( (getRuntime() - t_start ) > 3.5) break;\n if (Npos1 >=5 || Npos2>=5 || Npos3>=5)break;\n if (NposSilver1>=5 && NposSilver2>=5)break;\n if (NposSilver2>=5 && NposSilver3>=5)break;\n if (NposSilver1>=5 && NposSilver3>=5)break;\n if (tfod != null) {\n // getUpdatedRecognitions() will return null if no new information is available since\n // the last time that call was made.\n List<Recognition> updatedRecognitions = tfod.getUpdatedRecognitions();\n if (updatedRecognitions != null) {\n //telemetry.addData(\"# Object Detected\", updatedRecognitions.size());\n //if (updatedRecognitions.size() == 3) {\n int goldMineralX = -1;\n int silverMineralX = -1;\n for (Recognition recognition : updatedRecognitions) {\n if (recognition.getLabel().equals(LABEL_GOLD_MINERAL)) {\n goldMineralX = (int) recognition.getLeft();\n telemetry.addData(\"gold position\", goldMineralX);\n if(goldMineralX<300) {\n Npos1++;\n telemetry.addData(\"loc\", 1);\n }else if(goldMineralX<800){\n Npos2++;\n telemetry.addData(\"loc\", 2);\n }else{\n Npos3++;\n telemetry.addData(\"loc\", 3);\n }\n } \n \n if (recognition.getLabel().equals(LABEL_SILVER_MINERAL)) {\n silverMineralX = (int) recognition.getLeft();\n telemetry.addData(\"silver position\", silverMineralX);\n if(silverMineralX<300) {\n NposSilver1++;\n telemetry.addData(\"loc\", 1);\n }else if(silverMineralX<300){\n NposSilver2++;\n telemetry.addData(\"loc\", 2);\n }else{\n NposSilver3++;\n telemetry.addData(\"loc\", 3);\n }\n } \n }\n telemetry.update();\n }\n }\n }\n\n\n if (tfod != null) {\n tfod.shutdown();\n }\n \n \n \n telemetry.addData(\"\", 2);\n \n if (Npos1>=5)return 1;\n if (Npos2>=5)return 2;\n if (Npos3>=5)return 3;\n if (NposSilver1>=5 && NposSilver2>=5)return 3;\n if (NposSilver2>=5 && NposSilver3>=5)return 1; \n if (NposSilver1>=5 && NposSilver3>=5)return 2;\n\n return 3;\n }" ]
[ "0.6076081", "0.60636747", "0.5957733", "0.58972955", "0.5862138", "0.58412254", "0.58395666", "0.5806348", "0.5802053", "0.5790897", "0.5789965", "0.5740348", "0.5714532", "0.57080406", "0.56993014", "0.56975114", "0.56922865", "0.56875706", "0.56800747", "0.56658065", "0.5651796", "0.563956", "0.56374764", "0.56233007", "0.562204", "0.56090426", "0.55998373", "0.5598292", "0.558039", "0.55571246", "0.55550474", "0.55473614", "0.55452573", "0.5541885", "0.55320024", "0.5517036", "0.55121356", "0.5503624", "0.5479871", "0.5478567", "0.54770565", "0.5468993", "0.5465347", "0.54589283", "0.5458185", "0.545756", "0.5442508", "0.54393506", "0.54369146", "0.54321796", "0.54313034", "0.54306304", "0.5423621", "0.54226255", "0.5422457", "0.54218715", "0.5419539", "0.54086566", "0.5397827", "0.53945017", "0.5392304", "0.53922635", "0.53898895", "0.53863746", "0.5379542", "0.53784454", "0.53766966", "0.5370311", "0.5369917", "0.5365484", "0.5365072", "0.5364907", "0.5362944", "0.53594506", "0.5359405", "0.5357751", "0.5357631", "0.53544915", "0.53462017", "0.5344597", "0.53411615", "0.5339351", "0.5337139", "0.5337139", "0.5335951", "0.5335951", "0.5326562", "0.532577", "0.53234303", "0.5318431", "0.5315791", "0.5315617", "0.53139424", "0.5300293", "0.5299571", "0.52973723", "0.52952945", "0.5288291", "0.5284577", "0.5284499" ]
0.62451357
0
Upload Image To Specific Folder On Server
public static String uploadImage(String fileName, String serverUri, String serverFolderUploads) { HttpURLConnection connection = null; DataOutputStream outputStream = null; String pathToOurFile = fileName; String urlServer = serverUri; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; String charset = "UTF-8"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; try { FileInputStream fileInputStream = new FileInputStream(new File( pathToOurFile)); URL url = new URL(urlServer); connection = (HttpURLConnection) url.openConnection(); // Allow Inputs & Outputs connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); pathToOurFile = UUID.randomUUID().toString() + ".jpg"; // Enable POST method connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("ENCTYPE", "multipart/form-data"); connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); outputStream = new DataOutputStream(connection.getOutputStream()); outputStream.writeBytes(twoHyphens + boundary + lineEnd); outputStream.writeBytes("Content-Disposition: form-data; name=\"" + serverFolderUploads + "\"" + "; filename=\"" + pathToOurFile + "\"" + lineEnd); outputStream.writeBytes(lineEnd); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; // Read file bytesRead = fileInputStream.read(buffer, 0, bufferSize); try { while (bytesRead > 0) { outputStream.write(buffer, 0, bytesRead); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } } catch (Exception e) { e.printStackTrace(); } outputStream.writeBytes(lineEnd); outputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); // Responses from the server (code and message) int serverResponseCode = connection.getResponseCode(); String serverResponseMessage = connection.getResponseMessage(); fileInputStream.close(); outputStream.flush(); outputStream.close(); if (serverResponseCode == 200 && serverResponseMessage.equals("OK")) return pathToOurFile; else return ""; } catch (Exception e) { e.printStackTrace(); return ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void uploadFile(HttpServletRequest request, MultipartFile file, String code) {\n\t\tREAL_PATH = request.getSession().getServletContext().getRealPath(\"/assets/images/\");\n\t\t\n\t\tlogger.info(REAL_PATH);\n\t\t\n\t\tif (!new File(REAL_PATH).exists()) {\n\t\t\tnew File(REAL_PATH).mkdirs();\n\t\t}\n\t\tif (!new File(ABSOLUTE_PATH).exists()) {\n\t\t\tnew File(ABSOLUTE_PATH).mkdirs();\n\t\t}\n\t\t\n\t\ttry {\n\t\t\t// uploading ... project directory upload\n\t\t\tfile.transferTo(new File(ABSOLUTE_PATH + code + \".jpg\"));\n\t\t\t\n\t\t\t// uploading ... for the server\n\t\t\tfile.transferTo(new File(REAL_PATH + code + \".jpg\"));\n\t\t} catch (IOException e) {\n\t\t\t\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void uploadFile(HttpServletRequest request, MultipartFile file, String code) \r\n\t{\n\t\tREAL_PAIH=request.getSession().getServletContext().getRealPath(\"/assets/images/\");\r\n\t\t\r\n\t\tlogger.info(REAL_PAIH);\r\n\t\t\r\n\t\t//to make sure all directory exists\r\n\t\t//create new directory hmmmm\r\n\t\t\r\n\t\tif(!new File(ABS_PAIH).exists())\r\n\t\t{\r\n\t\t\t//create the directories\t\t\t\r\n\t\t\tnew File(ABS_PAIH).mkdirs();\r\n\t\t}\r\n\t\t\r\n\t\tif(!new File(REAL_PAIH).exists())\r\n\t\t{\r\n\t\t\t//create the directories\t\t\t\r\n\t\t\tnew File(REAL_PAIH).mkdirs();\r\n\t\t}\r\n\t\t\r\n\t\ttry\r\n\t\t{\r\n\t\t //server upload\r\n\t\t\tfile.transferTo(new File(REAL_PAIH + code + \".jpg\"));\r\n\t\t\t\r\n\t\t\t//project directory upload\r\n\t\t\tfile.transferTo(new File(ABS_PAIH + code + \".jpg\"));\r\n\r\n\t\t\t\r\n\t\t}catch(IOException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "void uploadingFolder(String remoteFolder);", "Path fileToUpload();", "void folderUploaded(String remoteFolder);", "private void doUpload(Part img1, String image) throws IOException{\n OutputStream out = null;\n InputStream filecontent = null;\n try {\n out = new FileOutputStream(new File(path \n + image));\n System.out.println(path \n + image);\n filecontent = img1.getInputStream();\n\n int read = 0;\n final byte[] bytes = new byte[1024];\n\n while ((read = filecontent.read(bytes)) != -1) {\n out.write(bytes, 0, read);\n }\n \n } catch (Exception fne) {\n System.out.println(\"You either did not specify a file to upload or are \"\n + \"trying to upload a file to a protected or nonexistent \"\n + \"location.\");\n fne.printStackTrace();\n\n } finally {\n if (out != null) {\n out.close();\n }\n if (filecontent != null) {\n filecontent.close();\n }\n }\n }", "void uploadingFile(String path);", "public void uploadMultipart() {\n //getting the actual path of the image\n String path = getPath(filePath);\n\n //Uploading code\n try {\n String uploadId = UUID.randomUUID().toString();\n\n //Creating a multi part request\n new MultipartUploadRequest(this, uploadId, \"todo\")\n .addFileToUpload(path, \"image\") //Adding file\n .setNotificationConfig(new UploadNotificationConfig())\n .setMaxRetries(2)\n .startUpload(); //Starting the upload\n\n } catch (Exception exc) {\n Toast.makeText(this, exc.getMessage(), Toast.LENGTH_SHORT).show();\n }\n }", "public Result uploadImage() {\n MultipartFormData<File> body = request().body().asMultipartFormData();\n MultipartFormData.FilePart<File> fileInput = body.getFile(\"inputFile\");\n if (fileInput != null) {\n File file = (File) fileInput.getFile();\n String imageUrl = S3Action.putImg(s3, file, UUID.randomUUID().toString());\n return ok(afterPutImg.render(imageUrl));\n } else {\n return badRequest(\"error\");\n }\n }", "public void crearRutaImgPublicacion(){\n \n servletContext=(ServletContext) contexto.getExternalContext().getContext();\n String ruta=\"\";\n //Ruta real hasta la carpeta uploads\n ruta=servletContext.getRealPath(\"/upload/\");\n //Obtener el codigo del usuario de la sesion actual\n //este es utilizado para ubicar la carpeta que le eprtenece\n String codUsuario=String.valueOf(new SessionLogica().obtenerUsuarioSession().getCodUsuario());\n //Concatenamiento de directorios internos\n ruta+=File.separatorChar+\"img\"+File.separatorChar+\"post\"+File.separatorChar+codUsuario+File.separatorChar+\"all\"+File.separatorChar;\n //Asignacion de la ruta creada\n this.rutaImgPublicacion=ruta;\n }", "private void uploadToServer(String filePath, String title) {\n APIClient apiClient = new APIClient();\n Retrofit retrofit = apiClient.getApiClient();\n ApiInterface apiInterface = retrofit.create(ApiInterface.class);\n File file = new File(filePath);\n\n MultipartBody.Part filePart =\n MultipartBody.Part.createFormData(\"file\", title+\".jpg\", //file.getName(),\n RequestBody.create(MediaType.parse(\"image/*\"), file));\n\n\n Call call = apiInterface.uploadImage(filePart);\n call.enqueue(new Callback() {\n @Override\n public void onResponse(Call call, Response response) {\n Toast.makeText(AddPost.this, \"Worked\",Toast.LENGTH_SHORT).show();\n }\n @Override\n public void onFailure(Call call, Throwable t) {\n t.printStackTrace();\n Toast.makeText(AddPost.this, \"Didn't work\",Toast.LENGTH_SHORT).show();\n }\n });\n }", "IbeisImage uploadImage(File image) throws UnsupportedImageFileTypeException, IOException, MalformedHttpRequestException,\n UnsuccessfulHttpRequestException;", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n int geekid = Integer.parseInt(request.getParameter(\"geekid\"));\n if (ServletFileUpload.isMultipartContent(request)) {\n try {\n\n List<FileItem> multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);\n\n for (FileItem item : multiparts) {\n\n if (!item.isFormField()) {\n item.write(new File(UPLOAD_DIRECTORY + File.separator + \"image\" + geekid + \".jpg\"));\n\n }\n \n String fileName = UPLOAD_DIRECTORY + File.separator + \"image\" + geekid + \".jpg\";\n\n }\n\n //File uploaded successfully\n request.setAttribute(\"message\", \"File Uploaded Successfully\");\n\n } catch (Exception ex) {\n\n request.setAttribute(\"message\", \"File Upload Failed due to \" + ex);\n\n }\n\n } else {\n\n request.setAttribute(\"message\",\n \"Sorry this Servlet only handles file upload request\");\n\n }\n\n request.getRequestDispatcher(\"/result.jsp\").forward(request, response);\n\n }", "public void uploadFile() {\n \n InputStream input = null;\n try {\n input = file.getInputStream();\n System.out.println(\"chay qua inpustream\");\n String itemName = file.getSubmittedFileName();\n String filename = itemName.substring(\n itemName.lastIndexOf(\"\\\\\") + 1);\n String dirPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(\"/upload/images\");\n fileNamed = \"/upload/images/\"+filename;\n File f = new File(dirPath + \"\\\\\" + filename);\n if (!f.exists()) {\n f.createNewFile();\n }\n FileOutputStream output = new FileOutputStream(f);\n byte[] buffer = new byte[1024];\n int length;\n while ((length = input.read(buffer)) > 0) {\n output.write(buffer, 0, length);\n }\n // resize(dirPath + \"\\\\\" + filename, dirPath + \"\\\\\" + filename, 200, 200);\n input.close();\n output.close();\n } catch (IOException ex) {\n System.out.println(\"loi io\");\n Logger.getLogger(ArtistsManagedBean.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n }", "@EventListener(ApplicationReadyEvent.class)\n private void createImageDirectory()\n {\n new File(productImageUpload).mkdir();\n }", "public void saveImage(MultipartFile imageFile) throws IOException {\n\t\tlogger.info(\"ComicDetail ID is \"+imageFile.getOriginalFilename());\r\n\t\tString folder=\"/images/comiccover\";\r\n\t\tbyte[] bytes = imageFile.getBytes();\r\n\t\tlogger.info(\"ComicDetail ID is \"+imageFile.getOriginalFilename());\r\n\t\t//Path path = Paths.get(folder+imageFile.getOriginalFilename());\r\n\t\r\n\t\t//Files.write(path, bytes);\r\n\t}", "String uploadProfileImage(String fileNameWithOutRepository,String fileName) throws GwtException, ServerDownException;", "public boolean uploadImage(String path2repository, String path2image) {\n\t\tbyte[] bin = Img2Bin(path2image);\n\t\t\n\t\tValueCollection payload = new ValueCollection();\n\t\tpayload.put(\"content\", new ImagePrimitive(bin));\n\t\tpayload.put(\"path\", new StringPrimitive(path2repository));\n\t\t\n\t\ttry {\n\t\t\tclient.invokeService(ThingworxEntityTypes.Things, \"SmartDoorRepository\", \"SaveImage\", payload, 5000);\n\t\t\tLOG.info(\"Image {} was uploaded to {}.\",path2image, path2repository);\n\t\t} catch (Exception e) {\n\t\t\tLOG.error(\"Image couldn't be uploaded. Error: {}\",e);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private void uploadImageFile(final String token, final GMImage image) {\n // create RequestBody instance from file\n File imgFile = storeHelper.getImageFile(image);\n final RequestBody requestFile = RequestBody.create(MediaType.parse(\"multipart/form-data\"), imgFile);\n\n // MultipartBody.Part is used to send also the actual file name\n MultipartBody.Part body = MultipartBody.Part.createFormData(\"file\", imgFile.getName(), requestFile);\n\n // Add file name within the multipart request\n RequestBody requestFileName = RequestBody.create(MediaType.parse(\"multipart/form-data\"), imgFile.getName());\n\n httpRequest.upload(token, requestFileName, body).enqueue(new Callback<ResponseBody>() {\n @Override\n public void onResponse(Call<ResponseBody> call, Response<ResponseBody> res) {\n if (res.code() == 200) {\n try {\n // upload image information\n image.addTag(TAG_RETRY, 0);\n createNewImage(token, image);\n\n } catch (JSONException e) {\n e.printStackTrace();\n notifyUploadFail();\n }\n } else {\n notifyUploadFail();\n }\n }\n\n @Override\n public void onFailure(Call<ResponseBody> call, Throwable t) {\n t.printStackTrace();\n\n // notify fail after retry reach limit\n if (((Integer) image.getTag(TAG_RETRY)) >= GMGlobal.RETRY_LIMIT) {\n notifyUploadFail();\n }\n\n // retry upload image\n new Retry() {\n @Override\n protected void handle(Object... params) {\n uploadImageFile((String) params[0], (GMImage) params[1]);\n }\n }.execute(token, image);\n }\n });\n }", "public void writeToDir() {\n\t\ttry{\n\t\t\tString dirPath = Paths.get(\".\").toAbsolutePath().normalize().toString()+\"/\";\n\t\t\tString path = dirPath + filename; //get server dir path\n\t\t\tSystem.out.println(\"output file path is: \" + path);\n\t\t\tFileOutputStream out = new FileOutputStream(path);\n out.write(img);\n out.close();\n PL.fsync();\n\t\t}catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void creaRutaImgPerfil(){\n servletContext=(ServletContext) contexto.getExternalContext().getContext();\n String ruta=\"\";\n //Ruta real hasta la carpeta de uploads\n ruta=servletContext.getRealPath(\"/upload/\");\n \n //Concatenamiento de directorios internos\n ruta+=File.separatorChar+\"img\"+File.separatorChar+\"users\"+File.separatorChar;\n \n //Asignacion de la ruta creada\n this.rutaImgPerfil=ruta;\n }", "public void upload_file(FileUploadEvent event) throws IOException {\n \t\n \tUploadedFile uploaded_file=event.getFile();\n \tFacesContext context = FacesContext.getCurrentInstance();\n \t\n\t\tHttpSession session = (HttpSession) FacesContext.getCurrentInstance()\n \t\t\t\t.getExternalContext().getSession(true);\n \t\tString pictures_folder=session.getAttribute(\"pictures_folder\").toString();\n \t\t\n \t\tPath folder = Paths.get(pictures_folder);\n\t\t\n\t\tString filename = FilenameUtils.getBaseName(uploaded_file.getFileName()); \n\t\tString extension = FilenameUtils.getExtension(uploaded_file.getFileName());\n\t\t//tou dinei rando onoma\n\t\tPath file = Files.createTempFile( folder,filename+\"-\" , \".\" + extension);\n\t\tSystem.out.println(\"folder: \"+folder.toString()+\"\\n\"+\"filename: \"+filename+\"\\n\"\n\t\t \t+ \"file: \"+file.toString());\n\t\t\n\t\tString profile_url;\n\t\ttry (InputStream input =uploaded_file.getInputstream()) {\n\t\t Files.copy(input, file, StandardCopyOption.REPLACE_EXISTING);\n\t\t profile_url=file.toString().split(\"/\")[file.toString().split(\"/\").length-1];\n\t\t}\n\n\t\tSystem.out.println(\"Uploaded picture successfully saved in \" + profile_url);\n\t\tString message=\"Pictures were uploaded Successfully\";\n\t\tFacesMessage facesMessage_11 = new FacesMessage(message);\n context.addMessage(files_upload_UI.getClientId(context), facesMessage_11);\n\t\t\n\t\t\n\t\t\n }", "public void uploadPictureToParkById(int id, MultipartFile multipartFile, boolean enablePublicReadAccess) {\n Optional<DogPark> dogPark = dogParkRepository.findById(id);\n\n if (dogPark.isPresent()) {\n\n //Create a new image to store the URL of the file that is being created\n Image image = new Image();\n\n //Creating the file\n String fileName = multipartFile.getOriginalFilename();\n\n try {\n //creating the file in the server (temporarily)\n File file = new File(fileName);\n FileOutputStream fos = new FileOutputStream(file);\n fos.write(multipartFile.getBytes());\n fos.close();\n\n for (int i = -1; i < dogPark.get().getImages().size(); i++) {\n\n if (i == dogPark.get().getImages().size() - 1) {\n fileName = dogPark.get().getName() + \"/\" + dogPark.get().getName() + (i + 1) + \".\" + FilenameUtils.getExtension(fileName);\n }\n }\n\n //Set the URL to the new image and connect with the correct dog park and save it to the repository\n image.setUrl(\"https://dogparks.s3.amazonaws.com/\" + fileName);\n image.setDogpark(dogPark.get());\n imageRepository.save(image);\n\n //Add the image to the dog park\n dogPark.get().getImages().add(image);\n\n PutObjectRequest putObjectReqeust = new PutObjectRequest(this.awsS3AudioBucket, fileName, file);\n\n if (enablePublicReadAccess) {\n putObjectReqeust.withCannedAcl(CannedAccessControlList.PublicRead);\n }\n\n this.amazonS3.putObject(putObjectReqeust);\n\n } catch (IOException | AmazonServiceException ex) {\n logger.error(\"error [\" + ex.getMessage() + \"] occurred while uploading [\" + fileName + \"] \");\n }\n }\n else {\n throw new DogParkNotFoundException();\n }\n }", "void setImageLocation(URL imageLocation) throws IOException;", "public void uploadImage() {\n if (imgPath != null && !imgPath.isEmpty()) {\n //prgDialog.setMessage(\"Converting Image to Binary Data\");\n //prgDialog.show();\n // Convert image to String using Base64\n new EncodeImageToStringTask().execute();\n // When Image is not selected from Gallery\n } else {\n //Toast.makeText(\n // getApplicationContext(),\n // \"You must select image from gallery before you try to upload\",\n // Toast.LENGTH_LONG).show();\n }\n }", "public static void upload_Image(String filePath) {\n\t\tboolean bstatus;\n\n\t\tbstatus = uploadFile1(btn_LiteratureImage, filePath);\n\t\tReporter.log(bstatus, \"Image Slected\", \"Image Not Slected\");\n\n\t}", "private void uploadImage() {\n if(checkPermissions()){ // if permission is granted we move on with the code\n Intent gallery = new Intent();\n gallery.setType(\"image/\");\n gallery.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(Intent.createChooser(gallery,\"Select Image With: \"),CHOOSE_IMAGE_FROM_GALLERY);\n }else{\n requestPermissionFromUser(); // if permission is not granted we go and request a permission from the user\n }\n }", "@PostMapping\n public ResponseEntity<BlobImage> saveImage(@RequestBody BlobStoreRequest request) {\n logger.info(\"Got a request to save an image: {}\", request.getMd5());\n BlobImage blob = BlobImage.builder()\n .build();\n blob = repository.save(blob);\n\n String storageLocation = properties.getStorageLocation();\n String uploadDir = storageLocation + \"/\" + blob.getId();\n\n blob.setImageUri(ServletUriComponentsBuilder.fromCurrentContextPath().path(\"/api/v1/blob/{id}\")\n .buildAndExpand(blob.getId()).toUriString());\n\n blob.setFileNameWithAbsolutePath(uploadDir);\n\n repository.save(blob);\n return ResponseEntity.ok(blob);\n }", "public String uploadFile(MultipartFile file) {\n\t\tString url;\r\n\t\tString visit = \"\";\r\n\t\tif (!file.isEmpty()) {\r\n try {\r\n \tSystem.out.println(\"进入文件上传\");\r\n \t//获取上传文件的文件类型\r\n \tString contentType=file.getContentType();\r\n \tif(contentType.startsWith(\"image/\")){\r\n \t//获取上传文件的文件名\r\n \tString name = file.getOriginalFilename();\r\n \t//获取文件的后缀\r\n \tint lastPoiIndex=name.lastIndexOf(\".\");\r\n \tString extendNam = null;\r\n \tif(lastPoiIndex>-1){\r\n \t\textendNam = name.substring(lastPoiIndex);\r\n \t\t\t}\r\n \t//确定新的文件名\r\n \t\t\tDate now=new Date();\r\n \t\t\t//获取当前时间\r\n \t\t\tSimpleDateFormat sdf=new SimpleDateFormat(\"yyyyMMddHHmmssSSS\");\r\n \t\t\tString newFileName=sdf.format(now)+extendNam;\r\n \t//文件储存的地址/WEB-INF/classes/resources/\r\n \t\t\turl =System.getProperty(\"user.dir\")+\"/src/main/resources/static/img/login/\"+newFileName;\r\n \tvisit = \"../img/login/\"+newFileName;\r\n// \turl =System.getProperty(\"user.dir\")+\"/\"+newFileName;\r\n//\t\t\t\treplace替换字符串\r\n// \turl =url1.replace(\"bin\",\"webapps/PIDStudioDemo/WEB-INF/classes/static/img/login\");\r\n \tvisit = \"../img/login/\"+newFileName;\r\n \tSystem.out.println(url);\r\n BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(url)));//储存文件到指定地址\t \r\n out.write(file.getBytes());\r\n out.flush();\r\n out.close();//关闭\r\n System.out.println(\"上传成功\");\r\n }else {\r\n \tSystem.out.println(\"文件不是图片\");\r\n \t return \"\";\r\n }\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n return \"\";\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n return \"\" ;\r\n }\r\n return visit ;\r\n } else {\r\n return \"\";\r\n }\r\n\t}", "public void uploader(WebDriver driver, String image, By browse, By upload) throws InterruptedException {\n\t\t String imageDir = Common.localImageDir;\n\t\t String imagePath = imageDir + File.separator + image;\n\t\t try{\n \t driver.findElement(browse).sendKeys(imagePath);\n \t Thread.sleep(1000);\n \t driver.findElement(upload).click();\n \t waitUntilElementInvisibility(driver, 10, Common.ajaxThrobber, \"Throbber\", new Exception().getStackTrace()[0]);\n }catch(Throwable e) { e.printStackTrace(); }\n }", "@RequestMapping(\"/add\")\n @ResponseBody\n public String handleFileUpload(@RequestParam(\"file\") MultipartFile file) {\n String path = \"C:\\\\Users\\\\Administrator\\\\Desktop\\\\lostfound\\\\static\\\\img\";\n String fileName = file.getOriginalFilename();\n Calendar currTime = Calendar.getInstance();\n String time = String.valueOf(currTime.get(Calendar.YEAR))+String.valueOf((currTime.get(Calendar.MONTH)+1));\n String suffix = fileName.substring(file.getOriginalFilename().lastIndexOf(\".\"));\n suffix = suffix.toLowerCase();\n if(suffix.equals(\".jpg\") || suffix.equals(\".jpeg\") || suffix.equals(\".png\")){\n fileName = UUID.randomUUID().toString()+suffix;\n File targetFile = new File(path, fileName);\n if(!targetFile.getParentFile().exists()){\n targetFile.getParentFile().mkdirs();\n }\n long size = 0;\n try {\n file.transferTo(targetFile);\n size = file.getSize();\n } catch (Exception e) {\n e.printStackTrace();\n return\"上传失败\";\n }\n String fileUrl=\"/static\";\n fileUrl = fileUrl + \"/img/\" + fileName;\n return fileUrl;\n }else{\n return \"上传失败\";\n }\n }", "@Test\n public void uploadAppImageTest() throws ApiException {\n File file = null;\n Integer id = null;\n Application response = api.uploadAppImage(file, id);\n\n // TODO: test validations\n }", "private void putImageInStorage() {\n final StorageReference ref = storageReference.child(\"images/\" + java.util.UUID.randomUUID().toString());\n ref.putFile(filePath)\n .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {\n @Override\n public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {\n if (taskSnapshot.getMetadata() != null) {\n if (taskSnapshot.getMetadata().getReference() != null) {\n Task<Uri> result = taskSnapshot.getStorage().getDownloadUrl();\n result.addOnSuccessListener(new OnSuccessListener<Uri>() {\n @Override\n public void onSuccess(Uri uri) {\n imageUrl = uri.toString();\n ChatMessage Message = new\n ChatMessage(null,\n mUsername,\n imageUrl, dateAndTime);\n mFirebaseDatabaseReference.child(CHATS_PATH + chatCode)\n .push().setValue(Message);\n }\n });\n }\n }\n }\n });\n }", "private void uploadImage(byte[] imageData) {\n\n }", "private void uploadImage() {\n FileChooser fileChooser = new FileChooser();\n\n //Extension de l'image\n FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(\"Fichier image\", \"*.*\");\n fileChooser.getExtensionFilters().addAll(extFilter);\n\n File file = fileChooser.showOpenDialog(null);\n\n try {\n BufferedImage bufferedImage = ImageIO.read(file);\n Image image = SwingFXUtils.toFXImage(bufferedImage, null);\n imageViewAvatar.setImage(image);\n getUser().setAvatar(image);\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@PostMapping(\"/upload\")\n public String handleFileUpload(@RequestParam MultipartFile file) throws IOException {\n final Path uploadDestination = Paths.get(\"C:\\\\uploads\").resolve(file.getName());\n\n file.transferTo(uploadDestination);\n return \"redirect:/\";\n }", "public void upload() {\r\n if (file != null) {\r\n try {\r\n String filepath = super.getUploadFolder() + \"/\" + file.getFileName();\r\n filepath = FileUtil.alternativeFilepathIfExists(filepath);\r\n FileUtil.createFile(filepath);\r\n\r\n file.write(filepath);\r\n super.info(\"Succesful\", file.getFileName() + \" is uploaded.\");\r\n\r\n Upload upload = new Upload();\r\n upload.setDescription(description);\r\n upload.setFilepath(filepath);\r\n upload.setTag(Md5Util.getMd5Sum(filepath));\r\n this.description = null;\r\n uploads.add(upload);\r\n // update ui and ready for save in db\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n }\r\n }", "@RequestMapping(value = {\"/register\"}, method = RequestMethod.POST)\r\n public String registerUser(@Valid FileBucket fileBucket, BindingResult result,\r\n ModelMap model, HttpServletRequest req) {\r\n\r\n MultipartFile[] files = fileBucket.getFiles();\r\n String originalImgPath = \"\";\r\n String resizedImgPath = \"\";\r\n //String serverFileName = \"\";\r\n String photoName = \"\";\r\n String itemViewName = \"\";\r\n String imgLocation = \"\";\r\n int width = 580;\r\n int height = 450;\r\n boolean saved = false;\r\n String serverFileName = \"\";\r\n\r\n FileBucket fb = new FileBucket();\r\n User user = new User();\r\n if (result.hasErrors()) {\r\n return \"registration\";\r\n }\r\n if (files != null && files.length > 0) {\r\n for (int i = 0; i < files.length; i++) {\r\n try {\r\n\r\n byte[] bytes = null;\r\n // Creating the directory to store file\r\n String rootPath = System.getProperty(\"catalina.home\");\r\n File dir = new File(rootPath + File.separator + \"tmpFiles\");\r\n if (!dir.exists()) {\r\n dir.mkdirs();\r\n }\r\n\r\n FilenameUtils fileUTIL = new FilenameUtils();\r\n\r\n String path = req.getServletContext().getRealPath(\"/image\");\r\n //String ext = fileUTIL.getExtension(file.getOriginalFilename());\r\n //String baseName = fileUTIL.getBaseName(file.getOriginalFilename());\r\n\r\n imgLocation = dir + File.separator;\r\n // get files name in the array\r\n if (i == 0) {\r\n photoName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + photoName;\r\n System.out.println(\"photoName:: \" + photoName);\r\n } else if (i == 1) {\r\n itemViewName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + itemViewName;\r\n System.out.println(\"itemViewName:: \" + itemViewName);\r\n }\r\n\r\n System.out.println(\"serverFileName :: \" + serverFileName);\r\n\r\n // resize image\r\n //utility.resize(originalImgPath, resizedImgPath, width, height);\r\n //create the file on server\r\n File serverFile = new File(serverFileName);\r\n BufferedOutputStream stream = new BufferedOutputStream(\r\n new FileOutputStream(serverFile));\r\n stream.write(bytes);\r\n stream.close();\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n\r\n //System.out.println(\"bytes ::\" + bytes);\r\n user.setFirstName(fileBucket.getFirstName());\r\n user.setLastName(fileBucket.getLastName());\r\n user.setPhoneNumber(fileBucket.getPhoneNumber());\r\n user.setItemView(fileBucket.getItemView());\r\n user.setAddress(fileBucket.getAddress());\r\n user.setPassportPhotograph(photoName);\r\n user.setImgLocation(imgLocation);\r\n user.setImgName(photoName);\r\n user.setImgItemName(itemViewName);\r\n\r\n saved = userService.saveUser(user);\r\n\r\n } else {\r\n System.out.println(\"File is empty / No image uploaded\");\r\n }\r\n\r\n //model.addAttribute(\"user\", user);\r\n model.addAttribute(\"user\", fb);\r\n //model.addAttribute(\"success\", \"User \" + user.getFirstName() + \" \" + user.getLastName() + \" saved successfully\");\r\n //model.addAttribute(\"saved\", saved);\r\n\r\n //return \"adduser\";\r\n //return \"redirect:/adduser\";\r\n return \"redirect:/register\";\r\n }", "@Override\r\n\t\tpublic void onClick(View v) {\n\t\t\tbyte image[] = Global.File2byte(pathImage);\r\n\t\t\t\r\n\t\t\tTransfer.uploadImage(image, new TransferListener() {\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void onSucceed(JSONObject obj) {\r\n\t\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t\tLog.e(\"upload\",obj.toString());\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void onFail(String desc) {\r\n\t\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t Log.e(\"upload\",desc);\t\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}", "public void uploadImage() {\n\t\tif (fileChooser.showOpenDialog(btnUploadImage) == JFileChooser.APPROVE_OPTION)\n\t\t\t;\n\n\t\tfileChooser.addChoosableFileFilter(new FileNameExtensionFilter(\"Images\", \"jpg\", \"png\", \"gif\", \"bmp\"));\n\t\tif (fileChooser.getSelectedFile() != null) {\n\t\t\timage = new ImageIcon(fileChooser.getSelectedFile().getAbsolutePath());\n\t\t\t// Resize image to 100x100\n\t\t\timg = image.getImage();\n\t\t\tImage newimg = img.getScaledInstance(100, 100, java.awt.Image.SCALE_SMOOTH);\n\t\t\timage = new ImageIcon(newimg);\n\t\t}\n\t}", "public void uploadImg(View view){\n Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);\n intent.addCategory(Intent.CATEGORY_OPENABLE);\n intent.setType(\"image/*\");\n intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);\n intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\n intent.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(Intent.createChooser(intent, \"Select Picture\"), SELECT_PICTURE);\n }", "@RequestMapping(\"/upload\")\n public String upload(HttpSession session) {\n // Get details about the current user\n User currUser = (User) session.getAttribute(\"currUser\");\n\n // If the current user is null then redirect back to homepage, else redirect to upload page\n // We are checking it to make sure a user is able to upload an image if and only if they are logged in and the session has been started\n if(currUser == null ){\n return \"redirect:/\";\n }\n else {\n return \"/upload\";\n }\n }", "public interface ImageService {\n\n void saveImageFile(Long recipeId, MultipartFile imageFile);\n}", "public void photoUpload() throws Exception {\n\r\n\t\tString Window=commonUtil.getWindowHandle(driver);\r\n\t\tcommonUtil.switchToWindow(Window, driver);\r\n\r\n\t\t// display picture window \r\n\t\tcommonUtil.clickOnButton(driver, ChangePicture,\"ChangePicture\");\r\n\r\n\r\n\t\t//load picture using robot class\r\n\t\r\n\t\tcommonUtil.LoadFile(driver, prop.getProperty(\"photopath\"));\r\n\t\t//System.out.println(\"photo is loading...\"); \r\n\r\n\t\t\r\n\t\t\r\n\t\t//switch to crop window\r\n\r\n\t\tWindow=commonUtil.getWindowHandle(driver);\r\n\t\tcommonUtil.switchToWindow(Window, driver);\r\n\r\n\r\n\t\t//crop image window \r\n\t\tcommonUtil.clickOnButton(driver, Cropimage,\"CropImage\");\r\n\t\t\r\n\t\t//enter Display name and discription\r\n\t\t\r\n\t\tcommonUtil.enterText(driver, Displaytext, prop.getProperty(\"displayname\"),\"Displayname\");\r\n\t\tcommonUtil.enterText(driver, Discriptiontext, prop.getProperty(\"Address\"),\"Discription\");\r\n\t\t\r\n\t\t//click on save button\r\n\t\t\r\n\t\tcommonUtil.clickOnButton(driver, Save,\"SaveButton\");\r\n\r\n\t\t\r\n\t}", "void fileUploaded(String path);", "public void upload(UploadedFile file) {\n FacesContext faces = FacesContext.getCurrentInstance();\n\n getSelected().setUrlImage(file.getFileName());\n String fileExtension = file.getFileName().split(\"\\\\.\")[file.getFileName().split(\"\\\\.\").length - 1];\n\n //String generatedFileName = \"file\" + System.currentTimeMillis();\n File directory = new File(faces.getExternalContext().getRealPath(UPLOAD_DIRECTORY_IMAGE_RELATIVE));\n\n if (!directory.exists()) {\n directory.mkdir();\n }\n\n File newFile = new File(faces.getExternalContext().getRealPath(UPLOAD_DIRECTORY_IMAGE_RELATIVE) + File.separator + file.getFileName());\n try {\n if (!newFile.createNewFile()) {\n String nameGenerated = \"file_generated\" + System.currentTimeMillis();\n newFile = new File(faces.getExternalContext().getRealPath(UPLOAD_DIRECTORY_IMAGE_RELATIVE) + File.separator + nameGenerated + \".\" + fileExtension);\n getSelected().setUrlImage(nameGenerated);\n }\n\n FileOutputStream output = new FileOutputStream(newFile);\n\n byte[] buffer = new byte[BUFFER];\n\n int bulk;\n\n InputStream input = file.getInputstream();\n\n while (true) {\n bulk = input.read(buffer);\n\n if (bulk < 0) {\n break;\n }\n\n output.write(buffer, 0, bulk);\n output.flush();\n }\n\n output.close();\n input.close();\n\n } catch (Exception ex) {\n ex.printStackTrace();\n FacesContext.getCurrentInstance().addMessage(\"\", new FacesMessage(bundle.getString(\"Error_file_created\")));\n }\n\n }", "@RequestMapping(value = \"/singleUpload\", method = RequestMethod.POST)\r\n\tpublic @ResponseBody boolean test(HttpServletRequest request,\r\n\t\t\t@RequestParam(\"file\") CommonsMultipartFile singleUploadFile) {\r\n\t\tboolean status = false;\r\n\t\tSystem.out.println(\"////// Inside there\");\r\n\r\n\t\tSystem.out.println(\"////// Inside there reh\" + singleUploadFile.getOriginalFilename());\r\n\r\n\t\tString fileName[] = singleUploadFile.getOriginalFilename().split(\"_\");\r\n\t\tString folderName = fileName[0];\r\n\t\t\r\n\t\t/*\r\n\t\t * try { ServletContext context = request.getServletContext(); String\r\n\t\t * uploadPath = context.getRealPath(\"/\" + folderName); File uploadDir =\r\n\t\t * new File(uploadPath); if (!uploadDir.exists()) { boolean success =\r\n\t\t * uploadDir.mkdir();\r\n\t\t * \r\n\t\t * if (success) { success = (new File(uploadDir + \"/\" +\r\n\t\t * subFolderName)).mkdir(); }\r\n\t\t * \r\n\t\t * } String path = uploadDir + \"/\" + subFolderName + \"/\" +fileName[2];\r\n\t\t * System.out.println(\"Path is\" + path); File serverFile = new\r\n\t\t * File(path); BufferedOutputStream stream = new\r\n\t\t * BufferedOutputStream(new FileOutputStream(serverFile));\r\n\t\t * stream.write(singleUploadFile.getBytes()); stream.close(); url =\r\n\t\t * folderName+\"_\"+subFolderName+\"_\"+fileName[2];\r\n\t\t * \r\n\t\t * }\r\n\t\t */ \r\n\t\ttry {\r\n\t\t\tServletContext context = request.getServletContext();\r\n\t\t\tString uploadPath = context.getRealPath(\"/\" + folderName);\r\n\t\t\tFile uploadDir = new File(uploadPath);\r\n\t\t\tif (!uploadDir.exists()) {\r\n\t\t\t\tboolean success = uploadDir.mkdir();\r\n\t\t\t\tif (success) {\r\n\t\t\t\t\tsuccess = (new File(uploadDir + \"/temp\")).mkdir();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tString path = uploadDir + \"/temp/\" + fileName[1];\r\n\t\t\tSystem.out.println(\"Path is\" + path);\r\n\t\t\tFile serverFile = new File(path);\r\n\t\t\tBufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));\r\n\t\t\tstream.write(singleUploadFile.getBytes());\r\n\t\t\tstatus = true;\r\n\t\t\tstream.close();\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\tAdminResponseClass adminResponseClass = new AdminResponseClass();\r\n\t\tadminResponseClass.setStatus(status);\r\n\t\treturn adminResponseClass.isStatus();\r\n\t}", "private void chooseImageAndUpload() {\n Intent intent = new Intent();\n intent.setType(\"image/*\");\n intent.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(Intent.createChooser(intent, \"Select Picture\"), Common.PICK_IMAGE_REQUEST);\n\n }", "public void uploadImage(int pos) throws InterruptedException {\n\t}", "public static String saveFile( MultipartFile filedata, HttpServletRequest request) {\n String pathval = \"C://KCGLIMG//\";\n String newFileName = String.valueOf( System.currentTimeMillis());\n String saveFilePath = \"images//equipment//\";\n\n File fileDir = new File(pathval + saveFilePath);\n if (!fileDir.exists()) {\n fileDir.mkdirs();\n }\n\n String filename=filedata.getOriginalFilename();\n\n String extensionName = filename.substring(filename.lastIndexOf(\".\") + 1);\n try {\n String imgPath = saveFilePath + newFileName + \".\" +extensionName;\n System.out.println(pathval + imgPath);\n FileOutputStream out = new FileOutputStream(pathval + imgPath);\n \n out.write(filedata.getBytes());\n out.flush();\n out.close();\n\n String path=pathval+imgPath;\n return path;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }", "public void upload(FileUploadEvent event) {\r\n\t\tUploadedFile uploadFile = event.getFile();\r\n\t\t// Recuperer le contenu de l'image en byte array (pixels)\r\n\t\tbyte[] contents = uploadFile.getContents();\r\n\t\tSystem.out.println(\"---------------- \" + contents);\r\n\t\tproduit.setPhoto(contents);\r\n\t\t// Transforme byte array en string (format basé64)\r\n\t\timage = \"data:image/png;base64,\" + Base64.encodeBase64String(produit.getPhoto());\r\n\t\t\r\n\t}", "public void upload() {\n try {\n BufferedImage bufferedProfile = ImageIO.read(profilePicture.getInputStream());\n FaceImage face = new FaceImage(bufferedProfile);\n\n if (face.foundFace()) {\n\n face.setNoCropMultiplier(1);\n face.setAdditionPadding(20);\n face.setDimension(128, 128);\n BufferedImage profilePicture = face.getScaledProfileFace();\n\n File outfile = new File(Settings.NEW_PROFILE_IMAGE_PATH.replace(\"~~username~~\", student.getUserName()));\n ImageIO.write(profilePicture, \"png\", outfile);\n\n success = true;\n\n student.setProfilePicturePath(\"profile/\" + student.getUserName() + \".png\");\n save();\n\n } else {\n FacesContext.getCurrentInstance().addMessage(\"imageContainer:file\", new FacesMessage(\"Kein Gesicht gefunden!\"));\n\n }\n\n } catch (IOException e) {\n System.err.println(\"something went wrong \" + e.getMessage());\n }\n\n }", "@Override\n public String saveFile(MultipartFile file, String rootDirectory ) {\n String path = null;\n try {\n if (file != null && !file.isEmpty()) {\n java.util.Date date = new java.util.Date();\n int i = (int) (date.getTime() / 1000);\n String extention = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(\".\")+1);\n String fileName =file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(\".\"));\n path = rootDirectory + fileName + \"-\" + i + \".\"+ extention;\n\n File finalFilePath = new File(path);\n //create all path directories if not exist\n finalFilePath.getParentFile().mkdirs();\n file.transferTo(new File(path));\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n return path;\n }", "@PostMapping(path = \"/uploadAppImg\")\n\tpublic ResponseEntity<String> uploadAppImg(@RequestParam(\"file\") MultipartFile file) {\n\t\tif (file.isEmpty()) {\n\t\t\treturn new ResponseEntity<>(\"上传的图片不能为空\", HttpStatus.BAD_REQUEST);\n\t\t}\n\t\tswitch (fileProperties.getLocation()) {\n\t\tcase \"oss\":\n\t\t\treturn fileUploadService.ossUpload(file)\n\t\t .map(url -> new ResponseEntity<String>(url, HttpStatus.OK))\n\t\t .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));\n\t\tcase \"local\":\n\t\t\treturn fileUploadService.uploadToLocal(file)\n\t\t .map(url -> new ResponseEntity<String>(url, HttpStatus.OK))\n\t\t .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));\n\t\tcase \"cloud\":\n\t\t\treturn new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);\n\t\t}\n\t\treturn new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);\n\n\t}", "public static void upload(String fpath) {\n String baseurl=\"http://dev.123go.net.cn\";\n File file = new File(fpath);\n\n // please check you mime type, i'm uploading only images\n RequestBody requestBody = RequestBody.create(MediaType.parse(\"image/*\"), file);\n /*RequestBody rbody=new MultipartBody.Builder()\n .addPart(requestBody).build();\n\n RequestBody requestFile =\n RequestBody.create(MediaType.parse(\"image/jpg\"), file);\n MultipartBody.Part body =\n MultipartBody.Part.createFormData(\"image\", file.getName(), requestFile);\n */\n\n Retrofit retrofit=new Retrofit.Builder()\n .baseUrl(baseurl)\n .addConverterFactory(GsonConverterFactory.create())\n .client(getOkhttpClient())\n .build();\n // 添加描述\n /*String descriptionString = \"hello, 这是文件描述\";\n RequestBody description =\n RequestBody.create(\n MediaType.parse(\"multipart/form-data\"), descriptionString);*/\n UploadServer server=retrofit.create(UploadServer.class);\n Call<ResponseBody> call = server.uploadImage(requestBody);\n call.enqueue(new Callback<ResponseBody>() {\n\n @Override\n public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {\n ResponseBody jsonObject=response.body();\n System.out.print(jsonObject.toString());\n }\n\n @Override\n public void onFailure(Call<ResponseBody> call, Throwable t) {\n\n }\n });\n }", "@Override\r\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n \r\n String FOLDER = \"/Image/AvatarImg\";\r\n HttpSession session = (HttpSession) request.getSession(false);\r\n User user = (User) session.getAttribute(\"user\");\r\n Boolean updateResult;\r\n User cgeUser = new User();\r\n \r\n //Creazione variabili \r\n String email = user.getEmail();\r\n String nominativo = request.getParameter(\"nominativo\");\r\n String password = request.getParameter(\"password\");\r\n Boolean send;\r\n send = request.getParameter(\"send\") != null;\r\n String url;\r\n \r\n //IMMAGINE ################################################################################\r\n Part filePart = request.getPart(\"file1\");\r\n if((filePart != null) && (filePart.getSize() > 0)){\r\n //delete current immage\r\n String imageFolder = getServletContext().getRealPath(user.getImage()); //cerca il link assoluto dell immagine\r\n if(imageFolder != null){\r\n imageFolder = imageFolder.replace(\"\\\\build\", \"\"); //rimuove build dal link assoluto\r\n File currentFile = new File(imageFolder); //carica il file nel ogetto \r\n if(currentFile.exists()){ //controlla se esiste il file\r\n try{\r\n ImageDispatcher.deleteImgFromDirectory(imageFolder);\r\n cgeUser.setImage(null);\r\n }catch(Exception e){\r\n System.out.println(\"Cancella immagine errata\");\r\n System.out.println(e);\r\n }\r\n }\r\n }\r\n //save new immage\r\n String extension = Paths.get(filePart.getSubmittedFileName()).getFileName().toString().split(Pattern.quote(\".\"))[1];\r\n String foldername = getServletContext().getRealPath(FOLDER);\r\n foldername = foldername.replace(\"\\\\build\", \"\");\r\n String filename;\r\n if(email.equals(\"\")){\r\n filename = ImageDispatcher.setImgName(user.getEmail(), extension);\r\n }else{\r\n filename = ImageDispatcher.setImgName(email, extension);\r\n }\r\n File file1 = new File(foldername,filename);\r\n try (InputStream fileContent = filePart.getInputStream()) {\r\n Files.copy(fileContent, file1.toPath());\r\n cgeUser.setImage(\"Image/AvatarImg/\" + filename);\r\n } catch (RuntimeException e) {\r\n throw e;\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n }\r\n //IMMAGINE ################################################################################\r\n\r\n //Aggiornamento dei campi nominativo, email, e password\r\n cgeUser.setEmail(email);\r\n cgeUser.setNominativo(nominativo);\r\n cgeUser.setPassword(password);\r\n cgeUser.setSendEmail(send);\r\n \r\n try {\r\n User finaluser = userdao.changeUser(cgeUser, user);\r\n if (finaluser != null) {\r\n updateResult = true;\r\n session.setAttribute(\"user\", finaluser);\r\n session.setAttribute(\"updateResult\", updateResult);\r\n }\r\n } catch (DAOException ex) {\r\n Logger.getLogger(updateUser.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n\r\n //Redirect\r\n if (session.getAttribute(\"user\") != null) {\r\n url = \"/Lists/profile.jsp\";\r\n } else {\r\n url = \"homepage.jsp\";\r\n out.println(\"Errore di tipo utente\");\r\n }\r\n\r\n response.sendRedirect(url);\r\n\r\n }", "public void postPhoto() throws InterruptedException, IOException, AWTException{\n\t\tString filepath= getTargetFilePath(\"PhotoToUpload\", \"Image\", \"jpeg\");\n\t\tSystem.out.println(\"File path is:\"+ filepath);\n\t\t\n\t\tclick(profileIcon);\n\t\tThread.sleep(1000);\n\t\tclick(PhotoTab);\n\t\tThread.sleep(1000);\n\t\tdriver.findElement(PhotoUpload).sendKeys(filepath);\n\t\tclick(PostBttn);\n\t}", "@RequestMapping(value = {\"/edit-user-{id}\"}, method = RequestMethod.POST)\r\n public String updateUser(@Valid FileBucket fileBucket, BindingResult result,\r\n ModelMap model, @PathVariable String id, HttpServletRequest req) {\r\n\r\n MultipartFile[] files = fileBucket.getFiles();\r\n String originalImgPath = \"\";\r\n String resizedImgPath = \"\";\r\n //String serverFileName = \"\";\r\n String photoName = \"\";\r\n String itemViewName = \"\";\r\n String imgLocation = \"\";\r\n int width = 580;\r\n int height = 450;\r\n boolean saved = false;\r\n String serverFileName = \"\";\r\n\r\n FileBucket fb = new FileBucket();\r\n User user = new User();\r\n if (result.hasErrors()) {\r\n return \"registration\";\r\n }\r\n if (files != null && files.length > 0) {\r\n for (int i = 0; i < files.length; i++) {\r\n try {\r\n\r\n byte[] bytes = null;\r\n // Creating the directory to store file\r\n String rootPath = System.getProperty(\"catalina.home\");\r\n File dir = new File(rootPath + File.separator + \"tmpFiles\");\r\n if (!dir.exists()) {\r\n dir.mkdirs();\r\n }\r\n\r\n FilenameUtils fileUTIL = new FilenameUtils();\r\n\r\n String path = req.getServletContext().getRealPath(\"/image\");\r\n //String ext = fileUTIL.getExtension(file.getOriginalFilename());\r\n //String baseName = fileUTIL.getBaseName(file.getOriginalFilename());\r\n\r\n imgLocation = dir + File.separator;\r\n // get files name in the array\r\n if (i == 0) {\r\n photoName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + photoName;\r\n System.out.println(\"photoName:: \" + photoName);\r\n } else if (i == 1) {\r\n itemViewName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + itemViewName;\r\n System.out.println(\"itemViewName:: \" + itemViewName);\r\n }\r\n\r\n System.out.println(\"serverFileName :: \" + serverFileName);\r\n\r\n // resize image\r\n //utility.resize(originalImgPath, resizedImgPath, width, height);\r\n //create the file on server\r\n File serverFile = new File(serverFileName);\r\n BufferedOutputStream stream = new BufferedOutputStream(\r\n new FileOutputStream(serverFile));\r\n stream.write(bytes);\r\n stream.close();\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n\r\n System.out.println(\"fileBucket.getPhoneNumber() ::\" + fileBucket.getPhoneNumber());\r\n user.setId(fileBucket.getId());\r\n user.setFirstName(fileBucket.getFirstName());\r\n user.setLastName(fileBucket.getLastName());\r\n user.setPhoneNumber(fileBucket.getPhoneNumber());\r\n user.setItemView(fileBucket.getItemView());\r\n user.setAddress(fileBucket.getAddress());\r\n user.setPassportPhotograph(photoName);\r\n user.setImgLocation(imgLocation);\r\n user.setImgName(photoName);\r\n user.setImgItemName(itemViewName);\r\n\r\n saved = userService.updateUser(user);\r\n\r\n } else {\r\n System.out.println(\"File is empty / No image uploaded\");\r\n }\r\n\r\n //model.addAttribute(\"user\", user);\r\n model.addAttribute(\"user\", fb);\r\n // model.addAttribute(\"success\", \"User \" + user.getFirstName() + \" \" + user.getLastName() + \" saved successfully\");\r\n // model.addAttribute(\"saved\", saved);\r\n\r\n //return \"adduser\";\r\n \r\n return \"redirect:/register\";\r\n }", "public String uploadPhoto(String path) {\n return uploadPhoto(path, null);\n }", "@Override\n\tpublic String saveUserImage(MultipartFile multipartFile, Long userImageId) {\n\t\t\n\t\ttry {\t\n\t\t\tFiles.deleteIfExists(Paths.get(Constants.USER_FOLDER + \"/\" + userImageId + \".png\"));\n\t\t\tInputStream reso = multipartFile.getInputStream();\n\t\t\tString path = (Constants.USER_FOLDER + userImageId + \".png\");\n\t\t\tnew UpDownServiceImpl().upload(reso, path);\n\t\t\t\n\t\t\t//resize profile image to reduce bandwitdh\n\n\t\t\t/*\n\t\t\t * InputStream input = multipartFile.getInputStream(); BufferedImage image =\n\t\t\t * ImageIO.read(input); BufferedImage resized = (resize(image,100,100)); File\n\t\t\t * output = new File(Constants.USER_FOLDER + \"/\" + userImageId +\n\t\t\t * \"_resized.png\"); ByteArrayOutputStream resi = new ByteArrayOutputStream();\n\t\t\t * ImageIO.write(resized, \"png\", resi);\n\t\t\t * \n\t\t\t * InputStream target = ByteArrayOutputStream(resi.toByteArray());\n\t\t\t */\n\t\t\t\n\t\t\treturn \"User picture saved to server\";\n\t\t} catch (IOException e) {\n\t\t\treturn \"User picture Saved\";\n\t\t}\n\t}", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n String savePath = request.getServletContext().getRealPath(\"/\") + \"images\";\n File fileSaveDir=new File(savePath);\n if(!fileSaveDir.exists()){\n fileSaveDir.mkdir();\n }\n\n \n Part imagePart = request.getPart(\"photo\");\n String fileName = extractFileName(imagePart);\n String fileLocalPath = File.separator + fileName;\n imagePart.write(savePath + fileLocalPath);\n String description = request.getParameter(\"description\");\n \n Conexion c=new Conexion();\n Connection con=c.getConexion();\n CallableStatement cs = null;\n \n try{\n String query = \"call sp_pv_insertPost(?,?,1)\";\n cs = con.prepareCall(query);\n cs.setString(1, fileLocalPath);\n cs.setString(2, description);\n cs.execute(); \n }catch(SQLException e){\n e.printStackTrace();\n }finally{\n BDUtil.cerrarStatement(cs);\n c.cerrarConexion();\n }\n \n response.setContentType(\"text/plain\"); \n response.setCharacterEncoding(\"UTF-8\");\n response.getWriter().write(\"success\"); \n \n }", "private void fileUpload(HttpServletRequest request, HttpServletResponse response) {\n\t \ttry {\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * String appPath = request.getServletContext().getRealPath(\"\");\r\n\t\t\t\t\t * System.out.println(appPath); String savePath = appPath + File.separator +\r\n\t\t\t\t\t * SAVE_DIR; System.out.println(savePath);\r\n\t\t\t\t\t */\r\n\t \t\t\r\n\t \t\t//String appPath = getServletContext().getRealPath(SAVE_DIR);\r\n\t \t\tSystem.out.println(appPath);\r\n\t \t\t String savePath = appPath + \"//\" +SAVE_DIR; \r\n\t \t\t System.out.println(savePath);\r\n\t\t\t\t\t\tCollection<Part>cp= request.getParts();\r\n\t \t String fileName = up.fileUpload(cp,appPath);\r\n\t \t System.out.println(fileName);\r\n\t \t \r\n\t \t request.setAttribute(\"message\", \"The file \"+fileName+\" has been uploaded successfully!\");\r\n\t \t RequestDispatcher dispatcher = request.getRequestDispatcher(\"success.jsp\");\r\n\t \t dispatcher.forward(request, response);\r\n\t}catch(Exception ex) {\r\n System.out.println(ex);\r\n }\r\n\t }", "@POST\r\n\t@Path(\"/publishimage\")\r\n\t@Consumes({ MediaType.MULTIPART_FORM_DATA })\r\n\tpublic Response uploadImageFile(@FormDataParam(\"file\") InputStream fileInputStream,\r\n\t\t\t@FormDataParam(\"file\") FormDataContentDisposition fileMetaData) throws Exception {\r\n\t\tString TEMP_PATH_ON_MAC = \"/tmp\";\r\n\t\twriteFileToServer(fileInputStream, fileMetaData, TEMP_PATH_ON_MAC);\r\n\t\treturn Response.ok().build();\r\n\t}", "@Override\n\tpublic void updateAvatar(CommonsMultipartFile fileUpload, String username) throws IOException {\n\t\tString savePath = imageConfiguration.getAvatarPackage(username);\n\t\tif (imageRepository.findImageNameByUsername(username) != null) {\n\t\t\tfileUpload.transferTo(new File(savePath));\n\t\t} else {\n\t\t\tUser user = findOne(username);\n\t\t\tImage image = new Image();\n\t\t\timage.setUser(user);\n\t\t\timage.setImageName(user.getUsername());\n\t\t\timage.setImageLocation(savePath);\n\t\t\timageService.create(image);\n\t\t\tfileUpload.transferTo(new File(savePath));\n\t\t}\n\t}", "@Test\n public void uploadTest() throws ApiException {\n String path = null;\n Integer devid = null;\n File file = null;\n api.upload(path, devid, file);\n\n // TODO: test validations\n }", "public void uploadTemp(FileUploadEvent event) {\n setFileImage(event.getFile());\n getSelected().setUrlImage(event.getFile().getFileName());\n RequestContext.getCurrentInstance().update(\"image\");\n\n }", "@RequestMapping(value = \"/upload\", method = RequestMethod.POST)\n // defining the upload\n public String uploadFile(@RequestParam(\"title\") String title,\n @RequestParam(\"description\") String description,\n @RequestParam(\"file\") MultipartFile file,\n @RequestParam(\"tags\") String tags,\n HttpSession session) throws IOException {\n\n User currUser = (User) session.getAttribute(\"currUser\");\n\n if(currUser == null ){\n return \"redirect:/\";\n }\n\n else {\n List<Tag> imageTags = findOrCreateTags(tags);\n // creating an id of the image\n Long imageId = createId();\n // uploading the image and converting it to a base64 encoded version of the image\n String uploadedImageData = convertUploadedFileToBase64(file);\n Image newImage = new Image(imageId, title, description, uploadedImageData, currUser, imageTags);\n // storing the new image\n imageService.save(newImage);\n // after upload is successful, redirect the user to the home page\n return \"redirect:/home\";\n }\n }", "private void saveFile(InputStream uploadedInputStream,\r\n String serverLocation) {\r\n \r\n try {\r\n OutputStream outpuStream = new FileOutputStream(new File(serverLocation));\r\n int read = 0;\r\n byte[] bytes = new byte[1024];\r\n \r\n outpuStream = new FileOutputStream(new File(serverLocation));\r\n while ((read = uploadedInputStream.read(bytes)) != -1) {\r\n outpuStream.write(bytes, 0, read);\r\n }\r\n outpuStream.flush();\r\n outpuStream.close();\r\n } catch (IOException e) {\r\n \r\n e.printStackTrace();\r\n }\r\n \r\n }", "public void moveFile(String url) throws IOException {\n\n\t\tSystem.out.println(\"folder_temp : \" + folder_temp);\n\t\tPath Source = Paths.get(folder_temp + url);\n\t\tPath Destination = Paths.get(folder_photo + url);\n\t\tSystem.out.println(\"folder_photo : \" + folder_photo);\n\n\t\tif (Files.exists(Source)) {\n\t\t\t// Files.move(Source, Destination,\n\t\t\t// StandardCopyOption.REPLACE_EXISTING);\n\t\t\t// cpie du fichiet au lieu de deplaacer car il est enn coiurs\n\t\t\t// d'utilisation\n\t\t\tFiles.copy(Source, Destination, StandardCopyOption.REPLACE_EXISTING);\n\t\t}\n\n\t}", "private void saveAndUpload(String name, String email, Uri photoUri){\n\n // TODO implement save to local DB\n // TODO implement safe upload to Server\n }", "@RequestMapping(value=\"/uploadBandsLogo/{bandsId}\", method=RequestMethod.POST)\n public @ResponseBody String uploadBandsLogo(@RequestParam(\"file\") MultipartFile file, @PathVariable String bandsId){\n String name = file.getOriginalFilename();\n if (!file.isEmpty()) {\n try {\n File dir = new File(\"uploads/bandsLogo/\"+bandsId);\n dir.mkdir();\n byte[] bytes = file.getBytes();\n BufferedOutputStream stream =\n new BufferedOutputStream(new FileOutputStream(new File(\"uploads/bandsLogo/\"+ bandsId + \"/\" + bandsId + \".png\" )));\n stream.write(bytes);\n stream.close();\n return \"You successfully uploaded \" + name + \" into \" + name + \"-uploaded !\";\n } catch (Exception e) {\n return \"You failed to upload \" + name + \" => \" + e.getMessage();\n }\n } else {\n return \"You failed to upload \" + name + \" because the file was empty.\";\n }\n }", "public void uploadFile(String path, String foldername)\n {\n try {\n InputStream in = new FileInputStream(path);\n FileMetadata metadata = client.files().uploadBuilder(foldername).uploadAndFinish(in);\n }\n catch (FileNotFoundException fne)\n {\n System.out.println(\"96 : FileNotFoundException Caused By \"+fne.getLocalizedMessage());\n }\n catch (IOException ioe)\n {\n System.out.println(\"100 : IOException Caused By \"+ioe.getLocalizedMessage());\n }\n catch (DbxException dbxe)\n {\n \n System.out.println(\"105 : DbxException Caused By \"+dbxe.getLocalizedMessage());\n }\n }", "public interface ImageUpload {\n void imageUploadToServer(int selectedImageResourceId);\n}", "void savePicturePath(String userName, String picturePath) throws DatabaseException;", "public void saveFile(Bitmap imageToSave, String folder) {\n File folderName = new File(Environment.\n getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), folder);\n\n if (!folderName.exists()) {\n Log.i(TAG, \"Folder doesn't exist, creating it...\");\n boolean rv = folderName.mkdir();\n Log.i(TAG, \"Folder creation \" + (rv ? \"success\" : \"failed\"));\n } else {\n Log.i(TAG, \"Folder already exists.\");\n }\n\n String captured = Global.currUser.email + \"Deja_\" + Global.imageNumber + \".jpg\";\n Global.imageNumber++;\n\n File file = new File(folderName, captured);\n\n try {\n FileOutputStream out = new FileOutputStream(file);\n imageToSave.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n\n Global.uploadImageQueue.add(file.getAbsolutePath());\n Log.d(TAG, \"filePath added: \" + file.getAbsolutePath());\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n scanSD(file);\n\n Log.d(TAG, \"+++++++\");\n }", "public static void uploadImage(String fileName) {\n EntityCreationPage.generalPanel.uploadPanel().sendKeys(System.getProperty(\"user.dir\") + \"/src/test/testData/\" + fileName);\n try {\n wait.until(ExpectedConditions.invisibilityOf(EntityCreationPage.uploadingMessage()));\n } catch (WebDriverException ignored) {\n }\n }", "public void upload(FileUploadEvent event){\n UploadedFile file = event.getFile();\n if(file != null){\n try {\n imagePic = new OracleSerialBlob(file.getContents());\n Long size = imagePic.length();\n putProfPic(imagePic);\n //setPhoto_profile(new ByteArrayContent(imagePic.getBytes(1, size.intValue())));\n } catch (SQLException ex) {\n LOG.error(ex);\n GBMessage.putErrorMessage(\"Error al subir el archivo\");\n } catch (IOException ex) {\n Logger.getLogger(StaffBean.class.getName()).log(Level.SEVERE, null, ex);\n }\n GBMessage.putInfoMessage(\"Carga correcta\");\n }\n }", "public void testPhotoUpload() throws Exception {\n LoginRequestTest.registerUser(\n getContext(),\n \"Tom\",\n LoginRequestTest.getUniqueEmail(),\n \"12345678\"\n );\n\n Place place = new Place();\n place.setId(6);\n\n //region Save picture\n Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.upload_image);\n File tempFile = null;\n try {\n tempFile = File.createTempFile(\"UPLOAD_TEST\", \".jpg\", getContext().getCacheDir());\n FileOutputStream out = new FileOutputStream(tempFile);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.close();\n } catch (IOException e) {\n Log.e(TAG, \"Image file could not be written.\", e);\n }\n //endregion\n\n assertNotNull(\"Temp file is null!\", tempFile);\n PhotoUploadRequest request = new PhotoUploadRequest(getContext(), place, tempFile);\n ResponseEntity<Picture> pictureResponseEntity = request.sendRequest();\n assertNotNull(\"No response entity received\", pictureResponseEntity);\n Picture picture = pictureResponseEntity.getBody();\n assertNotNull(\"Response entity has empty body\", picture);\n }", "private Path initFolder(String folder) throws IOException {\n return Files.createDirectory(Paths.get(uploadFolder + \"/\" + folder));\n }", "public String guardarImgPost(){\n \n File archivo=null;//Objeto para el manejo de os archivos\n InputStream in =null;//Objeto para el manejo del stream de datos del archivo\n //Se obtiene el codigo de usuario de la sesion actual\n String codUsuario=codUsuario=String.valueOf(new SessionLogica().obtenerUsuarioSession().getCodUsuario());\n //Se obtiene un codigo producto de la combinacion del codigo del usuario y de un numero aleatorio\n String codGenerado=new Utiles().generar(codUsuario);\n String extension=\"\";\n int i=0;\n //Extension del archivo ha subir\n extension=\".\"+FilenameUtils.getExtension(this.getObjImagen().getImagen().getFileName());\n \n \n try {\n //Pasa el buffer de datos en un array de bytes , finalmente lee cada uno de los bytes\n in=this.getObjImagen().getImagen().getInputstream();\n byte[] data=new byte[in.available()];\n in.read(data);\n \n //Crea un archivo en la ruta de publicacion\n archivo=new File(this.rutaImgPublicacion+codGenerado+extension);\n FileOutputStream out=new FileOutputStream(archivo);\n //Escribe los datos en el nuevo archivo creado\n out.write(data);\n \n System.out.println(\"Ruta de Path Absolute\");\n System.out.println(archivo.getAbsolutePath());\n \n //Cierra todas las conexiones\n in.close();\n out.flush();\n out.close();\n } catch (IOException ex) {\n System.out.println(ex.getMessage());\n return \"none.jpg\";\n }\n //Retorna el nombre de la iamgen almacenada\n return codGenerado+extension;\n }", "public void store_image(Images image) {\n\t\tir.save(image);\n\t}", "@RequestMapping(value = \"/marcas/images\", method = RequestMethod.POST, headers = (\"content-type=multipart/form-data\"))\n\tpublic ResponseEntity<byte[]> uploadImage(@RequestParam(\"id_marca\") Long idMarca,\n\t\t\t@RequestParam(\"file\") MultipartFile multipartFile, UriComponentsBuilder componentsBuilder) {\n\t\tif (idMarca == null) {\n\t\t\treturn new ResponseEntity(new CustomErrorType(\"IdMarca is required\"), HttpStatus.CONFLICT);\n\t\t}\n\t\tif (multipartFile.isEmpty()) {\n\t\t\treturn new ResponseEntity(new CustomErrorType(\"Please select a file to upload\"), HttpStatus.CONFLICT);\n\t\t}\n\t\tMarca marca = _marcaService.findById(idMarca);\n\t\tif (marca == null) {\n\t\t\treturn new ResponseEntity(new CustomErrorType(\"Marca con idMarca: \" + idMarca + \" not found\"),\n\t\t\t\t\tHttpStatus.CONFLICT);\n\t\t}\n\t\t/*\n\t\t * if (!marca.getLogo().isEmpty() || marca.getLogo() !=null ) {\n\t\t * //implementar metodos version final String filename =\n\t\t * marca.getLogo(); Path path = Path.get(filename); File f =\n\t\t * path.toFile(); if (f.exists()) { f.delete(); } }\n\t\t */\n\t\ttry {\n\t\t\tDate date = new Date();\n\t\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd-HH-mm-ss\");\n\t\t\tString dateName = dateFormat.format(date);\n\n\t\t\tString fileName = String.valueOf(idMarca) + \"-pictureMarca-\" + dateName + \".\"\n\t\t\t\t\t+ multipartFile.getContentType().split(\"/\")[1];\n\t\t\t// marca.setLogo(MARCA_UPLOADED_FOLDER + fileName); //implementar\n\t\t\t// metodos version final\n\t\t\tbyte[] bytes = multipartFile.getBytes();\n\t\t\tPath path = Paths.get(MARCA_UPLOADED_FOLDER + fileName);\n\t\t\tFiles.write(path, bytes);\n\n\t\t\t_marcaService.updateMarca(marca);\n\t\t\treturn ResponseEntity.ok().contentType(MediaType.IMAGE_JPEG).body(bytes);\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\te.printStackTrace();\n\t\t\treturn new ResponseEntity(\n\t\t\t\t\tnew CustomErrorType(\"Error during upload: \" + multipartFile.getOriginalFilename()),\n\t\t\t\t\tHttpStatus.CONFLICT);\n\t\t}\n\n\t}", "@PostMapping(\"/tasks/{id}/images\")\n public RedirectView addImages(@PathVariable UUID id, @RequestParam(value=\"file\")MultipartFile file){\n Task selectedTask = taskRepository.findById(id).get();\n List<String> pic = this.s3Client.uploadFile(file);\n //saving images and thumbImg\n selectedTask.setImages(pic.get(0));\n selectedTask.setThumbImg(pic.get(1));\n\n taskRepository.save(selectedTask);\n return new RedirectView(\"http://taskmaster1.s3-website-us-west-2.amazonaws.com/\");\n }", "public static String uploadPhoto(BufferedImage image) throws IOException {\n if (image == null) {\n throw new IOException(\"image was null\", new NullPointerException());\n }\n String publicLinkToPhoto = null;\n synchronized (singleton) {\n if (singleton.photoService == null) {\n throw new IOException(\"Could not authenticate with Picassa\");\n }\n\n singleton.baos.reset();\n ImageIO.write(image, \"png\", singleton.baos);\n MediaByteArraySource myMedia = new MediaByteArraySource(singleton.baos.toByteArray(), \"image/png\");\n\n PhotoEntry returnedPhoto;\n try {\n returnedPhoto = singleton.photoService.insert(singleton.pdfAlbumUrl, PhotoEntry.class, myMedia);\n } catch (ServiceException e) {\n e.printStackTrace();\n throw new IOException(\"Problem uploading photo\", e);\n }\n\n publicLinkToPhoto = returnedPhoto.getMediaThumbnails().get(0).getUrl();\n\n // scale it up to 800 px, which is the largest we can hotlink to\n publicLinkToPhoto = publicLinkToPhoto.replace(\"/s72/\", \"/s800/\").replace(\"/s144/\", \"/s800/\").replace(\"/s288/\", \"/s800/\");\n }\n return publicLinkToPhoto;\n }", "private String saveNewPhoto(byte[] photo,String sufix){\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\" + sufix + \".jpg\";\n \n \n File potlachBase = new File(\"src/main/webapp/photos\"); //Shit made\n potlachBase.mkdirs();\n\n File potlachImage = new File(potlachBase,imageFileName);\n\n\n OutputStream out = null;\n try {\n potlachImage.createNewFile();\n InputStream in = new ByteArrayInputStream(photo);\n out = new FileOutputStream(potlachImage);\n\n // Transfer bytes from in to out\n byte[] buf = new byte[1024];\n int len;\n while ((len = in.read(buf)) > 0) {\n out.write(buf, 0, len);\n }\n in.close();\n out.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return \"/photos/\"+imageFileName;\n\n\n\n\n }", "@PostMapping(path = \"/pictures\")\r\n public PictureResponse upload(@RequestHeader(\"api-key-token\") String key,\r\n @RequestParam(\"file\") MultipartFile file) {\r\n\r\n // TODO: move this to common location\r\n Authentication authentication = authenticationRepository.findByToken(key);\r\n User user = userRepository.findById(authentication.getUserId())\r\n .orElseThrow(\r\n () -> new IllegalArgumentException(\"User not found\"));\r\n\r\n return service.upload(file, user);\r\n }", "@PreAuthorize(\"hasAnyRole('ROLE_ADMIN','ROLE_CONTRIBUTOR')\")\r\n\t@CrossOrigin(origins=\"http://localhost:4200\")\r\n\t@RequestMapping(value=\"/image/upload/{idMangas:[0-9]+}\", method=RequestMethod.POST, produces=MediaType.APPLICATION_JSON_VALUE)\r\n\t@ResponseBody\r\n\tpublic Manga upload(@RequestParam(\"file\") MultipartFile file, @PathVariable(\"idMangas\") int idMangas){\n\t\tlog.info(\"File name: \" + file.getOriginalFilename());\r\n\t\tlog.info(\"File name: \" + file.getContentType());\r\n\t\t\r\n\t\ttry {\r\n\t\t\tImage img = new Image(0, file.getOriginalFilename(), file.getSize(), file.getContentType(), \"\", \"\");\r\n\t\t\timageDao.saveImageFile(img, file.getInputStream());\r\n\t\t\t// on save ensuite en bdd l image\r\n\t\t\timageDao.save(img);\r\n\t\t\t// puis on lie limage a mongas recup ds lurl\r\n\t\t\tManga m = mangasDao.findOne(idMangas);\r\n\t\t\tm.setImg(img);\r\n\t\t\treturn mangasDao.save(m);\r\n\t\t\t// return m;\r\n\t\t\t\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\tthrow new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, \"erreur lors de la sauvegarde\");\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {\r\n\r\n\t\tLOGGER.info(\"Upload action\");\r\n\t\tString description = request.getParameter(\"description\"); // Retrieves <input type=\"text\" name=\"description\">\r\n\t\tPart filePart = request.getPart(\"file\"); // Retrieves <input type=\"file\" name=\"file\">\r\n\t\tString fileName = Paths.get(filePart.getSubmittedFileName()).getFileName().toString(); // MSIE fix.\r\n\r\n\t\tHttpSession session = request.getSession();\r\n\t\tServletContext context = session.getServletContext();\r\n\t\tDAOFactory dao = (DAOFactory) context.getAttribute(\"DAOManager\");\r\n\t\tfinal String path = context.getRealPath(\"/images\");\r\n\t\tif (!description.equals(\"\")) {\r\n\t\t\tfileName = description;\r\n\t\t}\r\n\t\tString url = \"images/\" + fileName;\r\n\t\ttry (OutputStream outStream = new FileOutputStream(new File(path + File.separator + fileName));\r\n\t\t\t\tInputStream filecontent = filePart.getInputStream()) {\r\n\t\t\tint read = 0;\r\n\t\t\tfinal byte[] bytes = new byte[1024];\r\n\r\n\t\t\twhile ((read = filecontent.read(bytes)) != -1) {\r\n\t\t\t\toutStream.write(bytes, 0, read);\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tLOGGER.error(e.getMessage());\r\n\t\t\tsession.setAttribute(\"updateCarError\", \"Attempt to upload image failed.\");\r\n\t\t\treturn \"/frontController/cars\";\r\n\t\t}\r\n\t\tLOGGER.info(\"File uploaded successfully\");\r\n\r\n\t\tString id = request.getParameter(\"id\");\r\n\r\n\t\tCarService carService = new CarService(dao);\r\n\t\tCar car = carService.getCarById(Integer.parseInt(id));\r\n\t\tcar.setPhoto(url);\r\n\t\tInteger row = carService.updateCarPhoto(car);\r\n\t\tif (row == 1) {\r\n\t\t\tsession.setAttribute(\"UpdateCar\", \"You have successfully uploaded image.\");\r\n\t\t} else {\r\n\t\t\tsession.setAttribute(\"updateCarError\", \"Attempt to upload image failed.\");\r\n\t\t}\r\n\t\treturn \"/frontController/cars\";\r\n\t}", "private Integer uploadURL(URL url) {\n \t\ttry {\n \t\t\tString contentType = url.openConnection().getContentType();\n \t\t\tif (contentType == null || !contentType.startsWith(\"image/\")) {\n \t\t\t\treturn null;\n \t\t\t}\n \n \t\t\tString name = url.getPath().substring(1);\n \t\t\tif (contentType.contains(\"png\")) {\n \t\t\t\tname += \".png\";\n \t\t\t} else if (contentType.contains(\"jpg\")\n \t\t\t\t\t|| contentType.contains(\"jpeg\")) {\n \t\t\t\tname += \".jpg\";\n \t\t\t} else if (contentType.contains(\"gif\")) {\n \t\t\t\tname += \".gif\";\n \t\t\t}\n \n\t\t\treturn apiFactory.getFileAPI().uploadImage(url, name);\n \t\t} catch (IOException e) {\n \t\t\te.printStackTrace();\n \n \t\t\treturn null;\n \t\t}\n \t}", "public void upload(View view) {\n new Thread() {\n @Override\n public void run() {\n String url = \"http://124.71.115.4/FlyMonitor/servlet/upload\";\n// String filename = \"evo.jpg\";\n String filename = \"tonghuazhen.mp3\";\n // external=/storage/emulated/0\n String path = \"/mnt/sdcard/\" + filename;\n try {\n HttpEngine.upload(url, path, filename);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }.start();\n\n }", "@Override\n public boolean transferFile (MultipartFile file, String tag, String resultFilename) {\n try {\n file.transferTo(new File(Constans.UPLOADPATH + \"/\" + tag + \"/\" + resultFilename));\n }catch (IOException e){\n e.printStackTrace();\n return false;\n }\n return true;\n }", "public void createRecipeImage(FileUploadEvent event) {\r\n Image newImage = new Image();\r\n String destination = FacesContext.getCurrentInstance().getExternalContext().getRealPath(\"/\");\r\n String getParam = qm.get(\"recipeId\");\r\n Integer recipeID = Integer.parseInt(getParam);\r\n this.recipe = recipesEJB.findRecipe(recipeID);\r\n File file = new File(destination+\"uploads\"+File.separator+\"recipe\"+File.separator+recipeID);\r\n String abspath = file.getAbsolutePath()+ File.separator;\r\n if(!file.exists()){\r\n if(file.mkdirs());\r\n }\r\n //new name of the image\r\n List <Image> recipeImages = this.recipe.getImageGallery();\r\n Integer count = recipeImages.size();\r\n\r\n if(this.recipe.getImageGallery().get(0).getImagePath().equalsIgnoreCase(\"/resources/images/recipe_placeholder.png\") && count == 1){\r\n imageEJB.removeImage(this.recipe.getImageGallery().get(0));\r\n this.recipe.getImageGallery().remove(0);\r\n }else {\r\n count++;\r\n }\r\n String newImageName;\r\n if (event.getFile().getContentType().equalsIgnoreCase(\"image/jpeg\")) {\r\n newImageName = count + \".jpeg\";\r\n } else if (event.getFile().getContentType().equalsIgnoreCase(\"image/gif\")) {\r\n newImageName = count + \".gif\";\r\n } else {\r\n newImageName = count + \".png\";\r\n }\r\n // Do what you want with the file \r\n String newImagePath = \"/uploads/recipe/\"+recipeID+\"/\"+newImageName;\r\n try {\r\n copyFile(abspath,newImageName, event.getFile().getInputstream()); \r\n newImage = this.imageEJB.createImage(newImage);\r\n newImage.setCaption(\"This is the \"+this.recipe.getRecipeName()+\"'s recipe picture.\");\r\n newImage.setDescription(newImageName);\r\n newImage.setRecipe(this.recipe);\r\n newImage.setImagePath(newImagePath);\r\n newImage.setImageName(newImageName);\r\n newImage = this.imageEJB.editImage(newImage);\r\n this.recipe.getImageGallery().add(newImage);\r\n this.recipe = recipesEJB.editRecipe(recipe);\r\n FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Success!\", \"Your image was uploaded successfully.\"));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "public void copyImageFile() throws IOException {\n Path sourcePath = imageFile.toPath();\n\n String selectFileName = imageFile.getName();\n\n Path targetPath = Paths.get(\"/Users/houumeume/IdeaProjects/Assignment2/image/\" + selectFileName);\n\n //copy the file to the new directory\n Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);\n\n //update the imageFile to point to the new File\n imageFile = new File(targetPath.toString());\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n\nthrows ServletException, IOException {\n\nresponse.setContentType(\"text/html;charset=UTF-8\");\n\ntry (PrintWriter out = response.getWriter()) {\n\n// this tyr is created by me for the connection of database\n\ntry {\n\n// this is the path provide by me to save the image\n\nString savePath = \"C:\\\\Users\\\\Ratnesh Pandey\\\\eclipse-workspace\\\\kw\\\\WebContent\\\\images\" + File.separator + SAVE_DIR;\n\n/*in place of C: you can place a path where you need to save the image*/\n\n// this comment will pickup the image file and have convert it into file type\n\nFile fileSaveDir = new File(savePath);\n\nif (!fileSaveDir.exists()) {\n\nfileSaveDir.mkdir();\n\n}\n\n// this two comment will take the name and image form web page\n\nString userid= request.getParameter(\"userid\");\nString Heading= request.getParameter(\"Heading\");\nString content = request.getParameter(\"content\");\nPart part = request.getPart(\"file\");\n\n// this comment will extract the file name of image\n\nString fileName = extractFileName(part);\n\n// this will print the image name and user provide name\n\n/*out.println(fileName);\n\nout.println(\"\\n\" + userid);*/\n\n/*if you may have more than one files with same name then you can calculate\n\nsome random characters and append that characters in fileName so that it will\n\nmake your each image name identical.*/\n\npart.write(savePath + File.separator + fileName);\n\n/*\n\nYou need this loop if you submitted more than one file\n\nfor (Part part : request.getParts()) {\n\nString fileName = extractFileName(part);\n\npart.write(savePath + File.separator + fileName);\n\n}*/\n\n// connection to database\n\nClass.forName(\"com.mysql.jdbc.Driver\");\n\nConnection con = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/users\", \"root\", \"speedoflightis3x108\");\n\n// query to insert name and image name\n\nString query = \"INSERT INTO users.contribution(userid,Heading,content,photourl) values (?, ?, ?, ?)\";\n\nPreparedStatement pst;\n\npst = con.prepareStatement(query);\n\npst.setString(1, userid);\npst.setString(2, Heading);\npst.setString(3, content);\n\nString filePath = savePath + File.separator + fileName;\n\npst.setString(4, filePath);\n\npst.executeUpdate();\nresponse.sendRedirect(\"Home(ak).jsp\");\n\n} catch (Exception ex) {\n\nout.println(\"error\" + ex);\n\n}\n\n}\n\n}", "public ImageSendingClient(File imageFolder, String serverAddress, int serverPort)\n\t{\n\t\tthis.imageFolder = imageFolder;\n\t\tthis.serverAddress = serverAddress;\n\t\tthis.serverPort = serverPort;\n\t}", "private static String copyImageToDesired(String pathToImage, String imageName) {\n File oldFile = new File(RhoFileApi.absolutePath(pathToImage));\n File mediafile = new File(RhoFileApi.getDbFilesPath(), imageName);\n\n if (oldFile.getAbsolutePath().equalsIgnoreCase(mediafile.getAbsolutePath())) {\n return RhoFileApi.absolutePath(pathToImage);\n }\n\n InputStream finput= null;\n FileOutputStream fout = null;\n try {\n finput= RhoFileApi.open(pathToImage);\n fout = new FileOutputStream(mediafile);\n byte[] b = new byte[1024];\n int read = 0;\n while ((read = finput.read(b)) != -1) {\n fout.write(b, 0, read);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if(finput != null){\n try {\n finput.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n if(fout != null){\n try {\n fout.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return mediafile.getAbsolutePath();\n }", "protected void doPost(HttpServletRequest request, HttpServletResponse response)\n\t throws ServletException, IOException {\n\t\t \n\t boolean isMultipart = ServletFileUpload.isMultipartContent(request);\n\t \n\t if (isMultipart) {\n\t \t// Create a factory for disk-based file items\n\t \tFileItemFactory factory = new DiskFileItemFactory();\n \n\t \t// Create a new file upload handler\n\t \tServletFileUpload upload = new ServletFileUpload(factory);\n\t \tString uploadpath=\"c:/nice/uploads\";\n\t \tFile path = new File(uploadpath);\n\t \t String fileName = \"\";\n\t try {\n\t \t// Parse the request\n\t \t/* FileItem */\n\t \tList items = upload.parseRequest(request);\n\t Iterator iterator = items.iterator();\n\t while (iterator.hasNext()) {\n\t FileItem item = (FileItem) iterator.next();\n\t if (!item.isFormField()) {\n\t fileName = item.getName();\t \n\t // String root = getServletContext().getRealPath(\"/\");\n\t // File path = new File(root + \"/uploads\");\n\t //File path = new File(\"c:/uploads\");\n\t if (!path.exists()) {\n\t \t\n\t boolean status = path.mkdirs();\n\t System.out.println(\"Status \" +status);\n\t \n\t }\n\t \n\t File uploadedFile = new File(path + \"/\" + fileName);\n\t \n\t System.out.println(uploadedFile.getAbsolutePath());\n\t item.write(uploadedFile);\n\t \n\t \n\t \n\t \n\t }\n\t }\n\t \n\t \n\t \n\t \n\t } catch (FileUploadException e) {\n\t e.printStackTrace();\n\t } catch (Exception e) {\n\t e.printStackTrace();\n\t }\n\t \n\t }\n\t \n\t \n\t String message=\"Image uploaded Sucessfully\";\n\t RequestDispatcher rd = getServletContext().getRequestDispatcher(\"/fileupload.jsp?message=\" +message);\n\t rd.forward(request, response);\n\t }", "public void uploadImage(View v) {\n // When Image is selected from Gallery\n if (imgPath != null && !imgPath.isEmpty()) {\n prgDialog.setMessage(\"Converting Image to Binary Data\");\n prgDialog.show();\n // Convert image to String using Base64\n encodeImagetoString();\n // When Image is not selected from Gallery\n } else {\n Toast.makeText(\n getApplicationContext(),\n \"You must select image from gallery before you try to upload\",\n Toast.LENGTH_LONG).show();\n }\n }", "@Override\n\tpublic void run() {\n\t\ttry {\n\t\t\tuploadCurrentImage();\n\t\t} catch (IOException | InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t//Call function from client with the Image URL\n\t}", "public void setUploadPicture(String absolutePath) throws InterruptedException {\n URL url = getClass().getClassLoader().getResource(absolutePath);\n File file = null;\n try {\n file = new File(url.toURI());\n } catch (URISyntaxException e) {\n e.printStackTrace();\n }\n getDriver().findElement(uploadPicture).sendKeys(file.getAbsolutePath());\n Times.waitFor(2000);\n }" ]
[ "0.6989364", "0.6806271", "0.6651486", "0.6580909", "0.6518106", "0.64446867", "0.6151171", "0.61338073", "0.6107572", "0.6032557", "0.59963065", "0.59941196", "0.5979538", "0.59428626", "0.59329724", "0.5932128", "0.5883253", "0.58826727", "0.5876087", "0.57764304", "0.57703024", "0.5769576", "0.57528025", "0.5747111", "0.574575", "0.5723804", "0.57019156", "0.5701795", "0.56950307", "0.56885046", "0.5663852", "0.5660613", "0.56545967", "0.5613534", "0.5600833", "0.5599351", "0.55964506", "0.5569755", "0.5568312", "0.55640376", "0.5543566", "0.5540958", "0.5537528", "0.5528807", "0.55278665", "0.55237216", "0.5519283", "0.5514116", "0.55086833", "0.5504583", "0.5499507", "0.5482118", "0.5479628", "0.54785526", "0.54777557", "0.5470189", "0.546914", "0.54668325", "0.54374176", "0.5436309", "0.5433656", "0.541492", "0.541445", "0.54101133", "0.53992355", "0.53943616", "0.5389021", "0.5382498", "0.53688085", "0.5365324", "0.53597003", "0.53509384", "0.5349329", "0.534584", "0.53400654", "0.53374845", "0.53281736", "0.5319694", "0.53148574", "0.5308249", "0.5308135", "0.52985865", "0.5289477", "0.5288547", "0.5275006", "0.52642447", "0.5259", "0.5256731", "0.5250104", "0.52466494", "0.52349037", "0.5234454", "0.5233062", "0.52329624", "0.523078", "0.5216866", "0.5216165", "0.52103424", "0.5207272", "0.5201429" ]
0.5831183
19
Upload Image To Specific Folder On Server
public static String uploadImage(Bitmap bitmap, String serverUri, String serverFolderUploads) { HttpURLConnection connection = null; DataOutputStream outputStream = null; String urlServer = serverUri; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; String charset = "UTF-8"; String videoName; byte[] buffer; try { URL url = new URL(urlServer); connection = (HttpURLConnection) url.openConnection(); // Allow Inputs & Outputs connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); videoName = UUID.randomUUID().toString() + ".mp4"; // Enable POST method connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("ENCTYPE", "multipart/form-data"); connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); outputStream = new DataOutputStream(connection.getOutputStream()); outputStream.writeBytes(twoHyphens + boundary + lineEnd); outputStream.writeBytes("Content-Disposition: form-data; name=\"" + serverFolderUploads + "\"" + "; filename=\"" + videoName + "\"" + lineEnd); outputStream.writeBytes(lineEnd); buffer = ConvertBitMapToByteArray(bitmap); try { outputStream.write(buffer, 0, (int) getSizeInBytes(bitmap)); } catch (Exception e) { e.printStackTrace(); } outputStream.writeBytes(lineEnd); outputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); // Responses from the server (code and message) int serverResponseCode = connection.getResponseCode(); String serverResponseMessage = connection.getResponseMessage(); outputStream.flush(); outputStream.close(); if (serverResponseCode == 200 && serverResponseMessage.equals("OK")) return videoName; else return ""; } catch (Exception e) { e.printStackTrace(); return ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void uploadFile(HttpServletRequest request, MultipartFile file, String code) {\n\t\tREAL_PATH = request.getSession().getServletContext().getRealPath(\"/assets/images/\");\n\t\t\n\t\tlogger.info(REAL_PATH);\n\t\t\n\t\tif (!new File(REAL_PATH).exists()) {\n\t\t\tnew File(REAL_PATH).mkdirs();\n\t\t}\n\t\tif (!new File(ABSOLUTE_PATH).exists()) {\n\t\t\tnew File(ABSOLUTE_PATH).mkdirs();\n\t\t}\n\t\t\n\t\ttry {\n\t\t\t// uploading ... project directory upload\n\t\t\tfile.transferTo(new File(ABSOLUTE_PATH + code + \".jpg\"));\n\t\t\t\n\t\t\t// uploading ... for the server\n\t\t\tfile.transferTo(new File(REAL_PATH + code + \".jpg\"));\n\t\t} catch (IOException e) {\n\t\t\t\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void uploadFile(HttpServletRequest request, MultipartFile file, String code) \r\n\t{\n\t\tREAL_PAIH=request.getSession().getServletContext().getRealPath(\"/assets/images/\");\r\n\t\t\r\n\t\tlogger.info(REAL_PAIH);\r\n\t\t\r\n\t\t//to make sure all directory exists\r\n\t\t//create new directory hmmmm\r\n\t\t\r\n\t\tif(!new File(ABS_PAIH).exists())\r\n\t\t{\r\n\t\t\t//create the directories\t\t\t\r\n\t\t\tnew File(ABS_PAIH).mkdirs();\r\n\t\t}\r\n\t\t\r\n\t\tif(!new File(REAL_PAIH).exists())\r\n\t\t{\r\n\t\t\t//create the directories\t\t\t\r\n\t\t\tnew File(REAL_PAIH).mkdirs();\r\n\t\t}\r\n\t\t\r\n\t\ttry\r\n\t\t{\r\n\t\t //server upload\r\n\t\t\tfile.transferTo(new File(REAL_PAIH + code + \".jpg\"));\r\n\t\t\t\r\n\t\t\t//project directory upload\r\n\t\t\tfile.transferTo(new File(ABS_PAIH + code + \".jpg\"));\r\n\r\n\t\t\t\r\n\t\t}catch(IOException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "void uploadingFolder(String remoteFolder);", "Path fileToUpload();", "void folderUploaded(String remoteFolder);", "private void doUpload(Part img1, String image) throws IOException{\n OutputStream out = null;\n InputStream filecontent = null;\n try {\n out = new FileOutputStream(new File(path \n + image));\n System.out.println(path \n + image);\n filecontent = img1.getInputStream();\n\n int read = 0;\n final byte[] bytes = new byte[1024];\n\n while ((read = filecontent.read(bytes)) != -1) {\n out.write(bytes, 0, read);\n }\n \n } catch (Exception fne) {\n System.out.println(\"You either did not specify a file to upload or are \"\n + \"trying to upload a file to a protected or nonexistent \"\n + \"location.\");\n fne.printStackTrace();\n\n } finally {\n if (out != null) {\n out.close();\n }\n if (filecontent != null) {\n filecontent.close();\n }\n }\n }", "void uploadingFile(String path);", "public void uploadMultipart() {\n //getting the actual path of the image\n String path = getPath(filePath);\n\n //Uploading code\n try {\n String uploadId = UUID.randomUUID().toString();\n\n //Creating a multi part request\n new MultipartUploadRequest(this, uploadId, \"todo\")\n .addFileToUpload(path, \"image\") //Adding file\n .setNotificationConfig(new UploadNotificationConfig())\n .setMaxRetries(2)\n .startUpload(); //Starting the upload\n\n } catch (Exception exc) {\n Toast.makeText(this, exc.getMessage(), Toast.LENGTH_SHORT).show();\n }\n }", "public Result uploadImage() {\n MultipartFormData<File> body = request().body().asMultipartFormData();\n MultipartFormData.FilePart<File> fileInput = body.getFile(\"inputFile\");\n if (fileInput != null) {\n File file = (File) fileInput.getFile();\n String imageUrl = S3Action.putImg(s3, file, UUID.randomUUID().toString());\n return ok(afterPutImg.render(imageUrl));\n } else {\n return badRequest(\"error\");\n }\n }", "public void crearRutaImgPublicacion(){\n \n servletContext=(ServletContext) contexto.getExternalContext().getContext();\n String ruta=\"\";\n //Ruta real hasta la carpeta uploads\n ruta=servletContext.getRealPath(\"/upload/\");\n //Obtener el codigo del usuario de la sesion actual\n //este es utilizado para ubicar la carpeta que le eprtenece\n String codUsuario=String.valueOf(new SessionLogica().obtenerUsuarioSession().getCodUsuario());\n //Concatenamiento de directorios internos\n ruta+=File.separatorChar+\"img\"+File.separatorChar+\"post\"+File.separatorChar+codUsuario+File.separatorChar+\"all\"+File.separatorChar;\n //Asignacion de la ruta creada\n this.rutaImgPublicacion=ruta;\n }", "private void uploadToServer(String filePath, String title) {\n APIClient apiClient = new APIClient();\n Retrofit retrofit = apiClient.getApiClient();\n ApiInterface apiInterface = retrofit.create(ApiInterface.class);\n File file = new File(filePath);\n\n MultipartBody.Part filePart =\n MultipartBody.Part.createFormData(\"file\", title+\".jpg\", //file.getName(),\n RequestBody.create(MediaType.parse(\"image/*\"), file));\n\n\n Call call = apiInterface.uploadImage(filePart);\n call.enqueue(new Callback() {\n @Override\n public void onResponse(Call call, Response response) {\n Toast.makeText(AddPost.this, \"Worked\",Toast.LENGTH_SHORT).show();\n }\n @Override\n public void onFailure(Call call, Throwable t) {\n t.printStackTrace();\n Toast.makeText(AddPost.this, \"Didn't work\",Toast.LENGTH_SHORT).show();\n }\n });\n }", "IbeisImage uploadImage(File image) throws UnsupportedImageFileTypeException, IOException, MalformedHttpRequestException,\n UnsuccessfulHttpRequestException;", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n int geekid = Integer.parseInt(request.getParameter(\"geekid\"));\n if (ServletFileUpload.isMultipartContent(request)) {\n try {\n\n List<FileItem> multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);\n\n for (FileItem item : multiparts) {\n\n if (!item.isFormField()) {\n item.write(new File(UPLOAD_DIRECTORY + File.separator + \"image\" + geekid + \".jpg\"));\n\n }\n \n String fileName = UPLOAD_DIRECTORY + File.separator + \"image\" + geekid + \".jpg\";\n\n }\n\n //File uploaded successfully\n request.setAttribute(\"message\", \"File Uploaded Successfully\");\n\n } catch (Exception ex) {\n\n request.setAttribute(\"message\", \"File Upload Failed due to \" + ex);\n\n }\n\n } else {\n\n request.setAttribute(\"message\",\n \"Sorry this Servlet only handles file upload request\");\n\n }\n\n request.getRequestDispatcher(\"/result.jsp\").forward(request, response);\n\n }", "public void uploadFile() {\n \n InputStream input = null;\n try {\n input = file.getInputStream();\n System.out.println(\"chay qua inpustream\");\n String itemName = file.getSubmittedFileName();\n String filename = itemName.substring(\n itemName.lastIndexOf(\"\\\\\") + 1);\n String dirPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(\"/upload/images\");\n fileNamed = \"/upload/images/\"+filename;\n File f = new File(dirPath + \"\\\\\" + filename);\n if (!f.exists()) {\n f.createNewFile();\n }\n FileOutputStream output = new FileOutputStream(f);\n byte[] buffer = new byte[1024];\n int length;\n while ((length = input.read(buffer)) > 0) {\n output.write(buffer, 0, length);\n }\n // resize(dirPath + \"\\\\\" + filename, dirPath + \"\\\\\" + filename, 200, 200);\n input.close();\n output.close();\n } catch (IOException ex) {\n System.out.println(\"loi io\");\n Logger.getLogger(ArtistsManagedBean.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n }", "@EventListener(ApplicationReadyEvent.class)\n private void createImageDirectory()\n {\n new File(productImageUpload).mkdir();\n }", "public void saveImage(MultipartFile imageFile) throws IOException {\n\t\tlogger.info(\"ComicDetail ID is \"+imageFile.getOriginalFilename());\r\n\t\tString folder=\"/images/comiccover\";\r\n\t\tbyte[] bytes = imageFile.getBytes();\r\n\t\tlogger.info(\"ComicDetail ID is \"+imageFile.getOriginalFilename());\r\n\t\t//Path path = Paths.get(folder+imageFile.getOriginalFilename());\r\n\t\r\n\t\t//Files.write(path, bytes);\r\n\t}", "String uploadProfileImage(String fileNameWithOutRepository,String fileName) throws GwtException, ServerDownException;", "public boolean uploadImage(String path2repository, String path2image) {\n\t\tbyte[] bin = Img2Bin(path2image);\n\t\t\n\t\tValueCollection payload = new ValueCollection();\n\t\tpayload.put(\"content\", new ImagePrimitive(bin));\n\t\tpayload.put(\"path\", new StringPrimitive(path2repository));\n\t\t\n\t\ttry {\n\t\t\tclient.invokeService(ThingworxEntityTypes.Things, \"SmartDoorRepository\", \"SaveImage\", payload, 5000);\n\t\t\tLOG.info(\"Image {} was uploaded to {}.\",path2image, path2repository);\n\t\t} catch (Exception e) {\n\t\t\tLOG.error(\"Image couldn't be uploaded. Error: {}\",e);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private void uploadImageFile(final String token, final GMImage image) {\n // create RequestBody instance from file\n File imgFile = storeHelper.getImageFile(image);\n final RequestBody requestFile = RequestBody.create(MediaType.parse(\"multipart/form-data\"), imgFile);\n\n // MultipartBody.Part is used to send also the actual file name\n MultipartBody.Part body = MultipartBody.Part.createFormData(\"file\", imgFile.getName(), requestFile);\n\n // Add file name within the multipart request\n RequestBody requestFileName = RequestBody.create(MediaType.parse(\"multipart/form-data\"), imgFile.getName());\n\n httpRequest.upload(token, requestFileName, body).enqueue(new Callback<ResponseBody>() {\n @Override\n public void onResponse(Call<ResponseBody> call, Response<ResponseBody> res) {\n if (res.code() == 200) {\n try {\n // upload image information\n image.addTag(TAG_RETRY, 0);\n createNewImage(token, image);\n\n } catch (JSONException e) {\n e.printStackTrace();\n notifyUploadFail();\n }\n } else {\n notifyUploadFail();\n }\n }\n\n @Override\n public void onFailure(Call<ResponseBody> call, Throwable t) {\n t.printStackTrace();\n\n // notify fail after retry reach limit\n if (((Integer) image.getTag(TAG_RETRY)) >= GMGlobal.RETRY_LIMIT) {\n notifyUploadFail();\n }\n\n // retry upload image\n new Retry() {\n @Override\n protected void handle(Object... params) {\n uploadImageFile((String) params[0], (GMImage) params[1]);\n }\n }.execute(token, image);\n }\n });\n }", "public static String uploadImage(String fileName, String serverUri,\n String serverFolderUploads) {\n\n HttpURLConnection connection = null;\n DataOutputStream outputStream = null;\n\n String pathToOurFile = fileName;\n String urlServer = serverUri;\n String lineEnd = \"\\r\\n\";\n String twoHyphens = \"--\";\n String boundary = \"*****\";\n String charset = \"UTF-8\";\n\n int bytesRead, bytesAvailable, bufferSize;\n byte[] buffer;\n int maxBufferSize = 1 * 1024 * 1024;\n\n try {\n FileInputStream fileInputStream = new FileInputStream(new File(\n pathToOurFile));\n\n URL url = new URL(urlServer);\n connection = (HttpURLConnection) url.openConnection();\n\n // Allow Inputs & Outputs\n connection.setDoInput(true);\n connection.setDoOutput(true);\n connection.setUseCaches(false);\n\n pathToOurFile = UUID.randomUUID().toString() + \".jpg\";\n\n // Enable POST method\n connection.setRequestMethod(\"POST\");\n connection.setRequestProperty(\"Connection\", \"Keep-Alive\");\n connection.setRequestProperty(\"Accept-Charset\", charset);\n connection.setRequestProperty(\"ENCTYPE\", \"multipart/form-data\");\n connection.setRequestProperty(\"Content-Type\",\n \"multipart/form-data;boundary=\" + boundary);\n\n outputStream = new DataOutputStream(connection.getOutputStream());\n outputStream.writeBytes(twoHyphens + boundary + lineEnd);\n outputStream.writeBytes(\"Content-Disposition: form-data; name=\\\"\"\n + serverFolderUploads + \"\\\"\" + \"; filename=\\\"\"\n + pathToOurFile + \"\\\"\" + lineEnd);\n outputStream.writeBytes(lineEnd);\n\n bytesAvailable = fileInputStream.available();\n bufferSize = Math.min(bytesAvailable, maxBufferSize);\n buffer = new byte[bufferSize];\n\n // Read file\n bytesRead = fileInputStream.read(buffer, 0, bufferSize);\n try {\n while (bytesRead > 0) {\n outputStream.write(buffer, 0, bytesRead);\n bytesAvailable = fileInputStream.available();\n bufferSize = Math.min(bytesAvailable, maxBufferSize);\n bytesRead = fileInputStream.read(buffer, 0, bufferSize);\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n outputStream.writeBytes(lineEnd);\n outputStream.writeBytes(twoHyphens + boundary + twoHyphens\n + lineEnd);\n\n // Responses from the server (code and message)\n int serverResponseCode = connection.getResponseCode();\n String serverResponseMessage = connection.getResponseMessage();\n fileInputStream.close();\n outputStream.flush();\n outputStream.close();\n if (serverResponseCode == 200 && serverResponseMessage.equals(\"OK\"))\n return pathToOurFile;\n else\n return \"\";\n } catch (Exception e) {\n e.printStackTrace();\n return \"\";\n }\n }", "public void writeToDir() {\n\t\ttry{\n\t\t\tString dirPath = Paths.get(\".\").toAbsolutePath().normalize().toString()+\"/\";\n\t\t\tString path = dirPath + filename; //get server dir path\n\t\t\tSystem.out.println(\"output file path is: \" + path);\n\t\t\tFileOutputStream out = new FileOutputStream(path);\n out.write(img);\n out.close();\n PL.fsync();\n\t\t}catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void creaRutaImgPerfil(){\n servletContext=(ServletContext) contexto.getExternalContext().getContext();\n String ruta=\"\";\n //Ruta real hasta la carpeta de uploads\n ruta=servletContext.getRealPath(\"/upload/\");\n \n //Concatenamiento de directorios internos\n ruta+=File.separatorChar+\"img\"+File.separatorChar+\"users\"+File.separatorChar;\n \n //Asignacion de la ruta creada\n this.rutaImgPerfil=ruta;\n }", "public void upload_file(FileUploadEvent event) throws IOException {\n \t\n \tUploadedFile uploaded_file=event.getFile();\n \tFacesContext context = FacesContext.getCurrentInstance();\n \t\n\t\tHttpSession session = (HttpSession) FacesContext.getCurrentInstance()\n \t\t\t\t.getExternalContext().getSession(true);\n \t\tString pictures_folder=session.getAttribute(\"pictures_folder\").toString();\n \t\t\n \t\tPath folder = Paths.get(pictures_folder);\n\t\t\n\t\tString filename = FilenameUtils.getBaseName(uploaded_file.getFileName()); \n\t\tString extension = FilenameUtils.getExtension(uploaded_file.getFileName());\n\t\t//tou dinei rando onoma\n\t\tPath file = Files.createTempFile( folder,filename+\"-\" , \".\" + extension);\n\t\tSystem.out.println(\"folder: \"+folder.toString()+\"\\n\"+\"filename: \"+filename+\"\\n\"\n\t\t \t+ \"file: \"+file.toString());\n\t\t\n\t\tString profile_url;\n\t\ttry (InputStream input =uploaded_file.getInputstream()) {\n\t\t Files.copy(input, file, StandardCopyOption.REPLACE_EXISTING);\n\t\t profile_url=file.toString().split(\"/\")[file.toString().split(\"/\").length-1];\n\t\t}\n\n\t\tSystem.out.println(\"Uploaded picture successfully saved in \" + profile_url);\n\t\tString message=\"Pictures were uploaded Successfully\";\n\t\tFacesMessage facesMessage_11 = new FacesMessage(message);\n context.addMessage(files_upload_UI.getClientId(context), facesMessage_11);\n\t\t\n\t\t\n\t\t\n }", "public void uploadPictureToParkById(int id, MultipartFile multipartFile, boolean enablePublicReadAccess) {\n Optional<DogPark> dogPark = dogParkRepository.findById(id);\n\n if (dogPark.isPresent()) {\n\n //Create a new image to store the URL of the file that is being created\n Image image = new Image();\n\n //Creating the file\n String fileName = multipartFile.getOriginalFilename();\n\n try {\n //creating the file in the server (temporarily)\n File file = new File(fileName);\n FileOutputStream fos = new FileOutputStream(file);\n fos.write(multipartFile.getBytes());\n fos.close();\n\n for (int i = -1; i < dogPark.get().getImages().size(); i++) {\n\n if (i == dogPark.get().getImages().size() - 1) {\n fileName = dogPark.get().getName() + \"/\" + dogPark.get().getName() + (i + 1) + \".\" + FilenameUtils.getExtension(fileName);\n }\n }\n\n //Set the URL to the new image and connect with the correct dog park and save it to the repository\n image.setUrl(\"https://dogparks.s3.amazonaws.com/\" + fileName);\n image.setDogpark(dogPark.get());\n imageRepository.save(image);\n\n //Add the image to the dog park\n dogPark.get().getImages().add(image);\n\n PutObjectRequest putObjectReqeust = new PutObjectRequest(this.awsS3AudioBucket, fileName, file);\n\n if (enablePublicReadAccess) {\n putObjectReqeust.withCannedAcl(CannedAccessControlList.PublicRead);\n }\n\n this.amazonS3.putObject(putObjectReqeust);\n\n } catch (IOException | AmazonServiceException ex) {\n logger.error(\"error [\" + ex.getMessage() + \"] occurred while uploading [\" + fileName + \"] \");\n }\n }\n else {\n throw new DogParkNotFoundException();\n }\n }", "void setImageLocation(URL imageLocation) throws IOException;", "public void uploadImage() {\n if (imgPath != null && !imgPath.isEmpty()) {\n //prgDialog.setMessage(\"Converting Image to Binary Data\");\n //prgDialog.show();\n // Convert image to String using Base64\n new EncodeImageToStringTask().execute();\n // When Image is not selected from Gallery\n } else {\n //Toast.makeText(\n // getApplicationContext(),\n // \"You must select image from gallery before you try to upload\",\n // Toast.LENGTH_LONG).show();\n }\n }", "public static void upload_Image(String filePath) {\n\t\tboolean bstatus;\n\n\t\tbstatus = uploadFile1(btn_LiteratureImage, filePath);\n\t\tReporter.log(bstatus, \"Image Slected\", \"Image Not Slected\");\n\n\t}", "private void uploadImage() {\n if(checkPermissions()){ // if permission is granted we move on with the code\n Intent gallery = new Intent();\n gallery.setType(\"image/\");\n gallery.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(Intent.createChooser(gallery,\"Select Image With: \"),CHOOSE_IMAGE_FROM_GALLERY);\n }else{\n requestPermissionFromUser(); // if permission is not granted we go and request a permission from the user\n }\n }", "@PostMapping\n public ResponseEntity<BlobImage> saveImage(@RequestBody BlobStoreRequest request) {\n logger.info(\"Got a request to save an image: {}\", request.getMd5());\n BlobImage blob = BlobImage.builder()\n .build();\n blob = repository.save(blob);\n\n String storageLocation = properties.getStorageLocation();\n String uploadDir = storageLocation + \"/\" + blob.getId();\n\n blob.setImageUri(ServletUriComponentsBuilder.fromCurrentContextPath().path(\"/api/v1/blob/{id}\")\n .buildAndExpand(blob.getId()).toUriString());\n\n blob.setFileNameWithAbsolutePath(uploadDir);\n\n repository.save(blob);\n return ResponseEntity.ok(blob);\n }", "public String uploadFile(MultipartFile file) {\n\t\tString url;\r\n\t\tString visit = \"\";\r\n\t\tif (!file.isEmpty()) {\r\n try {\r\n \tSystem.out.println(\"进入文件上传\");\r\n \t//获取上传文件的文件类型\r\n \tString contentType=file.getContentType();\r\n \tif(contentType.startsWith(\"image/\")){\r\n \t//获取上传文件的文件名\r\n \tString name = file.getOriginalFilename();\r\n \t//获取文件的后缀\r\n \tint lastPoiIndex=name.lastIndexOf(\".\");\r\n \tString extendNam = null;\r\n \tif(lastPoiIndex>-1){\r\n \t\textendNam = name.substring(lastPoiIndex);\r\n \t\t\t}\r\n \t//确定新的文件名\r\n \t\t\tDate now=new Date();\r\n \t\t\t//获取当前时间\r\n \t\t\tSimpleDateFormat sdf=new SimpleDateFormat(\"yyyyMMddHHmmssSSS\");\r\n \t\t\tString newFileName=sdf.format(now)+extendNam;\r\n \t//文件储存的地址/WEB-INF/classes/resources/\r\n \t\t\turl =System.getProperty(\"user.dir\")+\"/src/main/resources/static/img/login/\"+newFileName;\r\n \tvisit = \"../img/login/\"+newFileName;\r\n// \turl =System.getProperty(\"user.dir\")+\"/\"+newFileName;\r\n//\t\t\t\treplace替换字符串\r\n// \turl =url1.replace(\"bin\",\"webapps/PIDStudioDemo/WEB-INF/classes/static/img/login\");\r\n \tvisit = \"../img/login/\"+newFileName;\r\n \tSystem.out.println(url);\r\n BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(url)));//储存文件到指定地址\t \r\n out.write(file.getBytes());\r\n out.flush();\r\n out.close();//关闭\r\n System.out.println(\"上传成功\");\r\n }else {\r\n \tSystem.out.println(\"文件不是图片\");\r\n \t return \"\";\r\n }\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n return \"\";\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n return \"\" ;\r\n }\r\n return visit ;\r\n } else {\r\n return \"\";\r\n }\r\n\t}", "public void uploader(WebDriver driver, String image, By browse, By upload) throws InterruptedException {\n\t\t String imageDir = Common.localImageDir;\n\t\t String imagePath = imageDir + File.separator + image;\n\t\t try{\n \t driver.findElement(browse).sendKeys(imagePath);\n \t Thread.sleep(1000);\n \t driver.findElement(upload).click();\n \t waitUntilElementInvisibility(driver, 10, Common.ajaxThrobber, \"Throbber\", new Exception().getStackTrace()[0]);\n }catch(Throwable e) { e.printStackTrace(); }\n }", "@RequestMapping(\"/add\")\n @ResponseBody\n public String handleFileUpload(@RequestParam(\"file\") MultipartFile file) {\n String path = \"C:\\\\Users\\\\Administrator\\\\Desktop\\\\lostfound\\\\static\\\\img\";\n String fileName = file.getOriginalFilename();\n Calendar currTime = Calendar.getInstance();\n String time = String.valueOf(currTime.get(Calendar.YEAR))+String.valueOf((currTime.get(Calendar.MONTH)+1));\n String suffix = fileName.substring(file.getOriginalFilename().lastIndexOf(\".\"));\n suffix = suffix.toLowerCase();\n if(suffix.equals(\".jpg\") || suffix.equals(\".jpeg\") || suffix.equals(\".png\")){\n fileName = UUID.randomUUID().toString()+suffix;\n File targetFile = new File(path, fileName);\n if(!targetFile.getParentFile().exists()){\n targetFile.getParentFile().mkdirs();\n }\n long size = 0;\n try {\n file.transferTo(targetFile);\n size = file.getSize();\n } catch (Exception e) {\n e.printStackTrace();\n return\"上传失败\";\n }\n String fileUrl=\"/static\";\n fileUrl = fileUrl + \"/img/\" + fileName;\n return fileUrl;\n }else{\n return \"上传失败\";\n }\n }", "@Test\n public void uploadAppImageTest() throws ApiException {\n File file = null;\n Integer id = null;\n Application response = api.uploadAppImage(file, id);\n\n // TODO: test validations\n }", "private void putImageInStorage() {\n final StorageReference ref = storageReference.child(\"images/\" + java.util.UUID.randomUUID().toString());\n ref.putFile(filePath)\n .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {\n @Override\n public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {\n if (taskSnapshot.getMetadata() != null) {\n if (taskSnapshot.getMetadata().getReference() != null) {\n Task<Uri> result = taskSnapshot.getStorage().getDownloadUrl();\n result.addOnSuccessListener(new OnSuccessListener<Uri>() {\n @Override\n public void onSuccess(Uri uri) {\n imageUrl = uri.toString();\n ChatMessage Message = new\n ChatMessage(null,\n mUsername,\n imageUrl, dateAndTime);\n mFirebaseDatabaseReference.child(CHATS_PATH + chatCode)\n .push().setValue(Message);\n }\n });\n }\n }\n }\n });\n }", "private void uploadImage(byte[] imageData) {\n\n }", "private void uploadImage() {\n FileChooser fileChooser = new FileChooser();\n\n //Extension de l'image\n FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(\"Fichier image\", \"*.*\");\n fileChooser.getExtensionFilters().addAll(extFilter);\n\n File file = fileChooser.showOpenDialog(null);\n\n try {\n BufferedImage bufferedImage = ImageIO.read(file);\n Image image = SwingFXUtils.toFXImage(bufferedImage, null);\n imageViewAvatar.setImage(image);\n getUser().setAvatar(image);\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@PostMapping(\"/upload\")\n public String handleFileUpload(@RequestParam MultipartFile file) throws IOException {\n final Path uploadDestination = Paths.get(\"C:\\\\uploads\").resolve(file.getName());\n\n file.transferTo(uploadDestination);\n return \"redirect:/\";\n }", "public void upload() {\r\n if (file != null) {\r\n try {\r\n String filepath = super.getUploadFolder() + \"/\" + file.getFileName();\r\n filepath = FileUtil.alternativeFilepathIfExists(filepath);\r\n FileUtil.createFile(filepath);\r\n\r\n file.write(filepath);\r\n super.info(\"Succesful\", file.getFileName() + \" is uploaded.\");\r\n\r\n Upload upload = new Upload();\r\n upload.setDescription(description);\r\n upload.setFilepath(filepath);\r\n upload.setTag(Md5Util.getMd5Sum(filepath));\r\n this.description = null;\r\n uploads.add(upload);\r\n // update ui and ready for save in db\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n }\r\n }", "@RequestMapping(value = {\"/register\"}, method = RequestMethod.POST)\r\n public String registerUser(@Valid FileBucket fileBucket, BindingResult result,\r\n ModelMap model, HttpServletRequest req) {\r\n\r\n MultipartFile[] files = fileBucket.getFiles();\r\n String originalImgPath = \"\";\r\n String resizedImgPath = \"\";\r\n //String serverFileName = \"\";\r\n String photoName = \"\";\r\n String itemViewName = \"\";\r\n String imgLocation = \"\";\r\n int width = 580;\r\n int height = 450;\r\n boolean saved = false;\r\n String serverFileName = \"\";\r\n\r\n FileBucket fb = new FileBucket();\r\n User user = new User();\r\n if (result.hasErrors()) {\r\n return \"registration\";\r\n }\r\n if (files != null && files.length > 0) {\r\n for (int i = 0; i < files.length; i++) {\r\n try {\r\n\r\n byte[] bytes = null;\r\n // Creating the directory to store file\r\n String rootPath = System.getProperty(\"catalina.home\");\r\n File dir = new File(rootPath + File.separator + \"tmpFiles\");\r\n if (!dir.exists()) {\r\n dir.mkdirs();\r\n }\r\n\r\n FilenameUtils fileUTIL = new FilenameUtils();\r\n\r\n String path = req.getServletContext().getRealPath(\"/image\");\r\n //String ext = fileUTIL.getExtension(file.getOriginalFilename());\r\n //String baseName = fileUTIL.getBaseName(file.getOriginalFilename());\r\n\r\n imgLocation = dir + File.separator;\r\n // get files name in the array\r\n if (i == 0) {\r\n photoName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + photoName;\r\n System.out.println(\"photoName:: \" + photoName);\r\n } else if (i == 1) {\r\n itemViewName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + itemViewName;\r\n System.out.println(\"itemViewName:: \" + itemViewName);\r\n }\r\n\r\n System.out.println(\"serverFileName :: \" + serverFileName);\r\n\r\n // resize image\r\n //utility.resize(originalImgPath, resizedImgPath, width, height);\r\n //create the file on server\r\n File serverFile = new File(serverFileName);\r\n BufferedOutputStream stream = new BufferedOutputStream(\r\n new FileOutputStream(serverFile));\r\n stream.write(bytes);\r\n stream.close();\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n\r\n //System.out.println(\"bytes ::\" + bytes);\r\n user.setFirstName(fileBucket.getFirstName());\r\n user.setLastName(fileBucket.getLastName());\r\n user.setPhoneNumber(fileBucket.getPhoneNumber());\r\n user.setItemView(fileBucket.getItemView());\r\n user.setAddress(fileBucket.getAddress());\r\n user.setPassportPhotograph(photoName);\r\n user.setImgLocation(imgLocation);\r\n user.setImgName(photoName);\r\n user.setImgItemName(itemViewName);\r\n\r\n saved = userService.saveUser(user);\r\n\r\n } else {\r\n System.out.println(\"File is empty / No image uploaded\");\r\n }\r\n\r\n //model.addAttribute(\"user\", user);\r\n model.addAttribute(\"user\", fb);\r\n //model.addAttribute(\"success\", \"User \" + user.getFirstName() + \" \" + user.getLastName() + \" saved successfully\");\r\n //model.addAttribute(\"saved\", saved);\r\n\r\n //return \"adduser\";\r\n //return \"redirect:/adduser\";\r\n return \"redirect:/register\";\r\n }", "@Override\r\n\t\tpublic void onClick(View v) {\n\t\t\tbyte image[] = Global.File2byte(pathImage);\r\n\t\t\t\r\n\t\t\tTransfer.uploadImage(image, new TransferListener() {\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void onSucceed(JSONObject obj) {\r\n\t\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t\tLog.e(\"upload\",obj.toString());\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void onFail(String desc) {\r\n\t\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t Log.e(\"upload\",desc);\t\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}", "public void uploadImage() {\n\t\tif (fileChooser.showOpenDialog(btnUploadImage) == JFileChooser.APPROVE_OPTION)\n\t\t\t;\n\n\t\tfileChooser.addChoosableFileFilter(new FileNameExtensionFilter(\"Images\", \"jpg\", \"png\", \"gif\", \"bmp\"));\n\t\tif (fileChooser.getSelectedFile() != null) {\n\t\t\timage = new ImageIcon(fileChooser.getSelectedFile().getAbsolutePath());\n\t\t\t// Resize image to 100x100\n\t\t\timg = image.getImage();\n\t\t\tImage newimg = img.getScaledInstance(100, 100, java.awt.Image.SCALE_SMOOTH);\n\t\t\timage = new ImageIcon(newimg);\n\t\t}\n\t}", "public void uploadImg(View view){\n Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);\n intent.addCategory(Intent.CATEGORY_OPENABLE);\n intent.setType(\"image/*\");\n intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);\n intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\n intent.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(Intent.createChooser(intent, \"Select Picture\"), SELECT_PICTURE);\n }", "@RequestMapping(\"/upload\")\n public String upload(HttpSession session) {\n // Get details about the current user\n User currUser = (User) session.getAttribute(\"currUser\");\n\n // If the current user is null then redirect back to homepage, else redirect to upload page\n // We are checking it to make sure a user is able to upload an image if and only if they are logged in and the session has been started\n if(currUser == null ){\n return \"redirect:/\";\n }\n else {\n return \"/upload\";\n }\n }", "public interface ImageService {\n\n void saveImageFile(Long recipeId, MultipartFile imageFile);\n}", "public void photoUpload() throws Exception {\n\r\n\t\tString Window=commonUtil.getWindowHandle(driver);\r\n\t\tcommonUtil.switchToWindow(Window, driver);\r\n\r\n\t\t// display picture window \r\n\t\tcommonUtil.clickOnButton(driver, ChangePicture,\"ChangePicture\");\r\n\r\n\r\n\t\t//load picture using robot class\r\n\t\r\n\t\tcommonUtil.LoadFile(driver, prop.getProperty(\"photopath\"));\r\n\t\t//System.out.println(\"photo is loading...\"); \r\n\r\n\t\t\r\n\t\t\r\n\t\t//switch to crop window\r\n\r\n\t\tWindow=commonUtil.getWindowHandle(driver);\r\n\t\tcommonUtil.switchToWindow(Window, driver);\r\n\r\n\r\n\t\t//crop image window \r\n\t\tcommonUtil.clickOnButton(driver, Cropimage,\"CropImage\");\r\n\t\t\r\n\t\t//enter Display name and discription\r\n\t\t\r\n\t\tcommonUtil.enterText(driver, Displaytext, prop.getProperty(\"displayname\"),\"Displayname\");\r\n\t\tcommonUtil.enterText(driver, Discriptiontext, prop.getProperty(\"Address\"),\"Discription\");\r\n\t\t\r\n\t\t//click on save button\r\n\t\t\r\n\t\tcommonUtil.clickOnButton(driver, Save,\"SaveButton\");\r\n\r\n\t\t\r\n\t}", "void fileUploaded(String path);", "public void upload(UploadedFile file) {\n FacesContext faces = FacesContext.getCurrentInstance();\n\n getSelected().setUrlImage(file.getFileName());\n String fileExtension = file.getFileName().split(\"\\\\.\")[file.getFileName().split(\"\\\\.\").length - 1];\n\n //String generatedFileName = \"file\" + System.currentTimeMillis();\n File directory = new File(faces.getExternalContext().getRealPath(UPLOAD_DIRECTORY_IMAGE_RELATIVE));\n\n if (!directory.exists()) {\n directory.mkdir();\n }\n\n File newFile = new File(faces.getExternalContext().getRealPath(UPLOAD_DIRECTORY_IMAGE_RELATIVE) + File.separator + file.getFileName());\n try {\n if (!newFile.createNewFile()) {\n String nameGenerated = \"file_generated\" + System.currentTimeMillis();\n newFile = new File(faces.getExternalContext().getRealPath(UPLOAD_DIRECTORY_IMAGE_RELATIVE) + File.separator + nameGenerated + \".\" + fileExtension);\n getSelected().setUrlImage(nameGenerated);\n }\n\n FileOutputStream output = new FileOutputStream(newFile);\n\n byte[] buffer = new byte[BUFFER];\n\n int bulk;\n\n InputStream input = file.getInputstream();\n\n while (true) {\n bulk = input.read(buffer);\n\n if (bulk < 0) {\n break;\n }\n\n output.write(buffer, 0, bulk);\n output.flush();\n }\n\n output.close();\n input.close();\n\n } catch (Exception ex) {\n ex.printStackTrace();\n FacesContext.getCurrentInstance().addMessage(\"\", new FacesMessage(bundle.getString(\"Error_file_created\")));\n }\n\n }", "@RequestMapping(value = \"/singleUpload\", method = RequestMethod.POST)\r\n\tpublic @ResponseBody boolean test(HttpServletRequest request,\r\n\t\t\t@RequestParam(\"file\") CommonsMultipartFile singleUploadFile) {\r\n\t\tboolean status = false;\r\n\t\tSystem.out.println(\"////// Inside there\");\r\n\r\n\t\tSystem.out.println(\"////// Inside there reh\" + singleUploadFile.getOriginalFilename());\r\n\r\n\t\tString fileName[] = singleUploadFile.getOriginalFilename().split(\"_\");\r\n\t\tString folderName = fileName[0];\r\n\t\t\r\n\t\t/*\r\n\t\t * try { ServletContext context = request.getServletContext(); String\r\n\t\t * uploadPath = context.getRealPath(\"/\" + folderName); File uploadDir =\r\n\t\t * new File(uploadPath); if (!uploadDir.exists()) { boolean success =\r\n\t\t * uploadDir.mkdir();\r\n\t\t * \r\n\t\t * if (success) { success = (new File(uploadDir + \"/\" +\r\n\t\t * subFolderName)).mkdir(); }\r\n\t\t * \r\n\t\t * } String path = uploadDir + \"/\" + subFolderName + \"/\" +fileName[2];\r\n\t\t * System.out.println(\"Path is\" + path); File serverFile = new\r\n\t\t * File(path); BufferedOutputStream stream = new\r\n\t\t * BufferedOutputStream(new FileOutputStream(serverFile));\r\n\t\t * stream.write(singleUploadFile.getBytes()); stream.close(); url =\r\n\t\t * folderName+\"_\"+subFolderName+\"_\"+fileName[2];\r\n\t\t * \r\n\t\t * }\r\n\t\t */ \r\n\t\ttry {\r\n\t\t\tServletContext context = request.getServletContext();\r\n\t\t\tString uploadPath = context.getRealPath(\"/\" + folderName);\r\n\t\t\tFile uploadDir = new File(uploadPath);\r\n\t\t\tif (!uploadDir.exists()) {\r\n\t\t\t\tboolean success = uploadDir.mkdir();\r\n\t\t\t\tif (success) {\r\n\t\t\t\t\tsuccess = (new File(uploadDir + \"/temp\")).mkdir();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tString path = uploadDir + \"/temp/\" + fileName[1];\r\n\t\t\tSystem.out.println(\"Path is\" + path);\r\n\t\t\tFile serverFile = new File(path);\r\n\t\t\tBufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));\r\n\t\t\tstream.write(singleUploadFile.getBytes());\r\n\t\t\tstatus = true;\r\n\t\t\tstream.close();\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\tAdminResponseClass adminResponseClass = new AdminResponseClass();\r\n\t\tadminResponseClass.setStatus(status);\r\n\t\treturn adminResponseClass.isStatus();\r\n\t}", "private void chooseImageAndUpload() {\n Intent intent = new Intent();\n intent.setType(\"image/*\");\n intent.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(Intent.createChooser(intent, \"Select Picture\"), Common.PICK_IMAGE_REQUEST);\n\n }", "public void uploadImage(int pos) throws InterruptedException {\n\t}", "public static String saveFile( MultipartFile filedata, HttpServletRequest request) {\n String pathval = \"C://KCGLIMG//\";\n String newFileName = String.valueOf( System.currentTimeMillis());\n String saveFilePath = \"images//equipment//\";\n\n File fileDir = new File(pathval + saveFilePath);\n if (!fileDir.exists()) {\n fileDir.mkdirs();\n }\n\n String filename=filedata.getOriginalFilename();\n\n String extensionName = filename.substring(filename.lastIndexOf(\".\") + 1);\n try {\n String imgPath = saveFilePath + newFileName + \".\" +extensionName;\n System.out.println(pathval + imgPath);\n FileOutputStream out = new FileOutputStream(pathval + imgPath);\n \n out.write(filedata.getBytes());\n out.flush();\n out.close();\n\n String path=pathval+imgPath;\n return path;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }", "public void upload(FileUploadEvent event) {\r\n\t\tUploadedFile uploadFile = event.getFile();\r\n\t\t// Recuperer le contenu de l'image en byte array (pixels)\r\n\t\tbyte[] contents = uploadFile.getContents();\r\n\t\tSystem.out.println(\"---------------- \" + contents);\r\n\t\tproduit.setPhoto(contents);\r\n\t\t// Transforme byte array en string (format basé64)\r\n\t\timage = \"data:image/png;base64,\" + Base64.encodeBase64String(produit.getPhoto());\r\n\t\t\r\n\t}", "public void upload() {\n try {\n BufferedImage bufferedProfile = ImageIO.read(profilePicture.getInputStream());\n FaceImage face = new FaceImage(bufferedProfile);\n\n if (face.foundFace()) {\n\n face.setNoCropMultiplier(1);\n face.setAdditionPadding(20);\n face.setDimension(128, 128);\n BufferedImage profilePicture = face.getScaledProfileFace();\n\n File outfile = new File(Settings.NEW_PROFILE_IMAGE_PATH.replace(\"~~username~~\", student.getUserName()));\n ImageIO.write(profilePicture, \"png\", outfile);\n\n success = true;\n\n student.setProfilePicturePath(\"profile/\" + student.getUserName() + \".png\");\n save();\n\n } else {\n FacesContext.getCurrentInstance().addMessage(\"imageContainer:file\", new FacesMessage(\"Kein Gesicht gefunden!\"));\n\n }\n\n } catch (IOException e) {\n System.err.println(\"something went wrong \" + e.getMessage());\n }\n\n }", "@Override\n public String saveFile(MultipartFile file, String rootDirectory ) {\n String path = null;\n try {\n if (file != null && !file.isEmpty()) {\n java.util.Date date = new java.util.Date();\n int i = (int) (date.getTime() / 1000);\n String extention = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(\".\")+1);\n String fileName =file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(\".\"));\n path = rootDirectory + fileName + \"-\" + i + \".\"+ extention;\n\n File finalFilePath = new File(path);\n //create all path directories if not exist\n finalFilePath.getParentFile().mkdirs();\n file.transferTo(new File(path));\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n return path;\n }", "@PostMapping(path = \"/uploadAppImg\")\n\tpublic ResponseEntity<String> uploadAppImg(@RequestParam(\"file\") MultipartFile file) {\n\t\tif (file.isEmpty()) {\n\t\t\treturn new ResponseEntity<>(\"上传的图片不能为空\", HttpStatus.BAD_REQUEST);\n\t\t}\n\t\tswitch (fileProperties.getLocation()) {\n\t\tcase \"oss\":\n\t\t\treturn fileUploadService.ossUpload(file)\n\t\t .map(url -> new ResponseEntity<String>(url, HttpStatus.OK))\n\t\t .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));\n\t\tcase \"local\":\n\t\t\treturn fileUploadService.uploadToLocal(file)\n\t\t .map(url -> new ResponseEntity<String>(url, HttpStatus.OK))\n\t\t .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));\n\t\tcase \"cloud\":\n\t\t\treturn new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);\n\t\t}\n\t\treturn new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);\n\n\t}", "public static void upload(String fpath) {\n String baseurl=\"http://dev.123go.net.cn\";\n File file = new File(fpath);\n\n // please check you mime type, i'm uploading only images\n RequestBody requestBody = RequestBody.create(MediaType.parse(\"image/*\"), file);\n /*RequestBody rbody=new MultipartBody.Builder()\n .addPart(requestBody).build();\n\n RequestBody requestFile =\n RequestBody.create(MediaType.parse(\"image/jpg\"), file);\n MultipartBody.Part body =\n MultipartBody.Part.createFormData(\"image\", file.getName(), requestFile);\n */\n\n Retrofit retrofit=new Retrofit.Builder()\n .baseUrl(baseurl)\n .addConverterFactory(GsonConverterFactory.create())\n .client(getOkhttpClient())\n .build();\n // 添加描述\n /*String descriptionString = \"hello, 这是文件描述\";\n RequestBody description =\n RequestBody.create(\n MediaType.parse(\"multipart/form-data\"), descriptionString);*/\n UploadServer server=retrofit.create(UploadServer.class);\n Call<ResponseBody> call = server.uploadImage(requestBody);\n call.enqueue(new Callback<ResponseBody>() {\n\n @Override\n public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {\n ResponseBody jsonObject=response.body();\n System.out.print(jsonObject.toString());\n }\n\n @Override\n public void onFailure(Call<ResponseBody> call, Throwable t) {\n\n }\n });\n }", "@Override\r\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n \r\n String FOLDER = \"/Image/AvatarImg\";\r\n HttpSession session = (HttpSession) request.getSession(false);\r\n User user = (User) session.getAttribute(\"user\");\r\n Boolean updateResult;\r\n User cgeUser = new User();\r\n \r\n //Creazione variabili \r\n String email = user.getEmail();\r\n String nominativo = request.getParameter(\"nominativo\");\r\n String password = request.getParameter(\"password\");\r\n Boolean send;\r\n send = request.getParameter(\"send\") != null;\r\n String url;\r\n \r\n //IMMAGINE ################################################################################\r\n Part filePart = request.getPart(\"file1\");\r\n if((filePart != null) && (filePart.getSize() > 0)){\r\n //delete current immage\r\n String imageFolder = getServletContext().getRealPath(user.getImage()); //cerca il link assoluto dell immagine\r\n if(imageFolder != null){\r\n imageFolder = imageFolder.replace(\"\\\\build\", \"\"); //rimuove build dal link assoluto\r\n File currentFile = new File(imageFolder); //carica il file nel ogetto \r\n if(currentFile.exists()){ //controlla se esiste il file\r\n try{\r\n ImageDispatcher.deleteImgFromDirectory(imageFolder);\r\n cgeUser.setImage(null);\r\n }catch(Exception e){\r\n System.out.println(\"Cancella immagine errata\");\r\n System.out.println(e);\r\n }\r\n }\r\n }\r\n //save new immage\r\n String extension = Paths.get(filePart.getSubmittedFileName()).getFileName().toString().split(Pattern.quote(\".\"))[1];\r\n String foldername = getServletContext().getRealPath(FOLDER);\r\n foldername = foldername.replace(\"\\\\build\", \"\");\r\n String filename;\r\n if(email.equals(\"\")){\r\n filename = ImageDispatcher.setImgName(user.getEmail(), extension);\r\n }else{\r\n filename = ImageDispatcher.setImgName(email, extension);\r\n }\r\n File file1 = new File(foldername,filename);\r\n try (InputStream fileContent = filePart.getInputStream()) {\r\n Files.copy(fileContent, file1.toPath());\r\n cgeUser.setImage(\"Image/AvatarImg/\" + filename);\r\n } catch (RuntimeException e) {\r\n throw e;\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n }\r\n //IMMAGINE ################################################################################\r\n\r\n //Aggiornamento dei campi nominativo, email, e password\r\n cgeUser.setEmail(email);\r\n cgeUser.setNominativo(nominativo);\r\n cgeUser.setPassword(password);\r\n cgeUser.setSendEmail(send);\r\n \r\n try {\r\n User finaluser = userdao.changeUser(cgeUser, user);\r\n if (finaluser != null) {\r\n updateResult = true;\r\n session.setAttribute(\"user\", finaluser);\r\n session.setAttribute(\"updateResult\", updateResult);\r\n }\r\n } catch (DAOException ex) {\r\n Logger.getLogger(updateUser.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n\r\n //Redirect\r\n if (session.getAttribute(\"user\") != null) {\r\n url = \"/Lists/profile.jsp\";\r\n } else {\r\n url = \"homepage.jsp\";\r\n out.println(\"Errore di tipo utente\");\r\n }\r\n\r\n response.sendRedirect(url);\r\n\r\n }", "public void postPhoto() throws InterruptedException, IOException, AWTException{\n\t\tString filepath= getTargetFilePath(\"PhotoToUpload\", \"Image\", \"jpeg\");\n\t\tSystem.out.println(\"File path is:\"+ filepath);\n\t\t\n\t\tclick(profileIcon);\n\t\tThread.sleep(1000);\n\t\tclick(PhotoTab);\n\t\tThread.sleep(1000);\n\t\tdriver.findElement(PhotoUpload).sendKeys(filepath);\n\t\tclick(PostBttn);\n\t}", "@RequestMapping(value = {\"/edit-user-{id}\"}, method = RequestMethod.POST)\r\n public String updateUser(@Valid FileBucket fileBucket, BindingResult result,\r\n ModelMap model, @PathVariable String id, HttpServletRequest req) {\r\n\r\n MultipartFile[] files = fileBucket.getFiles();\r\n String originalImgPath = \"\";\r\n String resizedImgPath = \"\";\r\n //String serverFileName = \"\";\r\n String photoName = \"\";\r\n String itemViewName = \"\";\r\n String imgLocation = \"\";\r\n int width = 580;\r\n int height = 450;\r\n boolean saved = false;\r\n String serverFileName = \"\";\r\n\r\n FileBucket fb = new FileBucket();\r\n User user = new User();\r\n if (result.hasErrors()) {\r\n return \"registration\";\r\n }\r\n if (files != null && files.length > 0) {\r\n for (int i = 0; i < files.length; i++) {\r\n try {\r\n\r\n byte[] bytes = null;\r\n // Creating the directory to store file\r\n String rootPath = System.getProperty(\"catalina.home\");\r\n File dir = new File(rootPath + File.separator + \"tmpFiles\");\r\n if (!dir.exists()) {\r\n dir.mkdirs();\r\n }\r\n\r\n FilenameUtils fileUTIL = new FilenameUtils();\r\n\r\n String path = req.getServletContext().getRealPath(\"/image\");\r\n //String ext = fileUTIL.getExtension(file.getOriginalFilename());\r\n //String baseName = fileUTIL.getBaseName(file.getOriginalFilename());\r\n\r\n imgLocation = dir + File.separator;\r\n // get files name in the array\r\n if (i == 0) {\r\n photoName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + photoName;\r\n System.out.println(\"photoName:: \" + photoName);\r\n } else if (i == 1) {\r\n itemViewName = files[i].getOriginalFilename();\r\n bytes = files[i].getBytes();\r\n serverFileName = imgLocation + itemViewName;\r\n System.out.println(\"itemViewName:: \" + itemViewName);\r\n }\r\n\r\n System.out.println(\"serverFileName :: \" + serverFileName);\r\n\r\n // resize image\r\n //utility.resize(originalImgPath, resizedImgPath, width, height);\r\n //create the file on server\r\n File serverFile = new File(serverFileName);\r\n BufferedOutputStream stream = new BufferedOutputStream(\r\n new FileOutputStream(serverFile));\r\n stream.write(bytes);\r\n stream.close();\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n\r\n System.out.println(\"fileBucket.getPhoneNumber() ::\" + fileBucket.getPhoneNumber());\r\n user.setId(fileBucket.getId());\r\n user.setFirstName(fileBucket.getFirstName());\r\n user.setLastName(fileBucket.getLastName());\r\n user.setPhoneNumber(fileBucket.getPhoneNumber());\r\n user.setItemView(fileBucket.getItemView());\r\n user.setAddress(fileBucket.getAddress());\r\n user.setPassportPhotograph(photoName);\r\n user.setImgLocation(imgLocation);\r\n user.setImgName(photoName);\r\n user.setImgItemName(itemViewName);\r\n\r\n saved = userService.updateUser(user);\r\n\r\n } else {\r\n System.out.println(\"File is empty / No image uploaded\");\r\n }\r\n\r\n //model.addAttribute(\"user\", user);\r\n model.addAttribute(\"user\", fb);\r\n // model.addAttribute(\"success\", \"User \" + user.getFirstName() + \" \" + user.getLastName() + \" saved successfully\");\r\n // model.addAttribute(\"saved\", saved);\r\n\r\n //return \"adduser\";\r\n \r\n return \"redirect:/register\";\r\n }", "public String uploadPhoto(String path) {\n return uploadPhoto(path, null);\n }", "@Override\n\tpublic String saveUserImage(MultipartFile multipartFile, Long userImageId) {\n\t\t\n\t\ttry {\t\n\t\t\tFiles.deleteIfExists(Paths.get(Constants.USER_FOLDER + \"/\" + userImageId + \".png\"));\n\t\t\tInputStream reso = multipartFile.getInputStream();\n\t\t\tString path = (Constants.USER_FOLDER + userImageId + \".png\");\n\t\t\tnew UpDownServiceImpl().upload(reso, path);\n\t\t\t\n\t\t\t//resize profile image to reduce bandwitdh\n\n\t\t\t/*\n\t\t\t * InputStream input = multipartFile.getInputStream(); BufferedImage image =\n\t\t\t * ImageIO.read(input); BufferedImage resized = (resize(image,100,100)); File\n\t\t\t * output = new File(Constants.USER_FOLDER + \"/\" + userImageId +\n\t\t\t * \"_resized.png\"); ByteArrayOutputStream resi = new ByteArrayOutputStream();\n\t\t\t * ImageIO.write(resized, \"png\", resi);\n\t\t\t * \n\t\t\t * InputStream target = ByteArrayOutputStream(resi.toByteArray());\n\t\t\t */\n\t\t\t\n\t\t\treturn \"User picture saved to server\";\n\t\t} catch (IOException e) {\n\t\t\treturn \"User picture Saved\";\n\t\t}\n\t}", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n String savePath = request.getServletContext().getRealPath(\"/\") + \"images\";\n File fileSaveDir=new File(savePath);\n if(!fileSaveDir.exists()){\n fileSaveDir.mkdir();\n }\n\n \n Part imagePart = request.getPart(\"photo\");\n String fileName = extractFileName(imagePart);\n String fileLocalPath = File.separator + fileName;\n imagePart.write(savePath + fileLocalPath);\n String description = request.getParameter(\"description\");\n \n Conexion c=new Conexion();\n Connection con=c.getConexion();\n CallableStatement cs = null;\n \n try{\n String query = \"call sp_pv_insertPost(?,?,1)\";\n cs = con.prepareCall(query);\n cs.setString(1, fileLocalPath);\n cs.setString(2, description);\n cs.execute(); \n }catch(SQLException e){\n e.printStackTrace();\n }finally{\n BDUtil.cerrarStatement(cs);\n c.cerrarConexion();\n }\n \n response.setContentType(\"text/plain\"); \n response.setCharacterEncoding(\"UTF-8\");\n response.getWriter().write(\"success\"); \n \n }", "private void fileUpload(HttpServletRequest request, HttpServletResponse response) {\n\t \ttry {\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * String appPath = request.getServletContext().getRealPath(\"\");\r\n\t\t\t\t\t * System.out.println(appPath); String savePath = appPath + File.separator +\r\n\t\t\t\t\t * SAVE_DIR; System.out.println(savePath);\r\n\t\t\t\t\t */\r\n\t \t\t\r\n\t \t\t//String appPath = getServletContext().getRealPath(SAVE_DIR);\r\n\t \t\tSystem.out.println(appPath);\r\n\t \t\t String savePath = appPath + \"//\" +SAVE_DIR; \r\n\t \t\t System.out.println(savePath);\r\n\t\t\t\t\t\tCollection<Part>cp= request.getParts();\r\n\t \t String fileName = up.fileUpload(cp,appPath);\r\n\t \t System.out.println(fileName);\r\n\t \t \r\n\t \t request.setAttribute(\"message\", \"The file \"+fileName+\" has been uploaded successfully!\");\r\n\t \t RequestDispatcher dispatcher = request.getRequestDispatcher(\"success.jsp\");\r\n\t \t dispatcher.forward(request, response);\r\n\t}catch(Exception ex) {\r\n System.out.println(ex);\r\n }\r\n\t }", "@POST\r\n\t@Path(\"/publishimage\")\r\n\t@Consumes({ MediaType.MULTIPART_FORM_DATA })\r\n\tpublic Response uploadImageFile(@FormDataParam(\"file\") InputStream fileInputStream,\r\n\t\t\t@FormDataParam(\"file\") FormDataContentDisposition fileMetaData) throws Exception {\r\n\t\tString TEMP_PATH_ON_MAC = \"/tmp\";\r\n\t\twriteFileToServer(fileInputStream, fileMetaData, TEMP_PATH_ON_MAC);\r\n\t\treturn Response.ok().build();\r\n\t}", "@Override\n\tpublic void updateAvatar(CommonsMultipartFile fileUpload, String username) throws IOException {\n\t\tString savePath = imageConfiguration.getAvatarPackage(username);\n\t\tif (imageRepository.findImageNameByUsername(username) != null) {\n\t\t\tfileUpload.transferTo(new File(savePath));\n\t\t} else {\n\t\t\tUser user = findOne(username);\n\t\t\tImage image = new Image();\n\t\t\timage.setUser(user);\n\t\t\timage.setImageName(user.getUsername());\n\t\t\timage.setImageLocation(savePath);\n\t\t\timageService.create(image);\n\t\t\tfileUpload.transferTo(new File(savePath));\n\t\t}\n\t}", "@Test\n public void uploadTest() throws ApiException {\n String path = null;\n Integer devid = null;\n File file = null;\n api.upload(path, devid, file);\n\n // TODO: test validations\n }", "public void uploadTemp(FileUploadEvent event) {\n setFileImage(event.getFile());\n getSelected().setUrlImage(event.getFile().getFileName());\n RequestContext.getCurrentInstance().update(\"image\");\n\n }", "@RequestMapping(value = \"/upload\", method = RequestMethod.POST)\n // defining the upload\n public String uploadFile(@RequestParam(\"title\") String title,\n @RequestParam(\"description\") String description,\n @RequestParam(\"file\") MultipartFile file,\n @RequestParam(\"tags\") String tags,\n HttpSession session) throws IOException {\n\n User currUser = (User) session.getAttribute(\"currUser\");\n\n if(currUser == null ){\n return \"redirect:/\";\n }\n\n else {\n List<Tag> imageTags = findOrCreateTags(tags);\n // creating an id of the image\n Long imageId = createId();\n // uploading the image and converting it to a base64 encoded version of the image\n String uploadedImageData = convertUploadedFileToBase64(file);\n Image newImage = new Image(imageId, title, description, uploadedImageData, currUser, imageTags);\n // storing the new image\n imageService.save(newImage);\n // after upload is successful, redirect the user to the home page\n return \"redirect:/home\";\n }\n }", "private void saveFile(InputStream uploadedInputStream,\r\n String serverLocation) {\r\n \r\n try {\r\n OutputStream outpuStream = new FileOutputStream(new File(serverLocation));\r\n int read = 0;\r\n byte[] bytes = new byte[1024];\r\n \r\n outpuStream = new FileOutputStream(new File(serverLocation));\r\n while ((read = uploadedInputStream.read(bytes)) != -1) {\r\n outpuStream.write(bytes, 0, read);\r\n }\r\n outpuStream.flush();\r\n outpuStream.close();\r\n } catch (IOException e) {\r\n \r\n e.printStackTrace();\r\n }\r\n \r\n }", "public void moveFile(String url) throws IOException {\n\n\t\tSystem.out.println(\"folder_temp : \" + folder_temp);\n\t\tPath Source = Paths.get(folder_temp + url);\n\t\tPath Destination = Paths.get(folder_photo + url);\n\t\tSystem.out.println(\"folder_photo : \" + folder_photo);\n\n\t\tif (Files.exists(Source)) {\n\t\t\t// Files.move(Source, Destination,\n\t\t\t// StandardCopyOption.REPLACE_EXISTING);\n\t\t\t// cpie du fichiet au lieu de deplaacer car il est enn coiurs\n\t\t\t// d'utilisation\n\t\t\tFiles.copy(Source, Destination, StandardCopyOption.REPLACE_EXISTING);\n\t\t}\n\n\t}", "private void saveAndUpload(String name, String email, Uri photoUri){\n\n // TODO implement save to local DB\n // TODO implement safe upload to Server\n }", "@RequestMapping(value=\"/uploadBandsLogo/{bandsId}\", method=RequestMethod.POST)\n public @ResponseBody String uploadBandsLogo(@RequestParam(\"file\") MultipartFile file, @PathVariable String bandsId){\n String name = file.getOriginalFilename();\n if (!file.isEmpty()) {\n try {\n File dir = new File(\"uploads/bandsLogo/\"+bandsId);\n dir.mkdir();\n byte[] bytes = file.getBytes();\n BufferedOutputStream stream =\n new BufferedOutputStream(new FileOutputStream(new File(\"uploads/bandsLogo/\"+ bandsId + \"/\" + bandsId + \".png\" )));\n stream.write(bytes);\n stream.close();\n return \"You successfully uploaded \" + name + \" into \" + name + \"-uploaded !\";\n } catch (Exception e) {\n return \"You failed to upload \" + name + \" => \" + e.getMessage();\n }\n } else {\n return \"You failed to upload \" + name + \" because the file was empty.\";\n }\n }", "public void uploadFile(String path, String foldername)\n {\n try {\n InputStream in = new FileInputStream(path);\n FileMetadata metadata = client.files().uploadBuilder(foldername).uploadAndFinish(in);\n }\n catch (FileNotFoundException fne)\n {\n System.out.println(\"96 : FileNotFoundException Caused By \"+fne.getLocalizedMessage());\n }\n catch (IOException ioe)\n {\n System.out.println(\"100 : IOException Caused By \"+ioe.getLocalizedMessage());\n }\n catch (DbxException dbxe)\n {\n \n System.out.println(\"105 : DbxException Caused By \"+dbxe.getLocalizedMessage());\n }\n }", "public interface ImageUpload {\n void imageUploadToServer(int selectedImageResourceId);\n}", "void savePicturePath(String userName, String picturePath) throws DatabaseException;", "public void saveFile(Bitmap imageToSave, String folder) {\n File folderName = new File(Environment.\n getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), folder);\n\n if (!folderName.exists()) {\n Log.i(TAG, \"Folder doesn't exist, creating it...\");\n boolean rv = folderName.mkdir();\n Log.i(TAG, \"Folder creation \" + (rv ? \"success\" : \"failed\"));\n } else {\n Log.i(TAG, \"Folder already exists.\");\n }\n\n String captured = Global.currUser.email + \"Deja_\" + Global.imageNumber + \".jpg\";\n Global.imageNumber++;\n\n File file = new File(folderName, captured);\n\n try {\n FileOutputStream out = new FileOutputStream(file);\n imageToSave.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n\n Global.uploadImageQueue.add(file.getAbsolutePath());\n Log.d(TAG, \"filePath added: \" + file.getAbsolutePath());\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n scanSD(file);\n\n Log.d(TAG, \"+++++++\");\n }", "public static void uploadImage(String fileName) {\n EntityCreationPage.generalPanel.uploadPanel().sendKeys(System.getProperty(\"user.dir\") + \"/src/test/testData/\" + fileName);\n try {\n wait.until(ExpectedConditions.invisibilityOf(EntityCreationPage.uploadingMessage()));\n } catch (WebDriverException ignored) {\n }\n }", "public void upload(FileUploadEvent event){\n UploadedFile file = event.getFile();\n if(file != null){\n try {\n imagePic = new OracleSerialBlob(file.getContents());\n Long size = imagePic.length();\n putProfPic(imagePic);\n //setPhoto_profile(new ByteArrayContent(imagePic.getBytes(1, size.intValue())));\n } catch (SQLException ex) {\n LOG.error(ex);\n GBMessage.putErrorMessage(\"Error al subir el archivo\");\n } catch (IOException ex) {\n Logger.getLogger(StaffBean.class.getName()).log(Level.SEVERE, null, ex);\n }\n GBMessage.putInfoMessage(\"Carga correcta\");\n }\n }", "public void testPhotoUpload() throws Exception {\n LoginRequestTest.registerUser(\n getContext(),\n \"Tom\",\n LoginRequestTest.getUniqueEmail(),\n \"12345678\"\n );\n\n Place place = new Place();\n place.setId(6);\n\n //region Save picture\n Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.upload_image);\n File tempFile = null;\n try {\n tempFile = File.createTempFile(\"UPLOAD_TEST\", \".jpg\", getContext().getCacheDir());\n FileOutputStream out = new FileOutputStream(tempFile);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.close();\n } catch (IOException e) {\n Log.e(TAG, \"Image file could not be written.\", e);\n }\n //endregion\n\n assertNotNull(\"Temp file is null!\", tempFile);\n PhotoUploadRequest request = new PhotoUploadRequest(getContext(), place, tempFile);\n ResponseEntity<Picture> pictureResponseEntity = request.sendRequest();\n assertNotNull(\"No response entity received\", pictureResponseEntity);\n Picture picture = pictureResponseEntity.getBody();\n assertNotNull(\"Response entity has empty body\", picture);\n }", "private Path initFolder(String folder) throws IOException {\n return Files.createDirectory(Paths.get(uploadFolder + \"/\" + folder));\n }", "public String guardarImgPost(){\n \n File archivo=null;//Objeto para el manejo de os archivos\n InputStream in =null;//Objeto para el manejo del stream de datos del archivo\n //Se obtiene el codigo de usuario de la sesion actual\n String codUsuario=codUsuario=String.valueOf(new SessionLogica().obtenerUsuarioSession().getCodUsuario());\n //Se obtiene un codigo producto de la combinacion del codigo del usuario y de un numero aleatorio\n String codGenerado=new Utiles().generar(codUsuario);\n String extension=\"\";\n int i=0;\n //Extension del archivo ha subir\n extension=\".\"+FilenameUtils.getExtension(this.getObjImagen().getImagen().getFileName());\n \n \n try {\n //Pasa el buffer de datos en un array de bytes , finalmente lee cada uno de los bytes\n in=this.getObjImagen().getImagen().getInputstream();\n byte[] data=new byte[in.available()];\n in.read(data);\n \n //Crea un archivo en la ruta de publicacion\n archivo=new File(this.rutaImgPublicacion+codGenerado+extension);\n FileOutputStream out=new FileOutputStream(archivo);\n //Escribe los datos en el nuevo archivo creado\n out.write(data);\n \n System.out.println(\"Ruta de Path Absolute\");\n System.out.println(archivo.getAbsolutePath());\n \n //Cierra todas las conexiones\n in.close();\n out.flush();\n out.close();\n } catch (IOException ex) {\n System.out.println(ex.getMessage());\n return \"none.jpg\";\n }\n //Retorna el nombre de la iamgen almacenada\n return codGenerado+extension;\n }", "public void store_image(Images image) {\n\t\tir.save(image);\n\t}", "@RequestMapping(value = \"/marcas/images\", method = RequestMethod.POST, headers = (\"content-type=multipart/form-data\"))\n\tpublic ResponseEntity<byte[]> uploadImage(@RequestParam(\"id_marca\") Long idMarca,\n\t\t\t@RequestParam(\"file\") MultipartFile multipartFile, UriComponentsBuilder componentsBuilder) {\n\t\tif (idMarca == null) {\n\t\t\treturn new ResponseEntity(new CustomErrorType(\"IdMarca is required\"), HttpStatus.CONFLICT);\n\t\t}\n\t\tif (multipartFile.isEmpty()) {\n\t\t\treturn new ResponseEntity(new CustomErrorType(\"Please select a file to upload\"), HttpStatus.CONFLICT);\n\t\t}\n\t\tMarca marca = _marcaService.findById(idMarca);\n\t\tif (marca == null) {\n\t\t\treturn new ResponseEntity(new CustomErrorType(\"Marca con idMarca: \" + idMarca + \" not found\"),\n\t\t\t\t\tHttpStatus.CONFLICT);\n\t\t}\n\t\t/*\n\t\t * if (!marca.getLogo().isEmpty() || marca.getLogo() !=null ) {\n\t\t * //implementar metodos version final String filename =\n\t\t * marca.getLogo(); Path path = Path.get(filename); File f =\n\t\t * path.toFile(); if (f.exists()) { f.delete(); } }\n\t\t */\n\t\ttry {\n\t\t\tDate date = new Date();\n\t\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd-HH-mm-ss\");\n\t\t\tString dateName = dateFormat.format(date);\n\n\t\t\tString fileName = String.valueOf(idMarca) + \"-pictureMarca-\" + dateName + \".\"\n\t\t\t\t\t+ multipartFile.getContentType().split(\"/\")[1];\n\t\t\t// marca.setLogo(MARCA_UPLOADED_FOLDER + fileName); //implementar\n\t\t\t// metodos version final\n\t\t\tbyte[] bytes = multipartFile.getBytes();\n\t\t\tPath path = Paths.get(MARCA_UPLOADED_FOLDER + fileName);\n\t\t\tFiles.write(path, bytes);\n\n\t\t\t_marcaService.updateMarca(marca);\n\t\t\treturn ResponseEntity.ok().contentType(MediaType.IMAGE_JPEG).body(bytes);\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\te.printStackTrace();\n\t\t\treturn new ResponseEntity(\n\t\t\t\t\tnew CustomErrorType(\"Error during upload: \" + multipartFile.getOriginalFilename()),\n\t\t\t\t\tHttpStatus.CONFLICT);\n\t\t}\n\n\t}", "@PostMapping(\"/tasks/{id}/images\")\n public RedirectView addImages(@PathVariable UUID id, @RequestParam(value=\"file\")MultipartFile file){\n Task selectedTask = taskRepository.findById(id).get();\n List<String> pic = this.s3Client.uploadFile(file);\n //saving images and thumbImg\n selectedTask.setImages(pic.get(0));\n selectedTask.setThumbImg(pic.get(1));\n\n taskRepository.save(selectedTask);\n return new RedirectView(\"http://taskmaster1.s3-website-us-west-2.amazonaws.com/\");\n }", "public static String uploadPhoto(BufferedImage image) throws IOException {\n if (image == null) {\n throw new IOException(\"image was null\", new NullPointerException());\n }\n String publicLinkToPhoto = null;\n synchronized (singleton) {\n if (singleton.photoService == null) {\n throw new IOException(\"Could not authenticate with Picassa\");\n }\n\n singleton.baos.reset();\n ImageIO.write(image, \"png\", singleton.baos);\n MediaByteArraySource myMedia = new MediaByteArraySource(singleton.baos.toByteArray(), \"image/png\");\n\n PhotoEntry returnedPhoto;\n try {\n returnedPhoto = singleton.photoService.insert(singleton.pdfAlbumUrl, PhotoEntry.class, myMedia);\n } catch (ServiceException e) {\n e.printStackTrace();\n throw new IOException(\"Problem uploading photo\", e);\n }\n\n publicLinkToPhoto = returnedPhoto.getMediaThumbnails().get(0).getUrl();\n\n // scale it up to 800 px, which is the largest we can hotlink to\n publicLinkToPhoto = publicLinkToPhoto.replace(\"/s72/\", \"/s800/\").replace(\"/s144/\", \"/s800/\").replace(\"/s288/\", \"/s800/\");\n }\n return publicLinkToPhoto;\n }", "private String saveNewPhoto(byte[] photo,String sufix){\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\" + sufix + \".jpg\";\n \n \n File potlachBase = new File(\"src/main/webapp/photos\"); //Shit made\n potlachBase.mkdirs();\n\n File potlachImage = new File(potlachBase,imageFileName);\n\n\n OutputStream out = null;\n try {\n potlachImage.createNewFile();\n InputStream in = new ByteArrayInputStream(photo);\n out = new FileOutputStream(potlachImage);\n\n // Transfer bytes from in to out\n byte[] buf = new byte[1024];\n int len;\n while ((len = in.read(buf)) > 0) {\n out.write(buf, 0, len);\n }\n in.close();\n out.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return \"/photos/\"+imageFileName;\n\n\n\n\n }", "@PostMapping(path = \"/pictures\")\r\n public PictureResponse upload(@RequestHeader(\"api-key-token\") String key,\r\n @RequestParam(\"file\") MultipartFile file) {\r\n\r\n // TODO: move this to common location\r\n Authentication authentication = authenticationRepository.findByToken(key);\r\n User user = userRepository.findById(authentication.getUserId())\r\n .orElseThrow(\r\n () -> new IllegalArgumentException(\"User not found\"));\r\n\r\n return service.upload(file, user);\r\n }", "@PreAuthorize(\"hasAnyRole('ROLE_ADMIN','ROLE_CONTRIBUTOR')\")\r\n\t@CrossOrigin(origins=\"http://localhost:4200\")\r\n\t@RequestMapping(value=\"/image/upload/{idMangas:[0-9]+}\", method=RequestMethod.POST, produces=MediaType.APPLICATION_JSON_VALUE)\r\n\t@ResponseBody\r\n\tpublic Manga upload(@RequestParam(\"file\") MultipartFile file, @PathVariable(\"idMangas\") int idMangas){\n\t\tlog.info(\"File name: \" + file.getOriginalFilename());\r\n\t\tlog.info(\"File name: \" + file.getContentType());\r\n\t\t\r\n\t\ttry {\r\n\t\t\tImage img = new Image(0, file.getOriginalFilename(), file.getSize(), file.getContentType(), \"\", \"\");\r\n\t\t\timageDao.saveImageFile(img, file.getInputStream());\r\n\t\t\t// on save ensuite en bdd l image\r\n\t\t\timageDao.save(img);\r\n\t\t\t// puis on lie limage a mongas recup ds lurl\r\n\t\t\tManga m = mangasDao.findOne(idMangas);\r\n\t\t\tm.setImg(img);\r\n\t\t\treturn mangasDao.save(m);\r\n\t\t\t// return m;\r\n\t\t\t\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\tthrow new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, \"erreur lors de la sauvegarde\");\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {\r\n\r\n\t\tLOGGER.info(\"Upload action\");\r\n\t\tString description = request.getParameter(\"description\"); // Retrieves <input type=\"text\" name=\"description\">\r\n\t\tPart filePart = request.getPart(\"file\"); // Retrieves <input type=\"file\" name=\"file\">\r\n\t\tString fileName = Paths.get(filePart.getSubmittedFileName()).getFileName().toString(); // MSIE fix.\r\n\r\n\t\tHttpSession session = request.getSession();\r\n\t\tServletContext context = session.getServletContext();\r\n\t\tDAOFactory dao = (DAOFactory) context.getAttribute(\"DAOManager\");\r\n\t\tfinal String path = context.getRealPath(\"/images\");\r\n\t\tif (!description.equals(\"\")) {\r\n\t\t\tfileName = description;\r\n\t\t}\r\n\t\tString url = \"images/\" + fileName;\r\n\t\ttry (OutputStream outStream = new FileOutputStream(new File(path + File.separator + fileName));\r\n\t\t\t\tInputStream filecontent = filePart.getInputStream()) {\r\n\t\t\tint read = 0;\r\n\t\t\tfinal byte[] bytes = new byte[1024];\r\n\r\n\t\t\twhile ((read = filecontent.read(bytes)) != -1) {\r\n\t\t\t\toutStream.write(bytes, 0, read);\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tLOGGER.error(e.getMessage());\r\n\t\t\tsession.setAttribute(\"updateCarError\", \"Attempt to upload image failed.\");\r\n\t\t\treturn \"/frontController/cars\";\r\n\t\t}\r\n\t\tLOGGER.info(\"File uploaded successfully\");\r\n\r\n\t\tString id = request.getParameter(\"id\");\r\n\r\n\t\tCarService carService = new CarService(dao);\r\n\t\tCar car = carService.getCarById(Integer.parseInt(id));\r\n\t\tcar.setPhoto(url);\r\n\t\tInteger row = carService.updateCarPhoto(car);\r\n\t\tif (row == 1) {\r\n\t\t\tsession.setAttribute(\"UpdateCar\", \"You have successfully uploaded image.\");\r\n\t\t} else {\r\n\t\t\tsession.setAttribute(\"updateCarError\", \"Attempt to upload image failed.\");\r\n\t\t}\r\n\t\treturn \"/frontController/cars\";\r\n\t}", "private Integer uploadURL(URL url) {\n \t\ttry {\n \t\t\tString contentType = url.openConnection().getContentType();\n \t\t\tif (contentType == null || !contentType.startsWith(\"image/\")) {\n \t\t\t\treturn null;\n \t\t\t}\n \n \t\t\tString name = url.getPath().substring(1);\n \t\t\tif (contentType.contains(\"png\")) {\n \t\t\t\tname += \".png\";\n \t\t\t} else if (contentType.contains(\"jpg\")\n \t\t\t\t\t|| contentType.contains(\"jpeg\")) {\n \t\t\t\tname += \".jpg\";\n \t\t\t} else if (contentType.contains(\"gif\")) {\n \t\t\t\tname += \".gif\";\n \t\t\t}\n \n\t\t\treturn apiFactory.getFileAPI().uploadImage(url, name);\n \t\t} catch (IOException e) {\n \t\t\te.printStackTrace();\n \n \t\t\treturn null;\n \t\t}\n \t}", "public void upload(View view) {\n new Thread() {\n @Override\n public void run() {\n String url = \"http://124.71.115.4/FlyMonitor/servlet/upload\";\n// String filename = \"evo.jpg\";\n String filename = \"tonghuazhen.mp3\";\n // external=/storage/emulated/0\n String path = \"/mnt/sdcard/\" + filename;\n try {\n HttpEngine.upload(url, path, filename);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }.start();\n\n }", "@Override\n public boolean transferFile (MultipartFile file, String tag, String resultFilename) {\n try {\n file.transferTo(new File(Constans.UPLOADPATH + \"/\" + tag + \"/\" + resultFilename));\n }catch (IOException e){\n e.printStackTrace();\n return false;\n }\n return true;\n }", "public void createRecipeImage(FileUploadEvent event) {\r\n Image newImage = new Image();\r\n String destination = FacesContext.getCurrentInstance().getExternalContext().getRealPath(\"/\");\r\n String getParam = qm.get(\"recipeId\");\r\n Integer recipeID = Integer.parseInt(getParam);\r\n this.recipe = recipesEJB.findRecipe(recipeID);\r\n File file = new File(destination+\"uploads\"+File.separator+\"recipe\"+File.separator+recipeID);\r\n String abspath = file.getAbsolutePath()+ File.separator;\r\n if(!file.exists()){\r\n if(file.mkdirs());\r\n }\r\n //new name of the image\r\n List <Image> recipeImages = this.recipe.getImageGallery();\r\n Integer count = recipeImages.size();\r\n\r\n if(this.recipe.getImageGallery().get(0).getImagePath().equalsIgnoreCase(\"/resources/images/recipe_placeholder.png\") && count == 1){\r\n imageEJB.removeImage(this.recipe.getImageGallery().get(0));\r\n this.recipe.getImageGallery().remove(0);\r\n }else {\r\n count++;\r\n }\r\n String newImageName;\r\n if (event.getFile().getContentType().equalsIgnoreCase(\"image/jpeg\")) {\r\n newImageName = count + \".jpeg\";\r\n } else if (event.getFile().getContentType().equalsIgnoreCase(\"image/gif\")) {\r\n newImageName = count + \".gif\";\r\n } else {\r\n newImageName = count + \".png\";\r\n }\r\n // Do what you want with the file \r\n String newImagePath = \"/uploads/recipe/\"+recipeID+\"/\"+newImageName;\r\n try {\r\n copyFile(abspath,newImageName, event.getFile().getInputstream()); \r\n newImage = this.imageEJB.createImage(newImage);\r\n newImage.setCaption(\"This is the \"+this.recipe.getRecipeName()+\"'s recipe picture.\");\r\n newImage.setDescription(newImageName);\r\n newImage.setRecipe(this.recipe);\r\n newImage.setImagePath(newImagePath);\r\n newImage.setImageName(newImageName);\r\n newImage = this.imageEJB.editImage(newImage);\r\n this.recipe.getImageGallery().add(newImage);\r\n this.recipe = recipesEJB.editRecipe(recipe);\r\n FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Success!\", \"Your image was uploaded successfully.\"));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "public void copyImageFile() throws IOException {\n Path sourcePath = imageFile.toPath();\n\n String selectFileName = imageFile.getName();\n\n Path targetPath = Paths.get(\"/Users/houumeume/IdeaProjects/Assignment2/image/\" + selectFileName);\n\n //copy the file to the new directory\n Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);\n\n //update the imageFile to point to the new File\n imageFile = new File(targetPath.toString());\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n\nthrows ServletException, IOException {\n\nresponse.setContentType(\"text/html;charset=UTF-8\");\n\ntry (PrintWriter out = response.getWriter()) {\n\n// this tyr is created by me for the connection of database\n\ntry {\n\n// this is the path provide by me to save the image\n\nString savePath = \"C:\\\\Users\\\\Ratnesh Pandey\\\\eclipse-workspace\\\\kw\\\\WebContent\\\\images\" + File.separator + SAVE_DIR;\n\n/*in place of C: you can place a path where you need to save the image*/\n\n// this comment will pickup the image file and have convert it into file type\n\nFile fileSaveDir = new File(savePath);\n\nif (!fileSaveDir.exists()) {\n\nfileSaveDir.mkdir();\n\n}\n\n// this two comment will take the name and image form web page\n\nString userid= request.getParameter(\"userid\");\nString Heading= request.getParameter(\"Heading\");\nString content = request.getParameter(\"content\");\nPart part = request.getPart(\"file\");\n\n// this comment will extract the file name of image\n\nString fileName = extractFileName(part);\n\n// this will print the image name and user provide name\n\n/*out.println(fileName);\n\nout.println(\"\\n\" + userid);*/\n\n/*if you may have more than one files with same name then you can calculate\n\nsome random characters and append that characters in fileName so that it will\n\nmake your each image name identical.*/\n\npart.write(savePath + File.separator + fileName);\n\n/*\n\nYou need this loop if you submitted more than one file\n\nfor (Part part : request.getParts()) {\n\nString fileName = extractFileName(part);\n\npart.write(savePath + File.separator + fileName);\n\n}*/\n\n// connection to database\n\nClass.forName(\"com.mysql.jdbc.Driver\");\n\nConnection con = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/users\", \"root\", \"speedoflightis3x108\");\n\n// query to insert name and image name\n\nString query = \"INSERT INTO users.contribution(userid,Heading,content,photourl) values (?, ?, ?, ?)\";\n\nPreparedStatement pst;\n\npst = con.prepareStatement(query);\n\npst.setString(1, userid);\npst.setString(2, Heading);\npst.setString(3, content);\n\nString filePath = savePath + File.separator + fileName;\n\npst.setString(4, filePath);\n\npst.executeUpdate();\nresponse.sendRedirect(\"Home(ak).jsp\");\n\n} catch (Exception ex) {\n\nout.println(\"error\" + ex);\n\n}\n\n}\n\n}", "public ImageSendingClient(File imageFolder, String serverAddress, int serverPort)\n\t{\n\t\tthis.imageFolder = imageFolder;\n\t\tthis.serverAddress = serverAddress;\n\t\tthis.serverPort = serverPort;\n\t}", "private static String copyImageToDesired(String pathToImage, String imageName) {\n File oldFile = new File(RhoFileApi.absolutePath(pathToImage));\n File mediafile = new File(RhoFileApi.getDbFilesPath(), imageName);\n\n if (oldFile.getAbsolutePath().equalsIgnoreCase(mediafile.getAbsolutePath())) {\n return RhoFileApi.absolutePath(pathToImage);\n }\n\n InputStream finput= null;\n FileOutputStream fout = null;\n try {\n finput= RhoFileApi.open(pathToImage);\n fout = new FileOutputStream(mediafile);\n byte[] b = new byte[1024];\n int read = 0;\n while ((read = finput.read(b)) != -1) {\n fout.write(b, 0, read);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if(finput != null){\n try {\n finput.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n if(fout != null){\n try {\n fout.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return mediafile.getAbsolutePath();\n }", "protected void doPost(HttpServletRequest request, HttpServletResponse response)\n\t throws ServletException, IOException {\n\t\t \n\t boolean isMultipart = ServletFileUpload.isMultipartContent(request);\n\t \n\t if (isMultipart) {\n\t \t// Create a factory for disk-based file items\n\t \tFileItemFactory factory = new DiskFileItemFactory();\n \n\t \t// Create a new file upload handler\n\t \tServletFileUpload upload = new ServletFileUpload(factory);\n\t \tString uploadpath=\"c:/nice/uploads\";\n\t \tFile path = new File(uploadpath);\n\t \t String fileName = \"\";\n\t try {\n\t \t// Parse the request\n\t \t/* FileItem */\n\t \tList items = upload.parseRequest(request);\n\t Iterator iterator = items.iterator();\n\t while (iterator.hasNext()) {\n\t FileItem item = (FileItem) iterator.next();\n\t if (!item.isFormField()) {\n\t fileName = item.getName();\t \n\t // String root = getServletContext().getRealPath(\"/\");\n\t // File path = new File(root + \"/uploads\");\n\t //File path = new File(\"c:/uploads\");\n\t if (!path.exists()) {\n\t \t\n\t boolean status = path.mkdirs();\n\t System.out.println(\"Status \" +status);\n\t \n\t }\n\t \n\t File uploadedFile = new File(path + \"/\" + fileName);\n\t \n\t System.out.println(uploadedFile.getAbsolutePath());\n\t item.write(uploadedFile);\n\t \n\t \n\t \n\t \n\t }\n\t }\n\t \n\t \n\t \n\t \n\t } catch (FileUploadException e) {\n\t e.printStackTrace();\n\t } catch (Exception e) {\n\t e.printStackTrace();\n\t }\n\t \n\t }\n\t \n\t \n\t String message=\"Image uploaded Sucessfully\";\n\t RequestDispatcher rd = getServletContext().getRequestDispatcher(\"/fileupload.jsp?message=\" +message);\n\t rd.forward(request, response);\n\t }", "public void uploadImage(View v) {\n // When Image is selected from Gallery\n if (imgPath != null && !imgPath.isEmpty()) {\n prgDialog.setMessage(\"Converting Image to Binary Data\");\n prgDialog.show();\n // Convert image to String using Base64\n encodeImagetoString();\n // When Image is not selected from Gallery\n } else {\n Toast.makeText(\n getApplicationContext(),\n \"You must select image from gallery before you try to upload\",\n Toast.LENGTH_LONG).show();\n }\n }", "@Override\n\tpublic void run() {\n\t\ttry {\n\t\t\tuploadCurrentImage();\n\t\t} catch (IOException | InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t//Call function from client with the Image URL\n\t}", "public void setUploadPicture(String absolutePath) throws InterruptedException {\n URL url = getClass().getClassLoader().getResource(absolutePath);\n File file = null;\n try {\n file = new File(url.toURI());\n } catch (URISyntaxException e) {\n e.printStackTrace();\n }\n getDriver().findElement(uploadPicture).sendKeys(file.getAbsolutePath());\n Times.waitFor(2000);\n }" ]
[ "0.6989364", "0.6806271", "0.6651486", "0.6580909", "0.6518106", "0.64446867", "0.6151171", "0.61338073", "0.6107572", "0.6032557", "0.59963065", "0.59941196", "0.5979538", "0.59428626", "0.59329724", "0.5932128", "0.5883253", "0.58826727", "0.5876087", "0.5831183", "0.57764304", "0.57703024", "0.5769576", "0.57528025", "0.5747111", "0.574575", "0.5723804", "0.57019156", "0.5701795", "0.56950307", "0.56885046", "0.5663852", "0.5660613", "0.56545967", "0.5613534", "0.5600833", "0.5599351", "0.55964506", "0.5569755", "0.5568312", "0.55640376", "0.5543566", "0.5540958", "0.5537528", "0.5528807", "0.55278665", "0.55237216", "0.5519283", "0.5514116", "0.55086833", "0.5504583", "0.5499507", "0.5482118", "0.5479628", "0.54785526", "0.54777557", "0.5470189", "0.546914", "0.54668325", "0.54374176", "0.5436309", "0.5433656", "0.541492", "0.541445", "0.54101133", "0.53992355", "0.53943616", "0.5389021", "0.5382498", "0.53688085", "0.5365324", "0.53597003", "0.53509384", "0.5349329", "0.534584", "0.53400654", "0.53374845", "0.53281736", "0.5319694", "0.53148574", "0.5308249", "0.5308135", "0.52985865", "0.5289477", "0.5288547", "0.5275006", "0.52642447", "0.5259", "0.5256731", "0.5250104", "0.52466494", "0.52349037", "0.5234454", "0.5233062", "0.52329624", "0.523078", "0.5216866", "0.5216165", "0.52103424", "0.5207272", "0.5201429" ]
0.0
-1
Upload video To Specific Folder On Server
public static String uploadVideo(String fileName, String serverUri, String serverFolderUploads) { HttpURLConnection connection = null; DataOutputStream outputStream = null; String pathToOurFile = fileName; String urlServer = serverUri; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; String charset = "UTF-8"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; try { File f = new File(pathToOurFile); FileInputStream fileInputStream = new FileInputStream(f); URL url = new URL(urlServer); connection = (HttpURLConnection) url.openConnection(); // Allow Inputs & Outputs connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); pathToOurFile = UUID.randomUUID().toString() + ".mp4"; // Enable POST method connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("ENCTYPE", "multipart/form-data"); connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); outputStream = new DataOutputStream(connection.getOutputStream()); outputStream.writeBytes(twoHyphens + boundary + lineEnd); outputStream.writeBytes(("Content-Disposition: form-data; name=\"" + serverFolderUploads + "\"" + "; filename=\"" + pathToOurFile + "\"" + lineEnd)); outputStream.writeBytes(lineEnd); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); // buffer = new byte[bufferSize]; buffer = null;//FileUtils.readFileToByteArray(f); @#$^@%^@$%^@$%&@$%&@$&&&&&&^%%%%%%%@##############@@@@@@@@@@@@@@ // ****************************************************************************************************** /* * byte byt[]=new byte[bufferSize]; fileInputStream.read(byt); * * bytesRead = fileInputStream.read(buffer, 0, bufferSize); * * outputStream.write(buffer, 0, bufferSize); */ // Read file bytesRead = fileInputStream.read(buffer, 0, bufferSize); try { while (bytesRead > 0) { outputStream.write(buffer, 0, bytesRead); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } } catch (Exception e) { Log.e("Uploading Video:::", e.getMessage()); e.printStackTrace(); } outputStream.writeBytes(lineEnd); outputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); // Responses from the server (code and message) int serverResponseCode = connection.getResponseCode(); Log.e("serverResponseCode:::", String.valueOf(serverResponseCode)); String serverResponseMessage = connection.getResponseMessage(); Log.e("serverResponseMessage:", serverResponseMessage); fileInputStream.close(); outputStream.flush(); outputStream.close(); if (serverResponseCode == 200 && serverResponseMessage.equals("OK")) return pathToOurFile; else return ""; } catch (Exception e) { Log.e("Uploading Video:::", e.getMessage()); e.printStackTrace(); return ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void uploadvideo(View view) {\n Helper.hideSoftKeyboard(getActivity());\n //getting name for the image\n String name = hashtag.getText().toString().trim();\n\n //getting the actual path of the image\n //Uploading code\n try {\n String uploadId = UUID.randomUUID().toString();\n uploadReceiver.setDelegate(this);\n uploadReceiver.setUploadID(uploadId);\n //Creating a multi part request\n new MultipartUploadRequest(this, uploadId, Constants.UPLOAD_VIDEO)\n .addFileToUpload(file, \"file\") //Adding file\n .addParameter(\"category_id\", category_id) //Adding text parameter to the request//Adding text parameter to the request\n .addParameter(\"name\", name) //Adding text parameter to the request\n .addHeader(\"Authorization\", token)\n .setNotificationConfig(new UploadNotificationConfig())\n .setMaxRetries(2)\n .startUpload(); //Starting the upload\n showToast(view);\n } catch (Exception exc) {\n\n }\n }", "@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tnew UploadVideo().execute(videoPath);\n\t\t\t\t\t}", "void uploadingFolder(String remoteFolder);", "void folderUploaded(String remoteFolder);", "default void uploadVideo() {\r\n\t\tSystem.out.println(\"upload the video\");\r\n\t}", "public static String uploadImage(Bitmap bitmap, String serverUri,\n String serverFolderUploads) {\n\n HttpURLConnection connection = null;\n DataOutputStream outputStream = null;\n\n String urlServer = serverUri;\n String lineEnd = \"\\r\\n\";\n String twoHyphens = \"--\";\n String boundary = \"*****\";\n String charset = \"UTF-8\";\n String videoName;\n byte[] buffer;\n try {\n\n URL url = new URL(urlServer);\n connection = (HttpURLConnection) url.openConnection();\n\n // Allow Inputs & Outputs\n connection.setDoInput(true);\n connection.setDoOutput(true);\n connection.setUseCaches(false);\n\n videoName = UUID.randomUUID().toString() + \".mp4\";\n\n // Enable POST method\n connection.setRequestMethod(\"POST\");\n connection.setRequestProperty(\"Connection\", \"Keep-Alive\");\n connection.setRequestProperty(\"Accept-Charset\", charset);\n connection.setRequestProperty(\"ENCTYPE\", \"multipart/form-data\");\n connection.setRequestProperty(\"Content-Type\",\n \"multipart/form-data;boundary=\" + boundary);\n\n outputStream = new DataOutputStream(connection.getOutputStream());\n outputStream.writeBytes(twoHyphens + boundary + lineEnd);\n outputStream.writeBytes(\"Content-Disposition: form-data; name=\\\"\"\n + serverFolderUploads + \"\\\"\" + \"; filename=\\\"\" + videoName\n + \"\\\"\" + lineEnd);\n outputStream.writeBytes(lineEnd);\n\n buffer = ConvertBitMapToByteArray(bitmap);\n try {\n outputStream.write(buffer, 0, (int) getSizeInBytes(bitmap));\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n outputStream.writeBytes(lineEnd);\n outputStream.writeBytes(twoHyphens + boundary + twoHyphens\n + lineEnd);\n\n // Responses from the server (code and message)\n int serverResponseCode = connection.getResponseCode();\n String serverResponseMessage = connection.getResponseMessage();\n outputStream.flush();\n outputStream.close();\n if (serverResponseCode == 200 && serverResponseMessage.equals(\"OK\"))\n return videoName;\n else\n return \"\";\n } catch (Exception e) {\n e.printStackTrace();\n return \"\";\n }\n }", "private File getOutputMediaFile(int type) {\n File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), \"NDS videos\");\n\n\n // Create the storage directory(MyCameraVideo) if it does not exist\n if (!mediaStorageDir.exists()) {\n\n if (!mediaStorageDir.mkdirs()) {\n\n //output.setText(\"Failed to create directory MyCameraVideo.\");\n\n Toast.makeText(Suggestion_box_suggest.this, \"Failed to create directory Boo_videos.\",\n Toast.LENGTH_LONG).show();\n\n Log.d(\"MyCameraVideo\", \"Failed to create directory Boo_videos.\");\n return null;\n }\n }\n\n// For unique file name appending current timeStamp with file name\n java.util.Date date = new java.util.Date();\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\")\n .format(date.getTime());\n\n File mediaFile;\n\n if (type == MEDIA_TYPE_VIDEO) {\n\n // For unique video file name appending current timeStamp with file name\n String filename_video = \"NDS_video_\" + timeStamp + \".mp4\";\n videoFileName = filename_video;\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n filename_video);\n final String path_0 = Environment.getExternalStorageDirectory() + File.separator\n + \"NDS videos/\" + filename_video;\n String filename_to_up = path_0.substring(path_0.lastIndexOf(\"/\") + 1);\n //addCaptionToSuggestionMedia(path_0, filename_to_up, \"video\", MYRemoteId, (editText.getTag().toString().isEmpty()) ? \"0\" : editText.getTag().toString());\n //addCaptionToSuggestionMedia(path_0, filename_to_up, \"audio\", MYRemoteId, (editText.getTag().toString().isEmpty()) ? \"0\" : editText.getTag().toString());\n path_000 = path_0;\n filename_000 = filename_to_up;\n myRemoteId_000 = MYRemoteId;\n SuggestionBoxId_000 = (editText.getTag().toString().isEmpty()) ? \"0\" : editText.getTag().toString();\n//-------0--------------------------the video send--\n mediaType_000 = \"video\";\n image_tag.setVisibility(View.GONE);\n video_tag.setVisibility(View.VISIBLE);\n audio_tag.setVisibility(View.GONE);\n textSuggestion.setVisibility(View.GONE);\n video_tag.setTag(filename_to_up);\n String videoFile = path_0;\n Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail(videoFile,\n MediaStore.Images.Thumbnails.FULL_SCREEN_KIND);\n//BitmapDrawable bitmapDrawable = new BitmapDrawable(thumbnail);\n // edixt_image_video.setImageBitmap(thumbnail);\n edixt_image_video.setVideoURI(Uri.parse(path_0));\n\n edixt_image_video.seekTo(100);\n///-------------\n edixt_image_video.setTag(path_0);\n///-------------\n edixt_image_video.setTag(path_0);\n//----\n edixt_image_video.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n\n }\n });\n edixt_image_video.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(path_0));\n intent.setDataAndType(Uri.parse(path_000), \"video/mp4\");\n startActivity(intent);\n\n return false;\n }\n });\n\n//------------0000000000000000000000000000000000000000000-dufhhhhhhhhhhhhhhhhhhhhh\n\n //-------------------\n\n } else {\n return null;\n }\n\n return mediaFile;\n }", "private void createVideoFolder() {\n File movieFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);\n mVideoFolder = new File(movieFile, \"Camera2_Video_Image\");\n //check to see if the folder is already created\n if (!mVideoFolder.exists()) {\n mVideoFolder.mkdirs();\n\n }\n\n }", "public File createVideoFolder() {\n// File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n// Environment.DIRECTORY_MOVIES + File.separator), \"RokidCameraVideo\");\n// mVideoFolder = mediaStorageDir;\n\n File movieFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);\n File mVideoFolder = new File(movieFile, \"Camera\");\n\n if (!mVideoFolder.exists()) {\n mVideoFolder.mkdirs();\n }\n\n return mVideoFolder;\n }", "@Override\n public void onClick(View v) {\n Intent it = new Intent(Intent.ACTION_VIEW);\n Uri uri = Uri.parse(\"http://\"+ PostUrl.Media+\":8080/upload/\"+item.getMediaPath().get(0).split(\"\\\\.\")[0]+\".mp4\");\n it.setDataAndType(uri, \"video/mp4\");\n context.startActivity(it);\n\n }", "Path fileToUpload();", "public void setVideo(File video){\n\t\tthis.video = video;\n\t}", "@Override\n protected Void doInBackground(String... name) {\n\n String rootDir = Environment.getExternalStorageDirectory()\n + File.separator + \"Video\";\n File rootFile = new File(rootDir);\n\n File file = new File(Environment.getExternalStorageDirectory() + File.separator + \"test.mp4\");\n try {\n file.createNewFile();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try {\n\n //downloadAndSaveFile(\"220.247.244.22\", 21, \"Chamal\", \"Chamal\", \"C:\\\\Users\\\\Administrator\\\\Desktop\\\\raw\", file);\n downloadAndSaveFile(\"220.247.244.22\", 21, \"Chamal\", \"Chamal\", \"\\\\\" + name[0], file);\n\n //downloadAndSaveFile(\"192.168.0.199\", 21, \"user02\", \"user1234\", \"D:\\\\Season 01\\\\The Simpsons S01E01 480p HDTV x265 - BrB.mkv\", file);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "public static UploadResultDto video(MultipartFile file, String uuid, HttpServletRequest request)\r\n\t\t\tthrows IOException {\n\t\tUploadResultDto dto = new UploadResultDto();\r\n\t\t// 1、允许的扩展名\r\n\t\tList<String> allowedExt = new ArrayList<String>();\r\n\t\tallowedExt.add(\".mp4\");\r\n\t\t// 2、最大上传文件2G\r\n\t\tLong maxSize = 2l * 1024 * 1024 * 1024;\r\n\r\n\t\t// 3、文件基本信息\r\n\t\tString originalFileName = file.getOriginalFilename();\r\n\t\tInteger fileType = FileTypeMap.VIDEO;\r\n\t\tLong fileSize = file.getSize();\r\n\t\tString fileExt = FileUtil.getExt(originalFileName);\r\n\t\tString fileName = UUID.randomUUID() + fileExt;\r\n\t\tInputStream is = file.getInputStream();\r\n\r\n\t\tdto.setOriginalFileName(originalFileName);\r\n\t\tdto.setFileType(fileType);\r\n\t\tdto.setFileExt(fileExt);\r\n\t\tdto.setFileSize(fileSize);\r\n\t\tdto.setFileName(fileName);\r\n\r\n\t\t// 4.验证\r\n\t\tBaseResult<Object> baseResult1 = FileUtil.isAllowedExt(fileExt, allowedExt);\r\n\t\tif (!baseResult1.getResult()) {\r\n\t\t\tdto.setResult(false);\r\n\t\t\tdto.setMessage(baseResult1.getMessage());\r\n\t\t\treturn dto;\r\n\t\t}\r\n\r\n\t\tBaseResult<Object> baseResult2 = FileUtil.isExceedingInSize(fileSize, maxSize);\r\n\t\tif (!baseResult2.getResult()) {\r\n\t\t\tdto.setResult(false);\r\n\t\t\tdto.setMessage(baseResult2.getMessage());\r\n\t\t\treturn dto;\r\n\t\t}\r\n\r\n\t\t// 5.设置视频总大小\r\n\t\tHttpSession session = request.getSession();\r\n\t\tsession.setAttribute(uuid + \"totalBytes\", fileSize);\r\n\t\tsession.setAttribute(uuid + \"transferredBytes\", 0);\r\n\t\t// 6.上传\r\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"/yyyy/MM/dd\");\r\n\t\tString yyyyMMdd = sdf.format(new Date());\r\n\t\tString filenameUUID = UUID.randomUUID().toString().replaceAll(\"-\", \"\");\r\n\t\tString savePath = \"/video\" + yyyyMMdd + \"/\" + filenameUUID + fileExt;\r\n\t\tString rootPath = PropertiesUtil.getProperty(\"app.upload.rootPath\");\r\n\t\tlogger.info(\"savePath:\" + savePath);\r\n\t\tlogger.info(\"imageRootPath:\" + rootPath);\r\n\t\tdto = FileUploader.saveVideoByInputStream(is, savePath, rootPath, uuid, request);\r\n\t\treturn dto;\r\n\t}", "public void upload(View view) {\n new Thread() {\n @Override\n public void run() {\n String url = \"http://124.71.115.4/FlyMonitor/servlet/upload\";\n// String filename = \"evo.jpg\";\n String filename = \"tonghuazhen.mp3\";\n // external=/storage/emulated/0\n String path = \"/mnt/sdcard/\" + filename;\n try {\n HttpEngine.upload(url, path, filename);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }.start();\n\n }", "void uploadingFile(String path);", "public void run() {\n\n\n if (videoFile != null) {\n //\n // Add Image to Photos Gallery\n //\n //final Uri uri = addMediaToGallery(mInscribedVideoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //final Uri uri = addMediaToGallery(videoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //Log.e(TAG, \"uri--->\" + uri.getPath());\n\n //\n // Create a media bean and set the copyright for server flags\n //\n String media_id = \"\";\n try {\n media_id = copyrightJsonObject.getString(\"media_id\");\n copyrightJsonObject.put(\"applyCopyrightOnServer\", 1);\n copyrightJsonObject.put(\"device_id\", SessionManager.getInstance().getDevice_id());\n copyrightJsonObject.put(\"device_type\", Common.DEVICE_TYPE);\n } catch (JSONException e) {\n // this shouldn't occur\n Log.e(TAG, \"JSONException trying to get media_id from copyright!\");\n }\n String mediaName = ImageUtils.getInstance()\n .getImageNameFromPath(videoFile.getAbsolutePath());\n GalleryBean media = new GalleryBean(videoFile.getAbsolutePath(),\n mediaName,\n \"video\",\n media_id,\n false,\n thumbnail,\n GalleryBean.GalleryType.NOT_SYNC);\n media.setDeviceId(SessionManager.getInstance().getDevice_id());\n media.setDeviceType(Common.DEVICE_TYPE);\n String mediaNamePrefix = mediaName.substring(0,\n mediaName.lastIndexOf('.'));\n media.setMediaNamePrefix(mediaNamePrefix);\n media.setMediaThumbBitmap(thumbnail);\n media.setLocalMediaPath(videoFile.getAbsolutePath());\n Date date = new Date();\n media.setMediaDate(date.getTime());\n //String mimeType = getContentResolver().getType(uri);\n media.setMimeType(\"video/mp4\"); // must be set for Amazon.\n media.setCopyright(copyrightJsonObject.toString());\n\n MemreasTransferModel transferModel = new MemreasTransferModel(\n media);\n transferModel.setType(MemreasTransferModel.Type.UPLOAD);\n QueueAdapter.getInstance().getSelectedTransferModelQueue()\n .add(transferModel);\n\n // Start the service if it's not running...\n startQueueService();\n } else {\n //\n // Show Toast error occurred here...\n //\n videoFile.delete();\n }\n\n }", "public static void uploadFile(HttpServletRequest request, MultipartFile file, String code) \r\n\t{\n\t\tREAL_PAIH=request.getSession().getServletContext().getRealPath(\"/assets/images/\");\r\n\t\t\r\n\t\tlogger.info(REAL_PAIH);\r\n\t\t\r\n\t\t//to make sure all directory exists\r\n\t\t//create new directory hmmmm\r\n\t\t\r\n\t\tif(!new File(ABS_PAIH).exists())\r\n\t\t{\r\n\t\t\t//create the directories\t\t\t\r\n\t\t\tnew File(ABS_PAIH).mkdirs();\r\n\t\t}\r\n\t\t\r\n\t\tif(!new File(REAL_PAIH).exists())\r\n\t\t{\r\n\t\t\t//create the directories\t\t\t\r\n\t\t\tnew File(REAL_PAIH).mkdirs();\r\n\t\t}\r\n\t\t\r\n\t\ttry\r\n\t\t{\r\n\t\t //server upload\r\n\t\t\tfile.transferTo(new File(REAL_PAIH + code + \".jpg\"));\r\n\t\t\t\r\n\t\t\t//project directory upload\r\n\t\t\tfile.transferTo(new File(ABS_PAIH + code + \".jpg\"));\r\n\r\n\t\t\t\r\n\t\t}catch(IOException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "private void initVideoPath() {\n File file = new File(Environment.getExternalStorageDirectory(),\n \"/Pictures/QQ/pandavideo_cut.mp4\");\n String videoPath = file.getAbsolutePath();\n\n// Toast.makeText(this,\"文件是否存在\"+file.exists(),Toast.LENGTH_LONG).show();\n Toast.makeText(this,\"文件路径\"+videoPath,Toast.LENGTH_LONG).show();\n mVideoView.setVideoPath(videoPath);\n mVideoView.start();\n\n }", "@SuppressLint(\"SimpleDateFormat\")\n public static File createVideoFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = VIDEO_FILE_PREFIX + timeStamp + MP4_FILE_SUFFIX;\n String nameAlbum = Environment.getExternalStorageDirectory().getAbsolutePath() + \"/\" + nameDir;// getString(R.string.app_name);\n File albumF = new File(nameAlbum);\n if (!albumF.exists()) {\n albumF.mkdirs();\n File noMedia = new File(albumF, \".nomedia\");\n noMedia.createNewFile();\n }\n\n File imageF = new File(albumF, imageFileName);\n imageF.createNewFile();\n return imageF;\n }", "@Override\n public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {\n Uri downloadUrl = taskSnapshot.getUploadSessionUri();\n\n //Toast.makeText(c, downloadUrl.toString(), Toast.LENGTH_LONG).show();\n onProgressOperation.onFinished(\"Upload complete!\", \"Video has been successfully uploaded\");\n\n }", "public void playVideo() {\n \t\t try {\n \t\t\t videoView.setOnPreparedListener(new OnPreparedListener() {\n \n \t\t\t\t @Override\n \t\t\t\t public void onPrepared(MediaPlayer mp) {\n \t\t\t\t\t mp.setLooping(true); \n \t\t\t\t }\n \t\t\t });\n \t\t\t videoView.setVideoPath(SAVE_PATH);\n \t\t\t videoView.start();\n \t\t } catch (Exception e) {\n \t\t\t Log.e(\"Video\", \"error: \" + e.getMessage(), e);\n \t\t }\n \t }", "public static void uploadFile(HttpServletRequest request, MultipartFile file, String code) {\n\t\tREAL_PATH = request.getSession().getServletContext().getRealPath(\"/assets/images/\");\n\t\t\n\t\tlogger.info(REAL_PATH);\n\t\t\n\t\tif (!new File(REAL_PATH).exists()) {\n\t\t\tnew File(REAL_PATH).mkdirs();\n\t\t}\n\t\tif (!new File(ABSOLUTE_PATH).exists()) {\n\t\t\tnew File(ABSOLUTE_PATH).mkdirs();\n\t\t}\n\t\t\n\t\ttry {\n\t\t\t// uploading ... project directory upload\n\t\t\tfile.transferTo(new File(ABSOLUTE_PATH + code + \".jpg\"));\n\t\t\t\n\t\t\t// uploading ... for the server\n\t\t\tfile.transferTo(new File(REAL_PATH + code + \".jpg\"));\n\t\t} catch (IOException e) {\n\t\t\t\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\t\tif (resultCode == Activity.RESULT_OK)\n\t\t{\n\tif (requestCode==100)\n\t{ \n\n\t\tif (data.hasExtra(\"video_path\"))\n\t\t{\n\t\t\tToast.makeText(getApplicationContext(), \"returned extra\", Toast.LENGTH_LONG).show();\n\t\t\tvideoPath=data.getStringExtra(\"video_path\");\n\t\t\tfinish();\n\t\t\t\n\t\t\t\n\t\t\t new Thread(new Runnable() {\n\t public void run() {\n\t \tuploadFilePath= videoPath.substring(videoPath.indexOf(\"/\"), videoPath.lastIndexOf(\"/\")+1); \n\t \t uploadFileName=videoPath.substring(videoPath.lastIndexOf(\"/\")+1);\n\t \n\t runOnUiThread(new Runnable() {\n\t\t\t\t\t\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\t//\tnew Upload_Img_VID_File(uploadFileName).execute(uploadFilePath + \"\" + uploadFileName);\n\t\t\t\t\t\tnew UploadVideo().execute(videoPath);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\n\t \n\t }\n\t }).start(); \n\t\t\t \n\t\t}\n\t\telse\n\t\t{\n\t\t\tfinish();\n\t\t\tToast.makeText(getApplicationContext(), \"no Extra\", Toast.LENGTH_LONG).show();\n\t\t\n\t\t\n\t\t}\n\t\t\n\t\t}\n\n\telse{\n\t\tfinish();\n\t\tToast.makeText(getApplicationContext(), \"error in request code\", Toast.LENGTH_LONG).show();\n\t\t\n\t}\n\t\n\t\t}\n\t\telse\n\t\t{\n\t\tToast.makeText(getApplicationContext(), \"erroe\", Toast.LENGTH_LONG).show();\t\n\t\t}\n\t\t\n\t\t\n\t}", "public static String uploadImage(final String pat,String area, String subarea, String cat ,\n String subcat, String userid, String comtext,String url) {\n Log.d(\"all_data\", \"\" + \"\\n\" + comtext + \"\\n\" + \"\\n\" );\n String res = null;\n try {\n StrictPolicy();\n File sourceFile = new File(pat);\n\n// FileBody pic = new FileBody(new File(sourceImageFile));\n if (sourceFile.exists()) {\n Log.d(\"img\", \"present\");\n// DecodeFile(sourceFile);\n } else {\n Log.d(\"img\", \"Not present\");\n }\n Log.d(\"TAG\", \"File...::::\" + sourceFile + \" : \" + sourceFile.exists());\n\n\n final MediaType MEDIA_TYPE_VDO = MediaType.parse(\"video/*\");\n String filename = pat.substring(pat.lastIndexOf(\"/\") + 1);\n\n\n RequestBody requestBody;\n requestBody = new MultipartBody.Builder()\n .setType(MultipartBody.FORM)\n\n .addFormDataPart(\"video\", filename, RequestBody.create(MEDIA_TYPE_VDO, sourceFile)).setType(MultipartBody.FORM)\n .setType(MultipartBody.FORM)\n .addFormDataPart(\"area_id\", area)\n .addFormDataPart(\"area_sub_id\", subarea)\n .addFormDataPart(\"cat_id\", cat)\n .addFormDataPart(\"cat_sub_id\", subcat)\n .addFormDataPart(\"user_id\",userid)\n .addFormDataPart(\"com_text\",comtext)\n .addFormDataPart(\"com_type\",\"confidential\")\n .build();\n\n Request request = new Request.Builder()\n .url(url)\n .post(requestBody)\n .build();\n OkHttpClient client = new OkHttpClient();\n Response response = client.newCall(request).execute();\n res = response.body().string();\n return res;\n } catch (UnknownHostException | UnsupportedEncodingException e) {\n Log.e(\"TAG\", \"Error: \" + e.getLocalizedMessage());\n } catch (Exception e) {\n Log.e(\"TAG\", \"Other Error: \" + e.getLocalizedMessage());\n }\n return res;\n }", "public void shareVideo(View view) {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);\n } else {\n // Permission has already been granted\n Intent intent2 = new Intent(Intent.ACTION_PICK,\n android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);\n intent2.putExtra(\"sender\", \"share_pic\");\n\n startActivityForResult(intent2, ACTIVITY_SELECT_VIDEO);\n }\n }", "public void saveAndTransferVideoComplexObs(){\n\n try{\n List<Encounter> encounters = Context.getEncounterService().getEncounters(null, null, null, null, null, null, true);\n Encounter lastEncounter = encounters.get(encounters.size()-1);\n\n Person patient = lastEncounter.getPatient();\n ConceptComplex conceptComplex = Context.getConceptService().getConceptComplex(14);\n Location location = Context.getLocationService().getDefaultLocation();\n Obs obs = new Obs(patient, conceptComplex, new Date(), location) ;\n\n String mergedUrl = tempMergedVideoFile.getCanonicalPath();\n InputStream out1 = new FileInputStream(new File(mergedUrl));\n\n ComplexData complexData = new ComplexData(\"mergedFile1.flv\", out1);\n obs.setComplexData(complexData);\n obs.setEncounter(lastEncounter);\n\n Context.getObsService().saveObs(obs, null);\n tempMergedVideoFile.delete();\n\n }catch (Exception e){\n log.error(e);\n }\n }", "public interface AddVideoServes {\n @Multipart\n @POST(\"servletc/AddVideoServlet\")\n Call<String> upload(\n @Part(\"userId\") String id,\n @Part MultipartBody.Part file);\n @POST(\"servletc/AddVideoPlayNumber\")\n Call<String> addVideoPlayNumber(@Query(\"videoId\") int id);\n}", "protected void saveVideo(final Uri uriVideo) {\n\n // click the video to save it\n mVideoView.setOnTouchListener(new View.OnTouchListener() {\n\n public boolean onTouch(View v, MotionEvent event) {\n\n boolean success = false;\n\n // make the directory\n File vidDir = new File(android.os.Environment.getExternalStoragePublicDirectory\n (Environment.DIRECTORY_MOVIES) + File.separator + \"Saved iCute Videos\");\n vidDir.mkdirs();\n // create unique identifier\n Random generator = new Random();\n int n = 100;\n n = generator.nextInt(n);\n // create file name\n String videoName = \"Video_\" + n + \".mp4\";\n File fileVideo = new File(vidDir.getAbsolutePath(), videoName);\n\n try {\n fileVideo.createNewFile();\n success = true;\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n if (success) {\n Toast.makeText(getApplicationContext(), \"Video saved!\",\n Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(getApplicationContext(),\n \"Error during video saving\", Toast.LENGTH_LONG).show();\n }\n\n return true;\n }\n });\n }", "public java.lang.CharSequence upload(java.lang.String appId, java.lang.String url, long duration, java.lang.String file) throws android.os.RemoteException;", "@RequestMapping(value=\"/editVideo/{username}\", method=RequestMethod.PUT)\n\tpublic String EditVideoPut(@Valid @ModelAttribute Upload upload, @PathVariable(\"username\") String username, BindingResult result, ModelMap model) throws IOException {\n\t\tif(upload.getVideo() != null)\n\t\t{\n\t\t\tFileCopyUtils.copy(upload.getVideo().getBytes(), new File(UPLOAD_LOCATION + upload.getVideo().getOriginalFilename())); \n\t\t}\n\t\t//Update video in database\n\t\tuploadService.updateVideo(upload, username);\n\t\treturn \"editSuccess\";\n\t}", "@Override\n public void onSuccess(Location location) {\n createVideo(location);\n }", "@Override\n public void onSuccess(Location location) {\n createVideo(location);\n }", "private void uploadFile(Uri uri, String messageType) {\n DatabaseReference databaseReference = rootReference.child(NodeNames.MESSAGES).child(currentUserId).child(chatUserId).push();\n String pushId = databaseReference.getKey();\n\n StorageReference storageReference = FirebaseStorage.getInstance().getReference();\n String folderName = messageType.equals(Constants.MESSAGE_TYPE_VIDEO)?Constants.MESSAGE_VIDEOS:Constants.MESSAGE_IMAGES;\n String fileName = messageType.equals(Constants.MESSAGE_TYPE_VIDEO)?pushId+\".mp4\":pushId+\".jpg\";\n\n StorageReference fileReference = storageReference.child(folderName).child(fileName);\n UploadTask uploadTask = fileReference.putFile(uri);\n uploadProgress(uploadTask, fileReference, pushId, messageType);\n }", "public void recordVideo() {\n\n }", "public void verVideo(View v) {\n ViewVideo.setVideoURI(Uri.parse(getExternalFilesDir(null) + \"/\" + txtNombreArchivo.getText().toString()));\n /*Ejecutamos el video*/\n ViewVideo.start();\n }", "@RequestMapping(value=VideoSvcApi.VIDEO_SVC_PATH, method=RequestMethod.POST)\n\tpublic Video addVideo(Video v) {\n\t\t// TODONE Implement the logic to store the meta data.\n\t\tassert(v != null);\n\t\tv = mVideoRepository.save(v);\n\t\t\n\t\tassert(v != null);\n\t\t// TODO Fix filename & path\n\t\tv.setDataUrl(getUrlBaseForLocalServer() \n\t\t\t\t+ VideoSvcApi.VIDEO_DATA_PATH.replace(\n\t\t\t\t\t\t\"{\" + VideoSvcApi.ID_PARAMETER + \"}\",\n\t\t\t\t\t\t\"\" + v.getId()));\n\t\t\n\t\treturn v;\n\t}", "@Override\n protected Void doInBackground(String... strings) {\n FTPClient client = new FTPClient();\n try {\n client.connect(\"ftp.earwormfix.com\", 21);\n client.login(\"XXXX\", \"XXXXX\"); // TODO: change when testing- leave no whitespace!!\n\n client.sendNoOp(); //used so server timeout exception will not rise\n int reply = client.getReplyCode();\n if(!FTPReply.isPositiveCompletion(reply)){\n client.disconnect();\n Log.e(TAG,\"FTP server refuse connection Code- \"+ reply);\n this.taskListener.onFinished(false);\n cancel(true);\n }\n client.enterLocalPassiveMode();//Switch to passive mode\n client.setFileType(FTP.BINARY_FILE_TYPE, FTP.BINARY_FILE_TYPE);\n client.setFileTransferMode(FTP.BINARY_FILE_TYPE);\n String remoteFile = \"post/\"+strings[1] +\n File.separator +\n strings[0].substring(strings[0].lastIndexOf(File.separator)+1);\n File videoFile = new File(strings[0]);\n InputStream inputStream = new FileInputStream(videoFile);\n\n Log.i(TAG,\"storing...\");\n boolean stored = client.storeFile(remoteFile, inputStream);\n if (stored) {\n Log.i(TAG,\"Done!!!\");\n }\n else{\n Log.e(TAG,\"Failed to send ftp \"+ reply);\n this.taskListener.onFinished(false);\n inputStream.close();\n client.logout();\n cancel(true);\n }\n inputStream.close();\n //logout will close the connection\n client.logout();\n } catch (IOException e) {\n e.printStackTrace();\n this.taskListener.onFinished(false);\n cancel(true);\n }\n return null;\n }", "private void onPlayVideoClick() {\n Intent intent = new Intent(Intent.ACTION_VIEW);\n intent.setDataAndType(Uri.parse(\"file://\" + mediaPath), \"video/mp4\");\n startActivity(intent);\n }", "private void fileUpload(HttpServletRequest request, HttpServletResponse response) {\n\t \ttry {\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * String appPath = request.getServletContext().getRealPath(\"\");\r\n\t\t\t\t\t * System.out.println(appPath); String savePath = appPath + File.separator +\r\n\t\t\t\t\t * SAVE_DIR; System.out.println(savePath);\r\n\t\t\t\t\t */\r\n\t \t\t\r\n\t \t\t//String appPath = getServletContext().getRealPath(SAVE_DIR);\r\n\t \t\tSystem.out.println(appPath);\r\n\t \t\t String savePath = appPath + \"//\" +SAVE_DIR; \r\n\t \t\t System.out.println(savePath);\r\n\t\t\t\t\t\tCollection<Part>cp= request.getParts();\r\n\t \t String fileName = up.fileUpload(cp,appPath);\r\n\t \t System.out.println(fileName);\r\n\t \t \r\n\t \t request.setAttribute(\"message\", \"The file \"+fileName+\" has been uploaded successfully!\");\r\n\t \t RequestDispatcher dispatcher = request.getRequestDispatcher(\"success.jsp\");\r\n\t \t dispatcher.forward(request, response);\r\n\t}catch(Exception ex) {\r\n System.out.println(ex);\r\n }\r\n\t }", "Builder addVideo(String value);", "private void addFilesInRequestEntity(MultipartEntity reqEntity, String keyForUploadFile, String filePath) {\n System.out.println(\"RestClient: FilePath \" + filePath);\n if (filePath != null && !\"\".equals(filePath)) {\n File file = new File(filePath);\n System.out.println(\"RestClient: File \" + file);\n FileBody fileBodyVideo = new FileBody(file);\n reqEntity.addPart(keyForUploadFile, fileBodyVideo);\n }\n }", "void fileUploaded(String path);", "private File createVideoFile() throws IOException {\n Date d = new Date();\n String nameDate = new SimpleDateFormat(\"ddMMyyyy_HHmmss\").format(d);\n this.date = new SimpleDateFormat(\"dd/MM/yyyy\").format(d);\n this.time = nameDate.substring(9,13);\n String videoFileName = \"MP4_\" + nameDate + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n videoFileName, /* prefix */\n \".mp4\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentVideoPath = image.getAbsolutePath();\n return image;\n }", "private void launchVideoFile(File videoFile){\n String dstPath = (Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DOWNLOADS) + \"/\" + videoFile.getName());\n File dstFile = new File(dstPath);\n if (dstFile.exists()){\n Uri path = Uri.fromFile(dstFile);\n Intent objIntent = new Intent(Intent.ACTION_VIEW);\n objIntent.setDataAndType(path, \"video/*\");\n objIntent.setFlags(Intent. FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(objIntent);//Starting the video viewer\n } else {\n Toast.makeText(this, \"Error: This file does not exist.\",\n Toast.LENGTH_SHORT).show();\n }\n }", "@Test\n public void uploadBadUrlVideo() {\n Video video = new Video(\"Cool video\", \"www.y.com\", 212);\n Response response = target.request(MediaType.APPLICATION_JSON)\n .post(Entity.entity(video, MediaType.APPLICATION_JSON));\n\n assertThat(response.getStatus(), is(Status.BAD_REQUEST.getStatusCode()));\n\n }", "private void searchLocalFiles(TwitchVideoInfo videoInfo) {\n if (videoInfo.getState().equals(INITIAL)) {\n File playlist = new File(playlistFolderPath + videoInfo.getId() + \".m3u\");\n if (playlist.exists() && playlist.isFile() && playlist.canRead()) {\n videoInfo.setMainRelatedFileOnDisk(playlist);\n videoInfo.putRelatedFile(\"playlist\", playlist);\n\n try {\n InputStream is = new FileInputStream(playlist);\n Scanner sc = new Scanner(is);\n int i = 0;\n while (sc.hasNextLine()) {\n String line = sc.nextLine();\n File file = new File(line);\n if (file.exists()) {\n i++;\n String key = String.format(\"playlist_item_%04d\", i);\n videoInfo.putRelatedFile(key, file);\n }\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n videoInfo.setState(DOWNLOADED);\n }\n\n ffmpegFileListFile = new File(playlistFolderPath + videoInfo.getId() + \".ffmpeglist\");\n if (ffmpegFileListFile.exists()) {\n videoInfo.putRelatedFile(\"ffmpegFileListFile\", ffmpegFileListFile);\n }\n\n File mp4Video = getVideoFile(videoInfo, true);\n\n if (mp4Video.exists() && mp4Video.isFile() && mp4Video.canRead()) {\n videoInfo.setMainRelatedFileOnDisk(mp4Video);\n videoInfo.putRelatedFile(\"mp4Video\", mp4Video);\n videoInfo.setState(CONVERTED);\n }\n }\n }", "@View(\"upload\")\n @Post(consumes = MediaType.MULTIPART_FORM_DATA)\n public HttpResponse upload(@Body CompletedFileUpload file) {\n Drive drive = null;\n try {\n drive = googleDriveAccessor.accessGoogleDrive();\n } catch (IOException e) {\n // Catch down below\n }\n\n if(drive == null) {\n return HttpResponse.serverError(CollectionUtils.mapOf(RSP_SERVER_ERROR_KEY,\n \"Unable to access Google Drive\"));\n }\n\n if ((file.getFilename() == null || file.getFilename().equals(\"\"))) {\n return HttpResponse.badRequest(CollectionUtils.mapOf(RSP_ERROR_KEY, \"Required file\"));\n }\n\n if(directoryKey == null) {\n return HttpResponse.serverError(CollectionUtils.mapOf(RSP_SERVER_ERROR_KEY,\n \"Directory key error, please contact admin\"));\n }\n\n JsonNode dirNode = null;\n try {\n dirNode = new ObjectMapper().readTree(this.getClass().getResourceAsStream(DIRECTORY_FILE_PATH));\n } catch (IOException e) {\n return HttpResponse.serverError(CollectionUtils.mapOf(RSP_SERVER_ERROR_KEY,\n \"Configuration error, please contact admin\"));\n }\n\n String parentId = dirNode.get(directoryKey) != null ? dirNode.get(directoryKey).asText() : null;\n if(parentId == null) {\n return HttpResponse.serverError(CollectionUtils.mapOf(RSP_SERVER_ERROR_KEY,\n \"Configuration error, please contact admin\"));\n }\n\n File fileMetadata = new File();\n fileMetadata.setName(file.getFilename());\n fileMetadata.setMimeType(file.getContentType().orElse(MediaType.APPLICATION_OCTET_STREAM_TYPE).toString());\n fileMetadata.setParents(List.of(parentId));\n\n InputStreamContent content;\n try {\n content = new InputStreamContent(fileMetadata.getMimeType(), file.getInputStream());\n } catch (IOException e) {\n return HttpResponse.badRequest(CollectionUtils.mapOf(RSP_ERROR_KEY,\n String.format(\"Unexpected error processing %s\", file.getFilename())));\n }\n\n try {\n drive.files().create(fileMetadata, content).setFields(\"parents\").execute();\n } catch (IOException e) {\n return HttpResponse.serverError(CollectionUtils.mapOf(RSP_SERVER_ERROR_KEY,\n \"Unable to upload file to Google Drive\"));\n }\n\n return HttpResponse.ok(CollectionUtils.mapOf(RSP_COMPLETE_MESSAGE_KEY,\n String.format(\"The file %s was uploaded\", file.getFilename())));\n }", "private void uploadFromUri(final Uri fileUri, final String videoname , final String link) {\n\n final StorageReference photoRef = mStorageRef.child(videoname\n + \".\" + getFileExtension(fileUri));\n\n uploadTask=photoRef.putFile(fileUri);\n\n uploadTask.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {\n @Override\n public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {\n if (isCancelled)\n return;\n showProgressNotification(\"Uploading\",\n taskSnapshot.getBytesTransferred(),\n taskSnapshot.getTotalByteCount());\n }\n })\n .continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {\n @Override\n public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {\n // Forward any exceptions\n if (!task.isSuccessful()) {\n throw task.getException();\n }\n\n Log.d(TAG, \"uploadFromUri: upload success\");\n\n // Request the public download URL\n return photoRef.getDownloadUrl();\n }\n })\n .addOnSuccessListener(new OnSuccessListener<Uri>() {\n @Override\n public void onSuccess(@NonNull final Uri downloadUri) {\n // Upload succeeded\n Log.d(TAG, \"uploadFromUri: getDownloadUri success\");\n\n // [START_EXCLUDE]\n broadcastUploadFinished(downloadUri, fileUri);\n showUploadFinishedNotification(downloadUri, fileUri);\n taskCompleted();\n // [END_EXCLUDE]\n\n //[META_DATA TO DATABASE]\n\n\n StorageReference reference =FirebaseStorage.getInstance().getReference(\"videosThumnails\").child(videoname+\".jpg\");\n reference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {\n @Override\n public void onSuccess(Uri uri) {\n\n Map<String,Object> videoMetaData= new HashMap<>();\n videoMetaData.put(\"videoName\",videoname);\n videoMetaData.put(\"thumbnail\",uri.toString());\n videoMetaData.put(\"videoUrl\",downloadUri.toString());\n videoMetaData.put(\"time\", FieldValue.serverTimestamp());\n\n mDatabaseRef.collection(\"VideoMetadata\").document(videoname)\n .set(videoMetaData);\n//\n }\n });\n\n\n\n Toast.makeText(getApplicationContext(), \"Upload Complete\", Toast.LENGTH_SHORT).show();\n\n }\n }).addOnCanceledListener(new OnCanceledListener() {\n @Override\n public void onCanceled() {\n\n dismissProgressNotification();\n stopSelf();\n }\n });\n\n }", "public void setVideo(String video) {\n this.video = video;\n }", "public void playVideo() {\n }", "@Override\n\tvoid postarVideo() {\n\n\t}", "public void uploadMultipart() {\n //getting the actual path of the image\n String path = getPath(filePath);\n\n //Uploading code\n try {\n String uploadId = UUID.randomUUID().toString();\n\n //Creating a multi part request\n new MultipartUploadRequest(this, uploadId, \"todo\")\n .addFileToUpload(path, \"image\") //Adding file\n .setNotificationConfig(new UploadNotificationConfig())\n .setMaxRetries(2)\n .startUpload(); //Starting the upload\n\n } catch (Exception exc) {\n Toast.makeText(this, exc.getMessage(), Toast.LENGTH_SHORT).show();\n }\n }", "private Result uploadFile(StoryModel storyModel) {\n if (isStopped())\n return Result.failure();\n\n\n String storyId = storyModel.get_id();\n if (storyModel.getType() != null && storyModel.getType().equals(\"image\")) {\n\n sendStartStatus(\"image\", storyModel.get_id());\n\n NotificationsManager.getInstance().showUpDownNotification(getApplicationContext(),\n storyModel.get_id(),\n storyModel.getUserId());\n if (uploadImageFile(storyModel.getFile())) {\n return Result.success();\n } else {\n if (compositeDisposable.isDisposed()) {\n sendErrorStatus(\"image\", storyId);\n }\n return Result.retry();\n }\n } else if (storyModel.getType() != null && storyModel.getType().equals(\"video\")) {\n\n sendStartStatus(\"video\", storyModel.get_id());\n\n NotificationsManager.getInstance().showUpDownNotification(getApplicationContext(),\n storyModel.get_id(),\n storyModel.getUserId());\n if (uploadVideoFile(storyModel.getFile())) {\n return Result.success();\n } else {\n if (compositeDisposable.isDisposed()) {\n sendErrorStatus(\"video\", storyId);\n }\n return Result.retry();\n }\n } else {\n return Result.failure();\n }\n }", "@Override\n\t\t\tpublic void onCompletion(MediaPlayer mp) {\n\t\t\t\tmyVideo.setVideoPath(file);\n\t\t\t\tmyVideo.start();\n\t\t\t}", "@Override\n public void onServerStart(String videoStreamUrl)\n {\n\n\n\n Log.d(\"Activity\",\"URL: \"+ videoStreamUrl);\n\n\n video = (VideoView)findViewById(R.id.video);\n\n Uri uri = Uri.parse(videoStreamUrl);\n video.setVideoURI(uri);\n video.start();\n\n\n\n }", "private void uploadToServer(String filePath, String title) {\n APIClient apiClient = new APIClient();\n Retrofit retrofit = apiClient.getApiClient();\n ApiInterface apiInterface = retrofit.create(ApiInterface.class);\n File file = new File(filePath);\n\n MultipartBody.Part filePart =\n MultipartBody.Part.createFormData(\"file\", title+\".jpg\", //file.getName(),\n RequestBody.create(MediaType.parse(\"image/*\"), file));\n\n\n Call call = apiInterface.uploadImage(filePart);\n call.enqueue(new Callback() {\n @Override\n public void onResponse(Call call, Response response) {\n Toast.makeText(AddPost.this, \"Worked\",Toast.LENGTH_SHORT).show();\n }\n @Override\n public void onFailure(Call call, Throwable t) {\n t.printStackTrace();\n Toast.makeText(AddPost.this, \"Didn't work\",Toast.LENGTH_SHORT).show();\n }\n });\n }", "int uploadSavi(File file, String project, DataDate date, DataDate updated) throws IOException, SQLException;", "private boolean saveFile(ClientInterface client, MyTubeFile file){\n try{\n byte[] content = client.readFile(file.getFilename());\n String savepath = uploadsPath+\"/\"+Integer.toString(file.getId());\n new File(savepath).mkdir();\n savepath += \"/\"+ file.getFilename();\n\n try (FileOutputStream fos = new FileOutputStream(savepath)) {\n fos.write(content);\n return true;\n }\n }catch(IOException e){\n return false;\n }\n }", "Builder addVideo(VideoObject value);", "public void downloadVideo(Context context, VideoView videoView){\n \t\t this.videoView = videoView;\n \t\t download = new DownloadVideo(context, SAVE_PATH);\n \t\t download.execute();\n \t }", "@PostMapping(\"/upload\")\n public String handleFileUpload(@RequestParam MultipartFile file) throws IOException {\n final Path uploadDestination = Paths.get(\"C:\\\\uploads\").resolve(file.getName());\n\n file.transferTo(uploadDestination);\n return \"redirect:/\";\n }", "protected String doInBackground(String... paths) {\n int count = paths.length;\n Log.d(LaunchActivity.TAG, \"ASHISH\");\n String uri = null;\n if (count != 1) {\n Log.wtf(LaunchActivity.TAG, \"count should have been 1\");\n }\n for (int i = 0; i < count; i++) {\n try {\n uri = Utils.uploadVideo(paths[i]);\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n publishProgress(true);\n }\n return uri;\n }", "@SuppressLint(\"SimpleDateFormat\")\n public static File createVideoFile3gp() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = VIDEO_FILE_PREFIX + timeStamp + F3GP_FILE_SUFFIX;\n String nameAlbum = Environment.getExternalStorageDirectory().getAbsolutePath() + \"/\" + nameDir;// getString(R.string.app_name);\n File albumF = new File(nameAlbum);\n if (!albumF.exists()) {\n albumF.mkdirs();\n File noMedia = new File(albumF, \".nomedia\");\n noMedia.createNewFile();\n }\n\n File imageF = new File(albumF, imageFileName);\n imageF.createNewFile();\n return imageF;\n }", "public abstract void addSentVideo(Video video) throws UnsuportedOperationException;", "public abstract void addSentVideo(Video video) throws UnsuportedOperationException;", "public abstract void share(String content, Uri imageOrVideo);", "@Override\n public void run() {\n setupRemoteVideo(uid);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data)\n {\n //\"/storage/emulated/0/IRON-HID/captures\" <== can open~!!\n //\"file:///mnt/sdcard/Download/20141025_170314.jpg\"\n if (requestCode == CHOOSE_FILE_TO_UPLOAD)\n {\n if (resultCode == RESULT_OK)\n {\n Uri uri = data.getData();\n if (uri != null)\n {\n // Send file\n String filePath = uri.getPath();\n filePath = filePath.replace(\"file://\", \"\");\n mPutCommand += \" \" + filePath;\n mCommandManager.SendCommand(mPutCommand);\n }\n }\n }\n\n super.onActivityResult(requestCode, resultCode, data);\n }", "@Test\n public void uploadTest() throws ApiException {\n String path = null;\n Integer devid = null;\n File file = null;\n api.upload(path, devid, file);\n\n // TODO: test validations\n }", "public void setFileTransferServer(String serverUrl);", "public MentorConnectRequestCompose addVideo()\n\t{\n\t\tmentorConnectRequestObjects.videoButton.click();\n\t\tmentorConnectRequestObjects.videoURLField.sendKeys(mentorConnectRequestObjects.videoURL);\n\t\tmentorConnectRequestObjects.postVideoButton.click();\n\t\treturn new MentorConnectRequestCompose(driver);\n\t}", "public void startVideoRecording() {\n\n try {\n mVideoFileTest = createVideoFile(mVideoFolder);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // set up Recorder\n try {\n setupMediaRecorder();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // prepare for recording\n sendVideoRecordingRequest();\n\n // start recording\n mMediaRecorder.start();\n\n if (mRokidCameraRecordingListener != null) {\n mRokidCameraRecordingListener.onRokidCameraRecordingStarted();\n }\n }", "public void setupDrive(){\n // Place Dove/ into base of drive\n new File(drv.toString() + File.separator + folderName).mkdir();\n //upload preset content if required\n isSetup = true;\n }", "public void grabarVideo(View v) {\n Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);\n /*Creamos un archivo que contendra el video, mandanto el path (null es para indicar que no\n va en un directorio interno, solo en la raiz) ---- nombre del video*/\n /*RECORDAR QUE ESTE ARCHIVO QUEDA EN LA CARPETA ANDROID, EN LA CARPETA CON EL NOMBRE DEL\n * PAQUETE DEL PROYECTO, ESA ES LA RAIZ*/\n File video = new File(getExternalFilesDir(null), txtNombreArchivo.getText().toString());\n /*Mandamos el permiso para almacenar, y la ruta del video donde quedara*/\n intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(video));\n /*Ejecutamos la actividad*/\n startActivity(intent);\n }", "public synchronized void upload(){\n\t}", "@Test\n public void uploadWrongDurationVideo() {\n Video video = new Video(\"Cool video\", \"www.youtube.com\", 0);\n Response response = target.request(MediaType.APPLICATION_JSON)\n .post(Entity.entity(video, MediaType.APPLICATION_JSON));\n\n assertThat(response.getStatus(), is(Status.BAD_REQUEST.getStatusCode()));\n\n }", "public void setUpVideo() {\n\n videosViewPager.setVisibility(VISIBLE);\n StorageReference filePath = storageReference.child(\"images\").child(new ArrayList<>(videos.keySet()).get(position));\n filePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {\n @Override\n public void onSuccess(Uri uri) {\n videosViewPager.setVideoURI(uri);\n videosViewPager.setMediaController(mediaController);\n mediaController.setAnchorView(videosViewPager);\n videosViewPager.requestFocus();\n }\n });\n //String videoPath = \"android.resource://\"+activity.getPackageName()+\"/\";\n //Uri uri = Uri.parse(videoPath);\n\n// DisplayMetrics displayMetrics = new DisplayMetrics();\n// activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);\n// int height = displayMetrics.heightPixels;\n// int width = displayMetrics.widthPixels;\n//\n//\n// videosViewPager.setMinimumHeight(height);\n// videosViewPager.setMinimumWidth(width);\n// videosViewPager.setVideoURI(uri);\n// videosViewPager.setMediaController(mediaController);\n// mediaController.setAnchorView(videosViewPager);\n// videosViewPager.requestFocus();\n //videosViewPager.start();\n\n\n\n }", "@Override\n public void onSubmit(EasyVideoPlayer player, Uri source) {\n }", "private void addFilesInRequestEntity(MultipartEntity reqEntity) {\n if (filePath_image != null && filePath_image.length > 0) {\n\n for (int i = 0; i < filePath_image.length; i++) {\n if (filePath_image[i] != null) {\n File file = new File(filePath_image[i]);\n\n FileBody fileBodyVideo = new FileBody(file);\n reqEntity.addPart(keyForUploadFileImage + i, fileBodyVideo);\n System.out.println(keyForUploadFileImage + i + \" RestClient: File \" + file);\n }\n }\n }\n if (filePath_video != null && filePath_video.length() > 0) {\n File file = new File(filePath_video);\n\n FileBody fileBodyVideo = new FileBody(file);\n reqEntity.addPart(keyForUploadFileVideo, fileBodyVideo);\n System.out.println(keyForUploadFileVideo + \" RestClient: File \" + file);\n }\n }", "default void setVideoPath(@Nullable String path) {\n setVideoUri(TextUtils.isEmpty(path) ? null : Uri.parse(path));\n }", "OutputStream receiveUpload(String filename, String mimeType);", "public void uploadFile(String path, String foldername)\n {\n try {\n InputStream in = new FileInputStream(path);\n FileMetadata metadata = client.files().uploadBuilder(foldername).uploadAndFinish(in);\n }\n catch (FileNotFoundException fne)\n {\n System.out.println(\"96 : FileNotFoundException Caused By \"+fne.getLocalizedMessage());\n }\n catch (IOException ioe)\n {\n System.out.println(\"100 : IOException Caused By \"+ioe.getLocalizedMessage());\n }\n catch (DbxException dbxe)\n {\n \n System.out.println(\"105 : DbxException Caused By \"+dbxe.getLocalizedMessage());\n }\n }", "@RequestMapping(value = \"/singleUpload\", method = RequestMethod.POST)\r\n\tpublic @ResponseBody boolean test(HttpServletRequest request,\r\n\t\t\t@RequestParam(\"file\") CommonsMultipartFile singleUploadFile) {\r\n\t\tboolean status = false;\r\n\t\tSystem.out.println(\"////// Inside there\");\r\n\r\n\t\tSystem.out.println(\"////// Inside there reh\" + singleUploadFile.getOriginalFilename());\r\n\r\n\t\tString fileName[] = singleUploadFile.getOriginalFilename().split(\"_\");\r\n\t\tString folderName = fileName[0];\r\n\t\t\r\n\t\t/*\r\n\t\t * try { ServletContext context = request.getServletContext(); String\r\n\t\t * uploadPath = context.getRealPath(\"/\" + folderName); File uploadDir =\r\n\t\t * new File(uploadPath); if (!uploadDir.exists()) { boolean success =\r\n\t\t * uploadDir.mkdir();\r\n\t\t * \r\n\t\t * if (success) { success = (new File(uploadDir + \"/\" +\r\n\t\t * subFolderName)).mkdir(); }\r\n\t\t * \r\n\t\t * } String path = uploadDir + \"/\" + subFolderName + \"/\" +fileName[2];\r\n\t\t * System.out.println(\"Path is\" + path); File serverFile = new\r\n\t\t * File(path); BufferedOutputStream stream = new\r\n\t\t * BufferedOutputStream(new FileOutputStream(serverFile));\r\n\t\t * stream.write(singleUploadFile.getBytes()); stream.close(); url =\r\n\t\t * folderName+\"_\"+subFolderName+\"_\"+fileName[2];\r\n\t\t * \r\n\t\t * }\r\n\t\t */ \r\n\t\ttry {\r\n\t\t\tServletContext context = request.getServletContext();\r\n\t\t\tString uploadPath = context.getRealPath(\"/\" + folderName);\r\n\t\t\tFile uploadDir = new File(uploadPath);\r\n\t\t\tif (!uploadDir.exists()) {\r\n\t\t\t\tboolean success = uploadDir.mkdir();\r\n\t\t\t\tif (success) {\r\n\t\t\t\t\tsuccess = (new File(uploadDir + \"/temp\")).mkdir();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tString path = uploadDir + \"/temp/\" + fileName[1];\r\n\t\t\tSystem.out.println(\"Path is\" + path);\r\n\t\t\tFile serverFile = new File(path);\r\n\t\t\tBufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));\r\n\t\t\tstream.write(singleUploadFile.getBytes());\r\n\t\t\tstatus = true;\r\n\t\t\tstream.close();\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\tAdminResponseClass adminResponseClass = new AdminResponseClass();\r\n\t\tadminResponseClass.setStatus(status);\r\n\t\treturn adminResponseClass.isStatus();\r\n\t}", "void folderCreated(String remoteFolder);", "public static void copy(String suffix) {\r\n boolean success = false;\r\n boolean doVideo = true;\r\n String imgSrcDir = zipDir0 + \"/R\";\r\n String videoSrcDir = zipDir0 + \"/Video\";\r\n String imgDstDir = rImagesDir0 + \"/Images\" + suffix;\r\n String videoDstDir = rVideoDir0 + \"/Video\" + suffix;\r\n File imgSrcDirFile = new File(imgSrcDir);\r\n File videoSrcDirFile = new File(videoSrcDir);\r\n File imgDstDirFile = new File(imgDstDir);\r\n File videoDstDirFile = new File(videoDstDir);\r\n\r\n // Check and create directories\r\n if(!imgSrcDirFile.isDirectory()) {\r\n System.err.println(\"Not a directory: \" + imgSrcDirFile.getPath());\r\n System.exit(1);\r\n }\r\n if(!videoSrcDirFile.isDirectory()) {\r\n doVideo = false;\r\n }\r\n if(!imgDstDirFile.isDirectory()) {\r\n success = imgDstDirFile.mkdir();\r\n if(!success) {\r\n System.err.println(\"Cannot create: \" + imgDstDirFile.getPath());\r\n System.exit(1);\r\n }\r\n }\r\n if(doVideo && !videoDstDirFile.isDirectory()) {\r\n success = videoDstDirFile.mkdir();\r\n if(!success) {\r\n System.err.println(\"Cannot create: \" + videoDstDirFile.getPath());\r\n System.exit(1);\r\n }\r\n }\r\n\r\n // Images\r\n System.out.println(\"\\nCopying images:\");\r\n System.out.println(\"From: \" + imgSrcDirFile.getPath());\r\n System.out.println(\"To: \" + imgDstDirFile.getPath());\r\n success = CopyUtils.copyDirectory(imgSrcDirFile, imgDstDirFile, saveSuffix);\r\n if(!success) {\r\n System.err.println(\"Copy failed:\\n From: \" + imgSrcDirFile.getPath()\r\n + \"\\n To: \" + imgDstDirFile.getPath() + \"\\n\");\r\n }\r\n\r\n // Video\r\n System.out.println(\"\\nCopying video:\");\r\n if(!doVideo) {\r\n System.out.println(\"No video found\");\r\n return;\r\n }\r\n System.out.println(\"From: \" + videoSrcDirFile.getPath());\r\n System.out.println(\"To: \" + videoDstDirFile.getPath());\r\n success = CopyUtils.copyDirectory(videoSrcDirFile, videoDstDirFile,\r\n saveSuffix);\r\n if(!success) {\r\n System.err.println(\"Copy failed:\\n From: \" + videoSrcDirFile.getPath()\r\n + \"\\n To: \" + videoDstDirFile.getPath() + \"\\n\");\r\n }\r\n }", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "@Override\n\t\t\t\t\tpublic void onCompletion(MediaPlayer mp) {\n\n\t\t\t\t\t\tmyVideoView.setVideoPath(videopath);\n\t\t\t\t\t\tmyVideoView.start();\n\n\t\t\t\t\t}", "public void handleFileUpload(FileUploadEvent event) {\r\n FacesMessage msg = new FacesMessage(\"Succesful\", event.getFile().getFileName() + \" is uploaded.\");\r\n UploadedFile file = event.getFile();\r\n try {\r\n file.write(super.getUploadFolder() + \"/\" + file.getFileName());\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n// RequestContext.getCurrentInstance().execute(\"PF('uploadJs').start()\");\r\n System.out.println(event.getFile().getFileName());\r\n FacesContext.getCurrentInstance().addMessage(null, msg);\r\n }", "protected void onActivityResult(int requestCode,\n int resultCode, Intent data) {\n\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == VIDEO_CAPTURE) {\n if (resultCode == RESULT_OK )\n {\n // The rest of the code takes the video into the input stream and writes it to the location given in the internal storage\n Log.d(\"uy\",\"ok res\");\n File newfile;\n //data.\n AssetFileDescriptor videoAsset = null;\n FileInputStream in_stream = null;\n OutputStream out_stream = null;\n try {\n\n videoAsset = getContentResolver().openAssetFileDescriptor(data.getData(), \"r\");\n Log.d(\"uy\",\"vid ead\");\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n try {\n in_stream = videoAsset.createInputStream();\n Log.d(\"uy\",\"in stream\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n Log.d(\"uy\",\"dir\");\n Log.d(\"uy\",Environment.getExternalStorageDirectory().getAbsolutePath());\n File dir = new File(folder_path);\n if (!dir.exists())\n {\n dir.mkdirs();\n Log.d(\"uy\",\"mkdir\");\n }\n\n newfile = new File(dir, vid_name);\n Log.d(\"uy\",\"hr\");\n\n if (newfile.exists()) {\n newfile.delete();\n }\n\n\n try {\n out_stream = new FileOutputStream(newfile);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n byte[] buf = new byte[1024];\n int len;\n\n while (true) {\n try\n {\n Log.d(\"uy\",\"try\");\n if (((len = in_stream.read(buf)) > 0))\n {\n Log.d(\"uy\",\"File write\");\n out_stream.write(buf, 0, len);\n }\n else\n {\n Log.d(\"uy\",\"else\");\n in_stream.close();\n out_stream.close();\n break;\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n\n // Function to convert video to avi for processing the heart rate\n convert_video_commands();\n\n Toast.makeText(this, \"Video has been saved to:\\n\" +\n data.getData(), Toast.LENGTH_LONG).show();\n } else if (resultCode == RESULT_CANCELED) {\n Toast.makeText(this, \"Video recording cancelled.\",\n Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(this, \"Failed to record video\",\n Toast.LENGTH_LONG).show();\n }\n }\n }", "public void upload_file(FileUploadEvent event) throws IOException {\n \t\n \tUploadedFile uploaded_file=event.getFile();\n \tFacesContext context = FacesContext.getCurrentInstance();\n \t\n\t\tHttpSession session = (HttpSession) FacesContext.getCurrentInstance()\n \t\t\t\t.getExternalContext().getSession(true);\n \t\tString pictures_folder=session.getAttribute(\"pictures_folder\").toString();\n \t\t\n \t\tPath folder = Paths.get(pictures_folder);\n\t\t\n\t\tString filename = FilenameUtils.getBaseName(uploaded_file.getFileName()); \n\t\tString extension = FilenameUtils.getExtension(uploaded_file.getFileName());\n\t\t//tou dinei rando onoma\n\t\tPath file = Files.createTempFile( folder,filename+\"-\" , \".\" + extension);\n\t\tSystem.out.println(\"folder: \"+folder.toString()+\"\\n\"+\"filename: \"+filename+\"\\n\"\n\t\t \t+ \"file: \"+file.toString());\n\t\t\n\t\tString profile_url;\n\t\ttry (InputStream input =uploaded_file.getInputstream()) {\n\t\t Files.copy(input, file, StandardCopyOption.REPLACE_EXISTING);\n\t\t profile_url=file.toString().split(\"/\")[file.toString().split(\"/\").length-1];\n\t\t}\n\n\t\tSystem.out.println(\"Uploaded picture successfully saved in \" + profile_url);\n\t\tString message=\"Pictures were uploaded Successfully\";\n\t\tFacesMessage facesMessage_11 = new FacesMessage(message);\n context.addMessage(files_upload_UI.getClientId(context), facesMessage_11);\n\t\t\n\t\t\n\t\t\n }", "private void compressVideo(String path, String destPath, VideoCompress.CompressListener listener){\n compressQuality = VideoCompress.getCompressQuality(path);\n switch (compressQuality) {\n default:\n case COMPRESS_QUALITY_HIGH:\n VideoCompress.compressVideoHigh(path,destPath,listener);\n break;\n case COMPRESS_QUALITY_MEDIUM:\n VideoCompress.compressVideoMedium(path,destPath,listener);\n break;\n case COMPRESS_QUALITY_LOW:\n VideoCompress.compressVideoLow(path,destPath,listener);\n break;\n case 0:\n WritableMap resultArr = Arguments.createMap();\n resultArr.putString(\"path\", path);\n mCompressPromise.resolve(resultArr);\n// mCompressPromise.reject(\"1\",\"Not Compressed.\");\n break;\n }\n\n }", "public void getPublishVideoData(String uid,File videoFile,File coverFile,String videoDesc,String latitude,String longitude){\n\n ApiService myQusetUtils = new HttpUtils.Builder()\n .addCallAdapterFactory()\n .addConverterFactory()\n .build()\n .getMyQusetUtils();\n /**\n * uid\n videoFile\n coverFile\n videoDesc\n latitude\n longitude\n\n */\n MultipartBody.Builder build = new MultipartBody.Builder().setType(MultipartBody.FORM);\n build.addFormDataPart(\"uid\",uid);\n build.addFormDataPart(\"videoDesc\",videoDesc);\n build.addFormDataPart(\"latitude\",latitude);\n build.addFormDataPart(\"longitude\",longitude);\n RequestBody requestFile = RequestBody.create(MediaType.parse(\"multipart/form-data\"), videoFile);\n build.addFormDataPart(\"videoFile\", videoFile.getName(), requestFile);\n RequestBody re = RequestBody.create(MediaType.parse(\"multipart/form-data\"), coverFile);\n build.addFormDataPart(\"coverFile\", coverFile.getName(),re);\n List<MultipartBody.Part> parts = build.build().parts();\n myQusetUtils.getPublishVideo(parts)\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Observer<PublishVideo>() {\n @Override\n public void onSubscribe(Disposable d) {\n\n }\n\n @Override\n public void onNext(PublishVideo publishVideo) {\n\n if(publishVideo.code.equals(\"0\")){\n getPublishVideoMessage.getPublishVideoSuccess(publishVideo);\n }else {\n getPublishVideoMessage.getPublishVideoFailure(publishVideo.msg);\n }\n }\n\n @Override\n public void onError(Throwable e) {\n\n }\n\n @Override\n public void onComplete() {\n\n }\n });\n }", "@Override\n public String saveFile(MultipartFile file, String rootDirectory ) {\n String path = null;\n try {\n if (file != null && !file.isEmpty()) {\n java.util.Date date = new java.util.Date();\n int i = (int) (date.getTime() / 1000);\n String extention = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(\".\")+1);\n String fileName =file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(\".\"));\n path = rootDirectory + fileName + \"-\" + i + \".\"+ extention;\n\n File finalFilePath = new File(path);\n //create all path directories if not exist\n finalFilePath.getParentFile().mkdirs();\n file.transferTo(new File(path));\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n return path;\n }", "public void upload() {\r\n if (file != null) {\r\n try {\r\n String filepath = super.getUploadFolder() + \"/\" + file.getFileName();\r\n filepath = FileUtil.alternativeFilepathIfExists(filepath);\r\n FileUtil.createFile(filepath);\r\n\r\n file.write(filepath);\r\n super.info(\"Succesful\", file.getFileName() + \" is uploaded.\");\r\n\r\n Upload upload = new Upload();\r\n upload.setDescription(description);\r\n upload.setFilepath(filepath);\r\n upload.setTag(Md5Util.getMd5Sum(filepath));\r\n this.description = null;\r\n uploads.add(upload);\r\n // update ui and ready for save in db\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n }\r\n }", "private File createVideoFileName() throws IOException {\n String timestamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n //there are two types of SimpleDateFormat and Date()\n String prepend = \"VIDEO_\" + timestamp + \"_\";\n File videoFile = File.createTempFile(prepend, \".mp4\", mVideoFolder);\n mVideoFileName = videoFile.getAbsolutePath();\n return videoFile;\n\n }", "public String upload() throws FileNotFoundException, IOException{\n FileOutputStream fout=new FileOutputStream(\"/tmp/mi_archivo\");\n int read=0;\n byte[] data=new byte[1024];\n InputStream in = archivo.getInputStream();\n\n while((read = in.read(data)) != -1){\n fout.write(data, 0, read);\n }\n\n return \"\";\n }", "@RequestMapping(value=VideoSvcApi.VIDEO_DATA_PATH, method=RequestMethod.POST)\n\tpublic @ResponseBody VideoStatus addVideo(@PathVariable long id, \n\t\t\t@RequestParam(\"data\") MultipartFile videoFile, \n\t\t\tHttpServletResponse response) {\n\t\t// TODONE Implement the logic to store the video data.\n\t\tassert(videos != null);\n\t\t\n\t\tLong longId = new Long(id);\n\t\tif (videos.containsKey(longId)) {\n\t\t\tVideo v = videos.get(longId);\n\t\t\tassert(v != null);\n\t\t\t\n\t\t\ttry {\n\t\t\t\tVideoFileManager.get().saveVideoData(v, \n\t\t\t\t\t\tvideoFile.getInputStream());\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tresponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);\n\t\t\t}\n\t\t\t//return new VideoStatus(VideoState.READY);\n\t\t} else {\n\t\t\tresponse.setStatus(HttpServletResponse.SC_NOT_FOUND);\n\t\t}\n\t\t//return null;\n\t\treturn new VideoStatus(VideoState.READY);\n\t}", "public File getMediaDir() {\r\n return mediaDir;\r\n }" ]
[ "0.7057831", "0.6614868", "0.65239507", "0.6459067", "0.6419937", "0.6137689", "0.59337264", "0.5926715", "0.58440953", "0.58333117", "0.5823258", "0.58149064", "0.5807469", "0.58040273", "0.5771977", "0.56544703", "0.56508046", "0.5617477", "0.5557559", "0.5555738", "0.55307555", "0.55243075", "0.551574", "0.5500888", "0.54844075", "0.5433588", "0.54268605", "0.54099464", "0.5391623", "0.5390124", "0.5384557", "0.5375376", "0.5375376", "0.53646266", "0.5351498", "0.5349794", "0.5331934", "0.53194", "0.5279944", "0.5268074", "0.5238037", "0.52212346", "0.521846", "0.5211573", "0.51979244", "0.519134", "0.5188127", "0.51838124", "0.5180506", "0.51774526", "0.51730555", "0.5165091", "0.51612467", "0.516112", "0.5159879", "0.5129453", "0.5123223", "0.51213837", "0.5117066", "0.51162606", "0.5111839", "0.5108672", "0.5106837", "0.5100057", "0.5087384", "0.5087384", "0.5067887", "0.50657547", "0.5056214", "0.50395167", "0.5034035", "0.5003476", "0.49971408", "0.49970964", "0.4990366", "0.49869388", "0.49815848", "0.4975228", "0.49489105", "0.49478117", "0.49418294", "0.49371928", "0.49305576", "0.49283904", "0.49265313", "0.49163085", "0.49158686", "0.49158686", "0.4911789", "0.49107498", "0.49008226", "0.48987484", "0.48887601", "0.48848262", "0.48761854", "0.48702246", "0.4869512", "0.48615056", "0.48416108", "0.4828488" ]
0.66040343
2
Create a DateFormatter object for displaying date in specified format.
public static String getDate(long milliSeconds, String dateFormat) { SimpleDateFormat formatter = new SimpleDateFormat(dateFormat, Locale.US); // Create a calendar object that will convert the date and time value in milliseconds to date. Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Formatter() {\n\t\t// locale the locale for weekday names.\n\t\tfinal Locale locale = Locale.ENGLISH;\n\t\tdateFormatter = DateTimeFormatter.ofPattern(\"dd.MM.yyyy 'at' HH:mm\", locale);\n\t\tweekdayFormatter = DateTimeFormatter.ofPattern(\"EEEE\", locale);\n\t}", "public DateTextFieldConfig withFormat(final String value) {\n put(Key.Format, Dates.toJavaScriptDateFormat(value));\n return this;\n }", "@Bean(name = \"dateFormatter\")\n public SimpleDateFormat dateFormatter() {\n return new SimpleDateFormat(\"dd/MM/yyyy\");\n }", "ISimpleDateFormat createSDF(String format, String lang, String country, String tz);", "public SimpleDateFormat() {\n\t\tthis(getDefaultPattern(), null, null, null, null, true, null);\n\t}", "private static java.text.SimpleDateFormat getFormatter() {\r\n\r\n\t\treturn getDBLayer().getDateFormatter();\r\n\t}", "public DateTimeFormatRenderer(DateTimeFormat format) {\n this(format, null);\n }", "private Formatter makeFormatter(String formatterName) {\r\n Class c = null;\r\n Formatter f = null;\r\n\r\n try {\r\n c = Class.forName(formatterName);\r\n f = (Formatter) c.newInstance();\r\n } catch (Exception e) {\r\n f = new SimpleFormatter();\r\n }\r\n return f;\r\n }", "protected static SimpleDateFormat dateFormat() {\n return dateFormat(true, false);\n }", "public Date formatDate( String date, String format )\n throws ParseException {\n SimpleDateFormat dateFormat = new SimpleDateFormat(format);\n dateFormat.setLenient(false);\n return dateFormat.parse(date);\n }", "public static DateTimeFormatter forStrptimePattern(String pattern) {\n if (pattern == null || pattern.length() == 0)\n throw new IllegalArgumentException(\"Empty date time pattern specification\");\n\n DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();\n parseToBuilder(builder, pattern);\n DateTimeFormatter formatter = builder.toFormatter();\n\n return formatter;\n }", "public static final DataType<Date> createDate(final String format) {\r\n return new ARXDate(format);\r\n }", "@Deprecated\n\tpublic static SimpleDateFormat getInstance(final Calendar.FormatConfiguration formatConfig) {\n\n\t\tString ostr = formatConfig.getOverrideString();\n\t\tboolean useFast = (ostr != null && ostr.length() > 0);\n\n\t\treturn new SimpleDateFormat(formatConfig.getPatternString(), formatConfig.getDateFormatSymbols(), formatConfig.getCalendar(), null,\n\t\t\t\tformatConfig.getLocale(), useFast, formatConfig.getOverrideString());\n\t}", "private ARXDate(final String formatString) {\r\n if (formatString == null || formatString.equals(\"Default\")) {\r\n this.string = \"dd.MM.yyyy\";\r\n this.format = new SimpleDateFormat(string);\r\n this.locale = null;\r\n } else {\r\n this.format = new SimpleDateFormat(formatString);\r\n this.string = formatString;\r\n this.locale = null;\r\n }\r\n }", "private LocalDate parse(String format) {\r\n\t\tString lista[] = format.split(\"/\"); // DD - MM - YYYY\r\n\t\tint dia = Integer.parseInt(lista[0]);\r\n\t\tint mes = Integer.parseInt(lista[1]);\r\n\t\tint ano = Integer.parseInt(lista[2]);\r\n\t\tLocalDate date = LocalDate.of(ano, mes, dia);\r\n\t\treturn date;\r\n\t}", "public static DateTimeFormatter getDateTimeFormatter() {\n return getDateTimeFormatter(\"dd.MM.yyyy\", \"dd. MM. yyyy\", \"yyyy-MM-dd\");\n }", "public static DateFormat urlDateFormatter() {\n return Iso8601Formatter.dateTimeMillisFormatter();\n }", "public static SimpleDateFormat getDayFormat() {\n return new SimpleDateFormat(\"EEE dd\");\n }", "public String dateFormatter(String fromDate) {\n\t\tString newDateString=\"\";\n\t\ttry {\n\t\t\tfinal String oldFormat = \"yyyy/MM/dd\";\n\t\t\tfinal String newFormat = \"yyyy-MM-dd\";\n\t\t\tSimpleDateFormat sdf = new SimpleDateFormat(oldFormat);\n\t\t\tDate d = sdf.parse(fromDate);\n\t\t\tsdf.applyPattern(newFormat);\n\t\t\tnewDateString = sdf.format(d);\n\t\t} catch(Exception exp) {\n\t\t\tthrow ExceptionUtil.getYFSException(ExceptionLiterals.ERRORCODE_INVALID_DATE, exp);\n\t\t}\n\t\treturn newDateString;\n\t}", "DateFormat getDisplayDateFormat();", "public static SimpleDateFormat createDateFormat() {\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSS\");\n TimeZone myTimeZone = TimeZone.getTimeZone(ZoneId.of(\"UTC\"));\n dateFormat.setTimeZone(myTimeZone);\n dateFormat.setLenient(false);\n return dateFormat;\n }", "public static String date_d(String sourceDate,String format) throws ParseException {\n SimpleDateFormat sdf_ = new SimpleDateFormat(\"yyyy-MM-dd\");\n SimpleDateFormat sdfNew_ = new SimpleDateFormat(format);\n return sdfNew_.format(sdf_.parse(sourceDate));\n }", "private String easyDateFormat(final String format) {\n Date today = new Date();\n SimpleDateFormat formatter = new SimpleDateFormat(format);\n String datenewformat = formatter.format(today);\n return datenewformat;\n }", "public static String convertDateFormat (String dateStr, String fromFormatPattern, String toFormatPattern) {\n\t\tDateFormat fromFormat = new SimpleDateFormat(fromFormatPattern);\n\t\tDateFormat toFormat = new SimpleDateFormat(toFormatPattern);\n\t\ttoFormat.setLenient(false);\n\t\tDate date;\n\t\ttry {\n\t\t\tdate = fromFormat.parse(dateStr);\n\t\t\treturn toFormat.format(date);\n\t\t} catch (ParseException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tLog.d(\"ERROR\", \"Date formatting Error\");\n\t\t}\n\t\treturn null;\n\t}", "public static String getFormattedDate(String dateStr, String toformat)\r\n\t{\r\n\t\tString mName = \"getFormattedDate()\";\r\n\t\tIDateFormatter dateFormatter = null;\r\n\t\tDateFormatConfig dateFormat = null;\r\n\t\tString formattedDate = null;\r\n\t\tdateFormat = getDateFormat(toformat);\r\n\t\ttry\r\n\t\t{\r\n\t\t\tdateFormatter = (IDateFormatter) ResourceLoaderUtils.createInstance(dateFormat.getFormatterClass(),\r\n\t\t\t\t\t(Object[]) null);\r\n\t\t\tformattedDate = dateFormatter.formatDate(dateStr, dateFormat.getJavaDateFormat());\r\n\t\t} catch (Exception exp)\r\n\t\t{\r\n\t\t\tlogger.cterror(\"CTBAS00112\", exp, mName);\r\n\r\n\t\t}\r\n\t\treturn formattedDate;\r\n\t}", "private ARXDate(String formatString, Locale locale) {\r\n if (formatString == null || formatString.equals(\"Default\")) {\r\n this.string = \"dd.MM.yyyy\";\r\n this.format = new SimpleDateFormat(string, locale);\r\n this.locale = locale;\r\n } else {\r\n this.format = new SimpleDateFormat(formatString, locale);\r\n this.string = formatString;\r\n this.locale = locale;\r\n }\r\n }", "public static String convertDateFormat(Date sourceDate, SimpleDateFormat dateForm) {\n return dateForm.format(sourceDate);\n }", "@org.jetbrains.annotations.NotNull()\n public static final java.lang.String getFormattedDate(@org.jetbrains.annotations.NotNull()\n java.util.Calendar $this$getFormattedDate, @org.jetbrains.annotations.NotNull()\n java.lang.String format) {\n return null;\n }", "public SimpleDateFormat getDateFormat(HttpServletRequest req) {\n\t\treturn new SimpleDateFormat(DateUtil.getDatePattern(getResourceBundle(req)), Constants.DEF_LOCALE_NUMBER);\n\t}", "public SimpleDateFormat(final String pattern, final DateFormatSymbols formatData) {\n\t\tthis(pattern, (DateFormatSymbols) formatData.clone(), null, null, null, true, null);\n\t}", "String getFormatter();", "public static SimpleDateFormat getSimpleDateFormatByMode(int mode) {\n SimpleDateFormat simpleDateFormat = null;\n if (CalendarMode.DAY == mode) {\n simpleDateFormat = new SimpleDateFormat(\"EEE dd\");\n } else if (CalendarMode.WEEK == mode) {\n simpleDateFormat = new SimpleDateFormat(\"dd/MM\");\n } else {\n simpleDateFormat = new SimpleDateFormat(\"MMM yyyy\");\n }\n return simpleDateFormat;\n }", "public Date date(String name, String format) {\n return getDate(name, format);\n }", "private SimpleDateFormat(final String pattern, final DateFormatSymbols formatData, final Calendar calendar,\n\t\t\tfinal NumberFormat numberFormat, final ULocale locale, final boolean useFastFormat, final String override) {\n\t\tthis.pattern = pattern;\n\t\tthis.formatData = formatData;\n\t\tthis.calendar = calendar;\n\t\tthis.numberFormat = numberFormat;\n\t\tthis.locale = locale; // time zone formatting\n\t\tthis.useFastFormat = useFastFormat;\n\t\tthis.override = override;\n\t\tinitialize();\n\t}", "protected abstract DateFormat getDateFormat();", "public SimpleDateFormat getDateFormat(int displayType, Language language, String pattern) {\n\t\treturn null;\n\t}", "public String format (Date date , String dateFormat) ;", "private DateFormatterManager()\r\n\t{\r\n\r\n\t}", "public DefaultFormat() {\n }", "public String formatDate(Date date, String format) {\n return this.convertDateToString(date, format);\n }", "public Date getDate(String format){\n String date = et_Date.getText().toString();\n //Date date;\n\t\ttry {\n\t\t\treturn frontFormat.parse(date);\n\t\t} catch (ParseException e) {\n\t\t\tLogM.log(getContext(), getClass(), Level.SEVERE, \"getDate(String)\", e);\n\t\t} \n return null;\n }", "public static Date changeDateFormat(String date, String format){\n SimpleDateFormat sdf = new SimpleDateFormat(format);\n try {\n return sdf.parse(date);\n } catch (ParseException e) {\n e.printStackTrace();\n return null;\n }\n }", "SimpleDateFormat(final String pattern, final DateFormatSymbols formatData, final Calendar calendar, final ULocale locale,\n\t\t\tfinal boolean useFastFormat, final String override) {\n\t\tthis(pattern, (DateFormatSymbols) formatData.clone(), (Calendar) calendar.clone(), null, locale, useFastFormat, override);\n\t}", "public static DateFormat defaultFormat() {\n return convertFormat(Locale.getDefault(), \"dd/MM/yyyy hh:mma\");\n }", "public ValidatorFactory setDateFormat(int dateStyle, int timeStyle) {\n if (timeStyle < 0) {\n DateFormat.getDateInstance(dateStyle);\n } else if (dateStyle < 0) {\n DateFormat.getTimeInstance(timeStyle);\n } else {\n DateFormat.getDateTimeInstance(dateStyle, timeStyle);\n }\n this.dateStyle = dateStyle;\n this.timeStyle = timeStyle;\n this.datePattern = null;\n return this;\n }", "public final DateWithTypeDateFormat newDate() throws RIFCSException {\n return new DateWithTypeDateFormat(this.newElement(\n Constants.ELEMENT_DATE));\n }", "public DateGraphFormat(String pattern){\n\t((SimpleDateFormat) dateFormat).applyPattern(pattern);\n }", "public static Date toDate(String dateStr, SimpleDateFormat format) throws ParseException {\r\n\t\treturn format.parse(dateStr);\r\n\t}", "public DefaultImpl() {\n this(DEFAULT_DATE_FORMAT);\n }", "public Date parseDate(String date, String format) {\n return this.convertStringToDate(date, format);\n }", "public static String formatDate(Calendar date, DateFormat format) {\n\n switch (format) {\n case COMPLETE_DATE_FORMAT:\n format = DateFormat.COMPLETE_DATE_FORMAT;\n break;\n case DAY_FORMAT:\n format = DateFormat.DAY_FORMAT;\n break;\n }\n\n SimpleDateFormat dateFormatter = new SimpleDateFormat(format.getFormat(), Locale.US);\n\n return dateFormatter.format(date.getTime());\n }", "public static DateFormatConfig getDateFormat(String toformat)\r\n\t{\r\n\t\tString mName = \"getDateFormat()\";\r\n\t\tDateFormatConfig dateFormat = null;\r\n\t\t// look up in DateFormatRegistry with toformat(dateId) and it returns DateFormatConfig object\r\n\t\tDateFormatRegistry datefrmtRegistry = DateFormatRegistry.getInstance();\r\n\t\ttry\r\n\t\t{\r\n\t\t\tdateFormat = (DateFormatConfig) datefrmtRegistry.lookup(toformat);\r\n\t\t} catch (Exception e)\r\n\t\t{\r\n\t\t\tlogger.cterror(\"CTBAS00110\", e, mName);\r\n\t\t}\r\n\t\treturn dateFormat;\r\n\r\n\t}", "DateFormat getSourceDateFormat();", "public ValidatorFactory setDateFormat(String pattern) {\n this.datePattern = pattern == null ? null : new SimpleDateFormat(pattern).toPattern();\n return this;\n }", "public static DateFormat convertFormat(final Locale locale, final String format) {\n return convertFormats(locale, format)[0];\n }", "public static DateTimeFormatter getDateTimeFormatter(String... patterns) {\n DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();\n for (String pattern : patterns) {\n builder.appendOptional(DateTimeFormatter.ofPattern(pattern));\n }\n return builder.toFormatter();\n }", "@Override // override for Javadoc and performance\n public String format(DateTimeFormatter formatter) {\n Objects.requireNonNull(formatter, \"formatter\");\n return formatter.format(this);\n }", "public SimpleDateFormat(final String pattern) {\n\t\tthis(pattern, null, null, null, null, true, null);\n\t}", "public static final DataType<Date> createDate(final String format, final Locale locale) {\r\n return new ARXDate(format, locale);\r\n }", "private ThreadLocal<SimpleDateFormat> getDateFormatter() {\n\n return madisDateFormat;\n }", "public static String dateToStringFormat(Date date, String format){\n return new SimpleDateFormat(format).format(date);\n }", "public static String formatDate(java.util.Date value, String pattern) {\r\n\t\tif (value != null) {\r\n\t\t\t// Cria Locale informando Portugues Brasil\r\n\t\t\tLocale locale = new Locale(\"pt\", \"BR\");\r\n\t\t\t// Cria Formatador de data informando padr�o\r\n\t\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(pattern, locale);\r\n\t\t\t// Passa o resultado final obtido para uma String\r\n\t\t\tString retorno = dateFormat.format(value);\r\n\t\t\t// Trata a String para que a primeira letra seja maiuscula (caso esteja no padr�o MMM/yyyy\r\n\t\t\tif ((retorno != null) && (retorno.length() > 0)) {\r\n\t\t\t\tretorno = (retorno.charAt(0) + \"\").toUpperCase() + retorno.substring(1);\r\n\t\t\t}\r\n\t\t\treturn retorno;\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "public Date formatForDate(String data) throws ParseException{\n //definindo a forma da Data Recebida\n DateFormat formatUS = new SimpleDateFormat(\"dd-MM-yyyy\");\n return formatUS.parse(data);\n }", "public void mostrarHora(String formato){\n Date objDate = new Date();\n SimpleDateFormat objSDF = new SimpleDateFormat(formato);\n //este sera el resultado de la fechas\n fecha=objSDF.format(objDate);\n }", "public static String formatDate(Date valor, String formato) {\r\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(formato);\r\n\t\treturn sdf.format(valor);\r\n\t}", "public void setDateFormatString(String value) {\n this.dateFormatString = value;\n }", "public static String formatDateToString(Date d, String formatoData) {\n\t\tfinal String OLD_FORMAT = \"yyyy-MM-dd\";\r\n\r\n\t\tString newDateString;\r\n\r\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(OLD_FORMAT);\r\n\t\tsdf.applyPattern(formatoData);\r\n\t\tnewDateString = sdf.format(d);\r\n\t\t\r\n\t\treturn newDateString;\r\n\t}", "public static String formatDateToString(Date dateObj, String format) {\n SimpleDateFormat formatter = new SimpleDateFormat(format);\n return formatter.format(dateObj);\n }", "private static String dateFormatter(String date) {\n\t\tString[] dateArray = date.split(AnalyticsUDFConstants.SPACE_SEPARATOR);\n\t\ttry {\n\t\t\t// convert month which is in the format of string to an integer\n\t\t\tDate dateMonth = new SimpleDateFormat(AnalyticsUDFConstants.MONTH_FORMAT, Locale.ENGLISH).parse(dateArray[1]);\n\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\tcal.setTime(dateMonth);\n\t\t\t// months begin from 0, therefore add 1\n\t\t\tint month = cal.get(Calendar.MONTH) + 1;\n\t\t\tString dateString = dateArray[5] + AnalyticsUDFConstants.DATE_SEPARATOR + month + AnalyticsUDFConstants.DATE_SEPARATOR + dateArray[2];\n\t\t\tDateFormat df = new SimpleDateFormat(AnalyticsUDFConstants.DATE_FORMAT_WITHOUT_TIME);\n\t\t\treturn df.format(df.parse(dateString));\n\t\t} catch (ParseException e) {\n\t\t\treturn null;\n\t\t}\n\t}", "public static String formatDate(Date date, String format)\n\t{\n\t\tDateFormat dateFormat = new SimpleDateFormat(format);\n\t\treturn dateFormat.format(date);\n\t}", "DateFormatPanel() {\r\n\t\tfDateFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT);\r\n\t}", "public static synchronized String formatDate(Date d) {\n return dateFormat.format(d);\n }", "public DateTimeFormatRenderer(DateTimeFormat format, TimeZone timeZone) {\n assert format != null;\n this.format = format;\n this.timeZone = timeZone;\n }", "IFormatter getFormatter(Appendable dest, String format);", "private String createDate(){\n SimpleDateFormat date = new SimpleDateFormat(\"EEE, MMM d, yyyy\");\n String stringDate = date.format(new Date()); \n return stringDate;\n }", "private Formats() {\n }", "public void setDateFormat(int dateStyle, Locale locale) {\n this.setText(DateFormat.getDateInstance(dateStyle, locale).format(new Date()));\n }", "public static String formatterDate(Date date){\n\t\tString retour = null;\n\t\tif(date != null){\n\t\t\tretour = dfr.format(date);\n\t\t}\n\t\treturn retour;\n\t}", "public MessageFormatter(Locale locale, String format) {\n\t\tif (locale == null || format == null) {\n\t\t\tthrow new NullPointerException();\n\t\t}\n\t\tthis.locale = locale;\n\t\tdecimalFormatSymbols = DecimalFormatSymbols.getInstance(locale);\n\t\tthis.zero = decimalFormatSymbols.getZeroDigit();\n\t\tthis.formatFragments = parse(format);\n\t}", "public Date formatDate( String dob )\n throws ParseException {\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"MM/dd/yyyy\");\n dateFormat.setLenient(false);\n return dateFormat.parse(dob);\n }", "public LocaleFormatter() {\r\n super(2);\r\n }", "public synchronized static DateFormat getDateFormat()\n\t{\n\t\treturn DATE_FORMAT;\n\t}", "public DateGraphFormat(DateFormat dateFormatIn){\n\tif(dateFormatIn != null){\n\t dateFormat = dateFormatIn;\n\t} \n }", "public static String format(Date d, DateFormat formatter, int gmt) {\n return formatter.format(DateUtil.transform(d, gmt));\n }", "public FormattedCellRenderer(Format format) {\r\n this.format = format;\r\n }", "public void setDateFormats(String dateFormats)\n {\n this.dateFormats = dateFormats;\n }", "protected DateFormat[] getDateFormats() {\r\n\t\tString[] formatStrings = getFormatStrings();\r\n\t\tSimpleDateFormat[] dateFormats = new SimpleDateFormat[formatStrings.length];\r\n\r\n\t\tfor (int i = 0; i < formatStrings.length; i++) {\r\n\t\t\tdateFormats[i] = new SimpleDateFormat(formatStrings[i], locale);\r\n\t\t\tdateFormats[i].setLenient(false);\r\n\t\t}\r\n\r\n\t\treturn dateFormats;\r\n\t}", "public DataFormat createDataFormat() {\n\t\treturn null;\n\t}", "private static DateFormat getTimestampFormat(ConfigurationObject config) {\r\n // Get timestamp format to be used in the email\r\n String timestampFormatStr = Helper.getPropertyValue(config, TIMESTAMP_FORMAT_KEY, false, false);\r\n\r\n try {\r\n return new SimpleDateFormat((timestampFormatStr == null) ? DEFAULT_TIME_FORMAT : timestampFormatStr);\r\n } catch (IllegalArgumentException e) {\r\n throw new LateDeliverablesTrackerConfigurationException(\"Invaid timestamp format value.\", e);\r\n }\r\n }", "public Object createObject() {\n final DecimalFormat format = (DecimalFormat) super.createObject();\n if (getParameter(\"pattern\") != null) {\n format.applyPattern((String) getParameter(\"pattern\"));\n }\n if (getParameter(\"localizedPattern\") != null) {\n format.applyLocalizedPattern((String) getParameter(\"localizedPattern\"));\n }\n return format;\n }", "private String getDefaultDateFormat() {\n return getString(DATE_FORMAT_KEY, DEFAULT_DATE_FORMAT);\n }", "public void setDateFormat(String format) {\n this.mDateFormat = format;\n }", "public DateTitle(int dateStyle, Locale locale, Font font, Paint paint, int position,\n int horizontalAlignment, int verticalAlignment, Insets insets) {\n\n super(DateFormat.getDateInstance(dateStyle, locale).format(new Date()),\n font, paint, position, horizontalAlignment, verticalAlignment, insets);\n }", "public Builder setFormat(\n String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n format_ = value;\n onChanged();\n return this;\n }", "public static void main(String[] args) {\n\t\t LocalDate ldt = LocalDate.of(2016,12,21);\n DateTimeFormatter format = DateTimeFormatter.ofPattern(\"yyyy-MMM-dd\");\n DateTimeFormatter format1 = DateTimeFormatter.ofPattern(\"YYYY-mmm-dd\");\n System.out.println(ldt.format(format));\n System.out.println(ldt.format(format1));\n\t}", "public void setDateFormat(String format) {\n dateFormat = format;\n constructVssDateTimeFormat();\n }", "public DateGraphFormat(){\n }", "private DateFormatsConfig getDateFormats()\r\n {\r\n ClasspathPreferencesPersistenceManager manager = new ClasspathPreferencesPersistenceManager();\r\n InternalPreferencesIF preferences = manager.load(MantleConstants.USER_DATE_FORMAT_CONFIG_FILE_TOPIC, null, false);\r\n\r\n DateFormatsConfig config = preferences.getJAXBObject(DateFormatsConfig.class, \"DateFormatConfig\", null);\r\n\r\n return config;\r\n }", "public synchronized static DateFormat getDateTimeFormat()\n\t{\n\t\treturn DATE_TIME_FORMAT;\n\t}", "public static String getFormattedDate(SimpleDateFormat formatter, String dateInLong) {\n Date date = new Date(Long.valueOf(dateInLong));\n return formatter.format(date);\n }", "@Override\n public DateFormat getDateFormat(Integer optionalDateStyle, Integer optionalTimeStyle, Locale locale, boolean currentUserTimezone) {\n return null;\n }" ]
[ "0.63322175", "0.59888315", "0.5935337", "0.591206", "0.58610135", "0.5818848", "0.5733177", "0.5621762", "0.5550225", "0.553472", "0.5496686", "0.5468932", "0.54364765", "0.54364455", "0.5419548", "0.541809", "0.5416088", "0.5413847", "0.53985244", "0.53871524", "0.5361416", "0.5352051", "0.5345266", "0.53218174", "0.5312538", "0.52983975", "0.52776915", "0.5270196", "0.52599007", "0.52506566", "0.52409285", "0.52400786", "0.5220736", "0.5219499", "0.5211047", "0.51874936", "0.517651", "0.5162121", "0.5129087", "0.5105543", "0.51002777", "0.50821584", "0.5074442", "0.50678307", "0.506733", "0.5058066", "0.50458777", "0.5026751", "0.50212824", "0.50197697", "0.5012483", "0.5012032", "0.49996987", "0.49948665", "0.4987909", "0.4983156", "0.49830315", "0.49763677", "0.49491063", "0.4939703", "0.4928127", "0.4926304", "0.49145433", "0.49090347", "0.49007508", "0.48915553", "0.48889947", "0.48861048", "0.48736972", "0.48679578", "0.4859764", "0.4856565", "0.4846722", "0.48175126", "0.48142678", "0.48071277", "0.48031226", "0.47998297", "0.47997943", "0.47991523", "0.4799043", "0.47946078", "0.47930804", "0.4793002", "0.47920105", "0.47791436", "0.47775874", "0.47697434", "0.47620228", "0.4759083", "0.47565168", "0.47433126", "0.4741871", "0.47404337", "0.47383055", "0.47330105", "0.47320595", "0.47291663", "0.47283128", "0.47213557", "0.47120813" ]
0.0
-1
We are calling this method to check the permission status
public static boolean isReadCallAllowed(FragmentActivity act) { //Getting the permission status int result = ContextCompat.checkSelfPermission(act, Manifest.permission.CALL_PHONE); //If permission is granted returning true if (result == PackageManager.PERMISSION_GRANTED) return true; //If permission is not granted returning false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "@Override\n public void checkPermission(Permission perm) {\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "public boolean checkPermission(Permission permission);", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), READ_CONTACTS);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\r\n int result2 = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\r\n int result3 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\r\n int result4 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result5 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_PHONE_STATE);\r\n int result6 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n int result7 = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\r\n //int result8 = ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH);\r\n\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED && result2 == PackageManager.PERMISSION_GRANTED &&\r\n result3 == PackageManager.PERMISSION_GRANTED && result4 == PackageManager.PERMISSION_GRANTED && result5 == PackageManager.PERMISSION_GRANTED &&\r\n result6 == PackageManager.PERMISSION_GRANTED && result7 == PackageManager.PERMISSION_GRANTED/*&& result8== PackageManager.PERMISSION_GRANTED*/;\r\n }", "private void chkPermission() {\n permissionStatus = getSharedPreferences(\"permissionStatus\", MODE_PRIVATE);\n\n if (ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED\n || ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[0])\n || ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[1])) {\n //Show Information about why you need the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n\n } else if (permissionStatus.getBoolean(permissionsRequired[0], false)) {\n //Previously Permission Request was cancelled with 'Dont Ask Again',\n // Redirect to Settings after showing Information about why you need the permission\n sentToSettings = true;\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n Uri uri = Uri.fromParts(\"package\", getPackageName(), null);\n intent.setData(uri);\n startActivityForResult(intent, REQUEST_PERMISSION_SETTING);\n Toast.makeText(getBaseContext(), \"Go to Permissions to Grant Camera, Phone and Storage\", Toast.LENGTH_LONG).show();\n\n } else {\n //just request the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n }\n\n //txtPermissions.setText(\"Permissions Required\");\n\n SharedPreferences.Editor editor = permissionStatus.edit();\n editor.putBoolean(permissionsRequired[0], true);\n editor.commit();\n } else {\n //You already have the permission, just go ahead.\n //proceedAfterPermission();\n }\n\n }", "boolean isHasPermissions();", "private boolean permisos() {\n for(String permission : PERMISSION_REQUIRED) {\n if(ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "public boolean checkPermissions(String check)\n {\n Log.d(TAG,\"check single PErmission\");\n int permissionRequest= ActivityCompat.checkSelfPermission(UploadActivity.this,check);\n if(permissionRequest!= PackageManager.PERMISSION_GRANTED)\n {\n Log.d(TAG,\"check PErmission\\nPermission was not granted for:\"+check);\n return false;\n }\n else\n {\n Log.d(TAG,\"check PErmission\\nPermission was granted for:\"+check);\n return true;\n }\n\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "void permissionGranted(int requestCode);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == REQUEST_PERMISSION_SETTING) {\n checkPermission();\n }\n }", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "private boolean checkAndRequestPermissions() {\n List<String> listPermissionsNeeded = new ArrayList<>();\n for (String pem : appPermissions){\n if (ContextCompat.checkSelfPermission(this, pem) != PackageManager.PERMISSION_GRANTED){\n listPermissionsNeeded.add(pem);\n }\n }\n\n //ask for non-granted permissions\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_REQUEST_CODE);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);\n\n if (result == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n return false;\n }\n }", "public void checkpermission()\n {\n permissionUtils.check_permission(permissions,\"Need GPS permission for getting your location\",1);\n }", "private void checkPermissions() {\n List<String> permissions = new ArrayList<>();\n String message = \"osmdroid permissions:\";\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n message += \"\\nLocation to show user location.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);\n message += \"\\nStorage access to store map tiles.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.READ_PHONE_STATE);\n message += \"\\n access to read phone state.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.RECEIVE_SMS);\n message += \"\\n access to receive sms.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.GET_ACCOUNTS);\n message += \"\\n access to read sms.\";\n //requestReadPhoneStatePermission();\n }\n if (!permissions.isEmpty()) {\n // Toast.makeText(this, message, Toast.LENGTH_LONG).show();\n String[] params = permissions.toArray(new String[permissions.size()]);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(params, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n } // else: We already have permissions, so handle as normal\n }", "public void checkPermission() {\n Log.e(\"checkPermission\", \"checkPermission\");\n\n // Here, thisActivity is the current activity\n if (ContextCompat.checkSelfPermission(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n\n\n }", "public void checkPermissions(){\n //Check if some of the core permissions are not already granted\n if ((ContextCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)) {\n Toast.makeText(this, \"Some permissions are not granted. Please enable them.\", Toast.LENGTH_SHORT).show();\n\n //If so, request the activation of this permissions\n ActivityCompat.requestPermissions(LoginActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_ASK_PERMISSIONS);\n }\n else{\n //Permissions already granted\n }\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "public boolean isAllGranted(){\n //PackageManager.PERMISSION_GRANTED\n return false;\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "private Boolean checkRuntimePermission() {\n List<String> permissionsNeeded = new ArrayList<String>();\n\n final List<String> permissionsList = new ArrayList<String>();\n if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))\n permissionsNeeded.add(\"Storage\");\n if (!addPermission(permissionsList, Manifest.permission.CAMERA))\n permissionsNeeded.add(\"Camera\");\n /* if (!addPermission(permissionsList, Manifest.permission.WRITE_CONTACTS))\n permissionsNeeded.add(\"Write Contacts\");*/\n\n if (permissionsList.size() > 0) {\n if (permissionsNeeded.size() > 0) {\n // Need Rationale\n String message = \"You need to grant access to \" + permissionsNeeded.get(0);\n for (int i = 1; i < permissionsNeeded.size(); i++)\n message = message + \", \" + permissionsNeeded.get(i);\n showMessageOKCancel(message,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n }\n });\n return false;\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n if (Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // Permission is not granted\n return false;\n } else {\n return true;// Permission has already been granted }\n }\n }", "void askForPermissions();", "private void checkPermission(){\n // vérification de l'autorisation d'accéder à la position GPS\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n// // l'autorisation n'est pas acceptée\n// if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n// Manifest.permission.ACCESS_FINE_LOCATION)) {\n// // l'autorisation a été refusée précédemment, on peut prévenir l'utilisateur ici\n// } else {\n // l'autorisation n'a jamais été réclamée, on la demande à l'utilisateur\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n FINE_LOCATION_REQUEST);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n // }\n } else {\n // TODO : autorisation déjà acceptée, on peut faire une action ici\n initLocation();\n }\n }", "abstract public void getPermission();", "public void verifyPermission() {\n Permissions.check(this/*context*/, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() {\n @Override\n public void onGranted() {\n addVideoInFolder();\n setupExoPlayer();\n settingListener();\n }\n\n @Override\n public void onDenied(Context context, ArrayList<String> deniedPermissions) {\n super.onDenied(context, deniedPermissions);\n verifyPermission();\n }\n });\n\n }", "private boolean checkDeviceSettings()\n {\n List<String> listPermissionNeeded= new ArrayList<>();\n boolean ret = true;\n for(String perm : permission)\n {\n if(ContextCompat.checkSelfPermission(this,perm)!= PackageManager.PERMISSION_GRANTED)\n listPermissionNeeded.add(perm);\n }\n if(!listPermissionNeeded.isEmpty())\n {\n ActivityCompat.requestPermissions(this,listPermissionNeeded.toArray(new String[listPermissionNeeded.size()]),REQUEST_PERMISSION);\n ret = false;\n }\n\n return ret;\n }", "public boolean validatePermissions()\r\n\t{\n\t\treturn true;\r\n\t}", "void requestNeededPermissions(int requestCode);", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "private void checkpermission() {\n permissionUtils = new PermissionUtils(context, this);\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n permissionUtils.check_permission(permissions, \"Need GPS permission for getting your location\", LOCATION_REQUEST_CODE);\n }", "private void checkPermissions() {\n final ArrayList<String> missedPermissions = new ArrayList<>();\n\n for (final String permission : PERMISSIONS_REQUIRED) {\n if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {\n missedPermissions.add(permission);\n }\n }\n\n if (!missedPermissions.isEmpty()) {\n final String[] permissions = new String[missedPermissions.size()];\n missedPermissions.toArray(permissions);\n\n ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);\n }\n }", "public void verifyAppPermissions() {\n boolean hasAll = true;\n mHasBluetoothPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED;\n mHasBluetoothAdminPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n\n if (!hasAll) {\n // We don't have permission so prompt the user\n ActivityCompat.requestPermissions(\n this,\n APP_PERMISSIONS,\n REQUEST_PERMISSIONS\n );\n }\n }", "int getPermissionRead();", "private boolean checkPermissions() {\n if (!read_external_storage_granted ||\n !write_external_storage_granted ||\n !write_external_storage_granted) {\n Toast.makeText(getApplicationContext(), \"Die App braucht Zugang zur Kamera und zum Speicher.\", Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }", "private void checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED){\n\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA}, 56);\n }\n }", "public void checkPermission(String permission, int requestCode)\n {\n if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {\n // Requesting the permission\n ActivityCompat.requestPermissions(this, new String[] { permission }, requestCode);\n }\n else {\n Toast.makeText(this, \"Permission already granted\", Toast.LENGTH_SHORT).show();\n }\n }", "public boolean checkPerms()\n {\n boolean perms = hasPerms();\n if (!perms) {\n ActivityCompat.requestPermissions(\n itsActivity, new String[] { itsPerm }, itsPermsRequestCode);\n }\n return perms;\n }", "private void checkPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this)\n .setMessage(getString(R.string.can_not_handle_calls))\n .setCancelable(false)\n .setPositiveButton(R.string.text_ok, (dialog, id) -> {\n requestPermission();\n });\n\n builder.create().show();\n } else {\n presenter.gotPermissions = true;\n }\n }", "public void checkRequestPermission(){\n\n\n hasPermission = (ActivityCompat.checkSelfPermission(this, Manifest.permission.VIBRATE)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED );\n//check group permissons\n if (!hasPermission){\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.VIBRATE,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE\n\n },\n REQUEST_NETWORK_ACCESS);\n }\n }", "private void checkAndRequestPermissions() {\n missingPermission = new ArrayList<>();\n // Check for permissions\n for (String eachPermission : REQUIRED_PERMISSION_LIST) {\n if (ContextCompat.checkSelfPermission(this, eachPermission) != PackageManager.PERMISSION_GRANTED) {\n missingPermission.add(eachPermission);\n }\n }\n // Request for missing permissions\n if (missingPermission.isEmpty()) {\n DroneModel.getInstance(this).setDjiProductStateCallBack(this);\n DroneModel.getInstance(this).startSDKRegistration();\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n missingPermission.toArray(new String[missingPermission.size()]),\n REQUEST_PERMISSION_CODE);\n }\n }", "private static boolean isPermissionGranted(Context context, String permission) {\n if (ContextCompat.checkSelfPermission(context, permission)\n == PackageManager.PERMISSION_GRANTED) {\n Log.i(TAG, permission + \" granted\");\n return true;\n }\n Log.i(TAG, permission + \" not granted yet\");\n return false;\n }", "private boolean checkPermissions() {\n int permissionState1 = ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION);\n\n int permissionState2 = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION);\n return permissionState1 == PackageManager.PERMISSION_GRANTED && permissionState2 == PackageManager.PERMISSION_GRANTED;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "private void permissionChecks() {\n if(Build.VERSION.SDK_INT < 23)\n return;\n\n if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 0);\n }\n }", "private void checkAndRequestForPermission() {\n if(ContextCompat.checkSelfPermission(RegisterActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED){\n if(ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE)){\n Toast.makeText(RegisterActivity.this, \"Please accept for required permission\",\n Toast.LENGTH_SHORT).show();\n }\n else{\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String []{Manifest.permission.READ_EXTERNAL_STORAGE},PReqCode);\n }\n }\n else{\n openGallery();\n }\n }", "private boolean checkPermissions() {\n int res = ContextCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.READ_EXTERNAL_STORAGE);\n if (res == PackageManager.PERMISSION_GRANTED)\n return true;\n else\n return false;\n }", "@Override\n public boolean hasPermission(Permission permission) {\n // FacesContext context = FacesContext.getCurrentInstance();\n String imp = (String)ADFContext.getCurrent().getSessionScope().get(\"isImpersonationOn\");\n// String imp = (String)context.getExternalContext().getSessionMap().get(\"isImpersonationOn\");\n if(imp == null || !imp.equals(\"Y\")){\n return super.hasPermission(permission);\n }\n else{\n return true;\n \n }\n \n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(\n this, Manifest.permission.ACCESS_FINE_LOCATION\n );\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "public boolean checkPermissions(String permission) {\r\n Log.d(TAG, \"checkPermissions: checking permission: \" + permission);\r\n\r\n int permissionRequest = ActivityCompat.checkSelfPermission(EditProfileActivity.this, permission);\r\n\r\n if (permissionRequest != PackageManager.PERMISSION_GRANTED) {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was not granted for: \" + permission);\r\n Toast.makeText(this, \"Permissions not granted to access camera,\\n\" +\r\n \"please give permissions to GetAplot\", Toast.LENGTH_SHORT).show();\r\n return false;\r\n } else {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was granted for: \" + permission);\r\n return true;\r\n }\r\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(UniformDrawer.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\r\n if (result == PackageManager.PERMISSION_GRANTED) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean CheckingPermissionIsEnabledOrNot()\n {\n int CameraPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\n int WriteStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ReadStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n\n return CameraPermissionResult == PackageManager.PERMISSION_GRANTED &&\n WriteStoragePermissionResult == PackageManager.PERMISSION_GRANTED &&\n ReadStoragePermissionResult == PackageManager.PERMISSION_GRANTED;\n }", "private void checkForPermission() {\n if (ContextCompat.checkSelfPermission(QuizConfirmationActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(QuizConfirmationActivity.this\n , Manifest.permission.READ_EXTERNAL_STORAGE)) {\n Toast.makeText(QuizConfirmationActivity.this,\n \"Please provide the required storage permission in the app setting\", Toast.LENGTH_SHORT).show();\n\n } else {\n\n ActivityCompat.requestPermissions(QuizConfirmationActivity.this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n\n PreqCode);\n }\n } else {\n imageSelect(QuizConfirmationActivity.this);\n }\n\n\n }", "private boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,\n android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n return false;\n\n } else {\n return true;\n }\n }", "@Override\n public void onPermissionGranted() {\n }", "private boolean checkPermissions() {\r\n int permissionState = ActivityCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION);\r\n return permissionState == PackageManager.PERMISSION_GRANTED;\r\n }", "private boolean checkPermission() {\n int fineLocation = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n\n if (fineLocation != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_FINE_LOCATION);\n }\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermission() {\n Log.d(\"TAG\", \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED );\n }", "@Override\n public void onPermissionGranted() {\n }", "public boolean CheckPermissions() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;\r\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private boolean arePermissionsEnabled(){\n for(String permission : mPermissions){\n if(checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED)\n return false;\n }\n return true;\n }", "private boolean checkPermissions() {\n boolean permissionGrant = false;\n if (Build.VERSION.SDK_INT >= 23 && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions((Activity) this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_ACCESS_COARSE_LOCATION);\n } else {\n permissionGrant = true;\n }\n return permissionGrant;\n\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_ACCESS_FINE_LOCATION);\n\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED){\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\n PERMISSIONS_ACCESS_COARSE_LOCATION);\n } else {\n isPermission = true;\n }\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkAndRequestPermissions() {\n int locationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n List<String> listPermissionsNeeded = new ArrayList<>();\n if (locationPermission != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n }\n// if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {\n// listPermissionsNeeded.add(Manifest.permission.SEND_SMS);\n// }\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED );\n }", "public boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n new AlertDialog.Builder(this)\n .setTitle(\"TITLE\")\n .setMessage(\"TEXT\")\n .setPositiveButton(\"OKAY\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Prompt the user once explanation has been shown\n ActivityCompat.requestPermissions(MapsActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n })\n .create()\n .show();\n\n\n } else {\n // No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n return false;\n } else {\n return true;\n }\n }", "@TargetApi(23)\r\n public void requestPermission() {\r\n ArrayList<String> arrayList;\r\n String[] strArr = this.mPermissions;\r\n for (String str : strArr) {\r\n if (this.mActivity.checkCallingOrSelfPermission(str) != 0) {\r\n if (shouldShowRequestPermissionRationale(str) || !PermissionUtils.isNeverShowEnabled(PermissionUtils.getRequestCode(str))) {\r\n if (this.normalPermissions == null) {\r\n this.normalPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.normalPermissions;\r\n } else {\r\n if (this.settingsPermissions == null) {\r\n this.settingsPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.settingsPermissions;\r\n }\r\n arrayList.add(str);\r\n }\r\n }\r\n Log.d(TAG, \"requestPermission() settingsPermissions:\" + this.settingsPermissions);\r\n Log.d(TAG, \"requestPermission() normalPermissions:\" + this.normalPermissions);\r\n ArrayList<String> arrayList2 = this.normalPermissions;\r\n if (arrayList2 == null || arrayList2.size() <= 0) {\r\n ArrayList<String> arrayList3 = this.settingsPermissions;\r\n if (arrayList3 == null || arrayList3.size() <= 0) {\r\n IGrantedTask iGrantedTask = this.mTask;\r\n if (iGrantedTask != null) {\r\n iGrantedTask.doTask();\r\n }\r\n } else {\r\n Activity activity = this.mActivity;\r\n PermissionUtils.showPermissionSettingsDialog(activity, activity.getResources().getString(R.string.app_name), this.settingsPermissions, true);\r\n this.settingsPermissions = null;\r\n }\r\n finishFragment();\r\n return;\r\n }\r\n requestPermissions((String[]) this.normalPermissions.toArray(new String[this.normalPermissions.size()]), 5003);\r\n this.normalPermissions = null;\r\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED) {\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\r\n PERMISSIONS_ACCESS_FINE_LOCATION);\r\n\r\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED){\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\r\n PERMISSIONS_ACCESS_COARSE_LOCATION);\r\n } else {\r\n isPermission = true;\r\n }\r\n }", "private boolean checkPermission() {\n Log.d(TAG, \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED);\n }", "private boolean checkPermissions() {\n return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n }", "private boolean checkForPermission() {\n\n int permissionCode = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\n\n if(permissionCode == PackageManager.PERMISSION_GRANTED) return true;\n else return false;\n }", "public void checkPermission(){\n Log.d(\"BluetoothLeService\", \"initialize is \" + mBluetoothManager);\n if (mBluetoothManager == null) {\n mBluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);\n if (mBluetoothManager == null) {\n Log.e(TAG, \"Unable to initialize BluetoothManager.\");\n return;\n }\n }\n\n mBluetoothAdapter = mBluetoothManager.getAdapter();\n if (mBluetoothAdapter == null) {\n Log.e(TAG, \"Unable to obtain a BluetoothAdapter.\");\n return;\n }\n\n if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();\n\n int PERMISSION_ALL = 1;\n /*\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.GET_ACCOUNTS};\n */\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION\n };\n\n if (!hasPermissions(this, PERMISSIONS)) {\n ActivityCompat.requestPermissions( this, PERMISSIONS, PERMISSION_ALL);\n }\n }", "public void onPermissionGranted() {\n\n }", "public boolean checkForPermission() {\r\n int permissionCAMERA = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);\r\n int storagePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\r\n int accessCoarseLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);\r\n int accessFineLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\r\n\r\n List<String> listPermissionsNeeded = new ArrayList<>();\r\n if (storagePermission != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\r\n }\r\n if (permissionCAMERA != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.CAMERA);\r\n }\r\n if (accessCoarseLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\r\n }\r\n if (accessFineLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\r\n }\r\n if (!listPermissionsNeeded.isEmpty()) {\r\n ActivityCompat.requestPermissions(this,\r\n listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), MY_PERMISSIONS_REQUEST);\r\n return false;\r\n }\r\n\r\n return true;\r\n }", "void checkPermission(T request) throws AuthorizationException;", "private void checkIfPermissionGranted() {\n\n //if user already allowed the permission, this condition will be true\n if (ContextCompat.checkSelfPermission(this, PERMISSION_CODE)\n == PackageManager.PERMISSION_GRANTED) {\n Intent launchIntent = getPackageManager().getLaunchIntentForPackage(\"com.example.a3\");\n if (launchIntent != null) {\n startActivity(launchIntent);//null pointer check in case package name was not found\n }\n }\n //if user didn't allow the permission yet, then ask for permission\n else {\n ActivityCompat.requestPermissions(this, new String[]{PERMISSION_CODE}, 0);\n }\n }", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "@Override\n public void onClick(View view) {\n String platform = checkPlatform();\n if (platform.equals(\"Marshmallow\")) {\n Log.d(TAG, \"Runtime permission required\");\n //Step 2. check the permission\n boolean permissionStatus = checkPermission();\n if (permissionStatus) {\n //Permission already granted\n Log.d(TAG, \"Permission already granted\");\n } else {\n //Permission not granted\n //Step 3. Explain permission i.e show an explanation\n Log.d(TAG, \"Explain permission\");\n explainPermission();\n //Step 4. Request Permissions\n Log.d(TAG, \"Request Permission\");\n requestPermission();\n }\n\n } else {\n Log.d(TAG, \"onClick: Runtime permission not required\");\n }\n\n\n }", "private boolean checkPermissions() {\n boolean hasPermission = true;\n\n int result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_FINE_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n\n // ACCESS_BACKGROUND_LOCATION is only required on API 29 and higher\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\n result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_BACKGROUND_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n }\n\n return hasPermission;\n }", "private void getPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n }", "private void checkPermissions(){\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){\n ActivityCompat.requestPermissions(this, new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.ACCESS_COARSE_LOCATION\n },PERMS_CALL_ID);\n\n }\n\n\n }", "@PermissionSuccess(requestCode = 100)\n public void onPermissionSuccess(){\n }", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_checkNotificationPermission, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "private boolean validateAccess(String permission) {\n\t\tif (\"READ\".equalsIgnoreCase(permission)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean isWritePermissionGranted();", "public static void checkAccess() throws SecurityException {\n if(isSystemThread.get()) {\n return;\n }\n //TODO: Add Admin Checking Code\n// if(getCurrentUser() != null && getCurrentUser().isAdmin()) {\n// return;\n// }\n throw new SecurityException(\"Invalid Permissions\");\n }", "boolean ignoresPermission();", "@Test\n public void testCheckExistsPermission() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE\");\n assertFalse(permissionManager.checkExists(permission2));\n }", "private boolean checkPermissions(String permissionStr, int requestCode) {\n // Check to see if we have permission to access something,\n // such like the microphone.\n int permission = ActivityCompat.checkSelfPermission(\n HotwordDetectionActivity.this,\n permissionStr);\n\n if (permission != PackageManager.PERMISSION_GRANTED) {\n // We can not access it, request authorization from the user.\n ActivityCompat.requestPermissions(\n HotwordDetectionActivity.this,\n new String[] {permissionStr},\n requestCode\n );\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermissionStorage() {\n\n boolean isPermissionGranted = true;\n\n int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n\n if (permissionStorage != PackageManager.PERMISSION_GRANTED)\n {\n isPermissionGranted = false;\n }\n\n return isPermissionGranted;\n }", "int getPermissionWrite();", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "public boolean CheckingPermissionIsEnabledOrNot() {\n int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), INTERNET);\n int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_NETWORK_STATE);\n int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ForthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_COARSE_LOCATION);\n int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\n int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), VIBRATE);\n// int EighthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CALL_PHONE);\n// int NinethPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\n\n return FirstPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SecondPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ThirdPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ForthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n FifthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SixthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SeventhPermissionResult == PackageManager.PERMISSION_GRANTED;\n// EighthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n// NinethPermissionResult == PackageManager.PERMISSION_GRANTED;\n }" ]
[ "0.78061116", "0.77052194", "0.7644345", "0.7578227", "0.74156034", "0.728739", "0.7255468", "0.724358", "0.72018945", "0.712154", "0.71159494", "0.7043407", "0.70355487", "0.70296174", "0.7007319", "0.6995498", "0.6977545", "0.6977358", "0.6973267", "0.6969954", "0.6968984", "0.6961357", "0.6953506", "0.6952861", "0.6946677", "0.693117", "0.6911616", "0.6909338", "0.6895584", "0.6864902", "0.68463343", "0.68353975", "0.68241066", "0.6803475", "0.6801704", "0.6800543", "0.67885953", "0.6779294", "0.6778586", "0.67656577", "0.67521626", "0.67511874", "0.6742429", "0.67396927", "0.6733997", "0.67183685", "0.67183095", "0.6711119", "0.67088073", "0.6703598", "0.66995126", "0.66935265", "0.669061", "0.66870254", "0.6664966", "0.6657274", "0.6652056", "0.6649899", "0.6646285", "0.6643312", "0.6637372", "0.66371506", "0.662881", "0.6623307", "0.6620403", "0.6618599", "0.6615486", "0.6607039", "0.66012925", "0.6600757", "0.6600757", "0.66002476", "0.6590849", "0.6584737", "0.6582371", "0.6576477", "0.6567547", "0.6565327", "0.65608585", "0.65580493", "0.65567786", "0.655208", "0.6550827", "0.6548847", "0.6545712", "0.6544774", "0.654415", "0.65431756", "0.6543069", "0.65279615", "0.6524164", "0.65184855", "0.6516418", "0.65155244", "0.6491373", "0.6488048", "0.64868426", "0.64837366", "0.64800864", "0.6471658", "0.6463857" ]
0.0
-1
We are calling this method to check the permission status
public static boolean isWriteExternalStorageAllowed(FragmentActivity act) { //Getting the permission status int result = ContextCompat.checkSelfPermission(act, Manifest.permission.WRITE_EXTERNAL_STORAGE); //If permission is granted returning true if (result == PackageManager.PERMISSION_GRANTED) return true; //If permission is not granted returning false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "@Override\n public void checkPermission(Permission perm) {\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "public boolean checkPermission(Permission permission);", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), READ_CONTACTS);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\r\n int result2 = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\r\n int result3 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\r\n int result4 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result5 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_PHONE_STATE);\r\n int result6 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n int result7 = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\r\n //int result8 = ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH);\r\n\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED && result2 == PackageManager.PERMISSION_GRANTED &&\r\n result3 == PackageManager.PERMISSION_GRANTED && result4 == PackageManager.PERMISSION_GRANTED && result5 == PackageManager.PERMISSION_GRANTED &&\r\n result6 == PackageManager.PERMISSION_GRANTED && result7 == PackageManager.PERMISSION_GRANTED/*&& result8== PackageManager.PERMISSION_GRANTED*/;\r\n }", "private void chkPermission() {\n permissionStatus = getSharedPreferences(\"permissionStatus\", MODE_PRIVATE);\n\n if (ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED\n || ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[0])\n || ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[1])) {\n //Show Information about why you need the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n\n } else if (permissionStatus.getBoolean(permissionsRequired[0], false)) {\n //Previously Permission Request was cancelled with 'Dont Ask Again',\n // Redirect to Settings after showing Information about why you need the permission\n sentToSettings = true;\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n Uri uri = Uri.fromParts(\"package\", getPackageName(), null);\n intent.setData(uri);\n startActivityForResult(intent, REQUEST_PERMISSION_SETTING);\n Toast.makeText(getBaseContext(), \"Go to Permissions to Grant Camera, Phone and Storage\", Toast.LENGTH_LONG).show();\n\n } else {\n //just request the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n }\n\n //txtPermissions.setText(\"Permissions Required\");\n\n SharedPreferences.Editor editor = permissionStatus.edit();\n editor.putBoolean(permissionsRequired[0], true);\n editor.commit();\n } else {\n //You already have the permission, just go ahead.\n //proceedAfterPermission();\n }\n\n }", "boolean isHasPermissions();", "private boolean permisos() {\n for(String permission : PERMISSION_REQUIRED) {\n if(ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "public boolean checkPermissions(String check)\n {\n Log.d(TAG,\"check single PErmission\");\n int permissionRequest= ActivityCompat.checkSelfPermission(UploadActivity.this,check);\n if(permissionRequest!= PackageManager.PERMISSION_GRANTED)\n {\n Log.d(TAG,\"check PErmission\\nPermission was not granted for:\"+check);\n return false;\n }\n else\n {\n Log.d(TAG,\"check PErmission\\nPermission was granted for:\"+check);\n return true;\n }\n\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "void permissionGranted(int requestCode);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == REQUEST_PERMISSION_SETTING) {\n checkPermission();\n }\n }", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "private boolean checkAndRequestPermissions() {\n List<String> listPermissionsNeeded = new ArrayList<>();\n for (String pem : appPermissions){\n if (ContextCompat.checkSelfPermission(this, pem) != PackageManager.PERMISSION_GRANTED){\n listPermissionsNeeded.add(pem);\n }\n }\n\n //ask for non-granted permissions\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_REQUEST_CODE);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);\n\n if (result == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n return false;\n }\n }", "public void checkpermission()\n {\n permissionUtils.check_permission(permissions,\"Need GPS permission for getting your location\",1);\n }", "private void checkPermissions() {\n List<String> permissions = new ArrayList<>();\n String message = \"osmdroid permissions:\";\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n message += \"\\nLocation to show user location.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);\n message += \"\\nStorage access to store map tiles.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.READ_PHONE_STATE);\n message += \"\\n access to read phone state.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.RECEIVE_SMS);\n message += \"\\n access to receive sms.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.GET_ACCOUNTS);\n message += \"\\n access to read sms.\";\n //requestReadPhoneStatePermission();\n }\n if (!permissions.isEmpty()) {\n // Toast.makeText(this, message, Toast.LENGTH_LONG).show();\n String[] params = permissions.toArray(new String[permissions.size()]);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(params, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n } // else: We already have permissions, so handle as normal\n }", "public void checkPermission() {\n Log.e(\"checkPermission\", \"checkPermission\");\n\n // Here, thisActivity is the current activity\n if (ContextCompat.checkSelfPermission(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n\n\n }", "public void checkPermissions(){\n //Check if some of the core permissions are not already granted\n if ((ContextCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)) {\n Toast.makeText(this, \"Some permissions are not granted. Please enable them.\", Toast.LENGTH_SHORT).show();\n\n //If so, request the activation of this permissions\n ActivityCompat.requestPermissions(LoginActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_ASK_PERMISSIONS);\n }\n else{\n //Permissions already granted\n }\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "public boolean isAllGranted(){\n //PackageManager.PERMISSION_GRANTED\n return false;\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "private Boolean checkRuntimePermission() {\n List<String> permissionsNeeded = new ArrayList<String>();\n\n final List<String> permissionsList = new ArrayList<String>();\n if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))\n permissionsNeeded.add(\"Storage\");\n if (!addPermission(permissionsList, Manifest.permission.CAMERA))\n permissionsNeeded.add(\"Camera\");\n /* if (!addPermission(permissionsList, Manifest.permission.WRITE_CONTACTS))\n permissionsNeeded.add(\"Write Contacts\");*/\n\n if (permissionsList.size() > 0) {\n if (permissionsNeeded.size() > 0) {\n // Need Rationale\n String message = \"You need to grant access to \" + permissionsNeeded.get(0);\n for (int i = 1; i < permissionsNeeded.size(); i++)\n message = message + \", \" + permissionsNeeded.get(i);\n showMessageOKCancel(message,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n }\n });\n return false;\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n if (Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // Permission is not granted\n return false;\n } else {\n return true;// Permission has already been granted }\n }\n }", "void askForPermissions();", "private void checkPermission(){\n // vérification de l'autorisation d'accéder à la position GPS\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n// // l'autorisation n'est pas acceptée\n// if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n// Manifest.permission.ACCESS_FINE_LOCATION)) {\n// // l'autorisation a été refusée précédemment, on peut prévenir l'utilisateur ici\n// } else {\n // l'autorisation n'a jamais été réclamée, on la demande à l'utilisateur\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n FINE_LOCATION_REQUEST);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n // }\n } else {\n // TODO : autorisation déjà acceptée, on peut faire une action ici\n initLocation();\n }\n }", "abstract public void getPermission();", "public void verifyPermission() {\n Permissions.check(this/*context*/, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() {\n @Override\n public void onGranted() {\n addVideoInFolder();\n setupExoPlayer();\n settingListener();\n }\n\n @Override\n public void onDenied(Context context, ArrayList<String> deniedPermissions) {\n super.onDenied(context, deniedPermissions);\n verifyPermission();\n }\n });\n\n }", "private boolean checkDeviceSettings()\n {\n List<String> listPermissionNeeded= new ArrayList<>();\n boolean ret = true;\n for(String perm : permission)\n {\n if(ContextCompat.checkSelfPermission(this,perm)!= PackageManager.PERMISSION_GRANTED)\n listPermissionNeeded.add(perm);\n }\n if(!listPermissionNeeded.isEmpty())\n {\n ActivityCompat.requestPermissions(this,listPermissionNeeded.toArray(new String[listPermissionNeeded.size()]),REQUEST_PERMISSION);\n ret = false;\n }\n\n return ret;\n }", "public boolean validatePermissions()\r\n\t{\n\t\treturn true;\r\n\t}", "void requestNeededPermissions(int requestCode);", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "private void checkpermission() {\n permissionUtils = new PermissionUtils(context, this);\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n permissionUtils.check_permission(permissions, \"Need GPS permission for getting your location\", LOCATION_REQUEST_CODE);\n }", "private void checkPermissions() {\n final ArrayList<String> missedPermissions = new ArrayList<>();\n\n for (final String permission : PERMISSIONS_REQUIRED) {\n if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {\n missedPermissions.add(permission);\n }\n }\n\n if (!missedPermissions.isEmpty()) {\n final String[] permissions = new String[missedPermissions.size()];\n missedPermissions.toArray(permissions);\n\n ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);\n }\n }", "public void verifyAppPermissions() {\n boolean hasAll = true;\n mHasBluetoothPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED;\n mHasBluetoothAdminPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n\n if (!hasAll) {\n // We don't have permission so prompt the user\n ActivityCompat.requestPermissions(\n this,\n APP_PERMISSIONS,\n REQUEST_PERMISSIONS\n );\n }\n }", "int getPermissionRead();", "private boolean checkPermissions() {\n if (!read_external_storage_granted ||\n !write_external_storage_granted ||\n !write_external_storage_granted) {\n Toast.makeText(getApplicationContext(), \"Die App braucht Zugang zur Kamera und zum Speicher.\", Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }", "private void checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED){\n\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA}, 56);\n }\n }", "public void checkPermission(String permission, int requestCode)\n {\n if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {\n // Requesting the permission\n ActivityCompat.requestPermissions(this, new String[] { permission }, requestCode);\n }\n else {\n Toast.makeText(this, \"Permission already granted\", Toast.LENGTH_SHORT).show();\n }\n }", "public boolean checkPerms()\n {\n boolean perms = hasPerms();\n if (!perms) {\n ActivityCompat.requestPermissions(\n itsActivity, new String[] { itsPerm }, itsPermsRequestCode);\n }\n return perms;\n }", "private void checkPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this)\n .setMessage(getString(R.string.can_not_handle_calls))\n .setCancelable(false)\n .setPositiveButton(R.string.text_ok, (dialog, id) -> {\n requestPermission();\n });\n\n builder.create().show();\n } else {\n presenter.gotPermissions = true;\n }\n }", "public void checkRequestPermission(){\n\n\n hasPermission = (ActivityCompat.checkSelfPermission(this, Manifest.permission.VIBRATE)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED );\n//check group permissons\n if (!hasPermission){\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.VIBRATE,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE\n\n },\n REQUEST_NETWORK_ACCESS);\n }\n }", "private void checkAndRequestPermissions() {\n missingPermission = new ArrayList<>();\n // Check for permissions\n for (String eachPermission : REQUIRED_PERMISSION_LIST) {\n if (ContextCompat.checkSelfPermission(this, eachPermission) != PackageManager.PERMISSION_GRANTED) {\n missingPermission.add(eachPermission);\n }\n }\n // Request for missing permissions\n if (missingPermission.isEmpty()) {\n DroneModel.getInstance(this).setDjiProductStateCallBack(this);\n DroneModel.getInstance(this).startSDKRegistration();\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n missingPermission.toArray(new String[missingPermission.size()]),\n REQUEST_PERMISSION_CODE);\n }\n }", "private static boolean isPermissionGranted(Context context, String permission) {\n if (ContextCompat.checkSelfPermission(context, permission)\n == PackageManager.PERMISSION_GRANTED) {\n Log.i(TAG, permission + \" granted\");\n return true;\n }\n Log.i(TAG, permission + \" not granted yet\");\n return false;\n }", "private boolean checkPermissions() {\n int permissionState1 = ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION);\n\n int permissionState2 = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION);\n return permissionState1 == PackageManager.PERMISSION_GRANTED && permissionState2 == PackageManager.PERMISSION_GRANTED;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "private void permissionChecks() {\n if(Build.VERSION.SDK_INT < 23)\n return;\n\n if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 0);\n }\n }", "private void checkAndRequestForPermission() {\n if(ContextCompat.checkSelfPermission(RegisterActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED){\n if(ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE)){\n Toast.makeText(RegisterActivity.this, \"Please accept for required permission\",\n Toast.LENGTH_SHORT).show();\n }\n else{\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String []{Manifest.permission.READ_EXTERNAL_STORAGE},PReqCode);\n }\n }\n else{\n openGallery();\n }\n }", "private boolean checkPermissions() {\n int res = ContextCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.READ_EXTERNAL_STORAGE);\n if (res == PackageManager.PERMISSION_GRANTED)\n return true;\n else\n return false;\n }", "@Override\n public boolean hasPermission(Permission permission) {\n // FacesContext context = FacesContext.getCurrentInstance();\n String imp = (String)ADFContext.getCurrent().getSessionScope().get(\"isImpersonationOn\");\n// String imp = (String)context.getExternalContext().getSessionMap().get(\"isImpersonationOn\");\n if(imp == null || !imp.equals(\"Y\")){\n return super.hasPermission(permission);\n }\n else{\n return true;\n \n }\n \n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(\n this, Manifest.permission.ACCESS_FINE_LOCATION\n );\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "public boolean checkPermissions(String permission) {\r\n Log.d(TAG, \"checkPermissions: checking permission: \" + permission);\r\n\r\n int permissionRequest = ActivityCompat.checkSelfPermission(EditProfileActivity.this, permission);\r\n\r\n if (permissionRequest != PackageManager.PERMISSION_GRANTED) {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was not granted for: \" + permission);\r\n Toast.makeText(this, \"Permissions not granted to access camera,\\n\" +\r\n \"please give permissions to GetAplot\", Toast.LENGTH_SHORT).show();\r\n return false;\r\n } else {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was granted for: \" + permission);\r\n return true;\r\n }\r\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(UniformDrawer.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\r\n if (result == PackageManager.PERMISSION_GRANTED) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean CheckingPermissionIsEnabledOrNot()\n {\n int CameraPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\n int WriteStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ReadStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n\n return CameraPermissionResult == PackageManager.PERMISSION_GRANTED &&\n WriteStoragePermissionResult == PackageManager.PERMISSION_GRANTED &&\n ReadStoragePermissionResult == PackageManager.PERMISSION_GRANTED;\n }", "private void checkForPermission() {\n if (ContextCompat.checkSelfPermission(QuizConfirmationActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(QuizConfirmationActivity.this\n , Manifest.permission.READ_EXTERNAL_STORAGE)) {\n Toast.makeText(QuizConfirmationActivity.this,\n \"Please provide the required storage permission in the app setting\", Toast.LENGTH_SHORT).show();\n\n } else {\n\n ActivityCompat.requestPermissions(QuizConfirmationActivity.this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n\n PreqCode);\n }\n } else {\n imageSelect(QuizConfirmationActivity.this);\n }\n\n\n }", "private boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,\n android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n return false;\n\n } else {\n return true;\n }\n }", "@Override\n public void onPermissionGranted() {\n }", "private boolean checkPermissions() {\r\n int permissionState = ActivityCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION);\r\n return permissionState == PackageManager.PERMISSION_GRANTED;\r\n }", "private boolean checkPermission() {\n int fineLocation = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n\n if (fineLocation != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_FINE_LOCATION);\n }\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermission() {\n Log.d(\"TAG\", \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED );\n }", "@Override\n public void onPermissionGranted() {\n }", "public boolean CheckPermissions() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;\r\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private boolean arePermissionsEnabled(){\n for(String permission : mPermissions){\n if(checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED)\n return false;\n }\n return true;\n }", "private boolean checkPermissions() {\n boolean permissionGrant = false;\n if (Build.VERSION.SDK_INT >= 23 && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions((Activity) this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_ACCESS_COARSE_LOCATION);\n } else {\n permissionGrant = true;\n }\n return permissionGrant;\n\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_ACCESS_FINE_LOCATION);\n\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED){\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\n PERMISSIONS_ACCESS_COARSE_LOCATION);\n } else {\n isPermission = true;\n }\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkAndRequestPermissions() {\n int locationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n List<String> listPermissionsNeeded = new ArrayList<>();\n if (locationPermission != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n }\n// if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {\n// listPermissionsNeeded.add(Manifest.permission.SEND_SMS);\n// }\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED );\n }", "public boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n new AlertDialog.Builder(this)\n .setTitle(\"TITLE\")\n .setMessage(\"TEXT\")\n .setPositiveButton(\"OKAY\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Prompt the user once explanation has been shown\n ActivityCompat.requestPermissions(MapsActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n })\n .create()\n .show();\n\n\n } else {\n // No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n return false;\n } else {\n return true;\n }\n }", "@TargetApi(23)\r\n public void requestPermission() {\r\n ArrayList<String> arrayList;\r\n String[] strArr = this.mPermissions;\r\n for (String str : strArr) {\r\n if (this.mActivity.checkCallingOrSelfPermission(str) != 0) {\r\n if (shouldShowRequestPermissionRationale(str) || !PermissionUtils.isNeverShowEnabled(PermissionUtils.getRequestCode(str))) {\r\n if (this.normalPermissions == null) {\r\n this.normalPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.normalPermissions;\r\n } else {\r\n if (this.settingsPermissions == null) {\r\n this.settingsPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.settingsPermissions;\r\n }\r\n arrayList.add(str);\r\n }\r\n }\r\n Log.d(TAG, \"requestPermission() settingsPermissions:\" + this.settingsPermissions);\r\n Log.d(TAG, \"requestPermission() normalPermissions:\" + this.normalPermissions);\r\n ArrayList<String> arrayList2 = this.normalPermissions;\r\n if (arrayList2 == null || arrayList2.size() <= 0) {\r\n ArrayList<String> arrayList3 = this.settingsPermissions;\r\n if (arrayList3 == null || arrayList3.size() <= 0) {\r\n IGrantedTask iGrantedTask = this.mTask;\r\n if (iGrantedTask != null) {\r\n iGrantedTask.doTask();\r\n }\r\n } else {\r\n Activity activity = this.mActivity;\r\n PermissionUtils.showPermissionSettingsDialog(activity, activity.getResources().getString(R.string.app_name), this.settingsPermissions, true);\r\n this.settingsPermissions = null;\r\n }\r\n finishFragment();\r\n return;\r\n }\r\n requestPermissions((String[]) this.normalPermissions.toArray(new String[this.normalPermissions.size()]), 5003);\r\n this.normalPermissions = null;\r\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED) {\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\r\n PERMISSIONS_ACCESS_FINE_LOCATION);\r\n\r\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED){\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\r\n PERMISSIONS_ACCESS_COARSE_LOCATION);\r\n } else {\r\n isPermission = true;\r\n }\r\n }", "private boolean checkPermission() {\n Log.d(TAG, \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED);\n }", "private boolean checkPermissions() {\n return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n }", "private boolean checkForPermission() {\n\n int permissionCode = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\n\n if(permissionCode == PackageManager.PERMISSION_GRANTED) return true;\n else return false;\n }", "public void checkPermission(){\n Log.d(\"BluetoothLeService\", \"initialize is \" + mBluetoothManager);\n if (mBluetoothManager == null) {\n mBluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);\n if (mBluetoothManager == null) {\n Log.e(TAG, \"Unable to initialize BluetoothManager.\");\n return;\n }\n }\n\n mBluetoothAdapter = mBluetoothManager.getAdapter();\n if (mBluetoothAdapter == null) {\n Log.e(TAG, \"Unable to obtain a BluetoothAdapter.\");\n return;\n }\n\n if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();\n\n int PERMISSION_ALL = 1;\n /*\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.GET_ACCOUNTS};\n */\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION\n };\n\n if (!hasPermissions(this, PERMISSIONS)) {\n ActivityCompat.requestPermissions( this, PERMISSIONS, PERMISSION_ALL);\n }\n }", "public void onPermissionGranted() {\n\n }", "public boolean checkForPermission() {\r\n int permissionCAMERA = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);\r\n int storagePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\r\n int accessCoarseLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);\r\n int accessFineLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\r\n\r\n List<String> listPermissionsNeeded = new ArrayList<>();\r\n if (storagePermission != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\r\n }\r\n if (permissionCAMERA != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.CAMERA);\r\n }\r\n if (accessCoarseLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\r\n }\r\n if (accessFineLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\r\n }\r\n if (!listPermissionsNeeded.isEmpty()) {\r\n ActivityCompat.requestPermissions(this,\r\n listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), MY_PERMISSIONS_REQUEST);\r\n return false;\r\n }\r\n\r\n return true;\r\n }", "void checkPermission(T request) throws AuthorizationException;", "private void checkIfPermissionGranted() {\n\n //if user already allowed the permission, this condition will be true\n if (ContextCompat.checkSelfPermission(this, PERMISSION_CODE)\n == PackageManager.PERMISSION_GRANTED) {\n Intent launchIntent = getPackageManager().getLaunchIntentForPackage(\"com.example.a3\");\n if (launchIntent != null) {\n startActivity(launchIntent);//null pointer check in case package name was not found\n }\n }\n //if user didn't allow the permission yet, then ask for permission\n else {\n ActivityCompat.requestPermissions(this, new String[]{PERMISSION_CODE}, 0);\n }\n }", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "@Override\n public void onClick(View view) {\n String platform = checkPlatform();\n if (platform.equals(\"Marshmallow\")) {\n Log.d(TAG, \"Runtime permission required\");\n //Step 2. check the permission\n boolean permissionStatus = checkPermission();\n if (permissionStatus) {\n //Permission already granted\n Log.d(TAG, \"Permission already granted\");\n } else {\n //Permission not granted\n //Step 3. Explain permission i.e show an explanation\n Log.d(TAG, \"Explain permission\");\n explainPermission();\n //Step 4. Request Permissions\n Log.d(TAG, \"Request Permission\");\n requestPermission();\n }\n\n } else {\n Log.d(TAG, \"onClick: Runtime permission not required\");\n }\n\n\n }", "private boolean checkPermissions() {\n boolean hasPermission = true;\n\n int result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_FINE_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n\n // ACCESS_BACKGROUND_LOCATION is only required on API 29 and higher\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\n result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_BACKGROUND_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n }\n\n return hasPermission;\n }", "private void getPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n }", "private void checkPermissions(){\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){\n ActivityCompat.requestPermissions(this, new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.ACCESS_COARSE_LOCATION\n },PERMS_CALL_ID);\n\n }\n\n\n }", "@PermissionSuccess(requestCode = 100)\n public void onPermissionSuccess(){\n }", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_checkNotificationPermission, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "private boolean validateAccess(String permission) {\n\t\tif (\"READ\".equalsIgnoreCase(permission)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean isWritePermissionGranted();", "public static void checkAccess() throws SecurityException {\n if(isSystemThread.get()) {\n return;\n }\n //TODO: Add Admin Checking Code\n// if(getCurrentUser() != null && getCurrentUser().isAdmin()) {\n// return;\n// }\n throw new SecurityException(\"Invalid Permissions\");\n }", "boolean ignoresPermission();", "@Test\n public void testCheckExistsPermission() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE\");\n assertFalse(permissionManager.checkExists(permission2));\n }", "private boolean checkPermissions(String permissionStr, int requestCode) {\n // Check to see if we have permission to access something,\n // such like the microphone.\n int permission = ActivityCompat.checkSelfPermission(\n HotwordDetectionActivity.this,\n permissionStr);\n\n if (permission != PackageManager.PERMISSION_GRANTED) {\n // We can not access it, request authorization from the user.\n ActivityCompat.requestPermissions(\n HotwordDetectionActivity.this,\n new String[] {permissionStr},\n requestCode\n );\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermissionStorage() {\n\n boolean isPermissionGranted = true;\n\n int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n\n if (permissionStorage != PackageManager.PERMISSION_GRANTED)\n {\n isPermissionGranted = false;\n }\n\n return isPermissionGranted;\n }", "int getPermissionWrite();", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "public boolean CheckingPermissionIsEnabledOrNot() {\n int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), INTERNET);\n int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_NETWORK_STATE);\n int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ForthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_COARSE_LOCATION);\n int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\n int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), VIBRATE);\n// int EighthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CALL_PHONE);\n// int NinethPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\n\n return FirstPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SecondPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ThirdPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ForthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n FifthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SixthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SeventhPermissionResult == PackageManager.PERMISSION_GRANTED;\n// EighthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n// NinethPermissionResult == PackageManager.PERMISSION_GRANTED;\n }" ]
[ "0.78061116", "0.77052194", "0.7644345", "0.7578227", "0.74156034", "0.728739", "0.7255468", "0.724358", "0.72018945", "0.712154", "0.71159494", "0.7043407", "0.70355487", "0.70296174", "0.7007319", "0.6995498", "0.6977545", "0.6977358", "0.6973267", "0.6969954", "0.6968984", "0.6961357", "0.6953506", "0.6952861", "0.6946677", "0.693117", "0.6911616", "0.6909338", "0.6895584", "0.6864902", "0.68463343", "0.68353975", "0.68241066", "0.6803475", "0.6801704", "0.6800543", "0.67885953", "0.6779294", "0.6778586", "0.67656577", "0.67521626", "0.67511874", "0.6742429", "0.67396927", "0.6733997", "0.67183685", "0.67183095", "0.6711119", "0.67088073", "0.6703598", "0.66995126", "0.66935265", "0.669061", "0.66870254", "0.6664966", "0.6657274", "0.6652056", "0.6649899", "0.6646285", "0.6643312", "0.6637372", "0.66371506", "0.662881", "0.6623307", "0.6620403", "0.6618599", "0.6615486", "0.6607039", "0.66012925", "0.6600757", "0.6600757", "0.66002476", "0.6590849", "0.6584737", "0.6582371", "0.6576477", "0.6567547", "0.6565327", "0.65608585", "0.65580493", "0.65567786", "0.655208", "0.6550827", "0.6548847", "0.6545712", "0.6544774", "0.654415", "0.65431756", "0.6543069", "0.65279615", "0.6524164", "0.65184855", "0.6516418", "0.65155244", "0.6491373", "0.6488048", "0.64868426", "0.64837366", "0.64800864", "0.6471658", "0.6463857" ]
0.0
-1
We are calling this method to check the permission status
public static boolean isReadStorageAllowed(FragmentActivity act) { //Getting the permission status int result = ContextCompat.checkSelfPermission(act, Manifest.permission.READ_EXTERNAL_STORAGE); //If permission is granted returning true if (result == PackageManager.PERMISSION_GRANTED) return true; //If permission is not granted returning false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "@Override\n public void checkPermission(Permission perm) {\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "public boolean checkPermission(Permission permission);", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), READ_CONTACTS);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\r\n int result2 = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\r\n int result3 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\r\n int result4 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result5 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_PHONE_STATE);\r\n int result6 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n int result7 = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\r\n //int result8 = ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH);\r\n\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED && result2 == PackageManager.PERMISSION_GRANTED &&\r\n result3 == PackageManager.PERMISSION_GRANTED && result4 == PackageManager.PERMISSION_GRANTED && result5 == PackageManager.PERMISSION_GRANTED &&\r\n result6 == PackageManager.PERMISSION_GRANTED && result7 == PackageManager.PERMISSION_GRANTED/*&& result8== PackageManager.PERMISSION_GRANTED*/;\r\n }", "private void chkPermission() {\n permissionStatus = getSharedPreferences(\"permissionStatus\", MODE_PRIVATE);\n\n if (ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED\n || ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[0])\n || ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[1])) {\n //Show Information about why you need the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n\n } else if (permissionStatus.getBoolean(permissionsRequired[0], false)) {\n //Previously Permission Request was cancelled with 'Dont Ask Again',\n // Redirect to Settings after showing Information about why you need the permission\n sentToSettings = true;\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n Uri uri = Uri.fromParts(\"package\", getPackageName(), null);\n intent.setData(uri);\n startActivityForResult(intent, REQUEST_PERMISSION_SETTING);\n Toast.makeText(getBaseContext(), \"Go to Permissions to Grant Camera, Phone and Storage\", Toast.LENGTH_LONG).show();\n\n } else {\n //just request the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n }\n\n //txtPermissions.setText(\"Permissions Required\");\n\n SharedPreferences.Editor editor = permissionStatus.edit();\n editor.putBoolean(permissionsRequired[0], true);\n editor.commit();\n } else {\n //You already have the permission, just go ahead.\n //proceedAfterPermission();\n }\n\n }", "boolean isHasPermissions();", "private boolean permisos() {\n for(String permission : PERMISSION_REQUIRED) {\n if(ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "public boolean checkPermissions(String check)\n {\n Log.d(TAG,\"check single PErmission\");\n int permissionRequest= ActivityCompat.checkSelfPermission(UploadActivity.this,check);\n if(permissionRequest!= PackageManager.PERMISSION_GRANTED)\n {\n Log.d(TAG,\"check PErmission\\nPermission was not granted for:\"+check);\n return false;\n }\n else\n {\n Log.d(TAG,\"check PErmission\\nPermission was granted for:\"+check);\n return true;\n }\n\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "void permissionGranted(int requestCode);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == REQUEST_PERMISSION_SETTING) {\n checkPermission();\n }\n }", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "private boolean checkAndRequestPermissions() {\n List<String> listPermissionsNeeded = new ArrayList<>();\n for (String pem : appPermissions){\n if (ContextCompat.checkSelfPermission(this, pem) != PackageManager.PERMISSION_GRANTED){\n listPermissionsNeeded.add(pem);\n }\n }\n\n //ask for non-granted permissions\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_REQUEST_CODE);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);\n\n if (result == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n return false;\n }\n }", "public void checkpermission()\n {\n permissionUtils.check_permission(permissions,\"Need GPS permission for getting your location\",1);\n }", "private void checkPermissions() {\n List<String> permissions = new ArrayList<>();\n String message = \"osmdroid permissions:\";\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n message += \"\\nLocation to show user location.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);\n message += \"\\nStorage access to store map tiles.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.READ_PHONE_STATE);\n message += \"\\n access to read phone state.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.RECEIVE_SMS);\n message += \"\\n access to receive sms.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.GET_ACCOUNTS);\n message += \"\\n access to read sms.\";\n //requestReadPhoneStatePermission();\n }\n if (!permissions.isEmpty()) {\n // Toast.makeText(this, message, Toast.LENGTH_LONG).show();\n String[] params = permissions.toArray(new String[permissions.size()]);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(params, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n } // else: We already have permissions, so handle as normal\n }", "public void checkPermission() {\n Log.e(\"checkPermission\", \"checkPermission\");\n\n // Here, thisActivity is the current activity\n if (ContextCompat.checkSelfPermission(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n\n\n }", "public void checkPermissions(){\n //Check if some of the core permissions are not already granted\n if ((ContextCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)) {\n Toast.makeText(this, \"Some permissions are not granted. Please enable them.\", Toast.LENGTH_SHORT).show();\n\n //If so, request the activation of this permissions\n ActivityCompat.requestPermissions(LoginActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_ASK_PERMISSIONS);\n }\n else{\n //Permissions already granted\n }\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "public boolean isAllGranted(){\n //PackageManager.PERMISSION_GRANTED\n return false;\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "private Boolean checkRuntimePermission() {\n List<String> permissionsNeeded = new ArrayList<String>();\n\n final List<String> permissionsList = new ArrayList<String>();\n if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))\n permissionsNeeded.add(\"Storage\");\n if (!addPermission(permissionsList, Manifest.permission.CAMERA))\n permissionsNeeded.add(\"Camera\");\n /* if (!addPermission(permissionsList, Manifest.permission.WRITE_CONTACTS))\n permissionsNeeded.add(\"Write Contacts\");*/\n\n if (permissionsList.size() > 0) {\n if (permissionsNeeded.size() > 0) {\n // Need Rationale\n String message = \"You need to grant access to \" + permissionsNeeded.get(0);\n for (int i = 1; i < permissionsNeeded.size(); i++)\n message = message + \", \" + permissionsNeeded.get(i);\n showMessageOKCancel(message,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n }\n });\n return false;\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n if (Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // Permission is not granted\n return false;\n } else {\n return true;// Permission has already been granted }\n }\n }", "void askForPermissions();", "private void checkPermission(){\n // vérification de l'autorisation d'accéder à la position GPS\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n// // l'autorisation n'est pas acceptée\n// if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n// Manifest.permission.ACCESS_FINE_LOCATION)) {\n// // l'autorisation a été refusée précédemment, on peut prévenir l'utilisateur ici\n// } else {\n // l'autorisation n'a jamais été réclamée, on la demande à l'utilisateur\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n FINE_LOCATION_REQUEST);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n // }\n } else {\n // TODO : autorisation déjà acceptée, on peut faire une action ici\n initLocation();\n }\n }", "abstract public void getPermission();", "public void verifyPermission() {\n Permissions.check(this/*context*/, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() {\n @Override\n public void onGranted() {\n addVideoInFolder();\n setupExoPlayer();\n settingListener();\n }\n\n @Override\n public void onDenied(Context context, ArrayList<String> deniedPermissions) {\n super.onDenied(context, deniedPermissions);\n verifyPermission();\n }\n });\n\n }", "private boolean checkDeviceSettings()\n {\n List<String> listPermissionNeeded= new ArrayList<>();\n boolean ret = true;\n for(String perm : permission)\n {\n if(ContextCompat.checkSelfPermission(this,perm)!= PackageManager.PERMISSION_GRANTED)\n listPermissionNeeded.add(perm);\n }\n if(!listPermissionNeeded.isEmpty())\n {\n ActivityCompat.requestPermissions(this,listPermissionNeeded.toArray(new String[listPermissionNeeded.size()]),REQUEST_PERMISSION);\n ret = false;\n }\n\n return ret;\n }", "public boolean validatePermissions()\r\n\t{\n\t\treturn true;\r\n\t}", "void requestNeededPermissions(int requestCode);", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "private void checkpermission() {\n permissionUtils = new PermissionUtils(context, this);\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n permissionUtils.check_permission(permissions, \"Need GPS permission for getting your location\", LOCATION_REQUEST_CODE);\n }", "private void checkPermissions() {\n final ArrayList<String> missedPermissions = new ArrayList<>();\n\n for (final String permission : PERMISSIONS_REQUIRED) {\n if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {\n missedPermissions.add(permission);\n }\n }\n\n if (!missedPermissions.isEmpty()) {\n final String[] permissions = new String[missedPermissions.size()];\n missedPermissions.toArray(permissions);\n\n ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);\n }\n }", "public void verifyAppPermissions() {\n boolean hasAll = true;\n mHasBluetoothPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED;\n mHasBluetoothAdminPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n\n if (!hasAll) {\n // We don't have permission so prompt the user\n ActivityCompat.requestPermissions(\n this,\n APP_PERMISSIONS,\n REQUEST_PERMISSIONS\n );\n }\n }", "int getPermissionRead();", "private boolean checkPermissions() {\n if (!read_external_storage_granted ||\n !write_external_storage_granted ||\n !write_external_storage_granted) {\n Toast.makeText(getApplicationContext(), \"Die App braucht Zugang zur Kamera und zum Speicher.\", Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }", "private void checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED){\n\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA}, 56);\n }\n }", "public void checkPermission(String permission, int requestCode)\n {\n if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {\n // Requesting the permission\n ActivityCompat.requestPermissions(this, new String[] { permission }, requestCode);\n }\n else {\n Toast.makeText(this, \"Permission already granted\", Toast.LENGTH_SHORT).show();\n }\n }", "public boolean checkPerms()\n {\n boolean perms = hasPerms();\n if (!perms) {\n ActivityCompat.requestPermissions(\n itsActivity, new String[] { itsPerm }, itsPermsRequestCode);\n }\n return perms;\n }", "private void checkPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this)\n .setMessage(getString(R.string.can_not_handle_calls))\n .setCancelable(false)\n .setPositiveButton(R.string.text_ok, (dialog, id) -> {\n requestPermission();\n });\n\n builder.create().show();\n } else {\n presenter.gotPermissions = true;\n }\n }", "public void checkRequestPermission(){\n\n\n hasPermission = (ActivityCompat.checkSelfPermission(this, Manifest.permission.VIBRATE)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED );\n//check group permissons\n if (!hasPermission){\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.VIBRATE,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE\n\n },\n REQUEST_NETWORK_ACCESS);\n }\n }", "private void checkAndRequestPermissions() {\n missingPermission = new ArrayList<>();\n // Check for permissions\n for (String eachPermission : REQUIRED_PERMISSION_LIST) {\n if (ContextCompat.checkSelfPermission(this, eachPermission) != PackageManager.PERMISSION_GRANTED) {\n missingPermission.add(eachPermission);\n }\n }\n // Request for missing permissions\n if (missingPermission.isEmpty()) {\n DroneModel.getInstance(this).setDjiProductStateCallBack(this);\n DroneModel.getInstance(this).startSDKRegistration();\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n missingPermission.toArray(new String[missingPermission.size()]),\n REQUEST_PERMISSION_CODE);\n }\n }", "private static boolean isPermissionGranted(Context context, String permission) {\n if (ContextCompat.checkSelfPermission(context, permission)\n == PackageManager.PERMISSION_GRANTED) {\n Log.i(TAG, permission + \" granted\");\n return true;\n }\n Log.i(TAG, permission + \" not granted yet\");\n return false;\n }", "private boolean checkPermissions() {\n int permissionState1 = ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION);\n\n int permissionState2 = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION);\n return permissionState1 == PackageManager.PERMISSION_GRANTED && permissionState2 == PackageManager.PERMISSION_GRANTED;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "private void permissionChecks() {\n if(Build.VERSION.SDK_INT < 23)\n return;\n\n if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 0);\n }\n }", "private void checkAndRequestForPermission() {\n if(ContextCompat.checkSelfPermission(RegisterActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED){\n if(ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE)){\n Toast.makeText(RegisterActivity.this, \"Please accept for required permission\",\n Toast.LENGTH_SHORT).show();\n }\n else{\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String []{Manifest.permission.READ_EXTERNAL_STORAGE},PReqCode);\n }\n }\n else{\n openGallery();\n }\n }", "private boolean checkPermissions() {\n int res = ContextCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.READ_EXTERNAL_STORAGE);\n if (res == PackageManager.PERMISSION_GRANTED)\n return true;\n else\n return false;\n }", "@Override\n public boolean hasPermission(Permission permission) {\n // FacesContext context = FacesContext.getCurrentInstance();\n String imp = (String)ADFContext.getCurrent().getSessionScope().get(\"isImpersonationOn\");\n// String imp = (String)context.getExternalContext().getSessionMap().get(\"isImpersonationOn\");\n if(imp == null || !imp.equals(\"Y\")){\n return super.hasPermission(permission);\n }\n else{\n return true;\n \n }\n \n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(\n this, Manifest.permission.ACCESS_FINE_LOCATION\n );\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "public boolean checkPermissions(String permission) {\r\n Log.d(TAG, \"checkPermissions: checking permission: \" + permission);\r\n\r\n int permissionRequest = ActivityCompat.checkSelfPermission(EditProfileActivity.this, permission);\r\n\r\n if (permissionRequest != PackageManager.PERMISSION_GRANTED) {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was not granted for: \" + permission);\r\n Toast.makeText(this, \"Permissions not granted to access camera,\\n\" +\r\n \"please give permissions to GetAplot\", Toast.LENGTH_SHORT).show();\r\n return false;\r\n } else {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was granted for: \" + permission);\r\n return true;\r\n }\r\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(UniformDrawer.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\r\n if (result == PackageManager.PERMISSION_GRANTED) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean CheckingPermissionIsEnabledOrNot()\n {\n int CameraPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\n int WriteStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ReadStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n\n return CameraPermissionResult == PackageManager.PERMISSION_GRANTED &&\n WriteStoragePermissionResult == PackageManager.PERMISSION_GRANTED &&\n ReadStoragePermissionResult == PackageManager.PERMISSION_GRANTED;\n }", "private void checkForPermission() {\n if (ContextCompat.checkSelfPermission(QuizConfirmationActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(QuizConfirmationActivity.this\n , Manifest.permission.READ_EXTERNAL_STORAGE)) {\n Toast.makeText(QuizConfirmationActivity.this,\n \"Please provide the required storage permission in the app setting\", Toast.LENGTH_SHORT).show();\n\n } else {\n\n ActivityCompat.requestPermissions(QuizConfirmationActivity.this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n\n PreqCode);\n }\n } else {\n imageSelect(QuizConfirmationActivity.this);\n }\n\n\n }", "private boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,\n android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n return false;\n\n } else {\n return true;\n }\n }", "@Override\n public void onPermissionGranted() {\n }", "private boolean checkPermissions() {\r\n int permissionState = ActivityCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION);\r\n return permissionState == PackageManager.PERMISSION_GRANTED;\r\n }", "private boolean checkPermission() {\n int fineLocation = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n\n if (fineLocation != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_FINE_LOCATION);\n }\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermission() {\n Log.d(\"TAG\", \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED );\n }", "@Override\n public void onPermissionGranted() {\n }", "public boolean CheckPermissions() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;\r\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private boolean arePermissionsEnabled(){\n for(String permission : mPermissions){\n if(checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED)\n return false;\n }\n return true;\n }", "private boolean checkPermissions() {\n boolean permissionGrant = false;\n if (Build.VERSION.SDK_INT >= 23 && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions((Activity) this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_ACCESS_COARSE_LOCATION);\n } else {\n permissionGrant = true;\n }\n return permissionGrant;\n\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_ACCESS_FINE_LOCATION);\n\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED){\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\n PERMISSIONS_ACCESS_COARSE_LOCATION);\n } else {\n isPermission = true;\n }\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkAndRequestPermissions() {\n int locationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n List<String> listPermissionsNeeded = new ArrayList<>();\n if (locationPermission != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n }\n// if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {\n// listPermissionsNeeded.add(Manifest.permission.SEND_SMS);\n// }\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED );\n }", "public boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n new AlertDialog.Builder(this)\n .setTitle(\"TITLE\")\n .setMessage(\"TEXT\")\n .setPositiveButton(\"OKAY\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Prompt the user once explanation has been shown\n ActivityCompat.requestPermissions(MapsActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n })\n .create()\n .show();\n\n\n } else {\n // No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n return false;\n } else {\n return true;\n }\n }", "@TargetApi(23)\r\n public void requestPermission() {\r\n ArrayList<String> arrayList;\r\n String[] strArr = this.mPermissions;\r\n for (String str : strArr) {\r\n if (this.mActivity.checkCallingOrSelfPermission(str) != 0) {\r\n if (shouldShowRequestPermissionRationale(str) || !PermissionUtils.isNeverShowEnabled(PermissionUtils.getRequestCode(str))) {\r\n if (this.normalPermissions == null) {\r\n this.normalPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.normalPermissions;\r\n } else {\r\n if (this.settingsPermissions == null) {\r\n this.settingsPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.settingsPermissions;\r\n }\r\n arrayList.add(str);\r\n }\r\n }\r\n Log.d(TAG, \"requestPermission() settingsPermissions:\" + this.settingsPermissions);\r\n Log.d(TAG, \"requestPermission() normalPermissions:\" + this.normalPermissions);\r\n ArrayList<String> arrayList2 = this.normalPermissions;\r\n if (arrayList2 == null || arrayList2.size() <= 0) {\r\n ArrayList<String> arrayList3 = this.settingsPermissions;\r\n if (arrayList3 == null || arrayList3.size() <= 0) {\r\n IGrantedTask iGrantedTask = this.mTask;\r\n if (iGrantedTask != null) {\r\n iGrantedTask.doTask();\r\n }\r\n } else {\r\n Activity activity = this.mActivity;\r\n PermissionUtils.showPermissionSettingsDialog(activity, activity.getResources().getString(R.string.app_name), this.settingsPermissions, true);\r\n this.settingsPermissions = null;\r\n }\r\n finishFragment();\r\n return;\r\n }\r\n requestPermissions((String[]) this.normalPermissions.toArray(new String[this.normalPermissions.size()]), 5003);\r\n this.normalPermissions = null;\r\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED) {\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\r\n PERMISSIONS_ACCESS_FINE_LOCATION);\r\n\r\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED){\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\r\n PERMISSIONS_ACCESS_COARSE_LOCATION);\r\n } else {\r\n isPermission = true;\r\n }\r\n }", "private boolean checkPermission() {\n Log.d(TAG, \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED);\n }", "private boolean checkPermissions() {\n return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n }", "private boolean checkForPermission() {\n\n int permissionCode = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\n\n if(permissionCode == PackageManager.PERMISSION_GRANTED) return true;\n else return false;\n }", "public void checkPermission(){\n Log.d(\"BluetoothLeService\", \"initialize is \" + mBluetoothManager);\n if (mBluetoothManager == null) {\n mBluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);\n if (mBluetoothManager == null) {\n Log.e(TAG, \"Unable to initialize BluetoothManager.\");\n return;\n }\n }\n\n mBluetoothAdapter = mBluetoothManager.getAdapter();\n if (mBluetoothAdapter == null) {\n Log.e(TAG, \"Unable to obtain a BluetoothAdapter.\");\n return;\n }\n\n if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();\n\n int PERMISSION_ALL = 1;\n /*\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.GET_ACCOUNTS};\n */\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION\n };\n\n if (!hasPermissions(this, PERMISSIONS)) {\n ActivityCompat.requestPermissions( this, PERMISSIONS, PERMISSION_ALL);\n }\n }", "public void onPermissionGranted() {\n\n }", "public boolean checkForPermission() {\r\n int permissionCAMERA = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);\r\n int storagePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\r\n int accessCoarseLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);\r\n int accessFineLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\r\n\r\n List<String> listPermissionsNeeded = new ArrayList<>();\r\n if (storagePermission != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\r\n }\r\n if (permissionCAMERA != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.CAMERA);\r\n }\r\n if (accessCoarseLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\r\n }\r\n if (accessFineLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\r\n }\r\n if (!listPermissionsNeeded.isEmpty()) {\r\n ActivityCompat.requestPermissions(this,\r\n listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), MY_PERMISSIONS_REQUEST);\r\n return false;\r\n }\r\n\r\n return true;\r\n }", "void checkPermission(T request) throws AuthorizationException;", "private void checkIfPermissionGranted() {\n\n //if user already allowed the permission, this condition will be true\n if (ContextCompat.checkSelfPermission(this, PERMISSION_CODE)\n == PackageManager.PERMISSION_GRANTED) {\n Intent launchIntent = getPackageManager().getLaunchIntentForPackage(\"com.example.a3\");\n if (launchIntent != null) {\n startActivity(launchIntent);//null pointer check in case package name was not found\n }\n }\n //if user didn't allow the permission yet, then ask for permission\n else {\n ActivityCompat.requestPermissions(this, new String[]{PERMISSION_CODE}, 0);\n }\n }", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "@Override\n public void onClick(View view) {\n String platform = checkPlatform();\n if (platform.equals(\"Marshmallow\")) {\n Log.d(TAG, \"Runtime permission required\");\n //Step 2. check the permission\n boolean permissionStatus = checkPermission();\n if (permissionStatus) {\n //Permission already granted\n Log.d(TAG, \"Permission already granted\");\n } else {\n //Permission not granted\n //Step 3. Explain permission i.e show an explanation\n Log.d(TAG, \"Explain permission\");\n explainPermission();\n //Step 4. Request Permissions\n Log.d(TAG, \"Request Permission\");\n requestPermission();\n }\n\n } else {\n Log.d(TAG, \"onClick: Runtime permission not required\");\n }\n\n\n }", "private boolean checkPermissions() {\n boolean hasPermission = true;\n\n int result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_FINE_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n\n // ACCESS_BACKGROUND_LOCATION is only required on API 29 and higher\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\n result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_BACKGROUND_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n }\n\n return hasPermission;\n }", "private void getPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n }", "private void checkPermissions(){\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){\n ActivityCompat.requestPermissions(this, new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.ACCESS_COARSE_LOCATION\n },PERMS_CALL_ID);\n\n }\n\n\n }", "@PermissionSuccess(requestCode = 100)\n public void onPermissionSuccess(){\n }", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_checkNotificationPermission, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "private boolean validateAccess(String permission) {\n\t\tif (\"READ\".equalsIgnoreCase(permission)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean isWritePermissionGranted();", "public static void checkAccess() throws SecurityException {\n if(isSystemThread.get()) {\n return;\n }\n //TODO: Add Admin Checking Code\n// if(getCurrentUser() != null && getCurrentUser().isAdmin()) {\n// return;\n// }\n throw new SecurityException(\"Invalid Permissions\");\n }", "boolean ignoresPermission();", "@Test\n public void testCheckExistsPermission() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE\");\n assertFalse(permissionManager.checkExists(permission2));\n }", "private boolean checkPermissions(String permissionStr, int requestCode) {\n // Check to see if we have permission to access something,\n // such like the microphone.\n int permission = ActivityCompat.checkSelfPermission(\n HotwordDetectionActivity.this,\n permissionStr);\n\n if (permission != PackageManager.PERMISSION_GRANTED) {\n // We can not access it, request authorization from the user.\n ActivityCompat.requestPermissions(\n HotwordDetectionActivity.this,\n new String[] {permissionStr},\n requestCode\n );\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermissionStorage() {\n\n boolean isPermissionGranted = true;\n\n int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n\n if (permissionStorage != PackageManager.PERMISSION_GRANTED)\n {\n isPermissionGranted = false;\n }\n\n return isPermissionGranted;\n }", "int getPermissionWrite();", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "public boolean CheckingPermissionIsEnabledOrNot() {\n int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), INTERNET);\n int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_NETWORK_STATE);\n int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ForthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_COARSE_LOCATION);\n int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\n int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), VIBRATE);\n// int EighthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CALL_PHONE);\n// int NinethPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\n\n return FirstPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SecondPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ThirdPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ForthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n FifthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SixthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SeventhPermissionResult == PackageManager.PERMISSION_GRANTED;\n// EighthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n// NinethPermissionResult == PackageManager.PERMISSION_GRANTED;\n }" ]
[ "0.78061116", "0.77052194", "0.7644345", "0.7578227", "0.74156034", "0.728739", "0.7255468", "0.724358", "0.72018945", "0.712154", "0.71159494", "0.7043407", "0.70355487", "0.70296174", "0.7007319", "0.6995498", "0.6977545", "0.6977358", "0.6973267", "0.6969954", "0.6968984", "0.6961357", "0.6953506", "0.6952861", "0.6946677", "0.693117", "0.6911616", "0.6909338", "0.6895584", "0.6864902", "0.68463343", "0.68353975", "0.68241066", "0.6803475", "0.6801704", "0.6800543", "0.67885953", "0.6779294", "0.6778586", "0.67656577", "0.67521626", "0.67511874", "0.6742429", "0.67396927", "0.6733997", "0.67183685", "0.67183095", "0.6711119", "0.67088073", "0.6703598", "0.66995126", "0.66935265", "0.669061", "0.66870254", "0.6664966", "0.6657274", "0.6652056", "0.6649899", "0.6646285", "0.6643312", "0.6637372", "0.66371506", "0.662881", "0.6623307", "0.6620403", "0.6618599", "0.6615486", "0.6607039", "0.66012925", "0.6600757", "0.6600757", "0.66002476", "0.6590849", "0.6584737", "0.6582371", "0.6576477", "0.6567547", "0.6565327", "0.65608585", "0.65580493", "0.65567786", "0.655208", "0.6550827", "0.6548847", "0.6545712", "0.6544774", "0.654415", "0.65431756", "0.6543069", "0.65279615", "0.6524164", "0.65184855", "0.6516418", "0.65155244", "0.6491373", "0.6488048", "0.64868426", "0.64837366", "0.64800864", "0.6471658", "0.6463857" ]
0.0
-1
We are calling this method to check the permission status
public static boolean isGPSAllowed(FragmentActivity act) { //Getting the permission status int result = ContextCompat.checkSelfPermission(act, Manifest.permission.ACCESS_FINE_LOCATION); //If permission is granted returning true if (result == PackageManager.PERMISSION_GRANTED) return true; //If permission is not granted returning false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "@Override\n public void checkPermission(Permission perm) {\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "public boolean checkPermission(Permission permission);", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), READ_CONTACTS);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\r\n int result2 = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\r\n int result3 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\r\n int result4 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result5 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_PHONE_STATE);\r\n int result6 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n int result7 = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\r\n //int result8 = ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH);\r\n\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED && result2 == PackageManager.PERMISSION_GRANTED &&\r\n result3 == PackageManager.PERMISSION_GRANTED && result4 == PackageManager.PERMISSION_GRANTED && result5 == PackageManager.PERMISSION_GRANTED &&\r\n result6 == PackageManager.PERMISSION_GRANTED && result7 == PackageManager.PERMISSION_GRANTED/*&& result8== PackageManager.PERMISSION_GRANTED*/;\r\n }", "private void chkPermission() {\n permissionStatus = getSharedPreferences(\"permissionStatus\", MODE_PRIVATE);\n\n if (ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED\n || ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[0])\n || ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[1])) {\n //Show Information about why you need the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n\n } else if (permissionStatus.getBoolean(permissionsRequired[0], false)) {\n //Previously Permission Request was cancelled with 'Dont Ask Again',\n // Redirect to Settings after showing Information about why you need the permission\n sentToSettings = true;\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n Uri uri = Uri.fromParts(\"package\", getPackageName(), null);\n intent.setData(uri);\n startActivityForResult(intent, REQUEST_PERMISSION_SETTING);\n Toast.makeText(getBaseContext(), \"Go to Permissions to Grant Camera, Phone and Storage\", Toast.LENGTH_LONG).show();\n\n } else {\n //just request the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n }\n\n //txtPermissions.setText(\"Permissions Required\");\n\n SharedPreferences.Editor editor = permissionStatus.edit();\n editor.putBoolean(permissionsRequired[0], true);\n editor.commit();\n } else {\n //You already have the permission, just go ahead.\n //proceedAfterPermission();\n }\n\n }", "boolean isHasPermissions();", "private boolean permisos() {\n for(String permission : PERMISSION_REQUIRED) {\n if(ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "public boolean checkPermissions(String check)\n {\n Log.d(TAG,\"check single PErmission\");\n int permissionRequest= ActivityCompat.checkSelfPermission(UploadActivity.this,check);\n if(permissionRequest!= PackageManager.PERMISSION_GRANTED)\n {\n Log.d(TAG,\"check PErmission\\nPermission was not granted for:\"+check);\n return false;\n }\n else\n {\n Log.d(TAG,\"check PErmission\\nPermission was granted for:\"+check);\n return true;\n }\n\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "void permissionGranted(int requestCode);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == REQUEST_PERMISSION_SETTING) {\n checkPermission();\n }\n }", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "private boolean checkAndRequestPermissions() {\n List<String> listPermissionsNeeded = new ArrayList<>();\n for (String pem : appPermissions){\n if (ContextCompat.checkSelfPermission(this, pem) != PackageManager.PERMISSION_GRANTED){\n listPermissionsNeeded.add(pem);\n }\n }\n\n //ask for non-granted permissions\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_REQUEST_CODE);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);\n\n if (result == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n return false;\n }\n }", "public void checkpermission()\n {\n permissionUtils.check_permission(permissions,\"Need GPS permission for getting your location\",1);\n }", "private void checkPermissions() {\n List<String> permissions = new ArrayList<>();\n String message = \"osmdroid permissions:\";\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n message += \"\\nLocation to show user location.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);\n message += \"\\nStorage access to store map tiles.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.READ_PHONE_STATE);\n message += \"\\n access to read phone state.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.RECEIVE_SMS);\n message += \"\\n access to receive sms.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.GET_ACCOUNTS);\n message += \"\\n access to read sms.\";\n //requestReadPhoneStatePermission();\n }\n if (!permissions.isEmpty()) {\n // Toast.makeText(this, message, Toast.LENGTH_LONG).show();\n String[] params = permissions.toArray(new String[permissions.size()]);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(params, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n } // else: We already have permissions, so handle as normal\n }", "public void checkPermission() {\n Log.e(\"checkPermission\", \"checkPermission\");\n\n // Here, thisActivity is the current activity\n if (ContextCompat.checkSelfPermission(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n\n\n }", "public void checkPermissions(){\n //Check if some of the core permissions are not already granted\n if ((ContextCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)) {\n Toast.makeText(this, \"Some permissions are not granted. Please enable them.\", Toast.LENGTH_SHORT).show();\n\n //If so, request the activation of this permissions\n ActivityCompat.requestPermissions(LoginActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_ASK_PERMISSIONS);\n }\n else{\n //Permissions already granted\n }\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "public boolean isAllGranted(){\n //PackageManager.PERMISSION_GRANTED\n return false;\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "private Boolean checkRuntimePermission() {\n List<String> permissionsNeeded = new ArrayList<String>();\n\n final List<String> permissionsList = new ArrayList<String>();\n if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))\n permissionsNeeded.add(\"Storage\");\n if (!addPermission(permissionsList, Manifest.permission.CAMERA))\n permissionsNeeded.add(\"Camera\");\n /* if (!addPermission(permissionsList, Manifest.permission.WRITE_CONTACTS))\n permissionsNeeded.add(\"Write Contacts\");*/\n\n if (permissionsList.size() > 0) {\n if (permissionsNeeded.size() > 0) {\n // Need Rationale\n String message = \"You need to grant access to \" + permissionsNeeded.get(0);\n for (int i = 1; i < permissionsNeeded.size(); i++)\n message = message + \", \" + permissionsNeeded.get(i);\n showMessageOKCancel(message,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n }\n });\n return false;\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n if (Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // Permission is not granted\n return false;\n } else {\n return true;// Permission has already been granted }\n }\n }", "void askForPermissions();", "private void checkPermission(){\n // vérification de l'autorisation d'accéder à la position GPS\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n// // l'autorisation n'est pas acceptée\n// if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n// Manifest.permission.ACCESS_FINE_LOCATION)) {\n// // l'autorisation a été refusée précédemment, on peut prévenir l'utilisateur ici\n// } else {\n // l'autorisation n'a jamais été réclamée, on la demande à l'utilisateur\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n FINE_LOCATION_REQUEST);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n // }\n } else {\n // TODO : autorisation déjà acceptée, on peut faire une action ici\n initLocation();\n }\n }", "abstract public void getPermission();", "public void verifyPermission() {\n Permissions.check(this/*context*/, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() {\n @Override\n public void onGranted() {\n addVideoInFolder();\n setupExoPlayer();\n settingListener();\n }\n\n @Override\n public void onDenied(Context context, ArrayList<String> deniedPermissions) {\n super.onDenied(context, deniedPermissions);\n verifyPermission();\n }\n });\n\n }", "private boolean checkDeviceSettings()\n {\n List<String> listPermissionNeeded= new ArrayList<>();\n boolean ret = true;\n for(String perm : permission)\n {\n if(ContextCompat.checkSelfPermission(this,perm)!= PackageManager.PERMISSION_GRANTED)\n listPermissionNeeded.add(perm);\n }\n if(!listPermissionNeeded.isEmpty())\n {\n ActivityCompat.requestPermissions(this,listPermissionNeeded.toArray(new String[listPermissionNeeded.size()]),REQUEST_PERMISSION);\n ret = false;\n }\n\n return ret;\n }", "public boolean validatePermissions()\r\n\t{\n\t\treturn true;\r\n\t}", "void requestNeededPermissions(int requestCode);", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "private void checkpermission() {\n permissionUtils = new PermissionUtils(context, this);\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n permissionUtils.check_permission(permissions, \"Need GPS permission for getting your location\", LOCATION_REQUEST_CODE);\n }", "private void checkPermissions() {\n final ArrayList<String> missedPermissions = new ArrayList<>();\n\n for (final String permission : PERMISSIONS_REQUIRED) {\n if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {\n missedPermissions.add(permission);\n }\n }\n\n if (!missedPermissions.isEmpty()) {\n final String[] permissions = new String[missedPermissions.size()];\n missedPermissions.toArray(permissions);\n\n ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);\n }\n }", "public void verifyAppPermissions() {\n boolean hasAll = true;\n mHasBluetoothPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED;\n mHasBluetoothAdminPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n\n if (!hasAll) {\n // We don't have permission so prompt the user\n ActivityCompat.requestPermissions(\n this,\n APP_PERMISSIONS,\n REQUEST_PERMISSIONS\n );\n }\n }", "int getPermissionRead();", "private boolean checkPermissions() {\n if (!read_external_storage_granted ||\n !write_external_storage_granted ||\n !write_external_storage_granted) {\n Toast.makeText(getApplicationContext(), \"Die App braucht Zugang zur Kamera und zum Speicher.\", Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }", "private void checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED){\n\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA}, 56);\n }\n }", "public void checkPermission(String permission, int requestCode)\n {\n if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {\n // Requesting the permission\n ActivityCompat.requestPermissions(this, new String[] { permission }, requestCode);\n }\n else {\n Toast.makeText(this, \"Permission already granted\", Toast.LENGTH_SHORT).show();\n }\n }", "public boolean checkPerms()\n {\n boolean perms = hasPerms();\n if (!perms) {\n ActivityCompat.requestPermissions(\n itsActivity, new String[] { itsPerm }, itsPermsRequestCode);\n }\n return perms;\n }", "private void checkPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this)\n .setMessage(getString(R.string.can_not_handle_calls))\n .setCancelable(false)\n .setPositiveButton(R.string.text_ok, (dialog, id) -> {\n requestPermission();\n });\n\n builder.create().show();\n } else {\n presenter.gotPermissions = true;\n }\n }", "private void checkAndRequestPermissions() {\n missingPermission = new ArrayList<>();\n // Check for permissions\n for (String eachPermission : REQUIRED_PERMISSION_LIST) {\n if (ContextCompat.checkSelfPermission(this, eachPermission) != PackageManager.PERMISSION_GRANTED) {\n missingPermission.add(eachPermission);\n }\n }\n // Request for missing permissions\n if (missingPermission.isEmpty()) {\n DroneModel.getInstance(this).setDjiProductStateCallBack(this);\n DroneModel.getInstance(this).startSDKRegistration();\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n missingPermission.toArray(new String[missingPermission.size()]),\n REQUEST_PERMISSION_CODE);\n }\n }", "public void checkRequestPermission(){\n\n\n hasPermission = (ActivityCompat.checkSelfPermission(this, Manifest.permission.VIBRATE)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED );\n//check group permissons\n if (!hasPermission){\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.VIBRATE,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE\n\n },\n REQUEST_NETWORK_ACCESS);\n }\n }", "private static boolean isPermissionGranted(Context context, String permission) {\n if (ContextCompat.checkSelfPermission(context, permission)\n == PackageManager.PERMISSION_GRANTED) {\n Log.i(TAG, permission + \" granted\");\n return true;\n }\n Log.i(TAG, permission + \" not granted yet\");\n return false;\n }", "private boolean checkPermissions() {\n int permissionState1 = ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION);\n\n int permissionState2 = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION);\n return permissionState1 == PackageManager.PERMISSION_GRANTED && permissionState2 == PackageManager.PERMISSION_GRANTED;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "private void permissionChecks() {\n if(Build.VERSION.SDK_INT < 23)\n return;\n\n if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 0);\n }\n }", "private void checkAndRequestForPermission() {\n if(ContextCompat.checkSelfPermission(RegisterActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED){\n if(ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE)){\n Toast.makeText(RegisterActivity.this, \"Please accept for required permission\",\n Toast.LENGTH_SHORT).show();\n }\n else{\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String []{Manifest.permission.READ_EXTERNAL_STORAGE},PReqCode);\n }\n }\n else{\n openGallery();\n }\n }", "private boolean checkPermissions() {\n int res = ContextCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.READ_EXTERNAL_STORAGE);\n if (res == PackageManager.PERMISSION_GRANTED)\n return true;\n else\n return false;\n }", "@Override\n public boolean hasPermission(Permission permission) {\n // FacesContext context = FacesContext.getCurrentInstance();\n String imp = (String)ADFContext.getCurrent().getSessionScope().get(\"isImpersonationOn\");\n// String imp = (String)context.getExternalContext().getSessionMap().get(\"isImpersonationOn\");\n if(imp == null || !imp.equals(\"Y\")){\n return super.hasPermission(permission);\n }\n else{\n return true;\n \n }\n \n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(\n this, Manifest.permission.ACCESS_FINE_LOCATION\n );\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "public boolean checkPermissions(String permission) {\r\n Log.d(TAG, \"checkPermissions: checking permission: \" + permission);\r\n\r\n int permissionRequest = ActivityCompat.checkSelfPermission(EditProfileActivity.this, permission);\r\n\r\n if (permissionRequest != PackageManager.PERMISSION_GRANTED) {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was not granted for: \" + permission);\r\n Toast.makeText(this, \"Permissions not granted to access camera,\\n\" +\r\n \"please give permissions to GetAplot\", Toast.LENGTH_SHORT).show();\r\n return false;\r\n } else {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was granted for: \" + permission);\r\n return true;\r\n }\r\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(UniformDrawer.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\r\n if (result == PackageManager.PERMISSION_GRANTED) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean CheckingPermissionIsEnabledOrNot()\n {\n int CameraPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\n int WriteStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ReadStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n\n return CameraPermissionResult == PackageManager.PERMISSION_GRANTED &&\n WriteStoragePermissionResult == PackageManager.PERMISSION_GRANTED &&\n ReadStoragePermissionResult == PackageManager.PERMISSION_GRANTED;\n }", "private void checkForPermission() {\n if (ContextCompat.checkSelfPermission(QuizConfirmationActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(QuizConfirmationActivity.this\n , Manifest.permission.READ_EXTERNAL_STORAGE)) {\n Toast.makeText(QuizConfirmationActivity.this,\n \"Please provide the required storage permission in the app setting\", Toast.LENGTH_SHORT).show();\n\n } else {\n\n ActivityCompat.requestPermissions(QuizConfirmationActivity.this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n\n PreqCode);\n }\n } else {\n imageSelect(QuizConfirmationActivity.this);\n }\n\n\n }", "private boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,\n android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n return false;\n\n } else {\n return true;\n }\n }", "@Override\n public void onPermissionGranted() {\n }", "private boolean checkPermissions() {\r\n int permissionState = ActivityCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION);\r\n return permissionState == PackageManager.PERMISSION_GRANTED;\r\n }", "private boolean checkPermission() {\n int fineLocation = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n\n if (fineLocation != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_FINE_LOCATION);\n }\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermission() {\n Log.d(\"TAG\", \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED );\n }", "@Override\n public void onPermissionGranted() {\n }", "public boolean CheckPermissions() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;\r\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private boolean arePermissionsEnabled(){\n for(String permission : mPermissions){\n if(checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED)\n return false;\n }\n return true;\n }", "private boolean checkPermissions() {\n boolean permissionGrant = false;\n if (Build.VERSION.SDK_INT >= 23 && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions((Activity) this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_ACCESS_COARSE_LOCATION);\n } else {\n permissionGrant = true;\n }\n return permissionGrant;\n\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_ACCESS_FINE_LOCATION);\n\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED){\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\n PERMISSIONS_ACCESS_COARSE_LOCATION);\n } else {\n isPermission = true;\n }\n }", "private boolean checkAndRequestPermissions() {\n int locationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n List<String> listPermissionsNeeded = new ArrayList<>();\n if (locationPermission != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n }\n// if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {\n// listPermissionsNeeded.add(Manifest.permission.SEND_SMS);\n// }\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n return true;\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkPermission() {\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED );\n }", "public boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n new AlertDialog.Builder(this)\n .setTitle(\"TITLE\")\n .setMessage(\"TEXT\")\n .setPositiveButton(\"OKAY\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Prompt the user once explanation has been shown\n ActivityCompat.requestPermissions(MapsActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n })\n .create()\n .show();\n\n\n } else {\n // No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n return false;\n } else {\n return true;\n }\n }", "@TargetApi(23)\r\n public void requestPermission() {\r\n ArrayList<String> arrayList;\r\n String[] strArr = this.mPermissions;\r\n for (String str : strArr) {\r\n if (this.mActivity.checkCallingOrSelfPermission(str) != 0) {\r\n if (shouldShowRequestPermissionRationale(str) || !PermissionUtils.isNeverShowEnabled(PermissionUtils.getRequestCode(str))) {\r\n if (this.normalPermissions == null) {\r\n this.normalPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.normalPermissions;\r\n } else {\r\n if (this.settingsPermissions == null) {\r\n this.settingsPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.settingsPermissions;\r\n }\r\n arrayList.add(str);\r\n }\r\n }\r\n Log.d(TAG, \"requestPermission() settingsPermissions:\" + this.settingsPermissions);\r\n Log.d(TAG, \"requestPermission() normalPermissions:\" + this.normalPermissions);\r\n ArrayList<String> arrayList2 = this.normalPermissions;\r\n if (arrayList2 == null || arrayList2.size() <= 0) {\r\n ArrayList<String> arrayList3 = this.settingsPermissions;\r\n if (arrayList3 == null || arrayList3.size() <= 0) {\r\n IGrantedTask iGrantedTask = this.mTask;\r\n if (iGrantedTask != null) {\r\n iGrantedTask.doTask();\r\n }\r\n } else {\r\n Activity activity = this.mActivity;\r\n PermissionUtils.showPermissionSettingsDialog(activity, activity.getResources().getString(R.string.app_name), this.settingsPermissions, true);\r\n this.settingsPermissions = null;\r\n }\r\n finishFragment();\r\n return;\r\n }\r\n requestPermissions((String[]) this.normalPermissions.toArray(new String[this.normalPermissions.size()]), 5003);\r\n this.normalPermissions = null;\r\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED) {\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\r\n PERMISSIONS_ACCESS_FINE_LOCATION);\r\n\r\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED){\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\r\n PERMISSIONS_ACCESS_COARSE_LOCATION);\r\n } else {\r\n isPermission = true;\r\n }\r\n }", "private boolean checkPermission() {\n Log.d(TAG, \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED);\n }", "private boolean checkPermissions() {\n return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n }", "private boolean checkForPermission() {\n\n int permissionCode = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\n\n if(permissionCode == PackageManager.PERMISSION_GRANTED) return true;\n else return false;\n }", "public void onPermissionGranted() {\n\n }", "public void checkPermission(){\n Log.d(\"BluetoothLeService\", \"initialize is \" + mBluetoothManager);\n if (mBluetoothManager == null) {\n mBluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);\n if (mBluetoothManager == null) {\n Log.e(TAG, \"Unable to initialize BluetoothManager.\");\n return;\n }\n }\n\n mBluetoothAdapter = mBluetoothManager.getAdapter();\n if (mBluetoothAdapter == null) {\n Log.e(TAG, \"Unable to obtain a BluetoothAdapter.\");\n return;\n }\n\n if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();\n\n int PERMISSION_ALL = 1;\n /*\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.GET_ACCOUNTS};\n */\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION\n };\n\n if (!hasPermissions(this, PERMISSIONS)) {\n ActivityCompat.requestPermissions( this, PERMISSIONS, PERMISSION_ALL);\n }\n }", "public boolean checkForPermission() {\r\n int permissionCAMERA = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);\r\n int storagePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\r\n int accessCoarseLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);\r\n int accessFineLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\r\n\r\n List<String> listPermissionsNeeded = new ArrayList<>();\r\n if (storagePermission != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\r\n }\r\n if (permissionCAMERA != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.CAMERA);\r\n }\r\n if (accessCoarseLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\r\n }\r\n if (accessFineLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\r\n }\r\n if (!listPermissionsNeeded.isEmpty()) {\r\n ActivityCompat.requestPermissions(this,\r\n listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), MY_PERMISSIONS_REQUEST);\r\n return false;\r\n }\r\n\r\n return true;\r\n }", "void checkPermission(T request) throws AuthorizationException;", "private void checkIfPermissionGranted() {\n\n //if user already allowed the permission, this condition will be true\n if (ContextCompat.checkSelfPermission(this, PERMISSION_CODE)\n == PackageManager.PERMISSION_GRANTED) {\n Intent launchIntent = getPackageManager().getLaunchIntentForPackage(\"com.example.a3\");\n if (launchIntent != null) {\n startActivity(launchIntent);//null pointer check in case package name was not found\n }\n }\n //if user didn't allow the permission yet, then ask for permission\n else {\n ActivityCompat.requestPermissions(this, new String[]{PERMISSION_CODE}, 0);\n }\n }", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "@Override\n public void onClick(View view) {\n String platform = checkPlatform();\n if (platform.equals(\"Marshmallow\")) {\n Log.d(TAG, \"Runtime permission required\");\n //Step 2. check the permission\n boolean permissionStatus = checkPermission();\n if (permissionStatus) {\n //Permission already granted\n Log.d(TAG, \"Permission already granted\");\n } else {\n //Permission not granted\n //Step 3. Explain permission i.e show an explanation\n Log.d(TAG, \"Explain permission\");\n explainPermission();\n //Step 4. Request Permissions\n Log.d(TAG, \"Request Permission\");\n requestPermission();\n }\n\n } else {\n Log.d(TAG, \"onClick: Runtime permission not required\");\n }\n\n\n }", "private void getPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n }", "private boolean checkPermissions() {\n boolean hasPermission = true;\n\n int result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_FINE_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n\n // ACCESS_BACKGROUND_LOCATION is only required on API 29 and higher\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\n result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_BACKGROUND_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n }\n\n return hasPermission;\n }", "private void checkPermissions(){\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){\n ActivityCompat.requestPermissions(this, new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.ACCESS_COARSE_LOCATION\n },PERMS_CALL_ID);\n\n }\n\n\n }", "@PermissionSuccess(requestCode = 100)\n public void onPermissionSuccess(){\n }", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_checkNotificationPermission, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "private boolean validateAccess(String permission) {\n\t\tif (\"READ\".equalsIgnoreCase(permission)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean isWritePermissionGranted();", "public static void checkAccess() throws SecurityException {\n if(isSystemThread.get()) {\n return;\n }\n //TODO: Add Admin Checking Code\n// if(getCurrentUser() != null && getCurrentUser().isAdmin()) {\n// return;\n// }\n throw new SecurityException(\"Invalid Permissions\");\n }", "boolean ignoresPermission();", "@Test\n public void testCheckExistsPermission() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE\");\n assertFalse(permissionManager.checkExists(permission2));\n }", "private boolean checkPermissions(String permissionStr, int requestCode) {\n // Check to see if we have permission to access something,\n // such like the microphone.\n int permission = ActivityCompat.checkSelfPermission(\n HotwordDetectionActivity.this,\n permissionStr);\n\n if (permission != PackageManager.PERMISSION_GRANTED) {\n // We can not access it, request authorization from the user.\n ActivityCompat.requestPermissions(\n HotwordDetectionActivity.this,\n new String[] {permissionStr},\n requestCode\n );\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermissionStorage() {\n\n boolean isPermissionGranted = true;\n\n int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n\n if (permissionStorage != PackageManager.PERMISSION_GRANTED)\n {\n isPermissionGranted = false;\n }\n\n return isPermissionGranted;\n }", "int getPermissionWrite();", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "public boolean CheckingPermissionIsEnabledOrNot() {\n int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), INTERNET);\n int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_NETWORK_STATE);\n int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ForthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_COARSE_LOCATION);\n int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\n int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), VIBRATE);\n// int EighthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CALL_PHONE);\n// int NinethPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\n\n return FirstPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SecondPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ThirdPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ForthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n FifthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SixthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SeventhPermissionResult == PackageManager.PERMISSION_GRANTED;\n// EighthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n// NinethPermissionResult == PackageManager.PERMISSION_GRANTED;\n }" ]
[ "0.780768", "0.7705898", "0.76458275", "0.7579255", "0.74163115", "0.7289032", "0.7255494", "0.7243952", "0.7202419", "0.71221095", "0.7116428", "0.70440745", "0.7035983", "0.7030622", "0.70084137", "0.69966084", "0.69780743", "0.69768894", "0.69740385", "0.6970628", "0.69696504", "0.6961938", "0.6954366", "0.69527566", "0.6946419", "0.6930548", "0.69128835", "0.69099504", "0.6897108", "0.68657726", "0.68482494", "0.6836068", "0.6823747", "0.6804345", "0.6803141", "0.680154", "0.67892575", "0.67805505", "0.6778432", "0.67664135", "0.67527926", "0.67520237", "0.6743644", "0.6739795", "0.673554", "0.6719494", "0.6719196", "0.671267", "0.6708608", "0.670348", "0.6700237", "0.6695056", "0.6691096", "0.6688028", "0.666488", "0.6658545", "0.66531605", "0.66493", "0.66484445", "0.66438967", "0.6638637", "0.66371053", "0.6629132", "0.662335", "0.66216725", "0.66188496", "0.661571", "0.66073716", "0.6602707", "0.660077", "0.6600661", "0.6600661", "0.6590905", "0.6584947", "0.6584242", "0.6577875", "0.6567554", "0.65652984", "0.65617156", "0.6557737", "0.65574527", "0.6552531", "0.6551836", "0.6550212", "0.65468115", "0.6545986", "0.6544458", "0.654402", "0.65433645", "0.65282387", "0.65240073", "0.65197647", "0.6516874", "0.65161526", "0.6491661", "0.6488652", "0.648783", "0.64841473", "0.64808834", "0.647211", "0.646276" ]
0.0
-1
Getting the permission status
public static boolean isWriteStorageAllowed(FragmentActivity act) { int result = ContextCompat.checkSelfPermission(act, Manifest.permission.WRITE_EXTERNAL_STORAGE); //If permission is granted returning true if (result == PackageManager.PERMISSION_GRANTED) return true; //If permission is not granted returning false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int getPermissionRead();", "String getPermission();", "public String getPermission()\r\n {\r\n return permission;\r\n }", "int getPermissionWrite();", "abstract public void getPermission();", "public Integer getPermission() {\n\t\treturn permission;\n\t}", "public String getPermission() {\n return this.permission;\n }", "public int getPermission() {\r\n\t\treturn nPermission;\r\n\t}", "public Permission getPermission() {\n return permission;\n }", "@Override\n\tpublic int getIsActive() {\n\t\treturn _permissionType.getIsActive();\n\t}", "public Enumeration permissions();", "public Boolean isPermissions() {\n return (Boolean) get(\"permissions\");\n }", "public boolean checkPermission(Permission permission);", "public int getUserModificationPermission() {\n return permission;\n }", "public FacebookPermissionsE permission(){\n\t\treturn this.permission;\n\t}", "boolean isHasPermissions();", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public java.lang.String getUserAvaibility(int status) throws android.os.RemoteException;", "public String getPermissionDescription() {\n return permissionDescription;\n }", "public int getPermission(Integer resourceId);", "public String getFloodPerm() throws PermissionDeniedException;", "public List<String> getPermissions() {\n AppMethodBeat.m2504i(92672);\n List permissions = this.properties.getPermissions();\n AppMethodBeat.m2505o(92672);\n return permissions;\n }", "public boolean [] getPermissions()\n\t{\n\t\treturn this.permissions;\n\t}", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "int getPermissionsCount();", "public List<Permission> getPermissionList() {\n return permissionList;\n }", "public String getAuthorizationStatus(){\n\t\treturn accessToken;\n\t}", "List<Permission> getPermissions();", "public String getPermissionName() {\n return permissionName;\n }", "@Column(name = \"PERMISSION_ACCESS\")\n\tpublic String getPermissionAccess()\n\t{\n\t\treturn permissionAccess;\n\t}", "public ArrayList<Permission> getPermissions()\r\n {\r\n return this.securityInfo.getPermissions();\r\n }", "@ApiModelProperty(required = true, value = \"The remote system permission of the invoking user on the file/folder.\")\n public String getPermissions() {\n return permissions;\n }", "public int getPermissions()\n {\n return encryptionDictionary.getInt( \"P\", 0 );\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "boolean isWritePermissionGranted();", "public Boolean getFlowTracking() throws PermissionDeniedException;", "public List<String> getPermissions() {\n return this.permissions;\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "public gov.nih.nlm.ncbi.www.soap.eutils.efetch_pmc.Permissions getPermissions() {\r\n return permissions;\r\n }", "public int getAccess()\n {\n ensureLoaded();\n return m_flags.getAccess();\n }", "public Integer getPermissionId() {\n return permissionId;\n }", "public Integer getPermissionId() {\n return permissionId;\n }", "@NonNull\n public PendingResult<PermissionStatus> checkPermissionStatus(@NonNull Permission permission) {\n UALog.d(\"Checking permission for %s\", permission);\n\n synchronized (pendingCheckResults) {\n return pendingOrCall(permission, pendingCheckResults, delegate -> {\n final PendingResult<PermissionStatus> pendingResult = new PendingResult<>();\n\n if (delegate == null) {\n UALog.d(\"No delegate for permission %s\", permission);\n pendingResult.setResult(PermissionStatus.NOT_DETERMINED);\n return pendingResult;\n }\n\n synchronized (pendingCheckResults) {\n pendingCheckResults.put(delegate, pendingResult);\n }\n\n mainHandler.post(() -> delegate.checkPermissionStatus(context, status -> {\n UALog.d(\"Check permission %s status result: %s\", permission, status);\n updatePermissionStatus(permission, status);\n pendingResult.setResult(status);\n\n synchronized (pendingCheckResults) {\n pendingCheckResults.remove(delegate);\n }\n }));\n\n return pendingResult;\n });\n }\n }", "@Override\n public void checkPermission(Permission perm) {\n }", "public int getPermissionsCount() {\n return permissions_.size();\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "void permissionGranted(int requestCode);", "private void getPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n }", "public String getAccess();", "public List<Permission> getUserPermission() {\n\t\treturn securityContext.getAuthorizationContext().getPermissions();\n\t}", "List<String> getAvailablePermissions() throws GWTJahiaServiceException;", "public int getPermissionsCount() {\n return permissions_.size();\n }", "UserStatus getStatus();", "public Integer getPermissionTypeId() {\n return permissionTypeId;\n }", "PermissionService getPermissionService();", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_checkNotificationPermission, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "public List<Permission> getPermissions()\r\n/* */ {\r\n/* 228 */ return this.permissions;\r\n/* */ }", "@PermissionSuccess(requestCode = 100)\n public void onPermissionSuccess(){\n }", "public List<Permission> getPermissionsPending(User user) throws UserManagementException;", "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "java.util.List<java.lang.String>\n getPermissionsList();", "public static String applicationPermission() {\n return holder.format(\"applicationPermission\");\n }", "@Override\n public boolean hasPermission(Permission permission) {\n // FacesContext context = FacesContext.getCurrentInstance();\n String imp = (String)ADFContext.getCurrent().getSessionScope().get(\"isImpersonationOn\");\n// String imp = (String)context.getExternalContext().getSessionMap().get(\"isImpersonationOn\");\n if(imp == null || !imp.equals(\"Y\")){\n return super.hasPermission(permission);\n }\n else{\n return true;\n \n }\n \n }", "public List<Permission> getPermissionsPending(String objectId) throws UserManagementException;", "public interface PermissionResult {\n\n void permissionGranted();\n\n void permissionDenied();\n\n void permissionForeverDenied();\n\n}", "public java.util.List<org.eclipse.stardust.engine.api.runtime.Permission>\n getPermissions()\n throws org.eclipse.stardust.common.error.WorkflowException;", "public String getPermissionAdmin() {\n return permissionAdmin;\n }", "AccessPoliciesStatus getAccessPoliciesStatus();", "@Column(name = \"PERMISSION_LEVEL\")\n\tpublic String getPermissionLevel()\n\t{\n\t\treturn permissionLevel;\n\t}", "public String getAccessionStatus() {\n\t\tString t = doc.get(\"collaccessionstatus\");\n\n\t\tif (t == null) {\n\t\t\treturn \"\";\n\t\t} else {\n\t\t\treturn t;\n\t\t}\n\t}", "public com.tangosol.net.ClusterPermission getPermission()\n {\n return __m_Permission;\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "public boolean granted(){\n\t\treturn this.granted;\n\t}", "java.lang.String getPermissions(int index);", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "private void chkPermission() {\n permissionStatus = getSharedPreferences(\"permissionStatus\", MODE_PRIVATE);\n\n if (ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED\n || ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[0])\n || ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[1])) {\n //Show Information about why you need the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n\n } else if (permissionStatus.getBoolean(permissionsRequired[0], false)) {\n //Previously Permission Request was cancelled with 'Dont Ask Again',\n // Redirect to Settings after showing Information about why you need the permission\n sentToSettings = true;\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n Uri uri = Uri.fromParts(\"package\", getPackageName(), null);\n intent.setData(uri);\n startActivityForResult(intent, REQUEST_PERMISSION_SETTING);\n Toast.makeText(getBaseContext(), \"Go to Permissions to Grant Camera, Phone and Storage\", Toast.LENGTH_LONG).show();\n\n } else {\n //just request the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n }\n\n //txtPermissions.setText(\"Permissions Required\");\n\n SharedPreferences.Editor editor = permissionStatus.edit();\n editor.putBoolean(permissionsRequired[0], true);\n editor.commit();\n } else {\n //You already have the permission, just go ahead.\n //proceedAfterPermission();\n }\n\n }", "String getAccess();", "String getAccess();", "public ResourceInformation.Permissions getEffectivePermissions() {\n\t\tif (effectivePermissions == null)\n\t\t\tfetchInfo();\n\t\treturn effectivePermissions;\n\t}", "public boolean getAtmStatus();", "public void getPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(permissions,\n MULTIPLE_PERMISSIONS);\n }\n }", "public PolicyPermission getPolicyPermission()\n {\n return this.perm;\n }", "public Integer getPermissionPid() {\n return permissionPid;\n }", "public boolean notificationPermissionEnabled() throws android.os.RemoteException;", "private boolean checkPermission() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);\n\n if (result == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n return false;\n }\n }", "@Override\n public boolean notificationPermissionEnabled() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n boolean _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_notificationPermissionEnabled, _data, _reply, 0);\n _reply.readException();\n _result = (0 != _reply.readInt());\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "public com.google.protobuf.ProtocolStringList\n getPermissionsList() {\n return permissions_;\n }", "public int getAccessFlags() {\n return access_flags;\n }", "@Override\n public Collection<WegasPermission> getRequieredUpdatePermission(RequestContext context) {\n return this.getState().getRequieredUpdatePermission(context);\n }", "public Permission getPermission(String objectId, User user, Boolean pending) throws UserManagementException;", "public TPermissionMode getUserPermissionArray() {\n\n\t\treturn otherPermission;\n\t}", "public boolean getIncludePermissions() {\n\t\treturn this.includePermissions;\n\n\t}", "public IPermissionActivity getPermissionActivity(long id);", "void askForPermissions();", "@Override\r\n\tpublic String permission() {\n\t\treturn Permissions.DEFAULT;\r\n\t}", "public Permission[] getPermissionsField() {\n\treturn super.getPermissions(null);\n }", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "boolean ignoresPermission();", "java.lang.String getPatStatus();", "java.lang.String getPatStatus();" ]
[ "0.7604785", "0.754987", "0.7191839", "0.7145541", "0.71204156", "0.7099868", "0.69878936", "0.694512", "0.69233185", "0.6874021", "0.68374723", "0.682301", "0.67940533", "0.6786591", "0.676555", "0.6731508", "0.66852635", "0.6621478", "0.6618902", "0.6560233", "0.6544853", "0.6542498", "0.6540263", "0.6539225", "0.6494729", "0.6485097", "0.64779687", "0.6464931", "0.64435136", "0.6441714", "0.6441113", "0.6439261", "0.6403843", "0.64018005", "0.63942677", "0.6374497", "0.6370993", "0.63621676", "0.6346669", "0.63433194", "0.63391364", "0.63000995", "0.63000995", "0.6283972", "0.62809163", "0.6276969", "0.6271978", "0.6267926", "0.62634647", "0.6250754", "0.62336165", "0.6218403", "0.6216731", "0.6212187", "0.6212182", "0.6206386", "0.6185007", "0.61673313", "0.61495113", "0.61461526", "0.6144294", "0.6143248", "0.6140406", "0.6139065", "0.6113182", "0.61011815", "0.6093845", "0.6084574", "0.60805094", "0.60787094", "0.6076846", "0.60683125", "0.6067988", "0.6067146", "0.6062017", "0.6061856", "0.6050548", "0.6042082", "0.6042082", "0.60370916", "0.6035524", "0.6034543", "0.60297954", "0.5993461", "0.5988796", "0.59837085", "0.59618455", "0.5960633", "0.595592", "0.5955138", "0.5954668", "0.5924577", "0.5922123", "0.5920088", "0.59165376", "0.59096587", "0.59091985", "0.5905473", "0.5892757", "0.5887419", "0.5887419" ]
0.0
-1
We are calling this method to check the permission status
public static boolean isCameraAllowed(FragmentActivity act) { //Getting the permission status int result = ContextCompat.checkSelfPermission(act, Manifest.permission.CAMERA); //If permission is granted returning true if (result == PackageManager.PERMISSION_GRANTED) return true; //If permission is not granted returning false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "@Override\n public void checkPermission(Permission perm) {\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "public boolean checkPermission(Permission permission);", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), READ_CONTACTS);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\r\n int result2 = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\r\n int result3 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\r\n int result4 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result5 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_PHONE_STATE);\r\n int result6 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n int result7 = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\r\n //int result8 = ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH);\r\n\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED && result2 == PackageManager.PERMISSION_GRANTED &&\r\n result3 == PackageManager.PERMISSION_GRANTED && result4 == PackageManager.PERMISSION_GRANTED && result5 == PackageManager.PERMISSION_GRANTED &&\r\n result6 == PackageManager.PERMISSION_GRANTED && result7 == PackageManager.PERMISSION_GRANTED/*&& result8== PackageManager.PERMISSION_GRANTED*/;\r\n }", "private void chkPermission() {\n permissionStatus = getSharedPreferences(\"permissionStatus\", MODE_PRIVATE);\n\n if (ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED\n || ActivityCompat.checkSelfPermission(LoginActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[0])\n || ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this, permissionsRequired[1])) {\n //Show Information about why you need the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n\n } else if (permissionStatus.getBoolean(permissionsRequired[0], false)) {\n //Previously Permission Request was cancelled with 'Dont Ask Again',\n // Redirect to Settings after showing Information about why you need the permission\n sentToSettings = true;\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n Uri uri = Uri.fromParts(\"package\", getPackageName(), null);\n intent.setData(uri);\n startActivityForResult(intent, REQUEST_PERMISSION_SETTING);\n Toast.makeText(getBaseContext(), \"Go to Permissions to Grant Camera, Phone and Storage\", Toast.LENGTH_LONG).show();\n\n } else {\n //just request the permission\n ActivityCompat.requestPermissions(LoginActivity.this, permissionsRequired, PERMISSION_CALLBACK_CONSTANT);\n }\n\n //txtPermissions.setText(\"Permissions Required\");\n\n SharedPreferences.Editor editor = permissionStatus.edit();\n editor.putBoolean(permissionsRequired[0], true);\n editor.commit();\n } else {\n //You already have the permission, just go ahead.\n //proceedAfterPermission();\n }\n\n }", "boolean isHasPermissions();", "private boolean permisos() {\n for(String permission : PERMISSION_REQUIRED) {\n if(ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "public boolean checkPermissions(String check)\n {\n Log.d(TAG,\"check single PErmission\");\n int permissionRequest= ActivityCompat.checkSelfPermission(UploadActivity.this,check);\n if(permissionRequest!= PackageManager.PERMISSION_GRANTED)\n {\n Log.d(TAG,\"check PErmission\\nPermission was not granted for:\"+check);\n return false;\n }\n else\n {\n Log.d(TAG,\"check PErmission\\nPermission was granted for:\"+check);\n return true;\n }\n\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "void permissionGranted(int requestCode);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == REQUEST_PERMISSION_SETTING) {\n checkPermission();\n }\n }", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "private boolean checkAndRequestPermissions() {\n List<String> listPermissionsNeeded = new ArrayList<>();\n for (String pem : appPermissions){\n if (ContextCompat.checkSelfPermission(this, pem) != PackageManager.PERMISSION_GRANTED){\n listPermissionsNeeded.add(pem);\n }\n }\n\n //ask for non-granted permissions\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_REQUEST_CODE);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);\n\n if (result == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n return false;\n }\n }", "public void checkpermission()\n {\n permissionUtils.check_permission(permissions,\"Need GPS permission for getting your location\",1);\n }", "private void checkPermissions() {\n List<String> permissions = new ArrayList<>();\n String message = \"osmdroid permissions:\";\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n message += \"\\nLocation to show user location.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);\n message += \"\\nStorage access to store map tiles.\";\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.READ_PHONE_STATE);\n message += \"\\n access to read phone state.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.RECEIVE_SMS);\n message += \"\\n access to receive sms.\";\n //requestReadPhoneStatePermission();\n }\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {\n permissions.add(Manifest.permission.GET_ACCOUNTS);\n message += \"\\n access to read sms.\";\n //requestReadPhoneStatePermission();\n }\n if (!permissions.isEmpty()) {\n // Toast.makeText(this, message, Toast.LENGTH_LONG).show();\n String[] params = permissions.toArray(new String[permissions.size()]);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(params, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n } // else: We already have permissions, so handle as normal\n }", "public void checkPermission() {\n Log.e(\"checkPermission\", \"checkPermission\");\n\n // Here, thisActivity is the current activity\n if (ContextCompat.checkSelfPermission(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n\n\n }", "public void checkPermissions(){\n //Check if some of the core permissions are not already granted\n if ((ContextCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED)\n || (ContextCompat.checkSelfPermission(LoginActivity.this,Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)) {\n Toast.makeText(this, \"Some permissions are not granted. Please enable them.\", Toast.LENGTH_SHORT).show();\n\n //If so, request the activation of this permissions\n ActivityCompat.requestPermissions(LoginActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_ASK_PERMISSIONS);\n }\n else{\n //Permissions already granted\n }\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "public boolean isAllGranted(){\n //PackageManager.PERMISSION_GRANTED\n return false;\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "private Boolean checkRuntimePermission() {\n List<String> permissionsNeeded = new ArrayList<String>();\n\n final List<String> permissionsList = new ArrayList<String>();\n if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))\n permissionsNeeded.add(\"Storage\");\n if (!addPermission(permissionsList, Manifest.permission.CAMERA))\n permissionsNeeded.add(\"Camera\");\n /* if (!addPermission(permissionsList, Manifest.permission.WRITE_CONTACTS))\n permissionsNeeded.add(\"Write Contacts\");*/\n\n if (permissionsList.size() > 0) {\n if (permissionsNeeded.size() > 0) {\n // Need Rationale\n String message = \"You need to grant access to \" + permissionsNeeded.get(0);\n for (int i = 1; i < permissionsNeeded.size(); i++)\n message = message + \", \" + permissionsNeeded.get(i);\n showMessageOKCancel(message,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n }\n });\n return false;\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n if (Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // Permission is not granted\n return false;\n } else {\n return true;// Permission has already been granted }\n }\n }", "void askForPermissions();", "private void checkPermission(){\n // vérification de l'autorisation d'accéder à la position GPS\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n// // l'autorisation n'est pas acceptée\n// if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n// Manifest.permission.ACCESS_FINE_LOCATION)) {\n// // l'autorisation a été refusée précédemment, on peut prévenir l'utilisateur ici\n// } else {\n // l'autorisation n'a jamais été réclamée, on la demande à l'utilisateur\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n FINE_LOCATION_REQUEST);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n // }\n } else {\n // TODO : autorisation déjà acceptée, on peut faire une action ici\n initLocation();\n }\n }", "abstract public void getPermission();", "public void verifyPermission() {\n Permissions.check(this/*context*/, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() {\n @Override\n public void onGranted() {\n addVideoInFolder();\n setupExoPlayer();\n settingListener();\n }\n\n @Override\n public void onDenied(Context context, ArrayList<String> deniedPermissions) {\n super.onDenied(context, deniedPermissions);\n verifyPermission();\n }\n });\n\n }", "private boolean checkDeviceSettings()\n {\n List<String> listPermissionNeeded= new ArrayList<>();\n boolean ret = true;\n for(String perm : permission)\n {\n if(ContextCompat.checkSelfPermission(this,perm)!= PackageManager.PERMISSION_GRANTED)\n listPermissionNeeded.add(perm);\n }\n if(!listPermissionNeeded.isEmpty())\n {\n ActivityCompat.requestPermissions(this,listPermissionNeeded.toArray(new String[listPermissionNeeded.size()]),REQUEST_PERMISSION);\n ret = false;\n }\n\n return ret;\n }", "public boolean validatePermissions()\r\n\t{\n\t\treturn true;\r\n\t}", "void requestNeededPermissions(int requestCode);", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "private void checkpermission() {\n permissionUtils = new PermissionUtils(context, this);\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n permissionUtils.check_permission(permissions, \"Need GPS permission for getting your location\", LOCATION_REQUEST_CODE);\n }", "private void checkPermissions() {\n final ArrayList<String> missedPermissions = new ArrayList<>();\n\n for (final String permission : PERMISSIONS_REQUIRED) {\n if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {\n missedPermissions.add(permission);\n }\n }\n\n if (!missedPermissions.isEmpty()) {\n final String[] permissions = new String[missedPermissions.size()];\n missedPermissions.toArray(permissions);\n\n ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);\n }\n }", "public void verifyAppPermissions() {\n boolean hasAll = true;\n mHasBluetoothPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED;\n mHasBluetoothAdminPermissions = ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n hasAll &= ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;\n\n if (!hasAll) {\n // We don't have permission so prompt the user\n ActivityCompat.requestPermissions(\n this,\n APP_PERMISSIONS,\n REQUEST_PERMISSIONS\n );\n }\n }", "int getPermissionRead();", "private boolean checkPermissions() {\n if (!read_external_storage_granted ||\n !write_external_storage_granted ||\n !write_external_storage_granted) {\n Toast.makeText(getApplicationContext(), \"Die App braucht Zugang zur Kamera und zum Speicher.\", Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }", "private void checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED){\n\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA}, 56);\n }\n }", "public void checkPermission(String permission, int requestCode)\n {\n if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {\n // Requesting the permission\n ActivityCompat.requestPermissions(this, new String[] { permission }, requestCode);\n }\n else {\n Toast.makeText(this, \"Permission already granted\", Toast.LENGTH_SHORT).show();\n }\n }", "public boolean checkPerms()\n {\n boolean perms = hasPerms();\n if (!perms) {\n ActivityCompat.requestPermissions(\n itsActivity, new String[] { itsPerm }, itsPermsRequestCode);\n }\n return perms;\n }", "private void checkPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this)\n .setMessage(getString(R.string.can_not_handle_calls))\n .setCancelable(false)\n .setPositiveButton(R.string.text_ok, (dialog, id) -> {\n requestPermission();\n });\n\n builder.create().show();\n } else {\n presenter.gotPermissions = true;\n }\n }", "public void checkRequestPermission(){\n\n\n hasPermission = (ActivityCompat.checkSelfPermission(this, Manifest.permission.VIBRATE)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED );\n//check group permissons\n if (!hasPermission){\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.VIBRATE,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE\n\n },\n REQUEST_NETWORK_ACCESS);\n }\n }", "private void checkAndRequestPermissions() {\n missingPermission = new ArrayList<>();\n // Check for permissions\n for (String eachPermission : REQUIRED_PERMISSION_LIST) {\n if (ContextCompat.checkSelfPermission(this, eachPermission) != PackageManager.PERMISSION_GRANTED) {\n missingPermission.add(eachPermission);\n }\n }\n // Request for missing permissions\n if (missingPermission.isEmpty()) {\n DroneModel.getInstance(this).setDjiProductStateCallBack(this);\n DroneModel.getInstance(this).startSDKRegistration();\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n missingPermission.toArray(new String[missingPermission.size()]),\n REQUEST_PERMISSION_CODE);\n }\n }", "private static boolean isPermissionGranted(Context context, String permission) {\n if (ContextCompat.checkSelfPermission(context, permission)\n == PackageManager.PERMISSION_GRANTED) {\n Log.i(TAG, permission + \" granted\");\n return true;\n }\n Log.i(TAG, permission + \" not granted yet\");\n return false;\n }", "private boolean checkPermissions() {\n int permissionState1 = ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION);\n\n int permissionState2 = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION);\n return permissionState1 == PackageManager.PERMISSION_GRANTED && permissionState2 == PackageManager.PERMISSION_GRANTED;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "private void permissionChecks() {\n if(Build.VERSION.SDK_INT < 23)\n return;\n\n if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 0);\n }\n }", "private void checkAndRequestForPermission() {\n if(ContextCompat.checkSelfPermission(RegisterActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED){\n if(ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE)){\n Toast.makeText(RegisterActivity.this, \"Please accept for required permission\",\n Toast.LENGTH_SHORT).show();\n }\n else{\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String []{Manifest.permission.READ_EXTERNAL_STORAGE},PReqCode);\n }\n }\n else{\n openGallery();\n }\n }", "private boolean checkPermissions() {\n int res = ContextCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.READ_EXTERNAL_STORAGE);\n if (res == PackageManager.PERMISSION_GRANTED)\n return true;\n else\n return false;\n }", "@Override\n public boolean hasPermission(Permission permission) {\n // FacesContext context = FacesContext.getCurrentInstance();\n String imp = (String)ADFContext.getCurrent().getSessionScope().get(\"isImpersonationOn\");\n// String imp = (String)context.getExternalContext().getSessionMap().get(\"isImpersonationOn\");\n if(imp == null || !imp.equals(\"Y\")){\n return super.hasPermission(permission);\n }\n else{\n return true;\n \n }\n \n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(\n this, Manifest.permission.ACCESS_FINE_LOCATION\n );\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "public boolean checkPermissions(String permission) {\r\n Log.d(TAG, \"checkPermissions: checking permission: \" + permission);\r\n\r\n int permissionRequest = ActivityCompat.checkSelfPermission(EditProfileActivity.this, permission);\r\n\r\n if (permissionRequest != PackageManager.PERMISSION_GRANTED) {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was not granted for: \" + permission);\r\n Toast.makeText(this, \"Permissions not granted to access camera,\\n\" +\r\n \"please give permissions to GetAplot\", Toast.LENGTH_SHORT).show();\r\n return false;\r\n } else {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was granted for: \" + permission);\r\n return true;\r\n }\r\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(UniformDrawer.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\r\n if (result == PackageManager.PERMISSION_GRANTED) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean CheckingPermissionIsEnabledOrNot()\n {\n int CameraPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\n int WriteStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ReadStoragePermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n\n return CameraPermissionResult == PackageManager.PERMISSION_GRANTED &&\n WriteStoragePermissionResult == PackageManager.PERMISSION_GRANTED &&\n ReadStoragePermissionResult == PackageManager.PERMISSION_GRANTED;\n }", "private void checkForPermission() {\n if (ContextCompat.checkSelfPermission(QuizConfirmationActivity.this,\n Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(QuizConfirmationActivity.this\n , Manifest.permission.READ_EXTERNAL_STORAGE)) {\n Toast.makeText(QuizConfirmationActivity.this,\n \"Please provide the required storage permission in the app setting\", Toast.LENGTH_SHORT).show();\n\n } else {\n\n ActivityCompat.requestPermissions(QuizConfirmationActivity.this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n\n PreqCode);\n }\n } else {\n imageSelect(QuizConfirmationActivity.this);\n }\n\n\n }", "private boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,\n android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n return false;\n\n } else {\n return true;\n }\n }", "@Override\n public void onPermissionGranted() {\n }", "private boolean checkPermissions() {\r\n int permissionState = ActivityCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION);\r\n return permissionState == PackageManager.PERMISSION_GRANTED;\r\n }", "private boolean checkPermission() {\n int fineLocation = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n\n if (fineLocation != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_FINE_LOCATION);\n }\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermission() {\n Log.d(\"TAG\", \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED );\n }", "@Override\n public void onPermissionGranted() {\n }", "public boolean CheckPermissions() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;\r\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private boolean arePermissionsEnabled(){\n for(String permission : mPermissions){\n if(checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED)\n return false;\n }\n return true;\n }", "private boolean checkPermissions() {\n boolean permissionGrant = false;\n if (Build.VERSION.SDK_INT >= 23 && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions((Activity) this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQUEST_CODE_ACCESS_COARSE_LOCATION);\n } else {\n permissionGrant = true;\n }\n return permissionGrant;\n\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_ACCESS_FINE_LOCATION);\n\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED){\n\n requestPermissions(\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\n PERMISSIONS_ACCESS_COARSE_LOCATION);\n } else {\n isPermission = true;\n }\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkPermissions() {\n int permissionState = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n return permissionState == PackageManager.PERMISSION_GRANTED;\n }", "private boolean checkAndRequestPermissions() {\n int locationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\n List<String> listPermissionsNeeded = new ArrayList<>();\n if (locationPermission != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n }\n// if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {\n// listPermissionsNeeded.add(Manifest.permission.SEND_SMS);\n// }\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n return true;\n }", "private boolean checkPermission() {\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED );\n }", "public boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n new AlertDialog.Builder(this)\n .setTitle(\"TITLE\")\n .setMessage(\"TEXT\")\n .setPositiveButton(\"OKAY\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Prompt the user once explanation has been shown\n ActivityCompat.requestPermissions(MapsActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n })\n .create()\n .show();\n\n\n } else {\n // No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n return false;\n } else {\n return true;\n }\n }", "@TargetApi(23)\r\n public void requestPermission() {\r\n ArrayList<String> arrayList;\r\n String[] strArr = this.mPermissions;\r\n for (String str : strArr) {\r\n if (this.mActivity.checkCallingOrSelfPermission(str) != 0) {\r\n if (shouldShowRequestPermissionRationale(str) || !PermissionUtils.isNeverShowEnabled(PermissionUtils.getRequestCode(str))) {\r\n if (this.normalPermissions == null) {\r\n this.normalPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.normalPermissions;\r\n } else {\r\n if (this.settingsPermissions == null) {\r\n this.settingsPermissions = new ArrayList<>(this.mPermissions.length);\r\n }\r\n arrayList = this.settingsPermissions;\r\n }\r\n arrayList.add(str);\r\n }\r\n }\r\n Log.d(TAG, \"requestPermission() settingsPermissions:\" + this.settingsPermissions);\r\n Log.d(TAG, \"requestPermission() normalPermissions:\" + this.normalPermissions);\r\n ArrayList<String> arrayList2 = this.normalPermissions;\r\n if (arrayList2 == null || arrayList2.size() <= 0) {\r\n ArrayList<String> arrayList3 = this.settingsPermissions;\r\n if (arrayList3 == null || arrayList3.size() <= 0) {\r\n IGrantedTask iGrantedTask = this.mTask;\r\n if (iGrantedTask != null) {\r\n iGrantedTask.doTask();\r\n }\r\n } else {\r\n Activity activity = this.mActivity;\r\n PermissionUtils.showPermissionSettingsDialog(activity, activity.getResources().getString(R.string.app_name), this.settingsPermissions, true);\r\n this.settingsPermissions = null;\r\n }\r\n finishFragment();\r\n return;\r\n }\r\n requestPermissions((String[]) this.normalPermissions.toArray(new String[this.normalPermissions.size()]), 5003);\r\n this.normalPermissions = null;\r\n }", "private void callPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED) {\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\r\n PERMISSIONS_ACCESS_FINE_LOCATION);\r\n\r\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M\r\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)\r\n != PackageManager.PERMISSION_GRANTED){\r\n\r\n requestPermissions(\r\n new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},\r\n PERMISSIONS_ACCESS_COARSE_LOCATION);\r\n } else {\r\n isPermission = true;\r\n }\r\n }", "private boolean checkPermission() {\n Log.d(TAG, \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED);\n }", "private boolean checkPermissions() {\n return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION);\n }", "private boolean checkForPermission() {\n\n int permissionCode = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\n\n if(permissionCode == PackageManager.PERMISSION_GRANTED) return true;\n else return false;\n }", "public void checkPermission(){\n Log.d(\"BluetoothLeService\", \"initialize is \" + mBluetoothManager);\n if (mBluetoothManager == null) {\n mBluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);\n if (mBluetoothManager == null) {\n Log.e(TAG, \"Unable to initialize BluetoothManager.\");\n return;\n }\n }\n\n mBluetoothAdapter = mBluetoothManager.getAdapter();\n if (mBluetoothAdapter == null) {\n Log.e(TAG, \"Unable to obtain a BluetoothAdapter.\");\n return;\n }\n\n if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();\n\n int PERMISSION_ALL = 1;\n /*\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.GET_ACCOUNTS};\n */\n String[] PERMISSIONS = {\n Manifest.permission.ACCESS_COARSE_LOCATION\n };\n\n if (!hasPermissions(this, PERMISSIONS)) {\n ActivityCompat.requestPermissions( this, PERMISSIONS, PERMISSION_ALL);\n }\n }", "public void onPermissionGranted() {\n\n }", "public boolean checkForPermission() {\r\n int permissionCAMERA = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);\r\n int storagePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);\r\n int accessCoarseLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);\r\n int accessFineLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);\r\n\r\n List<String> listPermissionsNeeded = new ArrayList<>();\r\n if (storagePermission != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\r\n }\r\n if (permissionCAMERA != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.CAMERA);\r\n }\r\n if (accessCoarseLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\r\n }\r\n if (accessFineLocation != PackageManager.PERMISSION_GRANTED) {\r\n listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\r\n }\r\n if (!listPermissionsNeeded.isEmpty()) {\r\n ActivityCompat.requestPermissions(this,\r\n listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), MY_PERMISSIONS_REQUEST);\r\n return false;\r\n }\r\n\r\n return true;\r\n }", "void checkPermission(T request) throws AuthorizationException;", "private void checkIfPermissionGranted() {\n\n //if user already allowed the permission, this condition will be true\n if (ContextCompat.checkSelfPermission(this, PERMISSION_CODE)\n == PackageManager.PERMISSION_GRANTED) {\n Intent launchIntent = getPackageManager().getLaunchIntentForPackage(\"com.example.a3\");\n if (launchIntent != null) {\n startActivity(launchIntent);//null pointer check in case package name was not found\n }\n }\n //if user didn't allow the permission yet, then ask for permission\n else {\n ActivityCompat.requestPermissions(this, new String[]{PERMISSION_CODE}, 0);\n }\n }", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "@Override\n public void onClick(View view) {\n String platform = checkPlatform();\n if (platform.equals(\"Marshmallow\")) {\n Log.d(TAG, \"Runtime permission required\");\n //Step 2. check the permission\n boolean permissionStatus = checkPermission();\n if (permissionStatus) {\n //Permission already granted\n Log.d(TAG, \"Permission already granted\");\n } else {\n //Permission not granted\n //Step 3. Explain permission i.e show an explanation\n Log.d(TAG, \"Explain permission\");\n explainPermission();\n //Step 4. Request Permissions\n Log.d(TAG, \"Request Permission\");\n requestPermission();\n }\n\n } else {\n Log.d(TAG, \"onClick: Runtime permission not required\");\n }\n\n\n }", "private boolean checkPermissions() {\n boolean hasPermission = true;\n\n int result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_FINE_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n\n // ACCESS_BACKGROUND_LOCATION is only required on API 29 and higher\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\n result = ContextCompat.checkSelfPermission(\n this,\n Manifest.permission.ACCESS_BACKGROUND_LOCATION\n );\n if (result == PERMISSION_DENIED) {\n hasPermission = false;\n }\n }\n\n return hasPermission;\n }", "private void getPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n }", "private void checkPermissions(){\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){\n ActivityCompat.requestPermissions(this, new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.ACCESS_COARSE_LOCATION\n },PERMS_CALL_ID);\n\n }\n\n\n }", "@PermissionSuccess(requestCode = 100)\n public void onPermissionSuccess(){\n }", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status = mRemote.transact(\n Stub.TRANSACTION_checkNotificationPermission, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "private boolean validateAccess(String permission) {\n\t\tif (\"READ\".equalsIgnoreCase(permission)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean isWritePermissionGranted();", "public static void checkAccess() throws SecurityException {\n if(isSystemThread.get()) {\n return;\n }\n //TODO: Add Admin Checking Code\n// if(getCurrentUser() != null && getCurrentUser().isAdmin()) {\n// return;\n// }\n throw new SecurityException(\"Invalid Permissions\");\n }", "boolean ignoresPermission();", "@Test\n public void testCheckExistsPermission() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE\");\n assertFalse(permissionManager.checkExists(permission2));\n }", "private boolean checkPermissions(String permissionStr, int requestCode) {\n // Check to see if we have permission to access something,\n // such like the microphone.\n int permission = ActivityCompat.checkSelfPermission(\n HotwordDetectionActivity.this,\n permissionStr);\n\n if (permission != PackageManager.PERMISSION_GRANTED) {\n // We can not access it, request authorization from the user.\n ActivityCompat.requestPermissions(\n HotwordDetectionActivity.this,\n new String[] {permissionStr},\n requestCode\n );\n return false;\n } else {\n return true;\n }\n }", "private boolean checkPermissionStorage() {\n\n boolean isPermissionGranted = true;\n\n int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n\n if (permissionStorage != PackageManager.PERMISSION_GRANTED)\n {\n isPermissionGranted = false;\n }\n\n return isPermissionGranted;\n }", "int getPermissionWrite();", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "public boolean CheckingPermissionIsEnabledOrNot() {\n int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), INTERNET);\n int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_NETWORK_STATE);\n int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ForthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_COARSE_LOCATION);\n int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\n int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), VIBRATE);\n// int EighthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CALL_PHONE);\n// int NinethPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\n\n return FirstPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SecondPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ThirdPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ForthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n FifthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SixthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SeventhPermissionResult == PackageManager.PERMISSION_GRANTED;\n// EighthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n// NinethPermissionResult == PackageManager.PERMISSION_GRANTED;\n }" ]
[ "0.78061116", "0.77052194", "0.7644345", "0.7578227", "0.74156034", "0.728739", "0.7255468", "0.724358", "0.72018945", "0.712154", "0.71159494", "0.7043407", "0.70355487", "0.70296174", "0.7007319", "0.6995498", "0.6977545", "0.6977358", "0.6973267", "0.6969954", "0.6968984", "0.6961357", "0.6953506", "0.6952861", "0.6946677", "0.693117", "0.6911616", "0.6909338", "0.6895584", "0.6864902", "0.68463343", "0.68353975", "0.68241066", "0.6803475", "0.6801704", "0.6800543", "0.67885953", "0.6779294", "0.6778586", "0.67656577", "0.67521626", "0.67511874", "0.6742429", "0.67396927", "0.6733997", "0.67183685", "0.67183095", "0.6711119", "0.67088073", "0.6703598", "0.66995126", "0.66935265", "0.669061", "0.66870254", "0.6664966", "0.6657274", "0.6652056", "0.6649899", "0.6646285", "0.6643312", "0.6637372", "0.66371506", "0.662881", "0.6623307", "0.6620403", "0.6618599", "0.6615486", "0.6607039", "0.66012925", "0.6600757", "0.6600757", "0.66002476", "0.6590849", "0.6584737", "0.6582371", "0.6576477", "0.6567547", "0.6565327", "0.65608585", "0.65580493", "0.65567786", "0.655208", "0.6550827", "0.6548847", "0.6545712", "0.6544774", "0.654415", "0.65431756", "0.6543069", "0.65279615", "0.6524164", "0.65184855", "0.6516418", "0.65155244", "0.6491373", "0.6488048", "0.64868426", "0.64837366", "0.64800864", "0.6471658", "0.6463857" ]
0.0
-1
function to get the device id
public static String getIMEI(Context context) { return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Integer getDeviceId();", "java.lang.String getDeviceId();", "UUID getDeviceId();", "private String getDeviceID() {\n try {\n TelephonyManager telephonyManager;\n\n telephonyManager =\n (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);\n\n /*\n * getDeviceId() function Returns the unique device ID.\n * for example,the IMEI for GSM and the MEID or ESN for CDMA phones.\n */\n return telephonyManager.getDeviceId();\n }catch(SecurityException e){\n return null;\n }\n }", "DeviceId deviceId();", "DeviceId deviceId();", "@SuppressLint(\"HardwareIds\")\n String getDeviceID() {\n return Settings.Secure.getString(getApplicationContext().getContentResolver(),\n Settings.Secure.ANDROID_ID);\n }", "private String getDeviceId() {\n String deviceId = telephonyManager.getDeviceId(); \n \n \n // \"generic\" means the emulator.\n if (deviceId == null || Build.DEVICE.equals(\"generic\")) {\n \t\n // This ID changes on OS reinstall/factory reset.\n deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);\n }\n \n return deviceId;\n }", "private String getDeviceId(Context context){\n TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);\n\n //\n ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE);\n String tmDevice = tm.getDeviceId();\n\n String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);\n\n String serial = null;\n if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) serial = Build.SERIAL;\n\n if(tmDevice != null) return \"01\" + tmDevice;\n if(androidId != null) return \"02\" + androidId;\n if(serial != null) return \"03\" + serial;\n\n return null;\n }", "org.hl7.fhir.String getDeviceIdentifier();", "public String getDeviceId() {\n //TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);\n String number = Build.SERIAL;\n return number;\n }", "public String getDeviceUDID() {\r\n\t\tTelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);\r\n\t\treturn telephonyManager.getDeviceId();\r\n\t}", "public final int getDeviceID() {\n return device.getDeviceID();\n }", "public static String deviceId() {\n\t\t// return device id\n\t\treturn getTelephonyManager().getDeviceId();\n\t}", "public String getDeviceid() {\n return deviceid;\n }", "public String getDevice_id() {\r\n\t\treturn device_id;\r\n\t}", "public String getDeviceId() {\n String deviceId = ((TelephonyManager) LoginActivity.this.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();\n if (deviceId != null && !deviceId.equalsIgnoreCase(\"null\")) {\n // System.out.println(\"imei number :: \" + deviceId);\n return deviceId;\n }\n\n deviceId = android.os.Build.SERIAL;\n // System.out.println(\"serial id :: \" + deviceId);\n return deviceId;\n\n }", "public String getDeviceId() {\n\t\tString id;\n\t\tid = options.getProperty(\"id\");\n\t\tif(id == null) {\n\t\t\tid = options.getProperty(\"Device-ID\");\n\t\t}\n\t\treturn trimedValue(id);\n\t}", "@SuppressWarnings(\"HardwareIds\")\n public String getUniqueDeviceId() {\n return Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID);\n }", "public static String getPseudoDeviceID() {\n final String ID = \"42\";\n return ID +\n Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +\n Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +\n Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 +\n Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 +\n Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 +\n Build.TAGS.length() % 10 + Build.TYPE.length() % 10 +\n Build.USER.length() % 10;\n }", "public static String getUniqueDeviceID(Context context) {\n\t\tString identifier = null;\n\t\tTelephonyManager tm = (TelephonyManager) context\n\t\t\t\t.getSystemService(Context.TELEPHONY_SERVICE);\n\t\tif (tm != null)\n\t\t\tidentifier = tm.getDeviceId();\n\t\tif (identifier == null || identifier.length() == 0)\n\t\t\tidentifier = Secure.getString(context.getContentResolver(),\n\t\t\t\t\tSecure.ANDROID_ID);\n\t\t// identifier = identifier + new Random().nextInt(1000);\n\t\treturn identifier;\n\t}", "@NonNull\n private String getDeviceId() {\n String ANDROID_ID = Settings.Secure.getString(cordova.getActivity().getContentResolver(), Settings.Secure.ANDROID_ID);\n return md5(ANDROID_ID).toUpperCase();\n }", "public static String getDeviceID(Context context) {\n return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);\n }", "public static String getDeviceId(Context context) {\n return getDevice(context).getId();\n }", "@Override\n public String getDeviceId() {\n return this.strDevId;\n }", "public String getDeviceId() {\n String info = \"\";\n try {\n Uri queryurl = Uri.parse(REGINFO_URL + CHUNLEI_ID);\n ContentResolver resolver = mContext.getContentResolver();\n info = resolver.getType(queryurl);\n if (null == info && null != mContext) {\n info = getIMEI();\n }\n if (null == info) {\n info = \"\";\n }\n } catch (Exception e) {\n System.out.println(\"in or out strean exception\");\n }\n return info;\n }", "public final String getDeviceId(){\n return peripheralDeviceId;\n }", "private String getAdmobDeviceId()\n\t{\n\t\tString android_id = Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID);\n\t\tString deviceId = md5(android_id).toUpperCase(Locale.US);\n\t\treturn deviceId;\n\t}", "public final int getDevice()\n\t{\n\t\treturn address & 0xFF;\n\t}", "public static String getDeviceUUID(){\n BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();\n String uuid = adapter.getAddress();\n return uuid;\n }", "public String uuid(){\n\t\t String device_unique_id = Secure.getString(activity.getContentResolver(),\n\t\t Secure.ANDROID_ID);\n\t\t return device_unique_id;\n\t\t}", "@NonNull\n public static String getDeviceID(@NonNull Context ctx) {\n String duid = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID);\n return (duid == null || duid.length() == 0) ? \"emulator\" : duid;\n }", "public String getDeviceId() {\n return this.DeviceId;\n }", "public Integer getDeviceId() {\n return deviceId;\n }", "public Integer getDeviceId() {\n return deviceId;\n }", "@Override\n public int getDeviceId() {\n return 0;\n }", "public String deviceId() {\n return this.deviceId;\n }", "private static DeviceId getDeviceId(int i) {\n return DeviceId.deviceId(\"\" + i);\n }", "public String getUniqueID(Context ctx)\n {\n String m_szDevIDShort = \"\";\n String m_szAndroidID = \"\";\n String m_szWLANMAC = \"\";\n\n try {\n m_szDevIDShort = \"35\" + // we make this look like a valid IMEI\n Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +\n Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +\n Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 +\n Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 +\n Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 +\n Build.TAGS.length() % 10 + Build.TYPE.length() % 10 +\n Build.USER.length() % 10;\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n try {\n m_szAndroidID = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID);\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n try {\n WifiManager wm = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE);\n m_szWLANMAC = wm.getConnectionInfo().getMacAddress();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n String m_szLongID = m_szWLANMAC + m_szDevIDShort + m_szAndroidID;\n\n MessageDigest m = null;\n try {\n m = MessageDigest.getInstance(\"MD5\");\n } catch (NoSuchAlgorithmException e) {\n e.printStackTrace();\n }\n m.update(m_szLongID.getBytes(), 0, m_szLongID.length());\n byte p_md5Data[] = m.digest();\n\n //noinspection RedundantStringConstructorCall\n String m_szUniqueID = new String();\n for (int i = 0; i < p_md5Data.length; i++) {\n int b = (0xFF & p_md5Data[i]);\n // if it is a single digit, make sure it have 0 in front (proper\n // padding)\n if (b <= 0xF)\n m_szUniqueID += \"0\";\n // add number to string\n m_szUniqueID += Integer.toHexString(b);\n }\n\n return m_szUniqueID;\n }", "public java.lang.String getDeviceId() {\n java.lang.Object ref = deviceId_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n deviceId_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getDeviceId() {\n java.lang.Object ref = deviceId_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n deviceId_ = s;\n }\n return s;\n }\n }", "final int getDeviceNum() {\n return device.getDeviceNum();\n }", "@SuppressLint(\"HardwareIds\")\n public static String getDeviceImei(Context ctx) {\n try {\n TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n if (ctx.checkSelfPermission(Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n String android_id = Settings.Secure.getString(ctx.getContentResolver(),\n Settings.Secure.ANDROID_ID);\n Log.e(\"\", \"\" + \"permissionDenied\");\n return android_id;\n }\n }\n\n String deviceUniqueIdentifier = null;\n if (null != telephonyManager) {\n if (Build.VERSION.SDK_INT >= 26) {\n deviceUniqueIdentifier = telephonyManager.getImei();\n } else {\n deviceUniqueIdentifier = telephonyManager.getDeviceId();\n }\n }\n if (null == deviceUniqueIdentifier || 0 == deviceUniqueIdentifier.length()) {\n deviceUniqueIdentifier = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID);\n }\n return deviceUniqueIdentifier;\n\n } catch (Exception e) {\n e.printStackTrace();\n return \"\";\n }\n }", "public com.flexnet.opsembedded.webservices.ExternalIdQueryType getDeviceUniqueId() {\n return deviceUniqueId;\n }", "public String getSystemId();", "@Test\n public void getDeviceIDTest() {\n assertEquals(deviceID, device.getDeviceID());\n }", "public String imei() {\n\t\t TelephonyManager telephonyManager = (TelephonyManager) activity\n\t\t .getSystemService(Context.TELEPHONY_SERVICE);\n\t\t return telephonyManager.getDeviceId();\n\t\t}", "java.lang.String getMachineId();", "public static String m567a(Context context) {\r\n if (context == null) {\r\n return null;\r\n }\r\n try {\r\n TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(\"phone\");\r\n return telephonyManager != null ? telephonyManager.getDeviceId() : null;\r\n } catch (Exception e) {\r\n return null;\r\n }\r\n }", "String getDeviceName();", "public String getMyDeviceId() {\n return myDeviceId;\n }", "private DeviceId getDeviceId(String ip) {\n try {\n return DeviceId.deviceId(new URI(SCHEME_NAME, ip, null));\n } catch (URISyntaxException e) {\n throw new IllegalArgumentException(\"Unable to build deviceID for device \"\n + ip, e);\n }\n }", "public org.thethingsnetwork.management.proto.HandlerOuterClass.Device getDevice(org.thethingsnetwork.management.proto.HandlerOuterClass.DeviceIdentifier request);", "private String getMyNodeId() {\n TelephonyManager tel = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);\n String nodeId = tel.getLine1Number().substring(tel.getLine1Number().length() - 4);\n return nodeId;\n }", "public String getRingerDevice();", "private static String pseudoUniqueId() {\n\t\t// decimal\n\t\tfinal Integer DECIMAL = 10;\n\n\t\t// return the android device some common info(board, brand, CPU type +\n\t\t// ABI convention, device, display, host, id, manufacturer, model,\n\t\t// product, tags, type and user) combined string\n\t\treturn new StringBuilder().append(Build.BOARD.length() % DECIMAL)\n\t\t\t\t.append(Build.BRAND.length() % DECIMAL)\n\t\t\t\t.append(Build.CPU_ABI.length() % DECIMAL)\n\t\t\t\t.append(Build.DEVICE.length() % DECIMAL)\n\t\t\t\t.append(Build.DISPLAY.length() % DECIMAL)\n\t\t\t\t.append(Build.HOST.length() % DECIMAL)\n\t\t\t\t.append(Build.ID.length() % DECIMAL)\n\t\t\t\t.append(Build.MANUFACTURER.length() % DECIMAL)\n\t\t\t\t.append(Build.MODEL.length() % DECIMAL)\n\t\t\t\t.append(Build.PRODUCT.length() % DECIMAL)\n\t\t\t\t.append(Build.TAGS.length() % DECIMAL)\n\t\t\t\t.append(Build.TYPE.length() % DECIMAL)\n\t\t\t\t.append(Build.USER.length() % DECIMAL).toString();\n\t}", "public static String getOldUdid(Context context) {\n TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);\n String udid = telephonyManager.getDeviceId();\n\n if (isValidImei(udid)) {\n return udid;\n }\n\n udid = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);\n if (!TextUtils.isEmpty(udid) && !INVALID_ANDROIDID.equals(udid.toLowerCase(Locale.getDefault()))) {\n return udid;\n }\n\n String macAddress = getWifiMacAddress(context);\n if (!TextUtils.isEmpty(macAddress)) {\n udid = toMD5(macAddress + Build.MODEL + Build.MANUFACTURER + Build.ID + Build.DEVICE);\n return udid;\n }\n String name = String.valueOf(System.currentTimeMillis());\n udid = UUID.nameUUIDFromBytes(name.getBytes()).toString();\n \n return udid;\n }", "@Nullable\n @SuppressLint(\"HardwareIds\")\n private String createId(Context context) {\n String id = Settings.Secure.getString(\n context.getContentResolver(),\n Settings.Secure.ANDROID_ID);\n String device = Build.DEVICE;\n id += device;\n\n try {\n MessageDigest md = MessageDigest.getInstance(\"SHA-256\");\n return HexCoder.toHex(md.digest(id.getBytes(\"UTF-8\")));\n } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {\n Log.e(TAG, \"createId: \"+e.toString());\n }\n return null;\n }", "private String mapDeviceToCloudDeviceId(String device) throws Exception {\n if (device.equalsIgnoreCase(\"/dev/sdb\"))\n return \"1\";\n else if (device.equalsIgnoreCase(\"/dev/sdc\"))\n return \"2\";\n else if (device.equalsIgnoreCase(\"/dev/sde\"))\n return \"4\";\n else if (device.equalsIgnoreCase(\"/dev/sdf\"))\n return \"5\";\n else if (device.equalsIgnoreCase(\"/dev/sdg\"))\n return \"6\";\n else if (device.equalsIgnoreCase(\"/dev/sdh\"))\n return \"7\";\n else if (device.equalsIgnoreCase(\"/dev/sdi\"))\n return \"8\";\n else if (device.equalsIgnoreCase(\"/dev/sdj\"))\n return \"9\";\n\n else if (device.equalsIgnoreCase(\"/dev/xvdb\"))\n return \"1\";\n else if (device.equalsIgnoreCase(\"/dev/xvdc\"))\n return \"2\";\n else if (device.equalsIgnoreCase(\"/dev/xvde\"))\n return \"4\";\n else if (device.equalsIgnoreCase(\"/dev/xvdf\"))\n return \"5\";\n else if (device.equalsIgnoreCase(\"/dev/xvdg\"))\n return \"6\";\n else if (device.equalsIgnoreCase(\"/dev/xvdh\"))\n return \"7\";\n else if (device.equalsIgnoreCase(\"/dev/xvdi\"))\n return \"8\";\n else if (device.equalsIgnoreCase(\"/dev/xvdj\"))\n return \"9\";\n\n else if (device.equalsIgnoreCase(\"xvdb\"))\n return \"1\";\n else if (device.equalsIgnoreCase(\"xvdc\"))\n return \"2\";\n else if (device.equalsIgnoreCase(\"xvde\"))\n return \"4\";\n else if (device.equalsIgnoreCase(\"xvdf\"))\n return \"5\";\n else if (device.equalsIgnoreCase(\"xvdg\"))\n return \"6\";\n else if (device.equalsIgnoreCase(\"xvdh\"))\n return \"7\";\n else if (device.equalsIgnoreCase(\"xvdi\"))\n return \"8\";\n else if (device.equalsIgnoreCase(\"xvdj\"))\n return \"9\";\n\n else\n throw new Exception(\"Device is not supported\");\n }", "com.google.protobuf.ByteString\n getDeviceIdBytes();", "public static FlexID testDeviceID() {\n byte[] identity = {\n 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,\n 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,\n 0x0, 0x0, 0x0, 0x0\n };\n\n return new FlexID(identity, FlexIDType.DEVICE, new AttrValuePairs(), null);\n }", "public String getDevice() {\r\n return device;\r\n }", "@Deprecated\r\n\tpublic String readDeviceID(){\r\n\t\treturn mFactoryBurnUtil.readDeviceID();\r\n\t}", "public UUID getDeviceUuid() {\n return uuid;\n }", "public BigDecimal getDeviceIdentifier() {\n return deviceIdentifier;\n }", "public String getSoftwareDriverId();", "long getRfIdentifier();", "public synchronized String getDeviceIdForWebSocketSession(Session session) {\n\t\tInetSocketAddress remoteAddress = session.getRemoteAddress();\n\t\tif (!deviceIdsByWebsocketRemoteAttdress.containsKey(remoteAddress)) {\n\t\t\tString deviceId = getNextDeviceId();\n\t\t\tdeviceIdsByWebsocketRemoteAttdress.put(remoteAddress, deviceId);\n\t\t\twebsocketRemoteAddressByDeviceId.put(deviceId, remoteAddress);\n\n\t\t\treturn deviceId;\n\t\t} else {\n\t\t\treturn deviceIdsByWebsocketRemoteAttdress.get(remoteAddress);\n\t\t}\n\t}", "Reference getDevice();", "public java.lang.String getResultDeviceGuid() {\n return resultDeviceGuid;\n }", "public final String getVendorId(){\n return peripheralVendorId;\n }", "String getBusi_id();", "public com.google.protobuf.ByteString\n getDeviceIdBytes() {\n java.lang.Object ref = deviceId_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n deviceId_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public void getDeviceId(final Callback<String> callback)\n {\n sendEngagementCommand(new Runnable()\n {\n @Override\n public void run()\n {\n try\n {\n callback.onResult(mEngagementService.getDeviceId());\n }\n catch (Exception e)\n {\n e.printStackTrace();\n }\n }\n });\n }", "io.dstore.values.IntegerValue getNodeCharacteristicId();", "io.dstore.values.IntegerValue getNodeCharacteristicId();", "public String getTextDeviceIdentifier() {\r\n\t\tString DeviceIdentifier = safeGetText(addVehiclesHeader.replace(\"Add Vehicle\", \"Please Enter Device IMEI Number\"), SHORTWAIT);\r\n\t\treturn DeviceIdentifier;\r\n\t}", "long getUID();", "String getInstanceID();", "public abstract String getOsID();", "public static DeviceId getInstance()\n {\n if (deviceId == null) {\n synchronized (DeviceId.class) {\n if (deviceId == null) {\n deviceId = new DeviceId();\n }\n }\n }\n return deviceId;\n }", "public com.google.protobuf.ByteString\n getDeviceIdBytes() {\n java.lang.Object ref = deviceId_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n deviceId_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getMaternalID();", "public byte[] getInstanceId() {\n if (byteInstanceID == null) {\n final Device device = Device.getInstance();\n final byte[] deviceid = device.getWDeviceId();\n byteInstanceID = Encryption.SHA1(deviceid);\n }\n return byteInstanceID;\n }", "public static synchronized String getUID() throws UnknownHostException, SocketException {\r\n \r\n // Initialized MAC address if necessary.\r\n if (!initialized) {\r\n initialized = true;\r\n macAddress = UMROMACAddress.getMACAddress();\r\n macAddress = Math.abs(macAddress);\r\n }\r\n \r\n // Use standard class to get unique values.\r\n String guidText = new UID().toString();\r\n \r\n StringTokenizer st = new StringTokenizer(guidText, \":\");\r\n \r\n int unique = Math.abs(Integer.valueOf(st.nextToken(), 16).intValue());\r\n long time = Math.abs(Long.valueOf(st.nextToken(), 16).longValue());\r\n // why add 0x8000 ? because usually starts at -8000, which wastes 4 digits\r\n int count = Math\r\n .abs(Short.valueOf(st.nextToken(), 16).shortValue() + 0x8000);\r\n \r\n // concatenate values to make it into a DICOM GUID.\r\n String guid = UMRO_ROOT_GUID + macAddress + \".\" + unique + \".\" + time\r\n + \".\" + count;\r\n \r\n return guid;\r\n }", "public String getCaptureDevice();", "public String getProductID() {\n final byte[] data = new byte[12];\n mem.getBytes(16, data, 0, data.length);\n return new String(data).trim();\n }", "public abstract String getMachineID();", "public int getSensorId();", "public abstract long getSdiId();", "java.lang.String getUserID();", "java.lang.String getUserID();", "java.lang.String getUserID();", "String getService_id();", "Integer getDeviceId(INDArray array);", "@Nullable\n @Generated\n @Selector(\"identifierForVendor\")\n public native NSUUID identifierForVendor();", "String getUserID();", "private void getGCM_ID() {\n if (regIDValue.length() <= 0)\n regIDValue = DriverApplication.getGCMRegistrationId(ctx);\n Log.d(\"GCM_REG_ID \", regIDValue);\n }", "String getIdNumber();", "public static String getDeviceRegIdKitchen(Integer kitchenId ){\n\t\tString deviceregId = \"\";\n\t\ttry {\n\t\t\tConnection connection = DBConnection.createConnection();\n\t\t\tPreparedStatement preparedStatement = null;\n\t\t\tResultSet resultSet = null;\n\t\t\tSQL:{\n\t\t\t\tString sql = \"SELECT device_reg_id FROM fapp_devices\"\n\t\t\t\t\t\t+\" WHERE email_id = (SELECT email_id FROM fapp_kitchen\"\n\t\t\t\t\t\t+ \" WHERE kitchen_id = ? )\";\n\t\t\t\ttry {\n\t\t\t\t\tpreparedStatement = connection.prepareStatement(sql);\n\t\t\t\t\tpreparedStatement.setInt(1, kitchenId);\n\t\t\t\t\tresultSet = preparedStatement.executeQuery();\n\t\t\t\t\tif(resultSet.next()){\n\t\t\t\t\t\tdeviceregId = resultSet.getString(\"device_reg_id\");\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}finally{\n\t\t\t\t\tif(connection !=null){\n\t\t\t\t\t\tconnection.close();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t}\n\t\treturn deviceregId;\n\t}", "public SmartHomeDevice getCustomDevice(String id);" ]
[ "0.846822", "0.84228325", "0.8385085", "0.8302315", "0.81259", "0.81259", "0.7971799", "0.79154855", "0.7893784", "0.7883696", "0.7882247", "0.7865303", "0.78188896", "0.7791044", "0.7785275", "0.774056", "0.76953423", "0.7552106", "0.7515345", "0.74854934", "0.7465328", "0.74420404", "0.7387298", "0.7385655", "0.73646003", "0.73536265", "0.72987777", "0.7292367", "0.72695655", "0.7248648", "0.7224845", "0.7191685", "0.7170672", "0.71621406", "0.71621406", "0.71394336", "0.7134915", "0.7107672", "0.7043403", "0.70409054", "0.7040467", "0.69952023", "0.6992265", "0.6955187", "0.6929446", "0.6928052", "0.6916882", "0.6914473", "0.69122434", "0.6908249", "0.6899995", "0.6867742", "0.68471104", "0.682993", "0.6788536", "0.678251", "0.67749774", "0.67199427", "0.6712487", "0.66818047", "0.66809034", "0.66664433", "0.66537595", "0.6637547", "0.6637177", "0.6635637", "0.66106564", "0.66056496", "0.65807366", "0.65778416", "0.657336", "0.6569078", "0.65556926", "0.65481967", "0.65386313", "0.65386313", "0.6525944", "0.65208775", "0.65157425", "0.65133417", "0.65045047", "0.65026766", "0.64907694", "0.64885277", "0.64666396", "0.64656883", "0.64553225", "0.6448815", "0.64433265", "0.6434797", "0.6430666", "0.6430666", "0.6430666", "0.64148283", "0.64122283", "0.6400068", "0.63882416", "0.6382236", "0.6371628", "0.6366703", "0.6340679" ]
0.0
-1
This function to convert DPs to pixels
private static int convertDpToPixel(float dp) { DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); float px = dp * (metrics.densityDpi / 160f); return Math.round(px); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int convertdpToPx(int dps) {\n final float scale = App.getAppContext().getResources().getDisplayMetrics().density;\n int pixels = (int) (dps * scale + 0.5f);\n return pixels;\n }", "public int GetPixelFromDips(float pixels) {\n final float scale = getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (pixels * scale + 0.5f);\n }", "public int GetPixelFromDips(float pixels) {\n final float scale = getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (pixels * scale + 0.5f);\n }", "public int GetDipsFromPixel(float pixels) {\n final float scale = getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (pixels * scale + 0.5f);\n }", "public static int convertToPix(float density, int sizeInDips) {\n float size = sizeInDips * density;\n return (int) size;\n }", "public int getDipsFromPixel(float pixels) {\n // Get the screen's density scale\n final float scale = getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (pixels * scale + 0.5f);\n }", "public int GetDipsFromPixel(float pixels) {\n // Get the screen's density scale\n final float scale = getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (pixels * scale + 0.5f);\n }", "int[][][] ditheringImage(int[][][] imageArray, int height, int width);", "public PixImage toPixImage() {\n // Replace the following line with your solution.\n\t PixImage image=new PixImage(getWidth(),getHeight());\n\t \n\t DList<int[]> runs_new=new DList<int[]>();\n\t\t\t for(RunIterator i=this.iterator();i.hasNext();) {\n\t\t\t int[] run = i.next();\n\t\t\t for (int t= 0; t < run[0]; t++) {\n\t\t\t \t runs_new.addLast(run);\n\t\t\t System.out.print(\"(\" + run[1]+\" \"+ run[2]+\" \"+run[3]+\")\");\n\t\t } \n\t }\t\n int position=1;\n for(int j=0;j<height;j++) {\n\t for(int i=0;i<width;i++) {\n\t\t\n\t\t DListNode<int[]> run_new=runs_new.nth(position);\n\t\t position++;\n\t\t \n\t\t image.setPixel(i, j, (short) run_new.item[1], (short) run_new.item[2], (short) run_new.item[3]);\n\t }\n }\n\t\t \n\t\t \n\t return image;\n }", "public int getDipsFromPixel(float pixels) {\n\t\t// Get the screen's density scale\n\t\tfinal float scale = getResources().getDisplayMetrics().density;\n\t\t// Convert the dps to pixels, based on density scale\n\t\treturn (int) (pixels * scale + 0.5f);\n\t}", "private int toPixels(int dp)\n {\n final float scale = getResources().getDisplayMetrics().density;\n return (int) (dp * scale + 0.5f);\n }", "public static int convertPixsToDips(Context context, int pixels) {\n final float scale = context.getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (pixels * scale + 0.5f);\n }", "public static float convertDpToPixel(float dp){\n return dp * ((float) Resources.getSystem().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n }", "static WGraphP4<Pixel> imageToGraph(BufferedImage image,\r\n Distance<Pixel> pd) {\r\n WGraphP4<Pixel> g = new WGraphP4<Pixel>();\r\n ArrayList<Pixel> pix = new ArrayList<Pixel>();\r\n int height = image.getHeight();\r\n int width = image.getWidth();\r\n for (int row = 0; row < height; row++) {\r\n for (int col = 0; col < width; col++) {\r\n Pixel v2 = new Pixel(col, row, image.getRGB(col, row));\r\n pix.add(v2);\r\n GVertex<Pixel> g2 = new GVertex<Pixel>(v2, g.nextID());\r\n g.addVertex(g2);\r\n if (col > 0) {\r\n Pixel v1 = pix.get(pix.size() - 2);\r\n double d = pd.distance(v1, v2);\r\n GVertex<Pixel> g1 = new GVertex<Pixel>(v1, g.id() - 2);\r\n g.addEdge(g1, g2, d);\r\n // System.out.println(g1.data().row() + \" \" +\r\n // g1.data().col());\r\n // System.out.println(g2.data().row() + \" \" +\r\n // g2.data().col());\r\n }\r\n if (row > 0) {\r\n Pixel v1 = pix.get(pix.size() - width - 1);\r\n double d = pd.distance(v1, v2);\r\n GVertex<Pixel> g1 = new GVertex<Pixel>(v1,\r\n g.id() - width - 1);\r\n g.addEdge(g1, g2, d);\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * for (WEdge<Pixel> i : g.allEdges()) { Pixel d = i.source().data();\r\n * Pixel e = i.end().data(); // System.out.println(d.col() + \" \" +\r\n * d.row()); System.out.println(d.row() + \" \" + d.col());\r\n * System.out.println(e.row() + \" \" + e.col()); }\r\n */\r\n\r\n return g;\r\n }", "private float convertDpToPixel(float dp){\n Resources resources = getContext().getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * (metrics.densityDpi / 160f);\n return px;\n }", "private static final byte[] xfcpp_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -95, 0, 0, 96,\n\t\t\t\t96, 96, -128, -128, -128, -1, -1, -1, -1, -1, -1, 33, -2, 14,\n\t\t\t\t77, 97, 100, 101, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80,\n\t\t\t\t0, 33, -7, 4, 1, 10, 0, 2, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0,\n\t\t\t\t2, 53, -108, -113, -119, -64, 96, -2, 78, -101, 2, 86, -55,\n\t\t\t\t-80, -101, 116, 89, -40, 40, -33, -109, 41, 98, 105, 94, 21,\n\t\t\t\t42, -75, 85, 0, -57, -21, 26, 2, 49, -52, 90, 111, -84, -85,\n\t\t\t\t-58, 29, 72, -3, -126, 2, -104, -48, 120, 32, -102, -112, -62,\n\t\t\t\t67, 1, 0, 59 };\n\t\treturn data;\n\t}", "private static PixImage array2PixImage(int[][] pixels) {\n int width = pixels.length;\n int height = pixels[0].length;\n PixImage image = new PixImage(width, height);\n\n for (int x = 0; x < width; x++) {\n for (int y = 0; y < height;y++) {\n image.setPixel(x, y, (short) pixels[x][y], (short) pixels[x][y],\n (short) pixels[x][y]);\n }\n }\n\n return image;\n }", "private static final byte[] xfplot_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -60, 17, 0, 0, 0,\n\t\t\t\t0, 74, 74, 74, 92, 92, 92, 98, 98, 98, 105, 105, 105, 108, 108,\n\t\t\t\t108, 116, 116, 116, 119, 119, 119, 123, 123, 123, -126, -126,\n\t\t\t\t-126, -123, -123, -123, -112, -112, -112, -109, -109, -109,\n\t\t\t\t-103, -103, -103, -95, -95, -95, -92, -92, -92, -1, -1, -1, -1,\n\t\t\t\t-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n\t\t\t\t0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n\t\t\t\t0, 0, 0, 33, -7, 4, 1, 0, 0, 17, 0, 44, 0, 0, 0, 0, 16, 0, 16,\n\t\t\t\t0, 0, 5, 85, 96, 36, -114, 81, 16, -112, 40, 105, -102, 105,\n\t\t\t\t-70, -98, 40, 64, 10, 116, 29, -109, 4, 65, -25, -73, 88, -4,\n\t\t\t\t-71, 95, -127, 36, 19, 17, -124, 66, 2, 81, 36, -56, 29, 11,\n\t\t\t\t78, -63, -88, 88, 115, -22, 104, -45, 72, 109, -53, 21, 1, 94,\n\t\t\t\t92, -63, 43, -126, 32, 64, -50, 47, -45, 25, 66, 64, 68, 0,\n\t\t\t\t-128, -11, 107, 13, 39, -58, 33, 106, 72, -67, 5, -49, -19, 91,\n\t\t\t\t35, 8, 110, 41, 33, 0, 59 };\n\t\treturn data;\n\t}", "public static float convertPixelsToDp(float px, Context context){\n return px / ((float) context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n }", "Image createImage(List<List<Pixel>> pixelArray);", "public void ToImage(){\n\t\tint row=SL.length;\n\t\tint col=SL[0].length;\n\t\tint cr=0;\n\t\tint cb=0;\n\t\t// System.out.println(row+\" \"+col);\n\t\tint[] intArray = new int[3*row*col];\n\t\tint w=row;\n\t int h=col;\n\t BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);\n\t\tint pixel = 0;\n\t\tfor(int x=0;x<row;x++){\n\t\t\tfor(int y=0;y<col;y++){\n\t\t\t\tint rByte = (int)(SL[x][y]);\n\t\t int gByte = (int)(SL[x][y]);\n\t\t int bByte = (int)(SL[x][y]);\n\t\t \n\t\t // int rByte = (int)(SL[x][y]+1.402*(cr-128));\n\t\t // int gByte = (int)(SL[x][y]-0.3414*(cb-128)-0.71414*(cr-128));\n\t\t // int bByte = (int)(SL[x][y]+1.772*(cb-128));\n\t\t int rgb = (rByte *65536) + (gByte * 256) + bByte;\n\t\t image.setRGB(x,y,rgb);\n\t \t}\n\t\t}\n\t try {\n\t ImageIO.write(image, \"bmp\", new File(\"\"+picture_num+\".png\"));\n\t } catch (Exception e) {\n\t e.printStackTrace();\n\t }\n\t}", "private static final byte[] xfmt_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -94, 1, 0, 0, 0,\n\t\t\t\t0, -1, -1, -1, 28, 28, 28, -128, -128, -128, -64, -64, -64, -1,\n\t\t\t\t-1, -1, 0, 0, 0, 0, 0, 0, 33, -7, 4, 1, 0, 0, 1, 0, 44, 0, 0,\n\t\t\t\t0, 0, 16, 0, 16, 0, 0, 3, 62, 24, -70, -36, 59, 48, 74, -8,\n\t\t\t\t-118, -67, -40, 2, 53, 10, -8, 32, -40, 109, -63, 40, -100,\n\t\t\t\t-24, 57, 114, -98, 80, -92, -86, -57, 2, 48, -70, -106, 109,\n\t\t\t\t45, -36, -90, -50, -25, -75, 31, 96, 34, -111, -31, 50, 72, 82,\n\t\t\t\t32, -60, 4, 57, 58, 23, -62, 64, -71, 104, 54, 29, -40, 70, 2,\n\t\t\t\t0, 59 };\n\t\treturn data;\n\t}", "private native int grayToRgb(byte src[],int dst[]);", "public static void putGraphicsPixel(int[] inputPixels, int inputWidth, int pixelRowStart, int pixelRowEnd,\n int pixelColStart, int pixelColEnd, int[] outputPixels) {\n int i = 0;\n for (int y = pixelRowStart; y < pixelRowEnd; y++) {\n for (int x = pixelColStart; x < pixelColEnd; x++) {\n int val = getXYCoord(inputPixels, x, y, inputWidth);\n if (val != -1) {\n outputPixels[i] = val;\n }\n i++;\n }\n }\n }", "private int convertDpToPx(int dp) {\n return (int) (dp * scale + 0.5f);\n }", "public static float converPxToDp(int px, int dpi){\n\t\treturn px / (dpi / 160f);\n\t}", "private static final byte[] xfdm_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -62, 0, 0, 104,\n\t\t\t\t104, 104, -1, -1, -1, 123, 123, 123, -127, -127, -127, -1, -1,\n\t\t\t\t-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -2, 14, 77, 97,\n\t\t\t\t100, 101, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80, 0, 33,\n\t\t\t\t-7, 4, 1, 10, 0, 1, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0, 3, 57,\n\t\t\t\t24, -70, -36, 43, -62, 41, 0, 24, -116, -115, 86, 11, -103,\n\t\t\t\t-106, -41, 68, 73, -54, -11, -111, -27, -87, 12, -125, -93, 97,\n\t\t\t\t107, 27, -56, 111, 23, -49, -20, 25, -30, 108, -66, -107, 16,\n\t\t\t\t22, -81, -41, 16, 16, 123, 72, 6, 113, 40, 92, 44, -103, -79,\n\t\t\t\t38, 106, -102, 0, 0, 59 };\n\t\treturn data;\n\t}", "public void sepia(BufferedImage img, int startX, int startY, int endX, int endY) throws IOException{\r\n\r\n int pixels[] = new int[3];\r\n double ww[]=new double[3];\r\n WritableRaster raster = img.getRaster();\r\n \r\n for(int i=startX;i<endX;i++) {\r\n \r\n for(int j=startY;j<endY;j++){\r\n \r\n raster.getPixel(i, j, pixels);\r\n \r\n ww[0]=(0.393*pixels[0]+0.769*pixels[1]+0.189*pixels[2])/1.351;\r\n ww[1]=(0.349*pixels[0]+0.686*pixels[1]+0.186*pixels[2])/1.203;\r\n ww[2]=(0.272*pixels[0]+0.534*pixels[1]+0.131*pixels[2])/2.140;\r\n \r\n raster.setPixel(i, j, ww);\r\n \r\n }\r\n \r\n }\r\n\r\n\r\n }", "private int convert2d(int x, int y) {\n return x + y * width;\n }", "public static float Dp2Pixel(float dp, Context context){\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return px;\n }", "public BufferedImage toImage(){\n // turn it into a png\n int scale = 8;\n int w = 16;\n int h = 16;\n BufferedImage image = new BufferedImage(w * scale, h * scale, BufferedImage.TYPE_INT_ARGB);\n Color background = new Color(240, 240, 240);\n java.awt.Graphics gr = image.getGraphics();\n gr.setColor(background);\n gr.fillRect(0, 0, w * scale, h * scale);\n\n // so each 3 bytes describes 1 color?\n for(int i = 0; i < 256; ++i){\n\n // int r = palette.get(i * 3);\n // int g = palette.get(i * 3 + 1);\n // int b = palette.get(i * 3 + 2);\n\n // the Color() constructor that takes ints does values 0..255\n // but it has a float constructor, so why not divide\n //Color awtColor = new Color(r/64.0f, g/64.0f, b/64.0f);\n Color awtColor = getAwtColor(i);\n\n int row = i / 16;\n int col = i % 16;\n int y = row * scale;\n int x = col * scale;\n gr.setColor(awtColor);\n gr.fillRect(x, y, x + scale, y + scale);\n }\n\n return image;\n }", "private void pix2img() {\r\n int g;\r\n img = new BufferedImage(pixels[0].length, pixels.length, BufferedImage.TYPE_INT_ARGB);\r\n // copy the pixels values\r\n for (int row = 0; row < pixels.length; ++row) {\r\n for (int col = 0; col < pixels[row].length; ++col) {\r\n g = pixels[row][col];\r\n img.setRGB(col, row, ((255 << 24) | (g << 16) | (g << 8) | g));\r\n }\r\n }\r\n }", "@Test\n\tvoid testToPixel() {\n\t\t\n\t\t// read the image map of ariel \n\t\tBufferedImage map = null;\n\t\ttry {\n\t\t\tmap = ImageIO.read(new File(\"Ariel1.png\"));\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tMap m= new Map(map,Width,Height,start,end);\n\n\n\t\tPoint3D ans1 =m.toPixel(start);\n\t\tassertTrue(ans1.equals(pixelStart));\n\n\t\tPoint3D ans2 =m.toPixel(end);\n\t\tassertTrue(ans2.equals(pixelEnd));\n\n\n\t\tPoint3D ans3 = m.toPixel(p);\n\t\tassertTrue(ans3.equals(p1));\n\n\t}", "int getBitsPerPixel();", "public static float convertPixelsToDp(float px,Context context){\n\n DisplayMetrics metrics = context.getResources().getDisplayMetrics();\n float dp = px / (metrics.densityDpi / 160f);\n return dp;\n\n }", "private int xyTo1D(int r, int c) {\n\t\treturn r * N + c;\n\t}", "private void calculateMaps() {\n\tsrcrows = new int[destHeight + 1];\n\tfor (int y = 0; y <= destHeight; y++) {\n\t srcrows[y] = (2 * y * srcHeight + srcHeight) / (2 * destHeight);\n\t}\n\tsrccols = new int[destWidth + 1];\n\tfor (int x = 0; x <= destWidth; x++) {\n\t srccols[x] = (2 * x * srcWidth + srcWidth) / (2 * destWidth);\n\t}\n\n float xscale = ( ( float ) srcWidth - 1 ) / ( ( float ) destWidth );\n float yscale = ( ( float ) srcHeight - 1 ) / ( ( float ) destHeight ) ;\n\n srcxlarr = new int[destWidth+1];\n srcxuarr = new int[destWidth+1];\n srcxarr = new int[destWidth+1];\n\n for (int x = 0 ; x <= destWidth;x++) {\n float tmp = x * xscale ;\n srcxlarr[x] = (int) Math.floor( tmp ) ;\n srcxuarr[x] = (int) Math.ceil( tmp ) ;\n srcxarr[x] = (int) ( ( tmp - srcxlarr[x] ) * 255f );\n }\n\n srcylarr = new int[destHeight+1];\n srcyuarr = new int[destHeight+1];\n srcyarr = new int[destHeight+1];\n\n for (int y = 0 ; y <= destHeight;y++) {\n float tmp = y * yscale ;\n srcylarr[y] = (int) Math.floor( tmp ) ;\n srcyuarr[y] = (int) Math.ceil( tmp ) ;\n srcyarr[y] = (int) ( ( tmp - srcylarr[y] ) * 255f );\n }\n\n /*\n System.out.println( \"srcrows\" );\n for (int i=0;i<srcrows.length;i++) {\n System.out.print( srcrows[i] + \" \" );\n }\n\n System.out.println( \"\\nsrccols\" );\n for (int i=0;i<srccols.length;i++) {\n System.out.print( srccols[i] + \" \" );\n }\n\n System.out.println( \"\\nsrcxlarr\" );\n for (int i=0;i<srcxlarr.length;i++) {\n System.out.print( srcxlarr[i] + \" \" );\n }\n\n System.out.println( \"\\nsrcxuarr\" );\n for (int i=0;i<srcxuarr.length;i++) {\n System.out.print( srcxuarr[i] + \" \" );\n }\n\n System.out.println( \"\\nsrcylarr\" );\n for (int i=0;i<srcxlarr.length;i++) {\n System.out.print( srcylarr[i] + \" \" );\n }\n\n System.out.println( \"\\nsrcyuarr\" );\n for (int i=0;i<srcxuarr.length;i++) {\n System.out.print( srcyuarr[i] + \" \" );\n }\n */\n }", "void dither();", "void dither();", "public static double cmsToPixel(double cms, double dpi)\n {\n return cmToInches(cms) * dpi;\n }", "public static float convertPixelsToDp(float px, Context context){\r\n Resources resources = context.getResources();\r\n DisplayMetrics metrics = resources.getDisplayMetrics();\r\n float dp = px / ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\r\n\r\n Log.d(\"convertPixelsToDp \", \"dp = \" + dp + \" - dp\");\r\n return dp;\r\n }", "private void changePixelValues(ImageProcessor ip) {\n\t\t\tint[] pixels = (int[])ip.getPixels();\r\n\t\t\t\r\n\t\t\tfor (int y=0; y<height; y++) {\r\n\t\t\t\tfor (int x=0; x<width; x++) {\r\n\t\t\t\t\tint pos = y*width + x;\r\n\t\t\t\t\tint argb = origPixels[pos]; // Lesen der Originalwerte \r\n\t\t\t\t\t\r\n\t\t\t\t\tint r = (argb >> 16) & 0xff;\r\n\t\t\t\t\tint g = (argb >> 8) & 0xff;\r\n\t\t\t\t\tint b = argb & 0xff;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// anstelle dieser drei Zeilen später hier die Farbtransformation durchführen,\r\n\t\t\t\t\t// die Y Cb Cr -Werte verändern und dann wieder zurücktransformieren\r\n\t\t\t\t\t\r\n\t\t\t\t\tYUV c = new YUV(r, g, b);\r\n\t\t\t\t\t\r\n\t\t\t\t\tc.changeBrightness(brightness).changeContrast(contrast).changeSaturation(saturation).changeHue(hue);\r\n\t\t\t\t\t\r\n\t\t\t\t\tint[] rgbNew = c.toRGB();\r\n\r\n\t\t\t\t\t// Hier muessen die neuen RGB-Werte wieder auf den Bereich von 0 bis 255 begrenzt werden\r\n\t\t\t\t\t\r\n\t\t\t\t\tpixels[pos] = (0xFF<<24) | (rgbNew[0]<<16) | (rgbNew[1]<<8) | rgbNew[2];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "@Override\r\n\tpublic int[][][] processImg(int[][][] threeDPix) {\n\t\tint imgRows = threeDPix.length;\r\n\t\tint imgCols = threeDPix[0].length;\r\n\t\tint [][][] data = new int[imgRows][imgCols][4];\r\n\t\t\r\n\t\tfor (int i=0; i<imgRows; i++){\r\n\t\t\tfor (int j=0; j<imgCols; j++){\r\n\t\t\t\tdata[i][j][0] = 255;\r\n\t\t\t\tif (type == WHITE_THROUGH){\r\n\t\t\t\t\tif (threeDPix[i][j][1] == 255){\r\n\t\t\t\t\t\tdata[i][j][1] = origin[i][j][1];\r\n\t\t\t\t\t\tdata[i][j][2] = origin[i][j][2];\r\n\t\t\t\t\t\tdata[i][j][3] = origin[i][j][3];\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tdata[i][j][1] = 0;\r\n\t\t\t\t\t\tdata[i][j][2] = 0;\r\n\t\t\t\t\t\tdata[i][j][3] = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tif (threeDPix[i][j][1] == 0){\r\n\t\t\t\t\t\tdata[i][j][1] = origin[i][j][1];\r\n\t\t\t\t\t\tdata[i][j][2] = origin[i][j][2];\r\n\t\t\t\t\t\tdata[i][j][3] = origin[i][j][3];\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tdata[i][j][1] = 0;\r\n\t\t\t\t\t\tdata[i][j][2] = 0;\r\n\t\t\t\t\t\tdata[i][j][3] = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn data;\r\n\t}", "int wkhtmltoimage_convert(PointerByReference converter);", "private static final byte[] xfj_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -29, 0, 0, 76,\n\t\t\t\t76, 76, 11, 11, 11, 7, 7, 7, -47, -47, -47, -1, -1, -1, -7, -7,\n\t\t\t\t-7, -128, -128, -128, 113, 113, 113, -1, -1, -1, -1, -1, -1,\n\t\t\t\t-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n\t\t\t\t-1, -1, 33, -2, 14, 77, 97, 100, 101, 32, 119, 105, 116, 104,\n\t\t\t\t32, 71, 73, 77, 80, 0, 33, -7, 4, 1, 10, 0, 8, 0, 44, 0, 0, 0,\n\t\t\t\t0, 16, 0, 16, 0, 0, 4, 93, 16, 73, 9, -24, -84, 51, 99, 84,\n\t\t\t\t119, -106, 1, 16, -124, -31, 7, 6, 2, -112, 10, -23, 24, 76,\n\t\t\t\t-63, 48, -90, -86, -8, 34, 119, 64, 12, -78, 27, -53, 56, 24,\n\t\t\t\t97, -57, -29, 13, 95, 55, 28, -95, 48, 100, 46, -111, -97, 0,\n\t\t\t\t115, 122, 76, 26, -82, -40, -31, 18, -104, -63, 94, -117, 50,\n\t\t\t\t-62, -31, 32, 41, 20, -68, -66, -27, -110, -116, -16, 26, -76,\n\t\t\t\t-50, -79, -28, -118, 56, 27, -118, 99, 118, -37, -48, -11, 125,\n\t\t\t\t-24, 38, -127, 17, 0, 59 };\n\t\treturn data;\n\t}", "public native PixelPacket[] getColormap() throws MagickException;", "public int transformPixel(int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {\n\n// int red = constrain(Color.red(inPixel) + ADJUSTMENT);\n// int green = constrain(Color.green(inPixel) + ADJUSTMENT);\n// int blue = constrain(Color.blue(inPixel) + ADJUSTMENT);\n// int outPixel = Color.argb(Color.alpha(inPixel), red, green, blue);\n int west[] = {1, 1, -1, 1, -2, -1, 1, 1, -1};\n int current[] = {p0, p1, p2, p3, p4, p5, p6, p7, p8};\n int outPixelR = 0, outPixelG = 0, outPixelB = 0;\n\n int[] currentR = new int[west.length];\n int[] currentG = new int[west.length];\n int[] currentB = new int[west.length];\n\n\n //separate RGB\n for (int i = 0; i < west.length; i++) {\n currentR[i] = constrain(Color.red(current[i]));\n currentG[i] = constrain(Color.green(current[i]));\n currentB[i] = constrain(Color.blue(current[i]));\n }\n\n //sum\n for (int i = 0; i < west.length; i++) {\n\n outPixelR += currentR[i] * west[i];\n outPixelG += currentG[i] * west[i];\n outPixelB += currentB[i] * west[i];\n\n }\n\n //divide for average\n outPixelG /= 9;\n outPixelR /= 9;\n outPixelB /= 9;\n\n\n\n\n int outPixel = Color.argb(Color.alpha(p4), outPixelR, outPixelG, outPixelB);\n\n\n return outPixel;\n }", "private static final byte[] xfsp_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -95, 0, 0, 76,\n\t\t\t\t76, 76, -1, -1, -1, 124, 124, 124, -1, -1, -1, 33, -2, 14, 77,\n\t\t\t\t97, 100, 101, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80, 0,\n\t\t\t\t33, -7, 4, 1, 10, 0, 3, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0, 2,\n\t\t\t\t52, -36, -128, -87, 104, 6, 2, -93, 4, -19, -56, 43, 104, 123,\n\t\t\t\t34, 4, -84, 57, -112, 7, 86, 28, 121, -123, 86, -9, -91, -26,\n\t\t\t\t-40, 78, 47, 91, 110, 112, 45, -46, -82, -51, 122, -88, 122,\n\t\t\t\t-14, -3, 102, 24, 8, -80, 24, 1, 46, -106, -122, 2, 0, 59 };\n\t\treturn data;\n\t}", "@Override\n public ImageData createPixelMap(double x, double y, int[] data) {\n return graphicsEnvironmentImpl.createPixelMap(canvas, x, y, data);\n }", "public void worldToImageCoords(Point2D.Double p, boolean isDistance);", "int[][][] sepiaToneImage(int[][][] imageArray, int height, int width);", "public int convertPixelToDP(Context context, int px) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n int dp = (int) (px * (metrics.densityDpi / 160f));\n return dp;\n }", "private ArrayList<Point> extractCC(Point r, Image img)\r\n/* 55: */ {\r\n/* 56: 58 */ this.s.clear();\r\n/* 57: 59 */ this.s.add(r);\r\n/* 58: 60 */ this.temp.setXYBoolean(r.x, r.y, true);\r\n/* 59: 61 */ this.list2.add(r);\r\n/* 60: */ \r\n/* 61: 63 */ Point[] N = { new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(0, -1), \r\n/* 62: 64 */ new Point(1, 1), new Point(-1, -1), new Point(-1, 1), new Point(1, -1) };\r\n/* 63: */ \r\n/* 64: 66 */ ArrayList<Point> pixels = new ArrayList();\r\n/* 65: */ int x;\r\n/* 66: */ int i;\r\n/* 67: 68 */ for (; !this.s.isEmpty(); i < N.length)\r\n/* 68: */ {\r\n/* 69: 70 */ Point tmp = (Point)this.s.pop();\r\n/* 70: */ \r\n/* 71: 72 */ x = tmp.x;\r\n/* 72: 73 */ int y = tmp.y;\r\n/* 73: 74 */ pixels.add(tmp);\r\n/* 74: */ \r\n/* 75: 76 */ this.temp2.setXYBoolean(x, y, true);\r\n/* 76: */ \r\n/* 77: 78 */ i = 0; continue;\r\n/* 78: 79 */ int _x = x + N[i].x;\r\n/* 79: 80 */ int _y = y + N[i].y;\r\n/* 80: 82 */ if ((_x >= 0) && (_x < this.xdim) && (_y >= 0) && (_y < this.ydim)) {\r\n/* 81: 84 */ if (!this.temp.getXYBoolean(_x, _y))\r\n/* 82: */ {\r\n/* 83: 86 */ boolean q = img.getXYBoolean(_x, _y);\r\n/* 84: 88 */ if (q)\r\n/* 85: */ {\r\n/* 86: 90 */ Point t = new Point(_x, _y);\r\n/* 87: 91 */ this.s.add(t);\r\n/* 88: */ \r\n/* 89: 93 */ this.temp.setXYBoolean(t.x, t.y, true);\r\n/* 90: 94 */ this.list2.add(t);\r\n/* 91: */ }\r\n/* 92: */ }\r\n/* 93: */ }\r\n/* 94: 78 */ i++;\r\n/* 95: */ }\r\n/* 96: 99 */ for (Point t : this.list2) {\r\n/* 97:100 */ this.temp.setXYBoolean(t.x, t.y, false);\r\n/* 98: */ }\r\n/* 99:101 */ this.list2.clear();\r\n/* 100: */ \r\n/* 101:103 */ return pixels;\r\n/* 102: */ }", "private static final byte[] xfvhdl_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -62, 0, 0, 96,\n\t\t\t\t96, 96, -91, -91, -91, -17, -17, -17, -111, -111, -111, -128,\n\t\t\t\t-128, -128, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -2, 14, 77,\n\t\t\t\t97, 100, 101, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80, 0,\n\t\t\t\t33, -7, 4, 1, 10, 0, 5, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0, 3,\n\t\t\t\t71, 88, -70, -36, 13, -64, 57, 16, 32, 16, -78, 88, 88, 33,\n\t\t\t\t110, -61, 101, 5, -35, -59, 12, 66, 40, -116, -27, 87, -92,\n\t\t\t\t-87, -56, 109, 88, -115, -86, -101, -11, -18, 48, 78, 13, -125,\n\t\t\t\t2, 97, 72, -20, 1, -128, 64, 5, 113, 104, 67, 54, -106, -75,\n\t\t\t\t66, -16, -71, 84, -72, 24, 67, 37, 33, 35, -36, 46, -68, -110,\n\t\t\t\t44, -105, -111, 0, 0, 59 };\n\t\treturn data;\n\t}", "private double[] gridArrayToPixels(double[] gridValues) {\n double[] result = new double[gridValues.length];\n\n for (int i = 0; i < gridValues.length; i++) {\n result[i] = gridValues[i] * gridSize;\n }\n return result;\n }", "private static int[][][] getImagePixels(Image img) {\n\n // Get the raw pixel data \n iObserver observer = new iObserver();\n int width1 = img.getWidth(observer);\n int height1 = img.getHeight(observer);\n int[] rawPixels = utils.getPixels(img,width1,height1);\n\n // Each pixel is represented by 32 bits. Separate the tH32 bits into\n // four 8-bit values (red, green, blue, offset).\n int[][] rgbPixels = new int[rawPixels.length][4];\n for(int j=0; j<rawPixels.length; j++) {\n rgbPixels[j][0] = ((rawPixels[j]>>16)&0xff);\n rgbPixels[j][1] = ((rawPixels[j]>>8)&0xff);\n rgbPixels[j][2] = (rawPixels[j]&0xff);\n rgbPixels[j][3] =((rawPixels[j]>>24)&0xff);\n } // for j\n\n // Arrange the data by rows and columns\n int[][][] imagePixels = new int[height1][width1][4];\n int index=0;\n for(int row=0; row<imagePixels.length; row++) {\n for(int col=0; col<imagePixels[0].length; col++) {\n for(int rgbo=0; rgbo<4; rgbo++) {\n imagePixels[row][col][rgbo]=rgbPixels[index][rgbo];\n } // for rgbo\n index++;\n } // for col\n } // for row\n return imagePixels;\n }", "public double[][] getPixelCoordinates(){\n return m_pdX;\n }", "private static final byte[] xfc_d_image() {\n\t\tbyte data[] = { 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -95, 0, 0, 96,\n\t\t\t\t96, 96, -128, -128, -128, -1, -1, -1, -1, -1, -1, 33, -2, 14,\n\t\t\t\t77, 97, 100, 101, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80,\n\t\t\t\t0, 33, -7, 4, 1, 10, 0, 2, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0,\n\t\t\t\t2, 43, -108, -113, -87, 6, -35, -84, -100, 116, -15, 33, 123,\n\t\t\t\t104, 76, 122, 93, -20, 49, 96, -40, 45, -63, -119, 2, -100,\n\t\t\t\t106, -96, -25, 52, -70, -109, -30, 6, -95, 112, -74, -74, -105,\n\t\t\t\t31, -69, -7, -69, 9, 10, 0, 59 };\n\t\treturn data;\n\t}", "@Override\n public native Color getPixelColor(int x, int y);", "public void grayScale(BufferedImage img, int startX, int startY, int endX, int endY) throws IOException{\r\n\r\n int pixels[] = new int[3];\r\n double ww[]=new double[3];\r\n WritableRaster raster = img.getRaster();\r\n \r\n \r\n for(int i=startX;i<endX;i++) {\r\n for(int j=startY;j<endY;j++){\r\n \r\n \r\n raster.getPixel(i, j, pixels);\r\n \r\n ww[0] = 0.299*pixels[0]+0.587*pixels[1]+0.114*pixels[2];\r\n ww[1] = 0.299*pixels[0]+0.587*pixels[1]+0.114*pixels[2];\r\n ww[2] = 0.299*pixels[0]+0.587*pixels[1]+0.114*pixels[2];\r\n \r\n raster.setPixel(i, j, ww);\r\n \r\n }\r\n \r\n }\r\n\r\n \r\n }", "public static float convertPixelsToDp(float px, Context context) {\r\n Resources resources = context.getResources();\r\n DisplayMetrics metrics = resources.getDisplayMetrics();\r\n float dp = px / (metrics.densityDpi / 160f);\r\n return dp;\r\n }", "@Override\n \tpublic Object getPixels(final int n) {\n \t\tif (n < 1 || n > layers.size()) return null;\n \t\treturn getProcessor(n).getPixels();\n \t}", "public static float convertPixelsToDp( float px, Context context ) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float dp = px / ( (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT );\n return dp;\n }", "public static float convertDpToPixel(float dp, Context context){\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return px;\n }", "public static float convertPixelsToDp(float px, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float dp = px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return dp;\n }", "public static float convertPixelsToDp(float px, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float dp = px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return dp;\n }", "public static float convertPixelsToDp(float px, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float dp = px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return dp;\n }", "public void gettingImageInput(){\n Bitmap bm = getYourInputImage();\n int z;\n if(res==2) { z=50; }\n else { z=224; }\n Bitmap bitmap = Bitmap.createScaledBitmap(bm, z, z, true);\n input = ByteBuffer.allocateDirect(z * z * 3 * 4).order(ByteOrder.nativeOrder());\n for (int y = 0; y < z; y++) {\n for (int x = 0; x < z; x++) {\n int px = bitmap.getPixel(x, y);\n\n // Get channel values from the pixel value.\n int r = Color.red(px);\n int g = Color.green(px);\n int b = Color.blue(px);\n\n // Normalize channel values to [-1.0, 1.0]. This requirement depends\n // on the model. For example, some models might require values to be\n // normalized to the range [0.0, 1.0] instead.\n float rf = (r) / 255.0f;\n float gf = (g) / 255.0f;\n float bf = (b) / 255.0f;\n\n input.putFloat(rf);\n input.putFloat(gf);\n input.putFloat(bf);\n }\n }\n }", "BufferedImage buildImgBuf(Dimension d)\n\t{\n\tBufferedImage gBufImg= ImgFactory.getImg(500, 600); //new BufferedImage(dmX, dmY, BufferedImage.TYPE_INT_ARGB);\n\tGraphics2D g2=gBufImg.createGraphics();\n\tif (drawGraphics(g2, d, samples))\n\t\treturn gBufImg;\n\t\treturn null;\n\n\t}", "private Point getPixel(Point source) {\n float stepWidth = /*canvasWidth*/ canvasHeight / mapWidth;\n float stepHeight = canvasHeight / mapHeight;\n\n float centerX = canvasWidth / 2;\n float centerY = canvasHeight / 2;\n\n return new Point((int) (centerX + source.X * stepWidth), (int) (centerY + source.Y * stepHeight));\n }", "public abstract void getPixelRgb(int x, int y, RGBPixel p);", "public void setPixels2(int x, int y, int w, int h,\n\t\t\t ColorModel model, int pixels[], int off,\n\t\t\t int scansize)\n {\n\tif (srcrows == null || srccols == null) {\n\t calculateMaps();\n\t}\n\tint sx, sy;\n\tint dx1 = (2 * x * destWidth + srcWidth - 1) / (2 * srcWidth);\n\tint dy1 = (2 * y * destHeight + srcHeight - 1) / (2 * srcHeight);\n\n //System.out.print( \"dx1 \" + dx1 + \", dy1 \" + dy1 ) ;\n\n // Obsolete. Used only for debugging purposes.\n float xscale = ( ( float ) srcWidth ) / ( ( float ) destWidth );\n float yscale = ( ( float ) srcHeight ) / ( ( float ) destHeight ) ;\n\n //System.out.println( \", xscale \" + xscale + \" yscale \" + yscale ) ;\n\n\tint outpix[];\n\tif (outpixbuf != null && outpixbuf instanceof int[]) {\n\t outpix = (int[]) outpixbuf;\n\t} else {\n\t outpix = new int[destWidth];\n\t outpixbuf = outpix;\n\t}\n\n // Main rendering loop\n\tfor (int dy = dy1; (sy = srcrows[dy]) < y + h; dy++) {\n int srcyl = srcylarr[dy];\n int srcyu = srcyuarr[dy];\n int srcoffl = off + scansize * (srcyl - y) ;\n int srcoffu = off + scansize * (srcyu - y) ;\n\n\t int srcoff = off + scansize * (sy - y);\n\t int dx ;\n for ( dx = dx1; (sx = srccols[dx]) < x + w; dx++) {\n int srcxl = srcxlarr[dx];\n int srcxu = srcxuarr[dx];\n\n //System.out.println( \"dx \" + dx + \", dy \" + dy ) ;\n //System.out.println( \"srcyl\" + srcyl + \", srcyu : \" + srcyu ) ;\n //System.out.println( \"srcoffl \" + srcoffl + \" srcoffu \" + srcoffu ) ;\n\n if ( srcxl == srcxu && srcyl == srcyu )\n \t\t outpix[dx] = pixels[srcoff + sx];\n else {\n //System.out.println( \"srcxl \" + srcxl + \" srcxu \" + srcxu ) ;\n //System.out.print( \" srcoffl + srcxl =\" + ( srcoffl + srcxl ) ) ;\n //System.out.print( \", srcoffl + srcxu =\" + ( srcoffl + srcxu ) ) ;\n //System.out.print( \", srcoffu + srcxl =\" + ( srcoffu + srcxl ) ) ;\n //System.out.println( \", srcoffu + srcxu =\" + ( srcoffu + srcxu ) ) ;\n int pelvalue = average( model, pixels[srcoffl + srcxl], pixels[srcoffl + srcxu],\n pixels[srcoffu + srcxl], pixels[srcoffu + srcxu],\n srcxarr[dx], srcyarr[dy] ) ;\n outpix[dx] = pelvalue ;\n }\n\t }\n\t if (dx > dx1) {\n\t\tconsumer.setPixels(dx1, dy, dx - dx1, 1,\n\t\t\t\t model, outpix, dx1, destWidth);\n\t }\n\t}\n }", "public void convertDisplayData(int[] destination,boolean dmaEnabled)\n {\n // TODO: Add HAM support\n // TODO: Add support for horizontal scrolling\n // TODO: Add support for dual playfields / playfield priorities / transparency\n\n final int[] ptrs = Arrays.copyOf(bplPointers,6);\n final int[] colorIndex = new int[16];\n int bitplaneCount = (bplcon0 & 0b0111_0000_0000_0000) >>> 12;\n if ( ! dmaEnabled )\n {\n // TODO: Hack to \"do the right thing\"...need to find documentation about\n // behaviour when DMA is off and/or bitplaneCount == 0\n bitplaneCount = 6;\n }\n\n // convert 4-bit RGB into 8-bit\n final boolean isEHB = isEHB();\n final int[] rgbColors = new int[isEHB ? 64: 32];\n for ( int i = 0 ; i < 32 ; i++)\n {\n final int color = colors[i];\n final int r = ((color >> 8) & 0b1111); // 0..15\n final int g = ((color >> 4) & 0b1111);\n final int b = ((color ) & 0b1111);\n rgbColors[i] = (r << 4) << 16 | (g << 4) << 8 | (b << 4);\n if ( isEHB ) {\n rgbColors[16+i] = (r << 2) << 16 | (g << 2) << 8 | (b << 2);\n }\n }\n\n // now convert the image data\n int dstPtr = 0;\n for ( int y = 0, maxY = getDisplayHeight() ; y < maxY ; y++)\n {\n for (int x = 0, maxX = getDisplayWidth(); x < maxX; x+=16) // operate on words\n {\n // reset colors as we're only going to OR '1'\n // bits (assume that all bits are 0 at the beginning)\n Arrays.fill(colorIndex,0);\n for ( int i = 0 ; i < bitplaneCount ; i++ )\n {\n // read 16 bits (=pixels) from the current bit plane\n final int data = dmaEnabled ? memory.readWord(ptrs[i]) : bpldat[i];\n\n // advance to next word\n ptrs[i] += 2;\n // now shift-in color idx bits starting with the MSB (left-most) one\n int mask = 1<<15;\n for ( int col = 0 ; col < 16 ; col++, mask >>>=1 ) {\n colorIndex[col] <<= 1;\n if ( (data & mask) != 0 ) {\n colorIndex[col] |= 1;\n }\n }\n }\n // now set 16 pixels in destination\n for ( int idx = 0 ; idx < 16 ; idx++ )\n {\n destination[dstPtr++] = rgbColors[colorIndex[idx]];\n }\n }\n // add modulo to bitplane pointers\n // to advance to the next line\n final int evenMod = bpl2mod;\n final int oddMod = bpl1mod;\n if ( evenMod != 0 || oddMod != 0 )\n {\n ptrs[0] += evenMod; // even bitplane\n ptrs[1] += oddMod; // odd bitplane\n ptrs[2] += evenMod; // even bitplane\n ptrs[3] += oddMod; // odd bitplane\n ptrs[4] += evenMod; // even bitplane\n ptrs[5] += oddMod; // odd bitplane\n }\n }\n }", "public void toRed(BufferedImage img, int startX, int startY, int endX, int endY) throws IOException{\r\n int pixels[] = new int[3];\r\n double ww[]=new double[3];\r\n WritableRaster raster = img.getRaster();\r\n \r\n for(int i=startX;i<endX;i++) {\r\n for(int j=startY;j<endY;j++){\r\n \r\n \r\n raster.getPixel(i, j, pixels);\r\n \r\n ww[0] = pixels[0];\r\n ww[1] = 0*pixels[1];\r\n ww[2] = 0*pixels[2];\r\n \r\n raster.setPixel(i, j, ww);\r\n \r\n }\r\n \r\n }\r\n\r\n \r\n\r\n }", "public void pixaveGreyscale(int x1, int y1, int x2, int y2) {\n //float sumr,sumg,sumb;\n float sumg;\n int pix;\n //int r,g,b;\n float g;\n int n;\n\n if(x1<0) x1=0;\n if(x2>=kWidth) x2=kWidth-1;\n if(y1<0) y1=0;\n if(y2>=kHeight) y2=kHeight-1;\n\n //sumr=sumg=sumb=0.0;\n sumg = 0.0f;\n for(int y=y1; y<=y2; y++) {\n for(int i=kWidth*y+x1; i<=kWidth*y+x2; i++) {\n \n // old method use depth image\n //pix= kinecter.depthImg.pixels[i];\n //g = pix & 0xFF; // grey\n //sumg += g;\n \n //b=pix & 0xFF; // blue\n // pix = pix >> 8;\n //g=pix & 0xFF; // green\n //pix = pix >> 8;\n //r=pix & 0xFF; // red\n //if( random(0, 150000) > 149000 && r > 0) println(\"r \" + r + \" b \" + b + \" g \" + g);\n // averaging the values\n //sumr += b;//r;//g;//r;\n //sumg += b;//r;//g;\n //sumb += b;//r;//g;//b;\n \n // WORK WITH RAW DEPTH INSTEAD\n sumg += kinecter.rawDepth[i];\n\n \n }\n }\n n = (x2-x1+1)*(y2-y1+1); // number of pixels\n // the results are stored in static variables\n //ar = sumr/n; \n //ag = sumg/n; \n //ab = sumb/n;\n\n ar = sumg/n; \n ag = ar; \n ab = ar;\n }", "public static float convertDpToPixel(float dp, Context context) {\r\n Resources resources = context.getResources();\r\n DisplayMetrics metrics = resources.getDisplayMetrics();\r\n float px = dp * (metrics.densityDpi / 160f);\r\n return px;\r\n }", "public static float convertDpToPixel(float dp, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * (metrics.densityDpi / 160f);\n return px;\n }", "public void toBlue(BufferedImage img, int startX, int startY, int endX, int endY) throws IOException{\r\n int pixels[] = new int[3];\r\n double ww[]=new double[3];\r\n WritableRaster raster = img.getRaster();\r\n \r\n for(int i=startX;i<endX;i++) {\r\n \r\n for(int j=startY;j<endY;j++){\r\n \r\n raster.getPixel(i, j, pixels);\r\n \r\n ww[0] = 0*pixels[0];\r\n ww[1] = 0*pixels[1];\r\n ww[2] = pixels[2];\r\n \r\n raster.setPixel(i, j, ww);\r\n \r\n }\r\n \r\n }\r\n\r\n \r\n\r\n }", "public static int convertDpToPixel(float dp, Context context) {\r\n\t\tResources resources = context.getResources();\r\n\t\tDisplayMetrics metrics = resources.getDisplayMetrics();\r\n\t\tint px = Math.round(dp * ( metrics.densityDpi / 160f ));\r\n\t\treturn px;\r\n\t}", "@SuppressWarnings(\"unused\")\n public float dipToPixel(float dip) {\n // Get the display metrics\n DisplayMetrics metrics = this.getDisplayMetrics(this.getContext());\n // Calc the conversion by the screen density\n return dip * metrics.density;\n }", "private static int[][][] convertToArray(BufferedImage image) {\n int width = image.getWidth();\n int height = image.getHeight();\n\n int[][][] result = new int[width][height][4];\n\n for (int y = 0; y < height; y++) {\n for (int x = 0; x < width; x++) {\n int p = image.getRGB(x, y);\n int a = (p >> 24) & 0xff;\n int r = (p >> 16) & 0xff;\n int g = (p >> 8) & 0xff;\n int b = p & 0xff;\n\n result[x][y][0] = a;\n result[x][y][1] = r;\n result[x][y][2] = g;\n result[x][y][3] = b;\n }\n }\n return result;\n }", "public static float convertDpToPx(float dp,int dpi){\n\t\treturn dp * (dpi / 160f);\n\t}", "protected int[] getPalettePixels() {\n \t\t\tif (palettePixels == null) {\n \n \t\t\t\tpalettePixels = new int[numColors];\n \t\t\t\t\n \t\t\t\tfor (int x = 0; x < numColors; x++) {\n \t\t\t\t\tpalettePixels[x] = rgb8ToPixel(palette[x]);\n \t\t\t\t}\n \t\t\t}\n \t\t\treturn palettePixels;\n \t\t}", "void greyscale();", "void greyscale();", "public void imageToWorldCoords(Point2D.Double p, boolean isDistance);", "@Test\r\n public void testDirectMatPainting8SC1() {\n Mat m = new Mat(width, height, CV_8SC1);\r\n assertEquals(1, m.channels());\r\n assertEquals(1, m.capacity());\r\n assertEquals(width, m.step());\r\n assertEquals(width, m.cols());\r\n assertEquals(height, m.rows());\r\n\r\n ByteBuffer bb = m.createBuffer();\r\n for (long i = 0; i < width * height; i++) {\r\n long x = i % width, y = i / width;\r\n // blue to gray:\r\n byte gray = (byte) (pixelFunc(x, y) & 0xff);\r\n bb.put(gray);\r\n }\r\n\r\n // negative gray values get ignored/mapped to black/0. The total\r\n // (Java byte -> gray value) mapping is then:\r\n // -128..127 -> 128x 0, 0..127\r\n imwrite(new File(TEMP_DIR, \"testDirectMatPainting8SC1.png\").getAbsolutePath(), m);\r\n // @insert:image:testDirectMatPainting8SC1.png@\r\n }", "public static int px2dip(int px) {\n DisplayMetrics metrics = getResources().getDisplayMetrics();\n float density = metrics.density;\n return (int) (px / density + 0.5f);\n }", "private void setPixels() {\n\t\t\tfinal byte[] dest = new byte[(int) (getMetadata().get(0).getAxisLength(\n\t\t\t\tAxes.X) * getMetadata().get(0).getAxisLength(Axes.Y))];\n\t\t\tlong lastImage = -1;\n\n\t\t\t// fill in starting image contents based on last image's dispose\n\t\t\t// code\n\t\t\tif (getMetadata().getLastDispose() > 0) {\n\t\t\t\tif (getMetadata().getLastDispose() == 3) { // use image before last\n\t\t\t\t\tfinal long n = getMetadata().get(0).getPlaneCount() - 2;\n\t\t\t\t\tif (n > 0) lastImage = n - 1;\n\t\t\t\t}\n\n\t\t\t\tif (lastImage != -1) {\n\t\t\t\t\tfinal byte[] prev = getMetadata().getImages().get((int) lastImage);\n\t\t\t\t\tSystem.arraycopy(prev, 0, dest, 0, (int) (getMetadata().get(0)\n\t\t\t\t\t\t.getAxisLength(Axes.X) * getMetadata().get(0).getAxisLength(\n\t\t\t\t\t\t\tAxes.Y)));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// copy each source line to the appropriate place in the destination\n\n\t\t\tint pass = 1;\n\t\t\tint inc = 8;\n\t\t\tint iline = 0;\n\t\t\tfor (int i = 0; i < getMetadata().getIh(); i++) {\n\t\t\t\tint line = i;\n\t\t\t\tif (getMetadata().isInterlace()) {\n\t\t\t\t\tif (iline >= getMetadata().getIh()) {\n\t\t\t\t\t\tpass++;\n\t\t\t\t\t\tswitch (pass) {\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tiline = 4;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tiline = 2;\n\t\t\t\t\t\t\t\tinc = 4;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tiline = 1;\n\t\t\t\t\t\t\t\tinc = 2;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tline = iline;\n\t\t\t\t\tiline += inc;\n\t\t\t\t}\n\t\t\t\tline += getMetadata().getIy();\n\t\t\t\tif (line < getMetadata().get(0).getAxisLength(Axes.Y)) {\n\t\t\t\t\tfinal int k = line * (int) getMetadata().get(0).getAxisLength(Axes.X);\n\t\t\t\t\tint dx = k + getMetadata().getIx(); // start of line in dest\n\t\t\t\t\tint dlim = dx + getMetadata().getIw(); // end of dest line\n\t\t\t\t\tif ((k + getMetadata().get(0).getAxisLength(Axes.X)) < dlim) dlim =\n\t\t\t\t\t\tk + (int) getMetadata().get(0).getAxisLength(Axes.X);\n\t\t\t\t\tint sx = i * getMetadata().getIw(); // start of line in\n\t\t\t\t\t// source\n\t\t\t\t\twhile (dx < dlim) {\n\t\t\t\t\t\t// map color and insert in destination\n\t\t\t\t\t\tfinal int index = getMetadata().getPixels()[sx++] & 0xff;\n\t\t\t\t\t\tdest[dx++] = (byte) index;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tgetMetadata().getColorTables().add(getMetadata().getAct());\n\t\t\tgetMetadata().getImages().add(dest);\n\t\t}", "private float calculateSidePixel(double straightDist, double sideDist) {\n double angleToObject = Math.toDegrees(atan(sideDist/straightDist));\n double pixelsToObject = cameraType.hPPA * angleToObject;\n // calculate px\n return (float)((CameraType.imageWidth/2) - pixelsToObject);\n }", "public Point_XY toPixel(Point_XY center, int size)\n {\n int x = (int)(size * (r + q/2.));\n int y = (int)(q * size * Math.sqrt(3) / 2);\n return new Point_XY(x + center.x(), y + center.y());\n }", "private static int convertDpToPx(int dp) {\r\n return (int) (dp * Resources.getSystem().getDisplayMetrics().density);\r\n }", "public static float pixels2Dp(float px, Context context){\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float dp = px / ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return dp;\n }", "public native PixelPacket getOnePixel(int x, int y) throws MagickException;", "public static float convertDpToPixel(float dp, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return px;\n }", "public static float convertDpToPixel(float dp, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return px;\n }", "public static float convertDpToPixel(float dp, Context context) {\n Resources resources = context.getResources();\n DisplayMetrics metrics = resources.getDisplayMetrics();\n float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);\n return px;\n }", "private static double [][][] convertToArray1(BufferedImage image) {\n int width = image.getWidth();\n int height = image.getHeight();\n\n double [][][] result = new double [width][height][4];\n\n for (int y = 0; y < height; y++) {\n for (int x = 0; x < width; x++) {\n int p = image.getRGB(x, y);\n int a = (p >> 24) & 0xff;\n int r = (p >> 16) & 0xff;\n int g = (p >> 8) & 0xff;\n int b = p & 0xff;\n\n result[x][y][0] = a;\n result[x][y][1] = r;\n result[x][y][2] = g;\n result[x][y][3] = b;\n }\n }\n return result;\n }", "public int pxToDp(float px,Context context) {\n final float scale = context.getResources().getDisplayMetrics().density;\n // Convert the dps to pixels, based on density scale\n return (int) (px * scale + 0.5f);\n }", "public void toGreen(BufferedImage img, int startX, int startY, int endX, int endY) throws IOException{\r\n int pixels[] = new int[3];\r\n double ww[]=new double[3];\r\n WritableRaster raster = img.getRaster();\r\n \r\n for(int i=startX;i<endX;i++) {\r\n \r\n for(int j=startY;j<endY;j++){\r\n \r\n raster.getPixel(i, j, pixels);\r\n \r\n ww[0] = 0*pixels[0];\r\n ww[1] = pixels[1];\r\n ww[2] = 0*pixels[2];\r\n \r\n raster.setPixel(i, j, ww);\r\n \r\n }\r\n \r\n }\r\n\r\n \r\n\r\n }" ]
[ "0.64522785", "0.62069327", "0.62069327", "0.6205767", "0.6152412", "0.6059522", "0.60393757", "0.60254765", "0.6000179", "0.59982556", "0.595276", "0.59005946", "0.58282435", "0.5739381", "0.57235193", "0.56939924", "0.56841147", "0.5643596", "0.557614", "0.5575467", "0.5552432", "0.5535986", "0.55108577", "0.5505455", "0.5493404", "0.5481523", "0.54786533", "0.54762715", "0.54596263", "0.5440794", "0.543402", "0.54238945", "0.54148036", "0.5397747", "0.53579277", "0.5352523", "0.5342891", "0.5341201", "0.5341201", "0.533306", "0.5291412", "0.52856785", "0.5269607", "0.5260439", "0.52313954", "0.5224252", "0.5223039", "0.5215614", "0.52086455", "0.52063215", "0.5201792", "0.5200352", "0.51917404", "0.5186426", "0.5183866", "0.5183595", "0.5182947", "0.51724976", "0.5170406", "0.51609087", "0.5144108", "0.51425046", "0.5130212", "0.51254326", "0.5119787", "0.5119787", "0.5119787", "0.5119362", "0.5116288", "0.50904113", "0.50848293", "0.5074894", "0.50741893", "0.50735664", "0.5061355", "0.5052079", "0.50501513", "0.50491405", "0.50461674", "0.50450516", "0.5042156", "0.5041852", "0.50353384", "0.50316024", "0.50316024", "0.50308084", "0.50291353", "0.5028571", "0.50263345", "0.5023506", "0.50206393", "0.5014328", "0.5013786", "0.5013356", "0.50117105", "0.50117105", "0.50117105", "0.5006684", "0.49816656", "0.49773934" ]
0.5634709
18
TODO Autogenerated method stub
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.new_class_add); context = this; Intent intent = getIntent(); String type = intent.getStringExtra("type"); if("1".equals(type)){ } name_of_class = (EditText) findViewById(R.id.name_of_class); name_of_class.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, ClassListActivity.class); startActivityForResult(intent, 2); } }); name_of_teacher = (EditText) findViewById(R.id.name_of_teacher); name_of_teacher.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, TeacherListActivity.class); startActivityForResult(intent, 1); } }); spinner1 = (Spinner) findViewById(R.id.Spinner01); adapter_m = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, m); // 设置下拉列表的风格 adapter_m.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // 将adapter 添加到spinner中 spinner1.setAdapter(adapter_m); // 设置默认值 spinner1.setVisibility(View.VISIBLE); spinner2= (Spinner) findViewById(R.id.Spinner02); adapter_n = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, n); // 设置下拉列表的风格 adapter_n.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // 将adapter 添加到spinner中 spinner2.setAdapter(adapter_n); // 设置默认值 spinner2.setVisibility(View.VISIBLE); spinner3= (Spinner) findViewById(R.id.Spinner03); adapter_address = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, address); // 设置下拉列表的风格 adapter_address.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // 将adapter 添加到spinner中 spinner3.setAdapter(adapter_address); // 设置默认值 spinner3.setVisibility(View.VISIBLE); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { name_of_teacher.setText(data.getStringExtra("teacherName")); name_of_teacher.setTag(data.getStringExtra("uuid")); } else if (requestCode == 2) { name_of_class.setText(data.getStringExtra("className")); name_of_class.setTag(data.getStringExtra("uuid")); } super.onActivityResult(requestCode, resultCode, data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Add a task name to the list of tombstones.
protected void addTombstone(String taskName) { if (!DatastoreServiceFactory.getDatastoreService().getActiveTransactions().isEmpty()) { // imitate the behavior in production throw new IllegalArgumentException("transactional tasks cannot be named: " + taskName); } if (!tombstones.add(taskName)) { throw new TaskAlreadyExistsException("Task name '" + taskName + "' is already in the queue"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void addTask(Task person) throws UniqueTaskList.DuplicateTaskException;", "public void add(Task t)\n {\n\ttoDo.add(t);\n }", "void addToList(Task task) throws InvalidCommandException;", "public void addTask(final BTask t) {\n\t\tbloc.addLast(t);\n\t}", "public void renameTask(String taskName, Task myTask) {\n \tSystem.out.println(\"Inside renameTask :\" + taskName);\n \t//System.out.println(toDoList);\n \tTask t = new Task();\n \tint count = 0;\n \tfor(Task task : toDoList) {\n \t\tif(task.getTaskName().equals(taskName));{\n \t\tSystem.out.println(\"inside\");\n \t\tt.setTaskName(myTask.getTaskName());\n \t\tt.setEmployee(myTask.getEmployee());\n \t\tt.setDone(myTask.isDone());\n \t\tt.setDeadline(myTask.getDeadline());\n \t\t\n \t\ttoDoList.set(count, t);\n \t}\n \tcount ++;\n }\n \t\n System.out.println(toDoList);\n\tdisplay();\n }", "public void add(Task task){ this.tasks.add(task);}", "public void addTask(Task task) {\n list.add(task);\n }", "void addDoneTasks(List<Task> task);", "void addTasks(List<Task> tasks);", "public void add(final Task task) {\n }", "public void add(Task task)\n {\n this.tasks.add(task);\n }", "public void addTask(Task t){\n\t\ttry {\n\t\t\taction.put(t);\n\t\t} catch (InterruptedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "void add(final Task task);", "public String addTask(Task t) {\n tasks.add(t);\n return tasks.get(tasks.size() - 1).toString();\n }", "public void addTask(Task task){\n SQLiteDatabase db = this.getWritableDatabase();\n ContentValues values = new ContentValues();\n values.put(KEY_ID, task.getId());\n values.put(KEY_LABEL, task.getLabel());\n values.put(KEY_TIME, task.getTime());\n db.insert(TABLE_NAME, null, values);\n db.close();\n }", "public void addToTaskList(Task task) {\n taskList.add(task);\n }", "public void addNewTask(String taskName) {\n\t\tCommand cmdAdd = new CmdAdd();\n\t\tcmdAdd.setParameter(CmdParameters.PARAM_NAME_TASK_NAME, taskName);\n\t\tcmdAdd.execute();\n\t}", "public void add(MiningTask mt) {\n miningTasks.add(mt);\n }", "void addTask(Task task);", "public void add(Task task) {\r\n tasks.add(task);\r\n }", "public void createTask(Task task) {\n ContentValues values = new ContentValues();\n values.put(SQLiteHelper.COLUMN_NAME, task.getName());\n database.insert(SQLiteHelper.TABLE_TASKS, null, values);\n }", "public void addTask(Task task)\n {\n tasks.add(task);\n }", "public void populateTaskList(String _task){\n\t\ttaskList.getItems().add(_task);\n\t}", "void addTask(Task<?> task) {\n tasks.addFirst(task);\n }", "String addTask(Task task);", "public void addTask(Task task) {\n\t\tSystem.out.println(\"Inside createTask()\");\n\t\t\n\t\ttoDoList.add(task);\n\t\tdisplay();\n\t}", "@Override\n\tpublic void addTask(Teatask ta)\n\t{\n\t\tteataskMapper.addTask(ta);\n\t}", "public void addTask(Task task) {\n tasks.add(task);\n }", "public void addTask(Task task) {\n tasks.add(task);\n }", "public void addTask(Task task) {\n tasks.add(task);\n }", "@Override\n\tpublic void addTask(Task task) {\n\t\t\n\t}", "public static void testAddTask(final Todoist todo, final String[] tokens) {\n try {\n todo.addTask(createTask(tokens));\n } catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }", "public static void testAddTask(final Todoist todo, final String[] tokens) {\n try {\n todo.addTask(createTask(tokens));\n } catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }", "void addSeeds(TaskList tasks);", "public void createTask()\n {\n boolean copy = false;\n if(check.checkTask(taskName.getText()))\n {\n // Go through list and make sure task isnt already there\n // If there is one already in list, then tell user there it is on list\n if(!(Item.getToDoList().isEmpty()))\n {\n for(Item task : Item.getToDoList())\n {\n if(task.getTask().equals(taskName.getText()))\n {\n status.setText(\"Task is already on the list. \");\n copy = true;\n }\n }\n\n if(!copy)\n {\n // If not copy, add the task to the list by calling method\n addTaskAndDisplay(taskName.getText(), completionDate.getText(), taskCompletedCheckBox.isSelected());\n }\n }\n\n // If list is empty, then no need to check if task is copy\n else\n {\n addTaskAndDisplay(taskName.getText(), completionDate.getText(), taskCompletedCheckBox.isSelected());\n }\n\n }\n\n // If task is invalid, alert user\n else\n {\n status.setText(\"Task invalid. Try again. \");\n }\n\n }", "public void addTask(Task task) {\n this.tasks.add(task);\n }", "public void createTask() {\n \tSystem.out.println(\"Inside createTask()\");\n \tTask task = Helper.inputTask(\"Please enter task details\");\n \t\n \ttoDoList.add(task);\n \tSystem.out.println(toDoList);\n }", "public void addTask(String type, String name) {\n Task taskToAdd = new Task(type, name);\n storage.add(taskToAdd);\n if (taskToAdd.hasDate()) {\n if (!dateStorage.containsKey(taskToAdd.getDate())) {\n dateStorage.put(taskToAdd.getDate(), new ArrayList<>());\n }\n dateStorage.get(taskToAdd.getDate()).add(taskToAdd);\n }\n taskAdded(taskToAdd, storage);\n }", "public void onAddTaskButtonPressed(View view) {\n\t\tString taskName = taskNameField.getText().toString();\n\t\tif (taskName.equals(\"\"))\n\t\t\treturn;\n\t\ttaskNameField.setText(\"\");\n\t\ttodoList.addTask(taskName);\n\t}", "public void addTask(View v) {\n EditText field = (EditText) findViewById(R.id.list_edittext);\n String task = field.getText().toString().trim();\n\n // Do not add empty tasks\n if(!task.equals(\"\")) {\n database.addTask(task);\n field.setText(\"\");\n Toast.makeText(this, String.format(getResources().getString(R.string.list_add_toast),\n task), Toast.LENGTH_LONG).show();\n }\n }", "public static void add(Tasks currentTask) {\n tasks.add(currentTask);\n tasksCount++;\n }", "@Override\n\tpublic void add(ScheduleTask st) {\n\t\tsave(st);\n\n\t}", "public void add(Task var) {\n\t\tif (tasks.size() < numOfTasks) {\n\t\t\ttasks.add(var);\n\t\t}\n\t}", "@Override\r\n\tpublic Task addTask(Task task) {\n\t\treturn taskRepository.save(task);\r\n\t}", "public void addTask(Task newTask) {\n recordedTask.add(newTask);\n updateTaskToFile();\n }", "public String addToDo(String name) {\n USER_TASKS.add(new ToDo(name));\n return \" \" + USER_TASKS.get(USER_TASKS.size() - 1).toString();\n }", "public void add(String name, String newToDo)\n {\n if (newToDo == null || name == null || newToDo.length() == 0 || name.length() == 0 )\n return;\n try {\n //Open a connection and create a statement and query.\n Connection con = ConnectDB();\n PreparedStatement prepStmt;\n \n //With NULL for an integer unique value, SQLite will automatically pick the next biggest integer for\n //the REFERENCE number\n String query = \"INSERT INTO TASKS VALUES(NULL, ?, ?, '0')\";\n prepStmt = con.prepareStatement(query);\n \n prepStmt.setString(1,name);\n prepStmt.setString(2, newToDo);\n \n prepStmt.executeUpdate();\n } catch (SQLException ex) {\n Logger.getLogger(SQLConnect.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "private void addTask(ToDoList toDoList, JSONObject jsonObject) {\n String name = jsonObject.getString(\"title\");\n LocalDate dueDate = LocalDate.parse(jsonObject.getString(\"dueDate\"));\n boolean complete = jsonObject.getBoolean(\"complete\");\n boolean important = jsonObject.getBoolean(\"important\");\n Task newTask = new Task(name, dueDate);\n newTask.setComplete(complete);\n newTask.setImportant(important);\n\n toDoList.addTask(newTask);\n }", "boolean addTask(Task newTask);", "public void addTransaction(Transactions t){\n listOfTransactions.put(LocalDate.now(), t);\n }", "public void addTask(String task, String... args) {\r\n\t\ttasks.add(new String[][]{new String[]{task}, args});\r\n\t}", "void addDoneTask(Task task);", "@Override\n\tpublic void addScheduleTask(ScheduleTask st) {\n\t\tscheduleTaskDAO.add(st);\n\t}", "public void addTask(Task task) {\n tasks.add(task);\n cachedTasks.push(new CachedTask(task, \"add\", getTasksSize() - 1));\n }", "int insertTask(TaskInfo taskInfo);", "public void add(Task newTask) {\n tasks.add(newTask);\n }", "public void markAsDone(String taskName) {\n \tSystem.out.println(\"Inside markAsDone()\");\n \tint count = 0;\n \t\n \tfor(Task task : toDoList) {\n \t\tif(task.getTaskName().equals(taskName)) {\n \t\t\ttask.setDone(true);\n \t\t\ttoDoList.set(count, task);\n \t\t\t}\n \t\tcount++;\n \t}\n System.out.println(\"Task Marked As Done Successfully\");\n \n System.out.println(toDoList);\n \t\n \tdisplay();\n }", "public void addTask(Task task) {\n\t\tMessage msg=new Message(null, null, task);\n\t\ttry {\n\t\t\tchannel.send(msg);\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\t//Runtime exception with info for use in debugging\n\t\t\tthrow new RuntimeException(ex.getMessage());\n\t\t}\n\t}", "public void addTweet (Tweet tweet) throws IllegalArgumentException{\n tweets.add(tweet);\n\n }", "@Override\n public CompletableFuture<Void> addTask(String queueName, GarbageCollector.TaskInfo task) {\n Preconditions.checkNotNull(queueName, \"queueName\");\n Preconditions.checkNotNull(task, \"task\");\n try {\n val processor = eventProcessorMap.get(queueName);\n Preconditions.checkArgument(null != processor, \"Attempt to add to non existent queue (%s).\", queueName);\n return Futures.toVoid(processor.add(SERIALIZER.serialize(task), Duration.ofMillis(1000)));\n } catch (Throwable e) {\n return CompletableFuture.failedFuture(e);\n }\n }", "public boolean addNewUnfinishedTask(Task task){\r\n if (!unfinished.add(task)){\r\n Task t = task;\r\n\r\n //Find the task in the set that is equal to the task in the argument\r\n for (Task tsk: unfinished){\r\n if (tsk.equals(task)){\r\n t = tsk;\r\n break;\r\n }\r\n }\r\n\r\n //Increment the hours required for that task\r\n t.incrementHrsReqd(task.getHrsLeft());\r\n return false;\r\n }\r\n return true;\r\n }", "private void addTaskToServer() {\n\t\twriter.println();\n\t\tSystem.out.println();\n\t\tNumberFormat formatter = new DecimalFormat(\"#0.00000\");\n\t\tfor (Iterator<Task> iterator = this.generatedTasks.iterator(); iterator.hasNext();) {\n\t\t\tTask t = iterator.next();\n\t\t\twriter.println(\"current time=\" + currentTime + \" ,tasks not assigned \" + t.getArrivalTime() + \" \"\n\t\t\t\t\t+ t.getprocessingTime());\n\t\t\tSystem.out.println(\"current time=\" + currentTime + \" ,tasks not assigned \" + t.getArrivalTime() + \" \"\n\t\t\t\t\t+ t.getprocessingTime());\n\t\t\tif (t.getArrivalTime() == currentTime || t.isLateProcessing()) {\n\t\t\t\t// if it can be dispatched\n\t\t\t\tif (this.scheduler.dispatchTask(t) == true)\n\t\t\t\t\titerator.remove();\n\t\t\t\telse\n\t\t\t\t\tt.setLateProcessing(true);\n\t\t\t}\n\t\t}\n\t}", "public void recoverTask(int index, Task task) {\n tasks.add(index, task);\n }", "public void addElement(DemoTask task) {\n\t\tdata.add(task);\n\t}", "@Override\n\tpublic void addTask(ISimpleTask task) {\n\t\ttry {\n\t\t\tqueue.put(task);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n\t\t\tpublic void setTaskName(String name) {\n\t\t\t\t\n\t\t\t}", "public void addCommandMutable(ListItem task) {\n this.listItems.add(task);\n }", "public void addTarea(String nombreTarea){\n tareas.add(nombreTarea);\n }", "public void addTarea(String nombreTarea){\n tareas.add(nombreTarea);\n }", "@Override\n public CommandResult execute() {\n tasks.add(taskToAdd);\n try {\n storage.appendToFile(taskToAdd);\n return new CommandResult(String.format(MESSAGE_SUCCESS, taskToAdd));\n } catch (IOException e) {\n return new CommandResult(e.getMessage());\n }\n }", "@Insert\n long insert(Task task);", "public void addItemsToTask(Task task) {\n\n \tString n, t, description;\n\t\tItemType type;\n \t\n \tfor(int i = 0;i<currentTaskItems.size();i++) {\n \t\t\n \t\tString temp[] = currentTaskItems.get(i);\n \t\t\n \t\t//map for item\n \t\t//0 -> number of item\n \t\t//1 -> item type\n \t\t//2 -> description\n \t\tn = temp[0];\n \t\tt = temp[1];\n \t\tdescription = temp[2];\n \t\t\n \t\tInteger num = Integer.valueOf(n);\n \t\t\n \t\tif(t.equals(\"Photo\")) {\n \t\t\ttype = ItemType.PHOTO;\n \t\t}else if(t.equals(\"Audio\")) {\n \t\t\ttype = ItemType.AUDIO;\n \t\t}else if(t.equals(\"Video\")) {\n \t\t\ttype = ItemType.VIDEO;\n \t\t}else{\n \t\t\ttype = ItemType.TEXT;\n \t\t}\n \t\t\n \t\t//create the item\n \t\tTaskItem item = new TfTaskItem(type, num, description);\n \t\ttask.addItem(item); \t\t\n \t}\n }", "@Override\n public boolean add(Task task) {\n return tasks.add(task);\n }", "void pushToFirebase(Task task) {\n un_FirebaseRef_tasks.push().setValue(task);\n }", "@Override\n public void execute(TaskListHandler handler, Storage storage, String input) throws DukeException {\n ArrayList<Task> taskList = handler.getTasks();\n handler.addToList(newTask);\n Ui.printSuccess(\"add\", newTask, taskList);\n handler.saveCurrentTaskList(input);\n storage.saveToFile(taskList);\n }", "private void add(Tile t) {\n tileBag.add(t);\n shuffleBag();\n }", "public void add(T ob) throws ToDoListException;", "private void m1562a(Task task) {\n m1559a();\n for (ListenerRecord listenerRecord : this.f1843d.values()) {\n listenerRecord.f1848d.add(task);\n m1567d(listenerRecord);\n }\n }", "public void addTaskList(TaskList taskList) {\n\t\tMessage msg=new Message(null, null, taskList);\n\t\ttry {\n\t\t\tchannel.send(msg);\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\t//Runtime exception with info for use in debugging\n\t\t\tthrow new RuntimeException(ex.getMessage());\n\t\t}\n\t}", "@Test\r\n\tpublic void testAddTask() {\n\t\ttodo.addTask(new Task(\"Test task1\"));\r\n\t\t\r\n\t\tCollection<Task> col = todo.getAllTasks();\r\n\t\tassertTrue(\"Expected collectioon to contain 1 task object\", col.size() == 1);\t\t\r\n\t\t\r\n\t\tTask[] tasks = new Task[] {};\r\n\t\tTask t = col.toArray(tasks)[0];\r\n\t\t\r\n\t\tassertEquals(\"Test task1\", t.getDescription());\t\t\r\n\t}", "public void setTaskName(String name) {\n\r\n\t}", "public synchronized void enqueue(Task task) {\n tasks.add(task);\n }", "public boolean addTask(Integer i){\n\n return toget.add(i);\n }", "public void addTask(Task task) {\n tasks.add(task);\n notifyObservers();\n }", "private void saveNameToLocalStorage(String phNumber, int status) {\n db.addName(phNumber, status);\n Name n = new Name(phNumber, status);\n names.add(n);\n\n\n\n }", "public void addedTask(ArrayList<Task> tasks) {\n System.out.println(\"Got it. I've added this task:\\n \"\n + tasks.get(tasks.size()-1).printTask()\n + \"\\nNow you have \"\n + tasks.size()\n + \" tasks in the list\");\n }", "public Builder addTaskId(\n String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n ensureTaskIdIsMutable();\n taskId_.add(value);\n onChanged();\n return this;\n }", "public void addTask(View v) {\n int taskId = Integer.parseInt(txtId.getText().toString());\n String tskName = txtTaskName.getText().toString();\n String taskDesc = txtTaskDescription.getText().toString();\n ContentValues values = new ContentValues();\n values.put(\"taskId\", taskId);\n values.put(\"taskName\", tskName);\n values.put(\"taskDescription\", taskDesc);\n try {\n taskManager.addTask(values);\n Toast.makeText(this, \"Data Inserted\", Toast.LENGTH_LONG).show();\n } catch (Exception e) {\n Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();\n }\n }", "Task(String name) {\n this.name = name;\n }", "@Override\r\n\tpublic void setTaskName(String name) {\n\r\n\t}", "public synchronized void addTask(AnimatorTask task) {\r\n\r\n\t\tif (!running) {\r\n\t\t\ttasks.add(task);\r\n\t\t}\r\n\t}", "@PostMapping(\"/tasks\")\n public List<Task> postTasks(@RequestBody Task task) {\n if (task.getAssignee().equals(\"\")) {\n task.setStatus(\"Available\");\n }else {\n task.setStatus(\"Assigned\");\n sentSMS(task.getTitle());\n }\n taskRepository.save(task);\n List<Task> allTask = (List) taskRepository.findAll();\n return allTask;\n }", "public void AddTaskToDB(View view){\n\t\tif (TASK_CREATED == true){\n\t\t\tString name = taskName.getText().toString();\n\t\t\tString desc = taskDescription.getText().toString();\n//\t\t\tlong millisecondsToReminder = 0;\n\t\t\tlong millisecondsToCreated = 0;\n//\t\t\tyear = taskDatePicker.getYear();\n//\t\t\tmonth = taskDatePicker.getMonth() + 1;\n//\t\t\tday = taskDatePicker.getDayOfMonth();\n//\t\t\thour = taskTimePicker.getCurrentHour();\n//\t\t\tminute = taskTimePicker.getCurrentMinute();\n\t\t\ttry {\n\t\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\t\tDate dateCreated = cal.getTime();\n\t\t\t\tmillisecondsToCreated = dateCreated.getTime();\n//\t\t\t\tString dateToParse = day + \"-\" + month + \"-\" + year + \" \" + hour + \":\" + minute;\n//\t\t\t\tSimpleDateFormat dateFormatter = new SimpleDateFormat(\"d-M-yyyy hh:mm\");\n//\t\t\t\tDate date = dateFormatter.parse(dateToParse);\n//\t\t\t\tmillisecondsToReminder = date.getTime();\n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t} // You will need try/catch around this\n\n\t\t\tBujoDbHandler taskHandler = new BujoDbHandler(view.getContext());\n\t\t\tcurrentTask = new Task(name, desc, millisecondsToCreated);\n\t\t\ttaskHandler.addTask(currentTask);\n\t\t}\n\t}", "public void addToDo() throws StringIndexOutOfBoundsException {\n System.out.println(LINEBAR);\n try {\n String taskDescription = userIn.substring(TODO_HEADER);\n ToDo todo = new ToDo(taskDescription);\n tasks.add(todo);\n storage.writeToFile(todo);\n ui.echoUserInput(todo, tasks.taskIndex);\n } catch (StringIndexOutOfBoundsException e) {\n ui.printStringIndexOOB();\n }\n System.out.println(LINEBAR);\n }", "@Override\n\t\tpublic void setTaskName(String arg0) {\n\n\t\t}", "private void queueTask(Version theTask) {\n\tsynchronized(_taskQueue) {\n\t _taskQueue.add(theTask);\n\t}\n }", "public void save(TaskList taskings) {\n\n try {\n FileWriter fw = new FileWriter(\"./data/duke.txt\");\n for (Task task : taskings) {\n String listOfTasks = task.toString() + System.lineSeparator();\n fw.append(listOfTasks);\n }\n fw.close();\n } catch (IOException e) {\n System.out.println(\"Cannot save data to disk!\");\n e.printStackTrace();\n }\n }", "public static void addTask(ArrayList<Task> taskList) {\n // String response; // String variable for user's input\n Task task; // declaring the temporary task variable for the user's task\n do { // do while loop for preventing the user from entering a label longer than 20 characters\n System.out.print(\"Task (max 20 char.): \"); // prompting the user for task label\n response = input.nextLine(); // receiving user input\n } while (response.length() > 20); // runs until they enter a valid input\n \n if (response.equals(\"\") || response.equals(\" \")) { // if they left the label blank\n task = new Task();\n } else {\n task = new Task(response);\n }\n System.out.print(\"Task added.\"); // tells the user that adding the task was successful\n System.out.println(\"\\n\"); // prints a newline for formatting\n taskList.add(task); // adds task to the task list\n pause(); // pauses the screen\n }", "private static void addTask() {\n Task task = new Task();\n System.out.println(\"Podaj tytuł zadania\");\n task.setTitle(scanner.nextLine());\n System.out.println(\"Podaj datę wykonania zadania (yyyy-mm-dd)\");\n\n while (true) {\n try {\n LocalDate parse = LocalDate.parse(scanner.nextLine(), DateTimeFormatter.ISO_LOCAL_DATE);\n task.setExecuteDate(parse);\n break;\n } catch (DateTimeParseException e) {\n System.out.println(\"Nieprawidłowy format daty. Spróbuj YYYY-MM-DD\");\n }\n }\n\n task.setCreationDate(LocalDate.now());\n\n queue.offer(task);\n System.out.println(\"tutuaj\");\n }", "public long addTask(Task task) {\n SQLiteDatabase db = this.getWritableDatabase();\n\n ContentValues values = new ContentValues();\n values.put(KEY_TASKNAME, task.getTaskName()); // task name\n // status of task- can be 0 for not done and 1 for done\n values.put(KEY_STATUS, task.getStatus());\n values.put(KEY_DATE,task.getDateAt());\n\n // Inserting Row\n long task_id= db.insert(TABLE_TASKS, null, values);\n // insert row\n\n return task_id;\n\n }" ]
[ "0.61587626", "0.6150656", "0.61191815", "0.61149263", "0.59813386", "0.59657556", "0.58732224", "0.5836968", "0.57675487", "0.57486486", "0.57016987", "0.5701532", "0.56825346", "0.5656795", "0.5656598", "0.5654435", "0.5645101", "0.56193453", "0.5615787", "0.56019366", "0.5601176", "0.55946165", "0.5534534", "0.5528523", "0.551665", "0.5514525", "0.5502942", "0.54653066", "0.54653066", "0.54653066", "0.5459482", "0.5424627", "0.5424627", "0.5406027", "0.53998655", "0.5319632", "0.53161454", "0.5310675", "0.5297689", "0.5286957", "0.527224", "0.5271199", "0.52501404", "0.5240874", "0.5235913", "0.52061546", "0.52052045", "0.51869684", "0.5170652", "0.51575965", "0.5150059", "0.51365054", "0.513438", "0.5119183", "0.510229", "0.5090257", "0.50850546", "0.50779027", "0.5071973", "0.50705147", "0.5058464", "0.5036072", "0.5033905", "0.50318646", "0.5024222", "0.501906", "0.5008841", "0.49906084", "0.49906084", "0.49900433", "0.4984131", "0.49796417", "0.49614528", "0.49571615", "0.49548024", "0.49364337", "0.4930187", "0.49298397", "0.4922483", "0.49090275", "0.49053288", "0.4898162", "0.4895772", "0.48928565", "0.4876937", "0.48735905", "0.4872974", "0.48575336", "0.485585", "0.48540166", "0.48377702", "0.48323897", "0.48201513", "0.48145", "0.48101795", "0.48078188", "0.4802502", "0.48009053", "0.48008937", "0.47935402" ]
0.76681525
0
Extension point to set up anything related to the current Task and Thread, like ThreadLocal variables
protected void setupTask(Task task) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ThreadLocal() {}", "public void setUp() {\n threadName = Thread.currentThread().getName();\n }", "@Context\r\npublic interface ThreadContext\r\n{\r\n /**\r\n * Get the minimum thread level.\r\n *\r\n * @param min the default minimum value\r\n * @return the minimum thread level\r\n */\r\n int getMin( int min );\r\n \r\n /**\r\n * Return maximum thread level.\r\n *\r\n * @param max the default maximum value\r\n * @return the maximum thread level\r\n */\r\n int getMax( int max );\r\n \r\n /**\r\n * Return the deamon flag.\r\n *\r\n * @param flag true if a damon thread \r\n * @return the deamon thread policy\r\n */\r\n boolean getDaemon( boolean flag );\r\n \r\n /**\r\n * Get the thread pool name.\r\n *\r\n * @param name the pool name\r\n * @return the name\r\n */\r\n String getName( String name );\r\n \r\n /**\r\n * Get the thread pool priority.\r\n *\r\n * @param priority the thread pool priority\r\n * @return the priority\r\n */\r\n int getPriority( int priority );\r\n \r\n /**\r\n * Get the maximum idle time.\r\n *\r\n * @param idle the default maximum idle time\r\n * @return the maximum idle time in milliseconds\r\n */\r\n int getIdle( int idle );\r\n \r\n}", "public void setUp() {\n instance = new Task();\n }", "public void setThread(Thread t);", "SetupTask(KaldiActivity activity) {\n this.activityReference = new WeakReference<>(activity);\n }", "@Test\n\tpublic static void testThreadLocal() {\n\t\tExecutorService service = Executors.newCachedThreadPool();\n\n\t\tRunnable task = new Runnable() {\n\t\t\tThreadLocal<AtomicInteger> tlocal = new ThreadLocal<AtomicInteger>() {\n\t\t\t\t@Override\n\t\t\t\tpublic AtomicInteger initialValue() {\n\t\t\t\t\treturn new AtomicInteger(1);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tpublic void run() {\n\t\t\t\tSystem.out.println(Thread.currentThread().getName() + \" start with value: \" + tlocal.get());\n\t\t\t\ttry {\n\t\t\t\t\tTimeUnit.SECONDS.sleep(1);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\ttlocal.set(new AtomicInteger(tlocal.get().addAndGet(1)));\n\t\t\t\tSystem.out.println(Thread.currentThread().getName() + \" ends with value: \" + tlocal.get());\n\t\t\t}\n\t\t};\n\t\tfor (int i = 0; i < 5; i++)\n\t\t\tservice.submit(task);\n\t\tservice.shutdown();\n\t}", "private ThreadUtil() {\n \n }", "public AbstractConcurrentTestCase() {\n mainThread = Thread.currentThread();\n }", "public void setupTask(TaskAttemptContext context) throws IOException {\n }", "protected void setupLocal() {}", "public static void setThreadLocalTransaction(Transaction tx) {\n threadlocal.set(tx);\n }", "public void registerCurrentThread() {\n // Remember this stage in TLS so that rendering thread can get it later.\n THREAD_LOCAL_STAGE.set(this);\n }", "public void threadManager() {\n /**Retrieve all data stored in \"preference\"*/\n if (mNodeThingUtils.getAllSavedThing() != null) {\n\n Map<String, String> getAllSensor = mNodeThingUtils.getAllSavedThing();\n Set<String> keys = getAllSensor.keySet();\n\n /**It checks to see if he has already been registered*/\n if (!threadControl.containsKey(String.valueOf(keys))) {\n for (Iterator i = keys.iterator(); i.hasNext(); ) {\n String key = (String) i.next();\n /**This control is used to separate the thread type from the sensor type*/\n if (!key.matches(Constant.Regexp.THREAD_CONTROL) && key.length() != 2) {\n\n /**Creates a new thread and registers it as \"nodename: thingname\"\n * of type \"map\" so that it is easy to check later*/\n threadControl.put(key, new ThreadUtils(mContext));\n }\n }\n } else {\n LogUtils.logger(TAG, \"There is a thread named as \" + keys);\n }\n }\n }", "public void asHigherOrderFunctions() {\nThreadLocal<DateFormat> localFormatter\n = ThreadLocal.withInitial(() -> new SimpleDateFormat());\n\n// Usage\nDateFormat formatter = localFormatter.get();\n// END local_formatter\n\n// BEGIN local_thread_id\n// Or...\nAtomicInteger threadId = new AtomicInteger();\nThreadLocal<Integer> localId\n = ThreadLocal.withInitial(() -> threadId.getAndIncrement());\n\n// Usage\nint idForThisThread = localId.get();\n// END local_thread_id\n }", "@Override\n public void run() {\n threadLocalTest.setName(Thread.currentThread().getName());\n System.out.println(Thread.currentThread().getName() + \":\" + threadLocalTest.getName());\n }", "protected void setup(Context context\n\t ) throws IOException, InterruptedException {\n\t // NOTHING\n\t }", "private void setWSClientToKeepSeparateContextPerThread() {\n ((BindingProvider) movilizerCloud).getRequestContext()\n .put(THREAD_LOCAL_CONTEXT_KEY, \"true\");\n }", "public TaskCurrent() {\n\t}", "protected void setup(Context context) {}", "@Test\n\tpublic static void testNonThreadLocal() {\n\t\tExecutorService service = Executors.newCachedThreadPool();\n\n\t\tRunnable task = new Runnable() {\n\t\t\tNonThreadLocal<AtomicInteger> tlocal = new NonThreadLocal<AtomicInteger>() {\n\t\t\t\t@Override\n\t\t\t\tpublic AtomicInteger initialValue() {\n\t\t\t\t\treturn new AtomicInteger(1);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tpublic void run() {\n\t\t\t\tSystem.out.println(Thread.currentThread().getName() + \" start with value: \" + tlocal.get());\n\t\t\t\ttry {\n\t\t\t\t\tTimeUnit.SECONDS.sleep(1);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tint res;\n//\t\t\t\tsynchronized (\"ABC\") {\n\t\t\t\t\tres = tlocal.get().addAndGet(1);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tTimeUnit.SECONDS.sleep(1);\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t\ttlocal.set(new AtomicInteger(res));\n//\t\t\t\t}\n\t\t\t\tSystem.out.println(Thread.currentThread().getName() + \" ends with value: \" + res);\n\t\t\t}\n\t\t};\n\t\tfor (int i = 0; i < 5; i++)\n\t\t\tservice.submit(task);\n\t\tservice.shutdown();\n\n\t}", "public OneValueThread(ThreadLocal<Integer> threadLocal) {\n\t\tthis.threadLocal = threadLocal;\n\t}", "private static void setupServerContext(){\n\n serverContext.set(new ServerContext());\n serverContext.get().bgThreadIds = new int[GlobalContext.getNumTotalBgThreads()];\n serverContext.get().numShutdownBgs = 0;\n serverContext.get().serverObj = new Server();\n\n }", "public static void main(String[] args) {\n\t\tWithoutThreadLocal safetask = new WithoutThreadLocal();\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\tThread thread = new Thread(safetask);\n\t\t\tthread.start();\n\t\t\ttry {\n\t\t\t\tTimeUnit.SECONDS.sleep(2);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"This output is thread local\");\n\t\t//Thsi Code is with thread local cocept\n\t\tWithThreadLocal task = new WithThreadLocal();\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\tThread thread = new Thread(task);\n\t\t\tthread.start();\n\t\t\ttry {\n\t\t\t\tTimeUnit.SECONDS.sleep(2);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "protected TaskChain() {\n\t}", "void init(@NotNull ExecutionContext context);", "private ThreadUtil() {\n }", "public void initialize() {\n\n\t\t// Initialize taskList\n\t\tthis.taskList = new LinkedList<Task>();\n\n\t\t// create a new thread for total size of pool\n\t\tfor (int i = 0; i < this.poolSize; ++i) {\n\t\t\tthreadPool.add(new WorkerThread(this));\n\t\t}\n\n\t\t// Start each thread in thread pool\n\t\tfor (WorkerThread t : threadPool) {\n\t\t\tnew Thread(t).start();\n\t\t}\n\n\t}", "void execSetupContext(ExecProcess ctx);", "@Override\n protected void setup(final TaskBundle bundle, final List<Task<?>> taskList) {\n this.bundle = bundle;\n //taskNotificationDispatcher.setBundle(bundle);\n this.taskList = taskList;\n this.taskWrapperList = new ArrayList<>(taskList.size());\n this.dataProvider = taskList.get(0).getDataProvider();\n this.uuidList = bundle.getUuidPath().getList();\n ClassLoader taskClassLoader = null;\n try {\n taskClassLoader = getTaskClassLoader(taskList.get(0));\n usedClassLoader = threadManager.useClassLoader(taskClassLoader);\n } catch (final Exception e) {\n final String msg = ExceptionUtils.getMessage(e) + \" - class loader lookup failed for uuidPath=\" + uuidList;\n if (debugEnabled) log.debug(msg, e);\n else log.warn(msg);\n }\n accumulatedElapsed.set(0L);\n }", "public void setupTask() {\n\t\tif (!hasInternetConnection()) {\n\t\t\tdlgNoInet.show();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tsetupMessageHandler();\n\t\t\n\t\t// Activate text box if user is logged in.\n\t\tString userid = checkLogin();\n\t\tLog.d(\"TIMER\", \"User logged in: \" + userid);\n\t\tif (userid != null && userid.length() > 0 && etMessage != null) {\n\t\t\tsetupSendMessageListener();\n\t\t\tetMessage.setEnabled(true);\n\t\t\thideVirtualKeyboard();\n\t\t}\n\t\t\n\t\t// Setup the message cursor object.\n\t\tsetupMessageCursor();\n\n\t\t// Start message listener if base url is set.\n\t\tstartMessageListener();\n\t}", "@Override\n public void run() {\n\n System.out.println(ThreadLocalInstance.getInstance());\n }", "@Before\n public void setup() {\n config.setProperty(Constants.PROPERTY_RETRY_DELAY, \"1\");\n config.setProperty(Constants.PROPERTY_RETRY_LIMIT, \"3\");\n rc = new RequestContext(null);\n rc.setTimeToLiveSeconds(2);\n }", "private void setupRequestContext() {\n\t\tMockHttpServletRequest request = new MockHttpServletRequest();\n\t\tServletRequestAttributes attributes = new ServletRequestAttributes(request);\n\t\tRequestContextHolder.setRequestAttributes(attributes);\n\t}", "private void setupRequestContext() {\r\n\t\tMockHttpServletRequest request = new MockHttpServletRequest();\r\n\t\tServletRequestAttributes attributes = new ServletRequestAttributes(request);\r\n\t\tRequestContextHolder.setRequestAttributes(attributes);\r\n\t}", "private void setupRequestContext() {\r\n\t\tMockHttpServletRequest request = new MockHttpServletRequest();\r\n\t\tServletRequestAttributes attributes = new ServletRequestAttributes(request);\r\n\t\tRequestContextHolder.setRequestAttributes(attributes);\r\n\t}", "private ThreadLocalTransaction() {\n }", "private final void setupLocal() {\n _topLocal = true;\n // Check for global vs local work\n if( _nlo >= 0 && _nlo < _nhi-1 ) { // Have global work?\n // Note: some top-level calls have no other global work, so\n // \"topLocal==true\" does not imply \"nlo < nhi-1\".\n int selfidx = H2O.SELF.index();\n if( _nlo < selfidx ) _nleft = remote_compute(_nlo, selfidx );\n if( selfidx+1 < _nhi ) _nrite = remote_compute(selfidx+1,_nhi);\n }\n _lo = 0; _hi = _fr.firstReadable().nChunks(); // Do All Chunks\n // If we have any output vectors, make a blockable Futures for them to\n // block on.\n if( _fr.hasAppendables() )\n _fs = new Futures();\n init(); // Setup any user's shared local structures\n }", "public void setThread(LoadThread thread) {\r\n this.thread = thread;\r\n }", "default void withContext(String tenantId, Runnable runnable) {\n final Optional<String> origContext = getContextOpt();\n setContext(tenantId);\n try {\n runnable.run();\n } finally {\n setContext(origContext.orElse(null));\n }\n }", "public void setThreadBuf(final ThreadLocal<ByteBuffer> threadBuf) {\n this.threadBuf = threadBuf;\n }", "private static native Object setupMainThread0(Object thread);", "private ServiceManage() {\r\n\t\tInitialThreads();\r\n\t}", "private void setup() {\n py.exec(\"from org.python.core import Py\");\n py.exec(\"import python.main.PythonTraceFunction\");\n py.set(\"ptf\", ptf);\n py.exec(\"Py.getThreadState().tracefunc = ptf\");\n py.set(\"console\", python.panel.getImplementation());\n py.set(\"__impl\", python.bot.getImplementation());\n }", "public void before() {\n process = Thread.currentThread();\n }", "public void setTask(Task inTask){\n punchTask = inTask;\n }", "public MyTask(ServletContext servletContext) { \r\n this.context = servletContext; \r\n try {\r\n Properties props = new Properties(); \r\n \t\r\n props.load(RedisUtil.class.getClassLoader().getResourceAsStream(\"redis/redis.properties\"));\r\n String flag=props.getProperty(\"redisFlag\").trim();\r\n if(flag.equals(\"true\")){\r\n \t redisFlag=true;\r\n }\r\n else{\r\n \t redisFlag=false;\r\n }\r\n props = new Properties(); \r\n props.load(RedisUtil.class.getClassLoader().getResourceAsStream(\"socket/socket.properties\"));\r\n \r\n socketIp=props.getProperty(\"ip\").trim();\r\n socketPort=props.getProperty(\"port\").trim();\r\n nettype=props.getProperty(\"nettype\").trim();\r\n \r\n \r\n \r\n } catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t} \r\n \t \r\n }", "public Task(Task source) {\n if (source.Application != null) {\n this.Application = new Application(source.Application);\n }\n if (source.TaskName != null) {\n this.TaskName = new String(source.TaskName);\n }\n if (source.TaskInstanceNum != null) {\n this.TaskInstanceNum = new Long(source.TaskInstanceNum);\n }\n if (source.ComputeEnv != null) {\n this.ComputeEnv = new AnonymousComputeEnv(source.ComputeEnv);\n }\n if (source.EnvId != null) {\n this.EnvId = new String(source.EnvId);\n }\n if (source.RedirectInfo != null) {\n this.RedirectInfo = new RedirectInfo(source.RedirectInfo);\n }\n if (source.RedirectLocalInfo != null) {\n this.RedirectLocalInfo = new RedirectLocalInfo(source.RedirectLocalInfo);\n }\n if (source.InputMappings != null) {\n this.InputMappings = new InputMapping[source.InputMappings.length];\n for (int i = 0; i < source.InputMappings.length; i++) {\n this.InputMappings[i] = new InputMapping(source.InputMappings[i]);\n }\n }\n if (source.OutputMappings != null) {\n this.OutputMappings = new OutputMapping[source.OutputMappings.length];\n for (int i = 0; i < source.OutputMappings.length; i++) {\n this.OutputMappings[i] = new OutputMapping(source.OutputMappings[i]);\n }\n }\n if (source.OutputMappingConfigs != null) {\n this.OutputMappingConfigs = new OutputMappingConfig[source.OutputMappingConfigs.length];\n for (int i = 0; i < source.OutputMappingConfigs.length; i++) {\n this.OutputMappingConfigs[i] = new OutputMappingConfig(source.OutputMappingConfigs[i]);\n }\n }\n if (source.EnvVars != null) {\n this.EnvVars = new EnvVar[source.EnvVars.length];\n for (int i = 0; i < source.EnvVars.length; i++) {\n this.EnvVars[i] = new EnvVar(source.EnvVars[i]);\n }\n }\n if (source.Authentications != null) {\n this.Authentications = new Authentication[source.Authentications.length];\n for (int i = 0; i < source.Authentications.length; i++) {\n this.Authentications[i] = new Authentication(source.Authentications[i]);\n }\n }\n if (source.FailedAction != null) {\n this.FailedAction = new String(source.FailedAction);\n }\n if (source.MaxRetryCount != null) {\n this.MaxRetryCount = new Long(source.MaxRetryCount);\n }\n if (source.Timeout != null) {\n this.Timeout = new Long(source.Timeout);\n }\n if (source.MaxConcurrentNum != null) {\n this.MaxConcurrentNum = new Long(source.MaxConcurrentNum);\n }\n if (source.RestartComputeNode != null) {\n this.RestartComputeNode = new Boolean(source.RestartComputeNode);\n }\n if (source.ResourceMaxRetryCount != null) {\n this.ResourceMaxRetryCount = new Long(source.ResourceMaxRetryCount);\n }\n }", "public void setInitThread(Thread work) {\n\t\tinitThread = work;\n\t\t\n\t}", "public void bindToThread() {\n\t\tthis.oldTransactionInfo = transactionInfoHolder.get();\n\t\ttransactionInfoHolder.set(this);\n\t}", "protected void setUpClassloader() throws Exception\n {\n threadContextClassLoader = Thread.currentThread()\n .getContextClassLoader();\n Thread.currentThread()\n .setContextClassLoader(\n new URLClassLoader(new URL[0], this.getClass()\n .getClassLoader()));\n classLoaderSet = true;\n }", "public FuncCallExecutor(ThreadRuntime rt) {\r\n\t\tthis.rt = rt;\r\n\t}", "public void setContext(Context context) {\n this.contextMain = context;\n }", "@Before\n public void setupEnvironment() {\n TestEnvironment testEnvironment;\n switch (mode) {\n case CLUSTER:\n // This only works because of the quirks we built in the TestEnvironment.\n // We should refactor this in the future!!!\n testEnvironment = MINI_CLUSTER_RESOURCE.getTestEnvironment();\n testEnvironment.getConfig().disableObjectReuse();\n testEnvironment.setAsContext();\n break;\n case CLUSTER_OBJECT_REUSE:\n // This only works because of the quirks we built in the TestEnvironment.\n // We should refactor this in the future!!!\n testEnvironment = MINI_CLUSTER_RESOURCE.getTestEnvironment();\n testEnvironment.getConfig().enableObjectReuse();\n testEnvironment.setAsContext();\n break;\n case COLLECTION:\n new CollectionTestEnvironment().setAsContext();\n break;\n }\n }", "@Override\n public void init() {\n this.log.pri1(LoggingInterface.INIT_START, \"\");\n // Any task initialization code goes here.\n this.log.pri1(LoggingInterface.INIT_END, \"\");\n }", "@Override\n\tpublic void initTask() {\n\t\tRankTempInfo rankInfo = RankServerManager.getInstance().getRankTempInfo(player.getPlayerId());\n\t\tif(rankInfo!=null){\n\t\t\tgetTask().getTaskInfo().setProcess((int)rankInfo.getSoul());\n\t\t}\n\t}", "int XInitThreads();", "public interface ExecutionTargetContextAware {\n\n /**\n * @param context the context used by the application\n */\n void setExecutionTargetContext(ExecutionTargetContext context);\n\n}", "protected TaskFlow( ) { }", "ContextVariable createContextVariable();", "protected void addToThreadExecutionContext(ExecutionContext threadContext, Partition partition) {\n // There is not any default implementation.\n }", "public void myTasks() {\n mMyTasks = true;\n onResume();\n }", "private void setVariables(Context context){\n this.context = context != null ? context : getContext();\n mwifiAdmin = new WifiAdmin(this.context);\n }", "@BeforeSuite(alwaysRun = true)\n public static void startSuite() {\n\n ThreadContext.put(THREAD_ID, Thread.currentThread().getName());\n EnvironmentConfig.initializeEnvironment();\n\n // Instantiates and stores the WebDriver into the ThreadLocal variable\n driverThread = ThreadLocal.withInitial(() -> {\n /*\n The following instruction is used to tell log4j which file the log will be written to\n depending on the thread name. The thread name is used as the value threadId that is used as\n the routing key in the routing appender. Check the log4j2.xml config file.\n For more info check here:\n https://stackoverflow.com/questions/8355847/how-to-log-multiple-threads-in-different-log-files\n http://logging.apache.org/log4j/2.x/faq.html#separate_log_files\n */\n ThreadContext.put(THREAD_ID, Thread.currentThread().getName());\n\n logger.trace(\"Instantiate WebDriver\");\n DriverFactory webDriverThread = new DriverFactory();\n webDriverThreadPool.add(webDriverThread);\n return webDriverThread;\n });\n }", "@Override\n\tpublic void onStartup(ServletContext servletContext)\n\t\t\tthrows ServletException {\n\t\tsuper.onStartup(servletContext);//master line where whole framework works\n\t\t//configure global objects/tasks if required\n\t}", "public JvmThreadRunner(JvmThread jvmThread) {\n Objects.requireNonNull(jvmThread, \"JVM Thread Runner cannot construct by null thread\");\n this.jvmThread = jvmThread;\n }", "public static void getThreadInfo(){\r\n ThreadMeasurement currentThreadState = new ThreadMeasurement();\r\n threadList.add(currentThreadState);\r\n //ThreadMeasurement.printThreadState(currentThreadState);\r\n }", "protected void init() {\n new AsyncTask<Void, Void, Void>() {\n @Override\n protected Void doInBackground(Void... params) {\n RosFragmentActivity.this.init(nodeMainExecutorService);\n //Let everyone know that init is called\n synchronized (mNodeInitListeners) {\n for (final NodeInitListener nodeInitListener : mNodeInitListeners) {\n nodeInitListener.onNodeInit(nodeMainExecutorService, getMasterUri());\n }\n mNodeInitListeners.clear();\n }\n return null;\n }\n }.execute();\n }", "public void switchToGlobalContext(){\n currentConstants = null;\n currentVariables = null;\n\n temporaryConstants = null;\n temporaryVariables = null;\n }", "@Override\n public void taskStarting() {\n\n }", "@PostConstruct\r\n public void init() {\r\n \t//registerNotificationCallback(null); //to register taskexecution engine as default\r\n ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat(\"MARM-thread-%d\").build();\r\n \texecutor = Executors.newFixedThreadPool(10, namedThreadFactory);\r\n\r\n ThreadFactory brokerThreadFactory = new ThreadFactoryBuilder().setNameFormat(\"Broker-thread-%d\").build();\r\n brokerExecutor = Executors.newFixedThreadPool(10, brokerThreadFactory);\r\n\r\n ThreadFactory logThreadFactory = new ThreadFactoryBuilder().setNameFormat(\"LOG-thread-%d\").setPriority(Thread.MIN_PRIORITY).build();\r\n logExecutor = Executors.newFixedThreadPool(10, logThreadFactory);\r\n broker.registerInputListener(this);\r\n broker.registerControlListener(this);\r\n }", "@Override\n public void onInitializeTasks() {\n }", "public void startTask() {\n\t}", "private void initShooter() {\n m_task = new ShooterThread(this);\n m_task.start();\n }", "public abstract void setThreadNumber(int threadIdx);", "@Override\r\n\tprotected final void setup() {\r\n \tsuper.setup();\r\n\r\n \tdoSetup();\r\n }", "@Override\n protected void beforeExecute(final Thread thread, final Runnable run) {\n mActiveTasks.add(run);\n super.beforeExecute(thread, run);\n }", "@PostConstruct\r\n\tprivate void init() {\n\t threadPool = Executors.newCachedThreadPool();\r\n\t}", "protected void activate(final ComponentContext ctx) throws Exception {\n // start background threads\n if ( this.threadPoolManager == null ) {\n throw new Exception(\"No ThreadPoolManager found.\");\n }\n final ThreadPoolConfig config = new ThreadPoolConfig();\n config.setMinPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_MIN_POOL_SIZE), DEFAULT_MIN_POOL_SIZE));\n config.setMaxPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_MAX_POOL_SIZE), DEFAULT_MAX_POOL_SIZE));\n config.setQueueSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_QUEUEL_SIZE), DEFAULT_QUEUE_SIZE));\n config.setShutdownGraceful(true);\n threadPoolManager.create(EventHelper.THREAD_POOL_NAME, config);\n\n this.threadPool = threadPoolManager.get(EventHelper.THREAD_POOL_NAME);\n if ( this.threadPool == null ) {\n throw new Exception(\"No thread pool with name \" + EventHelper.THREAD_POOL_NAME + \" found.\");\n }\n }", "public static void saveInitialThreads() {\n lock.lock();\n try {\n Set<Thread> currentThreads = getThreadsSnapshot();\n for (Thread thread : currentThreads) {\n LeakInfo leakInfo = new LeakInfo(thread, IGNORED);\n runningThreads.putIfAbsent(thread, leakInfo);\n }\n } finally {\n lock.unlock();\n }\n\n // Initialize the thread-local, in case some tests don't call testStarted()\n threadInfo.set(UNKNOWN);\n }", "@Override\n\tpublic ServerServices upstreamGlobalVarsInit() throws Exception {\n\t\treturn null;\n\t}", "ADTVTaskManager(ADTVService s){\n\t\tservice = s;\n\t\ttaskLists = new ArrayList[ADTVTask.PRIO_COUNT];\n\n\t\tfor(int i=0; i<ADTVTask.PRIO_COUNT; i++){\n\t\t\ttaskLists[i] = new ArrayList<ADTVTask>();\n\t\t}\n\n\t\tthreads = new MyThread[THREAD_COUNT];\n\t\tfor(int i=0; i<THREAD_COUNT; i++){\n\t\t\tthreads[i] = new MyThread();\n\t\t\tthreads[i].start();\n\t\t}\n\t}", "public void runInThread() {\n\t\tTaskRunner taskRunner = Dep.get(TaskRunner.class);\n\t\tATask atask = new ATask<Object>(getClass().getSimpleName()) {\n\t\t\t@Override\n\t\t\tprotected Object run() throws Exception {\n\t\t\t\tBuildTask.this.run();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t\n\t\t};\n\t\ttaskRunner.submitIfAbsent(atask);\n\t}", "ThreadCounterRunner() {}", "public void init() {\n // These data structures are initialized here because other\n // module's startUp() might be called before ours\n this.systemStartTime = System.currentTimeMillis();\n }", "public void setThreadLocalEntityManager(ThreadLocalEntityManagerService threadLocalEntityManager) {\r\n\t\tthis.threadLocalEntityManager = threadLocalEntityManager;\r\n\t}", "@Override\n public void init(TaskManager tm, Ui ui) {\n setResponse(ui.askEventName());\n setUtility(tm, ui);\n }", "public static void setup() {\n\n timers = new LinkedList<>();\n }", "private CollectTaskPool() {\n\t\tsuper();\n\t}", "public ThreadState(KThread thread) \n {\n this.thread = thread;\n setPriority(priorityDefault);\n }", "public void initialize() {\n service = Executors.newCachedThreadPool();\n }", "public TaskProvider getTaskProvider();", "public void setContext(Context ctx) {\n\t\tprefs = PreferenceManager.getDefaultSharedPreferences(ctx);\n\t\tupdateNextIdx();\n\t}", "private TransferDispatcher() {\n taskList=new Vector();\n }", "PrioritizedReactiveTask(Bot bot) {\n exchangeContext(bot);\n }", "private void setRequestUtils(RequestUtils requestUtils) {\n this.requestUtils = requestUtils;\n }", "protected PayerThread() {\n\t\t\tEvent.ASSERTION.issue(sets == null, \"builders is null\");\n\t\t\tEvent.ASSERTION.issue(workloadConfiguration == null, \"configuration is null\");\n\n\t\t\tsetDaemon(true);\n\t\t}", "@Override\n public void threadStarted() {\n }", "@Override\n\tpublic CompletableFuture<Void> setActive(boolean internal) {\n\t\treturn manager.execute(new GdbSetActiveThreadCommand(manager, id, internal));\n\t}", "private void updateLocalParameters(){\n Runnable r = new Runnable(){\n public void run(){\n logger.info(\"\\t*** Loading subscriptions and configuration from server...\");\n try{\n setCurrentLocalIP(MiscIP.getPublicIPAddress());\n\n FTPClientWrapper clientFTP = new FTPClientWrapper(FTPServerName, FTPLoginName, FTPPass);\n\n String raw = clientFTP.downloadAsStringWithTimeout(\"/pinger/remoteconf.txt\", 30*1000);\n \n ArrayList<String> lines = Misc.filterEmptyLines(Misc.getLines(raw));\n loadExecutionParameters(lines);\n setSubscriptionNames(Subscription.parseMany(lines));\n logger.info(\"\\tCurrent subscriptions (\"+getSubscriptionNames().size()+\"): \" + Misc.collectionToString(getSubscriptionNames()));\n }catch(Exception e){\n e.printStackTrace();\n }\n }\n };\n Thread t = new Thread(r);\n t.start();\n }" ]
[ "0.68926907", "0.6570433", "0.63298446", "0.601337", "0.5955339", "0.58938354", "0.5868608", "0.58620405", "0.58340335", "0.5798405", "0.5768635", "0.57625735", "0.56917834", "0.56907445", "0.5670473", "0.5625266", "0.56101835", "0.55897605", "0.55883914", "0.55761546", "0.55693567", "0.5568057", "0.55403274", "0.55357814", "0.55162936", "0.5471526", "0.546226", "0.54477465", "0.5424718", "0.54207337", "0.5406618", "0.5406129", "0.5376055", "0.5364056", "0.53549135", "0.53549135", "0.5339246", "0.5329494", "0.53044546", "0.5276686", "0.52610534", "0.52483267", "0.5245356", "0.52394444", "0.5224145", "0.5222742", "0.52071846", "0.51923364", "0.51898396", "0.5181955", "0.5177443", "0.51754993", "0.51672244", "0.5160051", "0.5151227", "0.51425004", "0.5137321", "0.51360923", "0.51312923", "0.51286834", "0.5127759", "0.5127436", "0.5119099", "0.5104802", "0.5103601", "0.509921", "0.5096079", "0.508626", "0.508048", "0.50735587", "0.5041455", "0.5033137", "0.5024556", "0.5022939", "0.5021937", "0.50202954", "0.50172734", "0.5008159", "0.5007074", "0.5005384", "0.49991122", "0.49964395", "0.49960822", "0.49958608", "0.49958023", "0.4992066", "0.49914885", "0.4991294", "0.49888533", "0.49862993", "0.49795657", "0.49786302", "0.49751884", "0.49717882", "0.4970617", "0.49515954", "0.49459845", "0.4942704", "0.4941664", "0.4933277" ]
0.62937176
3
Extension point to clean up anything related to the current Task and Thread, like ThreadLocal variables
protected void teardownTask(Task task) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void cleanup() {\n bundle.setParameter(BundleParameter.NODE_BUNDLE_ELAPSED_PARAM, accumulatedElapsed.get());\n this.dataProvider = null;\n usedClassLoader.dispose();\n usedClassLoader = null;\n //taskNotificationDispatcher.setBundle(this.bundle = null);\n this.taskList = null;\n this.uuidList = null;\n setJobCancelled(false);\n this.taskWrapperList = null;\n timeoutHandler.clear();\n }", "void destroyForCurrentThread() {\n holderInstance.remove();\n parentHolderInstanceStack.remove();\n }", "protected void cleanup() {\n finished = true;\n thread = null;\n }", "public static void clean() {\n kryoThreadLocalContext.remove();\n }", "@PreDestroy\r\n\tprivate void deinit() {\n\t if ((threadPool != null) &&\r\n\t (!threadPool.isShutdown())) {\r\n\t \r\n\t threadPool.shutdown();\r\n\t threadPool = null;\r\n }\r\n\t}", "protected void cleanup(Context context\n\t ) throws IOException, InterruptedException {\n\t // NOTHING\n\t }", "private void removeDestroyTask() {\n // If we registered a JVM shutdown hook, we don't need it anymore now:\n // We've already explicitly closed the context.\n if (this.shutdownTask != null) {\n ShutdownHook.removeTask(this.shutdownTask);\n this.shutdownTask = null;\n }\n }", "public void cleanupTask(HttpServletRequest request, Workflow wf)\n\t{\n\t\t\n\t\t//super.cleanupTask(request, wf);\n\t}", "public void cleanup() {\n }", "public void cleanup() {\r\n }", "@Override\n public void cleanup() {\n }", "public static void clearThreadLocalTransaction() {\n threadlocal.set(null);\n }", "public void cleanup();", "@Override\r\n public void cleanup() {\n }", "public static void clear() {\n\t\tThreadContext.clear();\n\t}", "public void cleanup() {\n\t}", "@Override\r\n\tpublic void cleanup() {\n\t\t\r\n\t}", "public void cleanup()\n {\n CogTool.delayedWorkMgr.doDelayedWork(true);\n }", "@Override\n public void cleanup() {\n \n }", "@Override\n public void cleanup() {\n \n }", "protected abstract void cleanup();", "@Override\n\tpublic void cleanup() {\n\t\t\n\t}", "@Override\n\tpublic void cleanup() {\n\t\t\n\t}", "@Override\n\tpublic void cleanup() {\n\t\t\n\t}", "public void cleanDeadThreads()\n {\n\t\tSystem.gc();\n }", "@Override\n\tpublic void cleanup() {\n\n\t}", "@Override\n\tpublic void cleanup() {\n\n\t}", "public void cleanup() {\n endtracking();\n\n //sends data to UI\n MainActivity.trackingservicerunning = false;\n MainActivity.servicestopped();\n\n //stops\n stopSelf();\n }", "public void finalize() {\r\n\tif (this.taskGroup!=null) this.taskGroup.interruptAll();\r\n}", "default void cleanup() {}", "public void destroy() {\n getBuildContextHolder().destroy();\n rememberedSet.clear();\n }", "@Override\n protected void performCleanup() {\n }", "void cleanup();", "void cleanup();", "void cleanup();", "@VisibleForTesting\n public void cleanup() {\n cleanupNative();\n }", "@Override\n\tpublic void cleanup() {\n\t\tstopThread=true;\n\t\texecutorService.shutdown();\n\t\t//LOG.info(\"ratioCalculateInteger:\"+ratioCalculateInteger.get());\n\t}", "public ThreadLocal() {}", "protected abstract void cleanup() throws Throwable;", "public void clean() {\n\tmTaskCompletedCallback = null;\n\tmTaskUpdateCallback = null;\n\tmIsDirty = false;\n }", "private void cleanUp() {\n timer_.cancel();\n countdownTask_.cancel();\n vibrator_.cancel();\n }", "public void switchToGlobalContext(){\n currentConstants = null;\n currentVariables = null;\n\n temporaryConstants = null;\n temporaryVariables = null;\n }", "public static void onPauseCleanUp() {\n for(PrioritizedReactiveTask task: activeTasks) {\n task.stopTask();\n }\n }", "private void cleanup() {\n\t\tif (myListener!=null)\n\t\t\t_prb.removeListener(myListener);\n\t}", "@Override\n\tpublic void destroy() throws Exception\n\t{\n\t\tlog.debug(\"Shutdown threadpool\");\n\t\tpool.shutdownNow(); // disable new tasks from being submitted and interrupt running threads.\n\n\t\t// Wait briefly for tasks to respond to being cancelled\n\t\tif (!pool.awaitTermination(1, TimeUnit.SECONDS))\n\t\t{\n\t\t\tlog.error(\"Threads still running\");\n\t\t}\n\t\tsuper.destroy();\n\t\tlog.debug(\"Leaving servlet destroy\");\n\t}", "@Override\n\tpublic void cleanUp() {\n\t\tofferingStrategy = null;\n\t\tacceptConditions = null;\n\t\topponentModel = null;\n\t\tnegotiationSession = null;\n\t\tutilitySpace = null;\n\t\tdagent = null;\n\t}", "public void toss() {\n\t\t\tif (pool != null) {\n\t\t\t\tpool.creator.destroy(content);\n\t\t\t}\n\t\t\t// Don't allow finalize to put it back in.\n\t\t\tpool = null;\n\t\t}", "@Override\n public void destroy() {\n // destroy any persistent resources\n // such as thread pools or persistent connections\n }", "public static void cleanseInits() {\n delayDuration = null;\n timerFrequency = null;\n numProcessorThreads = null;\n maxProcessorTasks = null;\n }", "@Override\r\n protected void tearDown() throws Exception {\r\n ctx = null;\r\n projectService = null;\r\n }", "@Override\n\t\tprotected void finalize() throws Throwable {\n\t\t\tif (pool != null) {\n\t\t\t\tdone();\n\t\t\t\tpool = null;\n\t\t\t}\n\t\t}", "@Override\n\tprotected void finalize() throws Throwable {\n\t\tctx.close();\n\t\tctx=null;\n\t\tsuper.finalize();\n\t}", "@PreDestroy\n\tpublic void destroy() {\n\t\tthis.executorService.shutdown();\n\t}", "private void doCleanup() {\n Log.INFO(\"Final cleanup\");\n try { // return to full-cluster-running state\n restartNode(); \n } catch (HoneycombTestException e) {\n Log.ERROR(\"Final cleanup failed: \" + e);\n }\n }", "public void destroy(){\n runner.destroy();\n }", "private void dispose() {\n\t\t\t\r\n\t\t\tif (TRACE) {\r\n\t\t\t\tSystem.out.println(\"Disposing thread \" + workerNo);\r\n\t\t\t}\r\n\t\t\tcontrolLock.lock();\r\n\t\t\ttry {\r\n\t\t\t\tthreads.remove(thread.getId());\r\n\t\t\t}\r\n\t\t\tfinally {\r\n\t\t\t\tcontrolLock.unlock();\r\n\t\t\t}\r\n\t\t}", "public void cleanup() {\n try {\n resManager.stopVirtualNodes();\n } catch (Exception e) {\n logger.error(ITConstants.TS + \": \" + DEL_VM_ERR, e);\n }\n logger.info(\"Cleanup done\");\n }", "@After\r\n\tpublic void cleanup() {\n\t}", "@After\r\n public void tearDown() throws Exception {\r\n super.tearDown();\r\n TestHelper.cleanupEnvironment();\r\n instance = null;\r\n }", "protected void cleanup() {\n this.dead = true;\n this.overflow = null;\n this.headerBuffer = null;\n this.expectBuffer = null;\n this.expectHandler = null;\n this.unfragmentedBufferPool = null;\n this.fragmentedBufferPool = null;\n this.state = null;\n this.currentMessage = null;\n \n /*\n this.onerror = null;\n this.ontext = null;\n this.onbinary = null;\n this.onclose = null;\n this.onping = null;\n this.onpong = null;*/\n}", "public static void cleanUp() {\n\t\tHashDecay.stopAll();\n\t\tSystem.gc();\n\t}", "public void remove(Env env) {\n\t\tT obj = objs.remove(Thread.currentThread());\n\t\tif(obj!=null)\n\t\t\tobj.destroy(env);\n\t}", "public void shutdown() {\n /**\n * Make this thread instance null.\n */\n THREAD_INSTANCE = null;\n\n /**\n * Destroy Keep Alive Thread.\n */\n KEEP_ALIVE_THREAD.pause();\n KEEP_ALIVE_THREAD.stop();\n KEEP_ALIVE_THREAD = null;\n }", "public void cleanUp() { listener = null; }", "@After\n public void clearState() throws Exception {\n getTagManager().clearTagsFromMemory();\n getTagManager().removeAllListeners();\n reset(topology);\n bigDeviceManager.clearAntiSpoofingMemoryStructures();\n testDeleteWithoutHttp(\"/tag-manager\");\n if (moduleContext != null) {\n IThreadPoolService tp = \n moduleContext.getServiceImpl(IThreadPoolService.class);\n if (tp != null)\n tp.getScheduledExecutor().shutdown();\n }\n }", "@PreDestroy\n\tpublic void doMyCleanupStfff() {\n\t\tSystem.out.println(\">> TennisCoach: inside of doMyCleanupStuff\");\n\t}", "public static void destruct() {\n\t\tinstance = null;\n\t}", "@Override\n\tprotected void finalize() throws Throwable {\n\t\ttry {\n\t\t\tsuper.finalize();\n\t\t\t(new ClearClipBoardTask()).run();\n\t\t} catch (Exception ex) {\n\t\t\tLogger.getLogger(this.getClass().getName()).severe(ex.getMessage());\n\t\t}\n\t}", "private void cleanUp(){\n\t\tSSHUtil sSHUtil=(SSHUtil) SpringUtil.getBean(\"sSHUtil\");\n\t\ttry {\n\t\t\tsSHUtil.disconnect();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@PreDestroy\r\n\tpublic void doMyCleanupStuff() {\r\n\t\tSystem.out.println(\">> TennisCoach: inside of doMyCleanupStuff()\");\r\n\t}", "@Override\n public void teardown() {\n }", "@Override\n\tpublic void destroy() {\n\t\tlogService=null;\n\t\tnoInterceptUrlRegxList=null;\n\n\t}", "public void cleanup()\n {\n \tsuper.cleanup();\n _channelHandler.cleanup();\n }", "private void cleanupResources() {\n Log.d(TAG, \"Initiating resource cleanup\");\n if (mWorkerThread != null) {\n mWorkerThread.quitSafely();\n try {\n mWorkerThread.join();\n mWorkerThread = null;\n } catch (InterruptedException e) {\n Log.e(TAG, \"Failed to join on mWorkerThread\");\n }\n }\n //mListener = null;//Release later when being finalized\n mDisplayHandler = null;\n mERDHandler = null;\n mContext = null;\n surface = null;\n mIface = null;\n mLocalWfdDevice = null;\n mPeerWfdDevice = null;\n mActionListener = null;\n Log.d(TAG, \"Done with resource cleanup\");\n }", "public final void cleanUp() {\n\t\tmgdmfunctions = null;\n\t\tmgdmlabels = null;\n\t\theap.finalize();\n\t\theap = null;\n\t\tSystem.gc();\n\t}", "void teardown();", "void teardown();", "protected void cleaningUp() {\n\t}", "public static void reset() {\n // shutdown thread-pools\n HystrixThreadPool.Factory.shutdown();\n _reset();\n }", "public void shutdown() {\n\t\tthreadPool.shutdown();\n\t}", "@Override\n public void onDestroy() {\n super.onDestroy();\n if(task != null)\n task.cancel(true);\n }", "public void dispose() {\n if (executionPlan != null)\n executionPlan.dispose();\n if (appClassList != null)\n appClassList.clear();\n if (classObserverList != null)\n classObserverList.clear();\n if (referencedClassSet != null)\n referencedClassSet.clear();\n analysisOptions.analysisFeatureSettingList = null;\n bugReporter = null;\n classFactory = null;\n classPath = null;\n classScreener = null;\n detectorFactoryCollection = null;\n executionPlan = null;\n progress = null;\n project = null;\n analysisOptions.userPreferences = null;\n }", "public void cleanup() {\n\t\tref.removeEventListener(listener);\n\t\tmodels.clear();\n\t\tmodelNames.clear();\n\t\tmodelNamesMapping.clear();\n\t}", "@Override\n\tpublic void teardown() {\n\t}", "@AfterClass\n\tpublic static void teardown() {\n\t\tdataMunger = null;\n\n\t}", "void deinit() {\n\t\tsafeLocationTask.cancel();\n\t\t//Deinit all remaining worlds\n\t\tworlds.values().forEach(WorldHandler::deinit);\n\t\t//Clear members\n\t\tworlds.clear();\n\t\toptions = null;\n\t}", "@Override\n\tprotected void onDestroy() {\n\t\tsuper.onDestroy();\n\t\tmStateHolder.cancelAlltasks();\n\n\t}", "public void closePool() {\n threadPool.destroy();\n }", "public void removeCredentialsFromCurrentThread() {\n\t\tthis.threadBoundCredentials.set(null);\n\t}", "final void cleanUp() {\r\n\t\t\tfor (Variable var : varRefs.keySet()) {\r\n\t\t\t\tvar.deleteObserver(this);\r\n\t\t\t}\r\n\t\t\tvarRefs.clear();\r\n\t\t}", "private void registerDestroyTask() {\n if (this.shutdownTask == null) {\n // Register a task to destroy the activity context on shutdown\n this.shutdownTask = ShutdownHook.addTask(() -> {\n synchronized (this.buildDestroyMonitor) {\n doDestroy();\n removeDestroyTask();\n }\n });\n }\n }", "@Override\n\tpublic void destroy() {\n\t\tif( null != mLooper ) {\n\t\t\tmLooper.quit();\n\t\t\tmLooper = null;\n\t\t\tmThread = null;\n\t\t}\n\t}", "@Override\n public void cleanup() {\n if (this.inputStream != null) {\n try {\n this.inputStream.close();\n }\n catch (IOException var1_1) {}\n }\n this.defaultFetcher.cleanup();\n }", "@After\n\tpublic void cleanUp() {\n\t\tif (model != null) {\n\t\t\tmodel.release(true);\n\t\t\tloader.unloadAll();\n\t\t}\n\t}", "public static void unsetExecutionContext() {\r\n\t\tServletLoggingOutput.servlets.set(null);\r\n\t}", "public void cleanUp();", "public void cleanUp();", "public void dispose() {\n if (python != null) {\n python.shutdown();\n }\n }", "public static void ender(ExternalThreadPool etp) {\n LOGGER.info(\"Starting ExternalThreadPool ender\");\n // Destroys the bash process\n etp.piper.destroy();\n\n // Pipes are destroyed by bash TRAP on script\n }", "@AfterClass\r\n public static void tearDown() throws Exception {\r\n instance = null;\r\n }" ]
[ "0.71233076", "0.7044316", "0.66797566", "0.66395885", "0.66372836", "0.6552077", "0.6492146", "0.64464605", "0.6335561", "0.6323371", "0.63228697", "0.62932086", "0.62931", "0.62838537", "0.62830555", "0.6240084", "0.62285364", "0.62251914", "0.6208664", "0.6208664", "0.6170089", "0.61488247", "0.61488247", "0.61488247", "0.6148805", "0.6113106", "0.6113106", "0.6104284", "0.60926133", "0.60737824", "0.6057218", "0.60230213", "0.5975275", "0.5975275", "0.5975275", "0.5944249", "0.5942252", "0.59271514", "0.59223247", "0.59149486", "0.5905254", "0.59047973", "0.5887253", "0.58868116", "0.58749515", "0.5866327", "0.5858213", "0.5832088", "0.5828005", "0.5820093", "0.58138347", "0.579208", "0.57847536", "0.5784496", "0.57779884", "0.57764316", "0.5767847", "0.57641", "0.5763774", "0.5763167", "0.57577014", "0.57528913", "0.57347375", "0.5727439", "0.5726738", "0.5721624", "0.57186925", "0.5717351", "0.5708258", "0.569983", "0.5698633", "0.5695596", "0.5690597", "0.5667666", "0.566469", "0.5661295", "0.5661295", "0.5654327", "0.5653615", "0.56512105", "0.5649478", "0.5648361", "0.56382054", "0.56379116", "0.56301296", "0.56287634", "0.5626622", "0.56066006", "0.5605326", "0.5592527", "0.5578484", "0.5547605", "0.5540588", "0.5539477", "0.55242246", "0.5516886", "0.5516886", "0.5515299", "0.550977", "0.55060637" ]
0.64556015
7
Serializes, deserializes and executes the task
public void run(Task task) { try { // inject before serializing, to check that all fields are serializable as JSON injectionService.injectMembers(task); String s = objectMapper.writeValueAsString(task); log.info("Executing " + s); // inject after deserializing, for proper execution AbstractTask deserialized = objectMapper.readValue(s, AbstractTask.class); injectionService.injectMembers(deserialized); setupTask(task); try { ((AbstractTask)deserialized).run(this); incCompletedTaskCount(task.getQueueName()); } finally { teardownTask(task); } } catch (IOException e) { throw new RuntimeException(e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public TaskReturnType Run();", "@Override\n public void execute(final Task<T> task) {\n }", "@Override\n public void execute() {\n Task<Void> task = new Task<Void>() {\n @Override\n protected Void call() throws Exception {\n exportData();\n return null;\n }\n\n @Override\n protected void succeeded(){\n callback.onSuccess();\n super.succeeded();\n }\n\n @Override\n protected void failed(){\n callback.onFail(this.getException());\n super.failed();\n }\n };\n new Thread(task).start();\n }", "public abstract void execute(Task t);", "@Override\n public void run() {\n task.run();\n }", "@Override\n\t\tpublic void run() {\n\t\t\ttask();\n\t\t}", "void saveTask( org.openxdata.server.admin.model.TaskDef task, AsyncCallback<Void> callback );", "@Override\r\n\tvoid execute(Runnable task);", "@Override\n\tpublic void executeTask(Task task) {\n\t\tif (task.getMethodName().equals(\"upload\")) {\n\t\t\tString[] parameterArrays = task.getParameters().split(\";\");\n\t\t\t\n\t\t}\n\t}", "Task createTask();", "Task createTask();", "Task createTask();", "public Task(){}", "@Override\n\tpublic void run() {\n\t\tRequestBody body = RequestBody.create(this.jsonType, this.contents);\n\t\tRequest request = new Request.Builder()\n\t\t\t.url(this.serverURL)\n\t\t\t.post(body)\n\t\t\t.build();\n\t\t\n\t\ttry {\n\t\t\tResponse response = client.newCall(request).execute();\n\t\t\tString str = response.body().string();\n\t\t\t//logger.log(Level.INFO, \n\t\t\t//\t\tString.format(\"DEBUG postCallInfoToServerTask succeed: %s\", str));\n\t\t} catch (IOException e) {\n\t\t\tNetProphetLogger.logError(\"PostCallInfoTask.run\", e.toString());\n\t\t}\n\t}", "@Override\r\n\tpublic void run() {\n\t\ttry {\r\n\t\t\tObjectInputStream objectInput = new ObjectInputStream(\r\n\t\t\t\t\tclsock.getInputStream());\r\n\t\t\tObject object = objectInput.readObject();\r\n\t\t\ttask = (String) object;// reading URLs from client\r\n\t\t} catch (ClassNotFoundException e) {\r\n\t\t\tSystem.out.println(\"The task Batch has not come from the Client\");\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\tString clientId = task.split(\",\")[0];\r\n\r\n\t\tRemoteScheduler remoteScheduler = new RemoteScheduler(clientId,\r\n\t\t\t\ttask);\r\n\t\tremoteScheduler.sendTaskToQueue();\r\n\t\tExecutorService remoteService = Executors.newFixedThreadPool(1);\r\n\t\ttry {\r\n\t\t\tFuture<String> remoteResult = remoteService\r\n\t\t\t\t\t.submit(remoteScheduler);\r\n\t\t\tString clientResult = remoteResult.get();\r\n\t\t\tObjectOutputStream outputStream = new ObjectOutputStream(\r\n\t\t\t\t\tclsock.getOutputStream());\r\n\t\t\toutputStream.writeObject(clientResult);\r\n\t\t\toutputStream.close();\r\n\t\t} catch (InterruptedException | ExecutionException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tclsock.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "public interface JsonTask extends Task {\n}", "@Override\n public void run() {\n runTask();\n\n }", "public abstract void task();", "void startTask( org.openxdata.server.admin.model.TaskDef task, AsyncCallback<java.lang.Boolean> callback );", "@Override\r\n\tpublic void doTask() {\n\t}", "public abstract TaskResult runTask(TaskKey taskKey) throws JobException;", "public void updateTask() {}", "protected abstract Version executeTaskLocal(Version theTask);", "public void execute(){\n if (pipeline != null){\n pipeline.addTask(this);\n } else {\n run();\n }\n }", "public interface Task {\n void execute() ;\n}", "@Override\n public void run() {\n if (checkFailure()) {\n throw new InvalidInputException(\"任务结果计算器暂时无法工作,因为未满足条件\");\n } else {\n analysisDistribution();\n File file = writeFile();\n task.setResult(OSSWriter.upload(file));\n task.setHasResult(true);\n taskController.update(task);\n }\n }", "public static Object createTaskObject(){\n try {\n\n return taskModel.make()\n .load(ClassLoader.getSystemClassLoader(), ClassLoadingStrategy.Default.WRAPPER)\n .getLoaded()\n .newInstance();\n\n\n } catch (InstantiationException e) {\n e.printStackTrace();\n } catch (IllegalAccessException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "Future_<V> submit(Callable_<V> task);", "public void execute(){\n\t\tnew PayCarOrderTask().execute();\n\t}", "public interface NetTaskModel<T> {\n\n Disposable execute(T data,LoadTaskCallBack callBack);\n}", "@Override\n public SyncObjectState call() {\n\n SyncObjectState callState = SyncObjectState.STARTED;\n \n \n long remainingSleep = task.getSleepUntil() - System.currentTimeMillis();\n if (remainingSleep > 0) {\n try {\n Thread.sleep(remainingSleep);\n } catch (InterruptedException ex) {\n logger.warn(buildStandardLogMessage(null, \" Interrupted task-remaining-sleep\"));\n }\n }\n\n // TODO: consider replacing Lock with with IMap, for the automatic GC\n // see https://groups.google.com/forum/#!topic/hzProcessingClient/9YFGh3xwe8I\n Lock hzPidLock = hzProcessingClient.getLock(task.getPid());\n \n // this section must be thread-safe otherwise, we may skip unlocking a lock.\n // see http://docs.hazelcast.org/docs/3.5/manual/html/lock.html\n try {\n logger.info(buildStandardLogMessage(null, \" Locking task, attempt \" + task.getLockAttempt()));\n \n if (hzPidLock.tryLock(1, TimeUnit.SECONDS)) {\n // got lock\n try {\n logger.info(buildStandardLogMessage(null, \" Processing SyncObject\"));\n SystemMetadata mnSystemMetadata = retrieveMNSystemMetadata();\n logger.debug(task.taskLabel() + \" MN system metadata retrieved...\");\n\n processTask(mnSystemMetadata);\n callState = SyncObjectState.SUCCESS;\n \n } catch (RetryableException ex) {\n if (task.getAttempt() < 20) {\n callState = SyncObjectState.RETRY;\n \n logger.warn(buildStandardLogMessage(ex, \" RetryableException raised on attempt \"\n + task.getAttempt() + \" of 20. Sleeping and requeueing.\"));\n\n task.setAttempt(task.getAttempt() + 1);\n task.setSleepUntil(System.currentTimeMillis() + 5000L);\n\n hzProcessingClient.getQueue(synchronizationObjectQueue).put(task);\n \n } else {\n logger.error(buildStandardLogMessage(ex,\" Exceeded retry limit.\"\n + \" Unable to process the SyncObject. Converting to UnrecoverableException\"),ex);\n throw new UnrecoverableException(task.getPid() + \": retry limits reached without success.\",\n ex.getCause());\n }\n } finally {\n hzPidLock.unlock();\n logger.info(buildStandardLogMessage(null, \" Unlocked Pid.\"));\n }\n } else {\n // lock-retry handling\n if (task.getLockAttempt() < 100) {\n callState = SyncObjectState.RETRY;\n \n logger.warn(buildStandardLogMessage(null,\n \" Cannot lock Pid! Requeueing the task. Attempt \" + task.getLockAttempt()));\n\n task.setLockAttempt(task.getLockAttempt() + 1);\n task.setSleepUntil(System.currentTimeMillis() + 1000L);\n hzProcessingClient.getQueue(synchronizationObjectQueue).put(task);\n \n } else {\n callState = SyncObjectState.FAILED;\n \n String message = \"Cannot lock Pid! Reached Max attempts (100), abandoning processing of this pid.\";\n logger.error(buildStandardLogMessage(null, message));\n throw new SynchronizationFailed(\"5000\",message);\n }\n }\n } catch (SynchronizationFailed e) {\n callState = SyncObjectState.FAILED;\n \n logger.error(buildStandardLogMessage(e.getCause(),\"SynchronizationFailed: \" + e.getMessage()),e);\n SyncFailedTask syncFailedTask = new SyncFailedTask(nodeCommunications, task);\n syncFailedTask.submitSynchronizationFailed(e);\n\n } catch (UnrecoverableException e) {\n callState = SyncObjectState.FAILED;\n // this is the proper location to decide whether or not to notify the MemberNode\n // (these are exceptions caused by internal problems)\n \n // in all cases, we need to log\n logger.error(buildStandardLogMessage(e.getCause(),\"UnrecoverableException: \" + e.getMessage()),e);\n \n // report to MN, for now\n\n SyncFailedTask syncFailedTask = new SyncFailedTask(nodeCommunications, task);\n if (e.getCause() instanceof BaseException)\n syncFailedTask.submitSynchronizationFailed(task.getPid(), null,(BaseException) e.getCause());\n \n else \n syncFailedTask.submitSynchronizationFailed(task.getPid(), null,\n new ServiceFailure(\"5000\", this.buildStandardLogMessage(e.getCause(), null)));\n\n\n \n } catch (InterruptedException e) {\n callState = SyncObjectState.FAILED;\n // was handled as Exception before I split this out\n // don't know if we need to handle it any differently,\n logger.error(buildStandardLogMessage(e, \"Interrupted: \" + e.getMessage()), e);\n\n } catch (Exception e) {\n callState = SyncObjectState.FAILED;\n logger.error(this.buildStandardLogMessage(e,e.getMessage()),e);\n\n } finally {\n logger.info(buildStandardLogMessage(null, \" exiting with callState: \" + callState));\n// XXX: Hold until 2.4, because it depends on an update to d1_cn_common\n// MetricLogEntry metricLogEntry = new MetricLogEntry(MetricEvent.SYNCHRONIZATION_TASK_EXECUTION);\n// metricLogEntry.setNodeId(TypeFactory.buildNodeReference(task.getNodeId()));\n// metricLogEntry.setPid(TypeFactory.buildIdentifier(task.getPid()));\n// metricLogEntry.setMessage(\"status=\" + callState);\n// MetricLogClientFactory.getMetricLogClient().logMetricEvent(metricLogEntry);\n }\n return callState;\n }", "@Override\n\tpublic void execute() {\n\t\tThreadPool pool=ThreadPool.getInstance();\n\t\tpool.beginTaskRun(this);\n\t}", "public XmlAdaptedTask() {}", "public XmlAdaptedTask() {}", "@Override\n public void runTask() {\n final String aid = agencyId();\n // Make API call\n final Value payload = NextBusApi.getVehiclesForAgency(Assets.httpClient(), aid, this.lastTime);\n // Extract information for all vehicles and the payload's timestamp\n final List<Value> vehicleInfos = new ArrayList<>(payload.length());\n for (Item i : payload) {\n if (i.head() instanceof Attr) {\n final String label = i.head().key().stringValue(null);\n if (\"vehicle\".equals(label)) {\n vehicleInfos.add(i.head().toValue());\n } else if (\"lastTime\".equals(label)) {\n this.lastTime = i.head().toValue().get(\"time\").longValue();\n }\n }\n }\n // Relay each vehicleInfo to the appropriate VehicleAgent\n int i = 0;\n for (Value vehicleInfo : vehicleInfos) {\n command(\"/vehicle/\" + aid + \"/\" + vehicleInfo.get(\"id\").stringValue(),\n \"addMessage\",\n // lastTime came separately, manually add it to each vehicleInfo\n vehicleInfo.updatedSlot(\"timestamp\", this.lastTime));\n i++;\n }\n System.out.println(nodeUri() + \": relayed info for \" + i + \" vehicles\");\n }", "void executeTask(org.apache.ant.common.antlib.Task task) throws org.apache.ant.common.util.ExecutionException;", "public Task() { }", "public interface Executor {\n void setTask(Task task);\n Task getTask();\n void startTask();\n}", "public interface Task<T> {\n T execute();\n}", "void completeTask(String userId, Long taskId, Map<String, Object> results);", "@Test\n public void testPerformTask1() throws Exception {\n EnableStreamingTaskRunner runner =\n createRunner(createMockS3StorageProviderV2(false),\n createMockS3ClientV3(),\n createMockCFServiceV3());\n\n try {\n runner.performTask(null);\n fail(\"Exception expected\");\n } catch(Exception expected) {\n assertNotNull(expected);\n }\n\n String results = runner.performTask(spaceId);\n assertNotNull(results);\n testResults(results);\n testCapturedProps();\n }", "Callable<E> getTask();", "@Test\n\tpublic void testDoTask() throws Exception {\n\t\tSystem.out.println(\"doTask\");\n\t\tFileInputStream fileIn = null;\n\n\t\tDeleteTask task = new DeleteTask(1);\n\t\tfileIn = new FileInputStream(\"./lib/input\");\n\t\tFileOutputStream fileOut = new FileOutputStream(\"./lib/output\");\n\t\ttask.doTask(fileIn, fileOut);\n\n\n\t\tfileIn.close();\n\n\t}", "public void startTask() {\n\t}", "public interface RunnableTask {\n ProcessResult run();\n}", "public final void execute() {\n\t\tLogUtils.i(TAG, \"execute\");\n\t\tpurelySetState(TaskState.Preparing);\n\t\tTaskQueue.addTask(this);\n\t}", "public Task(){\n super();\n }", "public abstract void execute(Serializable obj);", "public Task() {\r\n }", "public Task getTask() { return task; }", "java.util.concurrent.Future<StartExportTaskResult> startExportTaskAsync(StartExportTaskRequest startExportTaskRequest);", "abstract void execute(TaskList tasks, Ui ui, Storage storage) throws IOException;", "@Override\r\n\tpublic void run() {\n\t\tsuper.run();\r\n\t\tString playerid = getParam(\"playerid\");\r\n\t\tString taskno = getParam(\"taskno\");\r\n\t\t\r\n\t\t\r\n\t\ttry {\r\n\t\t\txmlCreate = new XMLTaskCreate();\r\n\t\t} catch (Exception e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tString csOk = xmlCreate.createXml(\"ACK_OK\", playerid, taskno, \"\", \"\");\t\r\n\t\tTcpSessionThread.getInstance().sendString(csOk);\r\n\t\t\r\n\t\tPlayerController.getInstance().setTurndown(true);\r\n\t}", "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n public void completeTask(Long taskId, Map<String, Object> outboundTaskVars, String userId, boolean disposeKsession) {\n TaskServiceSession taskSession = null;\n try {\n taskSession = taskService.createSession();\n Task taskObj = taskSession.getTask(taskId);\n int sessionId = taskObj.getTaskData().getProcessSessionId();\n long pInstanceId = taskObj.getTaskData().getProcessInstanceId();\n if(taskObj.getTaskData().getStatus() != Status.InProgress) {\n log.warn(\"completeTask() task with following id will be changed to status of InProgress: \"+taskId);\n taskSession.taskOperation(Operation.Start, taskId, userId, null, null, null);\n eventSupport.fireTaskStarted(taskId, userId);\n }\n \n if(outboundTaskVars == null)\n outboundTaskVars = new HashMap<String, Object>(); \n \n //~~ Nick: intelligent mapping the task input parameters as the results map\n // that said, copy the input parameters to the result map\n Map<String, Object> newOutboundTaskVarMap = null;\n if (isEnableIntelligentMapping()) {\n long documentContentId = taskObj.getTaskData().getDocumentContentId();\n if(documentContentId == -1)\n throw new RuntimeException(\"completeTask() documentContent must be created with addTask invocation\");\n \n // 1) constructure a purely empty new HashMap, as the final results map, which will be mapped out to the process instance\n newOutboundTaskVarMap = new HashMap<String, Object>();\n // 2) put the original input parameters first\n newOutboundTaskVarMap.putAll(populateHashWithTaskContent(documentContentId, \"documentContent\"));\n // 3) put the user modified into the final result map, replace the original values with the user modified ones if any\n newOutboundTaskVarMap.putAll(outboundTaskVars);\n } //~~ intelligent mapping\n else {\n newOutboundTaskVarMap = outboundTaskVars;\n }\n \n ContentData contentData = this.convertTaskVarsToContentData(newOutboundTaskVarMap, null);\n taskSession.taskOperation(Operation.Complete, taskId, userId, null, contentData, null);\n eventSupport.fireTaskCompleted(taskId, userId);\n \n StringBuilder sBuilder = new StringBuilder(\"completeTask()\");\n this.dumpTaskDetails(taskObj, sBuilder);\n \n // add TaskChangeDetails to outbound variables so that downstream branches can route accordingly\n TaskChangeDetails changeDetails = new TaskChangeDetails();\n changeDetails.setNewStatus(Status.Completed);\n changeDetails.setReason(TaskChangeDetails.NORMAL_COMPLETION_REASON);\n changeDetails.setTaskId(taskId);\n newOutboundTaskVarMap.put(TaskChangeDetails.TASK_CHANGE_DETAILS, changeDetails);\n \n kSessionProxy.completeWorkItem(taskObj.getTaskData().getWorkItemId(), newOutboundTaskVarMap, pInstanceId, sessionId);\n \n if(disposeKsession)\n kSessionProxy.disposeStatefulKnowledgeSessionAndExtras(taskObj.getTaskData().getProcessSessionId());\n }catch(org.jbpm.task.service.PermissionDeniedException x) {\n rollbackTrnx();\n throw x;\n }catch(RuntimeException x) {\n rollbackTrnx();\n if(x.getCause() != null && (x.getCause() instanceof javax.transaction.RollbackException) && (x.getMessage().indexOf(\"Could not commit transaction\") != -1)) {\n String message = \"completeTask() RollbackException thrown most likely because the following task object is dirty : \"+taskId;\n log.error(message);\n throw new PermissionDeniedException(message);\n }else {\n throw x;\n }\n }catch(Exception x) {\n throw new RuntimeException(x);\n }finally {\n if(taskSession != null)\n taskSession.dispose();\n }\n }", "public void readTaskInititate() {\n\t\tiStream = new ByteArrayInputStream(marshalledBytes);\t\n\t\tdin = new DataInputStream(new BufferedInputStream(iStream));\n\t\ttry {\n\t\t\tint rounds = din.readInt();\n\t\t\tfor(int i = 0; i<5; i++) {\n\t\t\t\t//Select random node from list of nodes to send a message to \n\t\t\t\tVertex randomNode = node.getRandomNode();\n\t\t\t\tStack<String> nxt= node.getNextNodesToReach(randomNode.ip,randomNode.port);\n\t\t\t\tString firstStop = nxt.pop();\n\t\t\t\tArrayList<String> nextSteps = new ArrayList<String>();\n\t\t\t\tfor(String x : nxt) {\n\t\t\t\t\tnextSteps.add(x);\n\t\t\t\t}\n\t\t\n\t\t\t\tMessage message = new ForwardMessage(nextSteps);\n\t\t\t\tSocket senderSocket = node.getConnections().getSocketWithName(firstStop);\n\t\t\t\tnew TCPSender(senderSocket, message);\n\t\t\t\tnode.addToSendSum(message.getPayload());\n\t\t\t\tnode.incrementSendTracker();\n\t\t\t}\n\t\t\trounds = rounds -1;\n\t\t\tif (rounds == 0) {\t\t\t\t// Send task Complete message if we have finished all of our rounds \n\t\t\t\tMessage completeMessage = new TaskComplete(node.ipAddr,node.portNum);\n\t\t\t\tSocket socketReturn = node.getConnections().getSocketWithName(node.getRegistryName());\n\t\t\t\tnew TCPSender (socketReturn, completeMessage);\n\t\t\t} else {\n\t\t\t\t//Else put a new event with a taskInitiate method into the queue\n\t\t\t\tMessage rerun = new TaskInitiate(rounds);\n\t\t\t\tbyte[] newData = rerun.getByteArray();\n\t\t\t\tEventFactory eventFactory = EventFactory.getInstance();\n\t\t\t\teventFactory.insert(messageType, newData, node, originSocket);\n\t\t\t}\n\t\t} catch (IOException e) { System.out.println(\"Failed to read message. \"); }\n\t}", "public Task() {\n\t}", "public Task() {\n }", "public interface Task {\n public void run(Object o);\n}", "public static void launchTask(Task tsk)\n {\n getInstance().doExecute(tsk);\n }", "public interface TaskInterface {\n\n public String getUrl();\n public void resultExecute(String result);\n\n}", "public void executeTask(Version theTask) {\n\n\tif (_stoppedTasks.contains(theTask)) {\n\t // todo: what to do here???\n\t // this task obviously didn't perform well .. \n\t // and now, there's another request to run it!\n\t if (true) {\n\t\t// either try the task again ... \n\t\t_stoppedTasks.remove(theTask);\n\t } else {\n\t\t// or, refuse to run it at all \n\t\treturn;\n\t }\n\t}\n\t\n\t// System.out.println(\" - - - - - - - - - - - PSL! entered executeTask, parameter version> \" + theTask);\n\t// if (_versionCache.contains(theTask)) return;\n\n\n\t// add the pre-execution task to our knowledge base\n\t// replicate it so that in case of a crash we may recover\n\t_versionCache.addVersion(theTask);\n\treplicate(theTask);\n\n\t// tell replicators that we are about to start executing\n\talertReplicatorsExecutingTask(theTask);\n\n\tString taskName = ((TaskDefinition)theTask.data()).getName();\n\n\t// execute the task and get the next task\n\tVersion nextTask = executeTaskLocal(theTask);\n\t_log.completedTaskLocal(theTask);\n\n\tif (_stoppedTasks.contains(theTask)) {\n\t // this task was supposed to be stopped .. can ignore result\n\t _stoppedTasks.remove(theTask);\n\t _log.ignoreResultsOfStoppedTask(theTask);\n\t} else if (nextTask == null) { \n\t // this only happens if we have reached\n\t // the end of the workflow execution \n\t // tell replicators that everything is done.\n\t System.out.println(\"WORKFLOW IS DONE\");\n\t alertReplicatorsDoneExecutingTask(theTask);\n\t} else {\n\t nextTask.append(taskName);\n\t // todo: we need to find a way to replicate the \n\t // post-execution task in a clean way. The here-under\n\t // commented code does not work as it creates a version clash.\n\t // todo: 16-Feb maybe uncomment this??\n\t // _versionCache.addVersion(nextTask);\n\n\t // set the next task for execution\n\t queueTask(nextTask);\n\t // tell the replicators we are done executing the task, they\n\t // don't have to worry about things anymore.\n\t alertReplicatorsDoneExecutingTask(theTask);\n\t}\n }", "@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tBitmap bit = InputStream2Bimap( taskModel.domainInputStreamResult ) ; \n\t\t\t\t\tMessage msg = new Message(); \n\t\t\t\t\tmsg.obj = bit ; \n\t\t\t\t\tmsg.what = 4 ; \n\t\t\t\t\thandler.sendMessage(msg) ;\n\t\t\t\t}", "public void submit(Task task) {\n\t\tthis.engine.pushTask(task);\n\t}", "public interface TaskBase {\n public void executeTask();\n\n}", "public interface TaskBase {\n\t/**\n\t * @return Returns the name of the task\n\t */\n\tpublic String GetName();\n\n\t/**\n\t * Called upon entering autonomous mode\n\t */\n\tpublic void Initialize();\n\n\t/**\n\t * Called every autonomous update\n\t * \n\t * @return Return task result enum\n\t */\n\tpublic TaskReturnType Run();\n\n}", "private static void executeTask02() {\n }", "@Override\n public void taskStarting() {\n\n }", "@Test\n public void testPerformTask2() throws Exception {\n EnableStreamingTaskRunner runner =\n createRunner(createMockS3StorageProviderV2(false),\n createMockS3ClientV3(),\n createMockCFServiceV2());\n\n String results = runner.performTask(spaceId);\n assertNotNull(results);\n testResults(results);\n testCapturedProps();\n }", "@Override\r\n\tpublic void PostExecute(TaskConfig config){\n\t}", "@Override\n public void execute(final Task<T> task, final long wait, final TimeUnit unit) {\n }", "public Task(Task source) {\n if (source.Application != null) {\n this.Application = new Application(source.Application);\n }\n if (source.TaskName != null) {\n this.TaskName = new String(source.TaskName);\n }\n if (source.TaskInstanceNum != null) {\n this.TaskInstanceNum = new Long(source.TaskInstanceNum);\n }\n if (source.ComputeEnv != null) {\n this.ComputeEnv = new AnonymousComputeEnv(source.ComputeEnv);\n }\n if (source.EnvId != null) {\n this.EnvId = new String(source.EnvId);\n }\n if (source.RedirectInfo != null) {\n this.RedirectInfo = new RedirectInfo(source.RedirectInfo);\n }\n if (source.RedirectLocalInfo != null) {\n this.RedirectLocalInfo = new RedirectLocalInfo(source.RedirectLocalInfo);\n }\n if (source.InputMappings != null) {\n this.InputMappings = new InputMapping[source.InputMappings.length];\n for (int i = 0; i < source.InputMappings.length; i++) {\n this.InputMappings[i] = new InputMapping(source.InputMappings[i]);\n }\n }\n if (source.OutputMappings != null) {\n this.OutputMappings = new OutputMapping[source.OutputMappings.length];\n for (int i = 0; i < source.OutputMappings.length; i++) {\n this.OutputMappings[i] = new OutputMapping(source.OutputMappings[i]);\n }\n }\n if (source.OutputMappingConfigs != null) {\n this.OutputMappingConfigs = new OutputMappingConfig[source.OutputMappingConfigs.length];\n for (int i = 0; i < source.OutputMappingConfigs.length; i++) {\n this.OutputMappingConfigs[i] = new OutputMappingConfig(source.OutputMappingConfigs[i]);\n }\n }\n if (source.EnvVars != null) {\n this.EnvVars = new EnvVar[source.EnvVars.length];\n for (int i = 0; i < source.EnvVars.length; i++) {\n this.EnvVars[i] = new EnvVar(source.EnvVars[i]);\n }\n }\n if (source.Authentications != null) {\n this.Authentications = new Authentication[source.Authentications.length];\n for (int i = 0; i < source.Authentications.length; i++) {\n this.Authentications[i] = new Authentication(source.Authentications[i]);\n }\n }\n if (source.FailedAction != null) {\n this.FailedAction = new String(source.FailedAction);\n }\n if (source.MaxRetryCount != null) {\n this.MaxRetryCount = new Long(source.MaxRetryCount);\n }\n if (source.Timeout != null) {\n this.Timeout = new Long(source.Timeout);\n }\n if (source.MaxConcurrentNum != null) {\n this.MaxConcurrentNum = new Long(source.MaxConcurrentNum);\n }\n if (source.RestartComputeNode != null) {\n this.RestartComputeNode = new Boolean(source.RestartComputeNode);\n }\n if (source.ResourceMaxRetryCount != null) {\n this.ResourceMaxRetryCount = new Long(source.ResourceMaxRetryCount);\n }\n }", "protected Task<Void> createTask() {\n\n\t\t\treturn new Task<Void>() {\n\n\t\t\t\tprotected Void call() {\n\t\t\t\t\t_button.setDisable(true);\n\t\t\t\t\tTaskScheduler.executeAlgorithm(_digraph);\n\n\t\t\t\t\treturn null;\n\n\n\t\t\t\t}\n\t\t\t};\n\t\t}", "void onTaskComplete(T result);", "public interface Task<T> extends Callable<T> {\n\n String getTaskName();\n void onComplete(T result);\n\n}", "@Override\n public void runTask() {\n PortugueseDistrictImportAuxiliaryServices aux = PortugueseDistrictImportAuxiliaryServices.getInstance();\n aux.executeTask(this);\n }", "@Override\n public CommandResult execute() {\n tasks.add(taskToAdd);\n try {\n storage.appendToFile(taskToAdd);\n return new CommandResult(String.format(MESSAGE_SUCCESS, taskToAdd));\n } catch (IOException e) {\n return new CommandResult(e.getMessage());\n }\n }", "public void handle(ResultItems result, Task task) {\n\n\t}", "abstract void doTaskOnRun();", "protected TaskFlow( ) { }", "@Override\n\t\tprotected String doInBackground(Task... arg0) {\n\t\t\tString taskID = TfTaskRepository.addTask(arg0[0], \n\t\t\t getApplicationContext());\n\t\t\t\n\t\t\ttaskID = taskID + \"\\n\";\n\t\t\t\n\t\t\t//saving the ID local\n\t\t\tlt.saveTaskId(taskID, getApplicationContext());\n\t\t\t\n\t\t\treturn null;\n\t\t}", "@Override\n public TaskResponse<AddPostResponse> loadInBackground() {\n response = new TaskResponse();\n try {\n response.data = Communication.addParentPost(AppConstant.METHOD_ADD_POST, bean, dataT, title, desc);\n } catch (Exception e) {\n response.error = e;\n }\n return response;\n }", "@Override\n public Class<? extends Task> taskClass() {\n return AmpoolSourceTask.class;\n }", "void registerTasks(Object taskClassObject);", "@Override\r\n\t\t\t\t\t\tpublic Void then(Task<List<Transaction>> task)\r\n\t\t\t\t\t\t\t\tthrows Exception {\n\t\t\t\t\t\t\tif (task.isFaulted()) {\r\n\t\t\t\t\t\t\t\tLog.e(CLASS_NAME, \"Exception : \"\r\n\t\t\t\t\t\t\t\t\t\t+ task.getError().getMessage());\r\n\t\t\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tfinal List<Transaction> objects = task.getResult();\r\n\r\n\t\t\t\t\t\t\t// If the result succeeds, load the list\r\n\t\t\t\t\t\t\tif (!isFinishing()) {\r\n\t\t\t\t\t\t\t\trunOnUiThread(new Runnable() {\r\n\t\t\t\t\t\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\t\t\t\t\t// clear local itemList\r\n\t\t\t\t\t\t\t\t\t\t// we'll be reordering and repopulating\r\n\t\t\t\t\t\t\t\t\t\t// from DataService\r\n\t\t\t\t\t\t\t\t\t\titemList.clear();\r\n\t\t\t\t\t\t\t\t\t\tfor (IBMDataObject item : objects) {\r\n\t\t\t\t\t\t\t\t\t\t\titemList.add((Transaction) item);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tsortItems(itemList);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t\t}", "@Override\r\n\tpublic void process(ResultItems arg0, Task arg1) {\n\t\t\r\n\t}", "public void execute() {\n }", "<T> AsyncResult<T> startProcess(Callable<T> task);", "public void execute() {\n\n\t}", "public <T> List<T> massExec(Callable<? extends T> task);", "public abstract void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException;", "@Override\r\n @SuppressWarnings(\"empty-statement\")\r\n public Object createTaskData(int taskid) { \r\n List curPara = new ArrayList();\r\n ArrayList<String[]> regArgs1=new ArrayList<String[]>();\r\n String [] regArgs2 = null;\r\n synchronized(lock){\r\n curPara = paramList.get(taskid); \r\n }\r\n \r\n String _taskType = curPara.get(2).toString();\r\n String _info1 = curPara.get(4).toString();\r\n String _info2 = curPara.get(5).toString();\r\n if(_taskType.equals(\"c4c\")){ \r\n String _tupleTag = curPara.get(1).toString();\r\n HashMap<String,Object> requestArgs ;\r\n if (_info2.equals(\"MET\")) {\r\n try {\r\n Thread.sleep(100);\r\n System.out.println(\"[Notification-createTaskData] metadata array to send \"+C4CHelper.regArgs2.size());\r\n Thread.sleep(100);\r\n regArgs1=C4CHelper.regArgs2;\r\n Thread.sleep(10000);\r\n System.out.println(\"[Notification-createTaskData] metadata completed\");\r\n C4CHelper.uploadModel=true;\r\n } catch (Exception ex) {\r\n Logger.getLogger(FedMeteorPublisherMaster.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n } else if (_info2.equals(\"VER\")){\r\n try {\r\n Thread.sleep(100);\r\n System.out.println(\"[Notification-createTaskData] version array to send \"+C4CHelper.regArgs1.size());\r\n Thread.sleep(100);\r\n regArgs1=C4CHelper.regArgs1;\r\n Thread.sleep(10000);\r\n System.out.println(\"[Notification-createTaskData] version completed\");\r\n } catch (InterruptedException ex) {\r\n Logger.getLogger(FedMeteorPublisherMaster.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n } else if (_info1.equals(\"CONFIG\")){\r\n try {\r\n ArrayList<String[]> result=new ArrayList<String[]>();\r\n String[] res=new String[10];\r\n System.out.println(\"[Notification-createTaskData] config array to send: \"+C4CHelper.resultConfig.length());\r\n Thread.sleep(100);\r\n Pattern pattern = Pattern.compile(\"<IPAddress>(.*?)</IPAddress>\");\r\n Pattern pattern2 = Pattern.compile(\"<Port>(.*?)</Port>\");\r\n Matcher matcher = pattern.matcher(C4CHelper.resultConfig);\r\n Matcher matcher2 = pattern2.matcher(C4CHelper.resultConfig);\r\n while ((matcher.find()) && (matcher2.find())){\r\n res[0]=matcher.group(1);\r\n res[1]=matcher2.group(1);\r\n //System.out.println(\"[Notification-createTaskData] 1111 config completed \"+res[0] +\"-\"+res[1]);\r\n result.add(new String[] {res[0],res[1]});\r\n \r\n } \r\n regArgs1=result;\r\n //System.out.println(\"[Socket getInterfaceData] configuring ...end \"+result.get(0)[0]);\r\n //System.out.println(\"[Socket getInterfaceData] configuring ...end \"+result.get(0)[1]);\r\n System.out.println(\"[Notification-createTaskData] config completed\");\r\n \r\n } catch (InterruptedException ex) {\r\n Logger.getLogger(FedMeteorPublisherMaster.class.getName()).log(Level.SEVERE, null, ex);\r\n } \r\n } else { \r\n \r\n System.out.println(\"[Notification-createTaskData] fetch received\");\r\n }\r\n return (Object) regArgs1;\r\n \r\n }else if(_taskType.equals(\"C4C\")){\r\n String _tupleTag = curPara.get(1).toString();\r\n HashMap<String,Object> requestArgs ;\r\n if(_tupleTag.equals(\"CPT\")){\r\n requestArgs = (HashMap<String,Object>)curPara.get(9);\r\n }else{\r\n regArgs1 = null;\r\n }\r\n return (Object) regArgs1;\r\n }else{\r\n return null;\r\n } \r\n }", "public interface Task<T> {\r\n /**\r\n * run the task.\r\n *\r\n * @return T a generic type.\r\n */\r\n T run();\r\n}", "public abstract void persistAndRunTaskHandler() throws IOException;", "public void execute() {\n\t\tlaunch();\n\t}", "@POST(\"pomodorotasks\")\n Call<PomodoroTask> pomodorotasksPost(\n @Body PomodoroTask pomodoroTask\n );", "public XmlAdaptedTask() {\n\t}", "public final void run() {\n final long contextID = Nodex.instance.getContextID();\n Runnable runner = new Runnable() {\n public void run() {\n try {\n final T result = execute();\n NodexInternal.instance.executeOnContext(contextID, new Runnable() {\n public void run() {\n completionHandler.onEvent(new Completion(result));\n }\n });\n } catch (final Exception e) {\n NodexInternal.instance.executeOnContext(contextID, new Runnable() {\n public void run() {\n completionHandler.onEvent(new Completion(e));\n }\n });\n } catch (Throwable t) {\n //Not much we can do, just log it\n t.printStackTrace(System.err);\n }\n }\n };\n\n NodexInternal.instance.executeInBackground(runner);\n }", "@SuppressWarnings(\"unchecked\")\n public <T> T execute() {\n return (T) fetchResponse(getCallToExecute());\n }", "java.util.concurrent.Future<StartImportTaskResult> startImportTaskAsync(StartImportTaskRequest startImportTaskRequest);", "public void execute();" ]
[ "0.65303093", "0.64029217", "0.6397914", "0.6349826", "0.6256274", "0.62372154", "0.62212574", "0.622062", "0.61691844", "0.6090357", "0.6090357", "0.6090357", "0.60714847", "0.60316116", "0.60293823", "0.60241574", "0.60138565", "0.6010591", "0.5894376", "0.5892287", "0.5892255", "0.5880453", "0.58457494", "0.5840991", "0.58362186", "0.581385", "0.5810811", "0.5797528", "0.5717376", "0.5713845", "0.5681064", "0.5635242", "0.5628621", "0.5628621", "0.56165224", "0.55963796", "0.5593467", "0.55917406", "0.55705196", "0.55589694", "0.55467904", "0.5534806", "0.55314505", "0.55256546", "0.55241036", "0.5522385", "0.5521372", "0.5510967", "0.55064857", "0.55063367", "0.55040646", "0.5494675", "0.54840696", "0.54721117", "0.54674757", "0.5465807", "0.54651344", "0.5448793", "0.54323274", "0.5432217", "0.5424583", "0.5420098", "0.5418645", "0.54118043", "0.5409185", "0.54090786", "0.540647", "0.54000354", "0.5394371", "0.53931385", "0.53880304", "0.53800243", "0.5378187", "0.5374379", "0.5374222", "0.53672856", "0.5366811", "0.5364893", "0.5362286", "0.5358615", "0.5349789", "0.5343217", "0.5332815", "0.53296536", "0.5329173", "0.5323907", "0.5322528", "0.53088456", "0.53077817", "0.52934116", "0.52886987", "0.528837", "0.5286188", "0.52708805", "0.5270007", "0.5267142", "0.52640766", "0.52596253", "0.52555287", "0.5251447" ]
0.74063087
0
Execute delayed tasks of the given type
public void runDelayedTasks(Class<? extends Task> taskClass) { log.info("Running delayed tasks..."); serializeExecutionOfTasks(delayedTasks, taskClass); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void executeAsync(long delayMs, Runnable task);", "public abstract void execute(Task t);", "@Override\n public void runTasks() {\n BukkitTask task1 = new BukkitRunnable() {\n long start = 0;\n long now = 0;\n\n @Override\n public void run() {\n start = now;\n now = System.currentTimeMillis();\n long tdiff = now - start;\n\n if (tdiff > 0) {\n instTps = (float) (1000 / tdiff);\n }\n }\n }.runTaskTimer(Aurora.getInstance(), 0, 1);\n\n //Task to populate avgTps\n BukkitTask task2 = new BukkitRunnable() {\n ArrayList<Float> tpsList = new ArrayList<>();\n\n @Override\n public void run() {\n Float totalTps = 0f;\n\n tpsList.add(instTps);\n //Remove old tps after 15s\n if (tpsList.size() >= 15) {\n tpsList.remove(0);\n }\n for (Float f : tpsList) {\n totalTps += f;\n }\n avgTps = totalTps / tpsList.size();\n }\n }.runTaskTimerAsynchronously(Aurora.getInstance(), 20, 20);\n\n //Add to runnables[]\n runnables = new BukkitTask[]{task1, task2};\n }", "public String scheduleAFixedDelayJob(Object instance,\n String methodName,\n Class<?>[] inputTypes,\n Object[] inputParams,\n long initialDelay,\n long taskDelay,\n TimeUnit timeUnit);", "@Override\n public void execute(final Task<T> task, final long wait, final TimeUnit unit) {\n }", "public static void asyncLater(long delay, Run runnable) {\n\t\tnew BukkitRunnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\trunnable.run();\n\t\t\t}\n\t\t}.runTaskLaterAsynchronously(AreaShop.getInstance(), delay);\n\t}", "public static void syncLater(long delay, Run runnable) {\n\t\tnew BukkitRunnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\trunnable.run();\n\t\t\t}\n\t\t}.runTaskLater(AreaShop.getInstance(), delay);\n\t}", "private static Future<?> directExecute(Runnable runnable, long delay) {\n Future<?> future = null;\n if (delay > 0) {\n /* no serial, but a delay: schedule the task */\n if (!(executor instanceof ScheduledExecutorService)) {\n throw new IllegalArgumentException(\"The executor set does not support scheduling\");\n }\n ScheduledExecutorService scheduledExecutorService = (ScheduledExecutorService) executor;\n future = scheduledExecutorService.schedule(runnable, delay, TimeUnit.MILLISECONDS);\n } else {\n if (executor instanceof ExecutorService) {\n ExecutorService executorService = (ExecutorService) executor;\n future = executorService.submit(runnable);\n } else {\n /* non-cancellable task */\n executor.execute(runnable);\n }\n }\n return future;\n }", "protected void executeSleep( String type, FitbitQuery query, ResponseHandler handler ) {\n\t\t\n\t\tDateTime date = query.from( ).withTimeAtStartOfDay( );\n\t\twhile ( date.isBefore( query.to( ) ) ) {\n\t\t\tfor ( String session : getSleepSessions( date.toLocalDate( ) ) ) {\n\t\t\t\tMap<String,String> params = new HashMap<String,String>( );\n\t\t\t\tparams.put( \"arg\", session );\n\t\t\t\texecute( type, date.toLocalDate( ), handler, params );\n\t\t\t}\n\t\t\tdate = date.plusDays( 1 );\n\t\t}\n\t}", "public void executWaiting() {\n for (Runnable action : this.todo) {\n runAction( action );\n }\n }", "@Scheduled(fixedDelay = 3000)\n\tpublic void scheduleTaskWithFixedDelay() {\n\t\tlog.info(\"Fixed Delay Task :: Execution Time - {}\", dateTimeFormatter.format(LocalDateTime.now()));\n\t\t//Sleep TimeUnit\n//\t\ttry {\n//\t\t\tTimeUnit.SECONDS.sleep(5);\n//\t\t} catch (Exception e) {\n//\t\t\tlog.error(\"Ran into an error {}\", e);\n//\t throw new IllegalStateException(e);\n//\t\t}\n\t}", "void scheduleTask(long delay) {\n executorService.schedule(\n backgroundTask, delay, TimeUnit.MILLISECONDS);\n }", "public void execute(EVENT_TYPE type) {\n\n\t\tswitch (type){\n\t\t\tcase DENATURE:\n\t\t\t\tdenature();\n\t\t\t\tbreak;\n\t\t\tcase INFECT:\n\t\t\t\tinfect();\n\t\t\t\tbreak;\n\t\t\tcase SWITCHPHASE:\n\t\t\t\tswitchPhase();\n\t\t\t\tbreak;\n\t\t\tcase SECRETE:\n\t\t\t\tsecrete();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.err.println(\"invalid event type\");\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t}", "public abstract void task();", "@Override\n public boolean isDelayedExecutionSupported()\n {\n return true;\n }", "public void runPendingTasks() {\n/* */ try {\n/* 578 */ this.loop.runTasks();\n/* 579 */ } catch (Exception e) {\n/* 580 */ recordException(e);\n/* */ } \n/* */ \n/* */ try {\n/* 584 */ this.loop.runScheduledTasks();\n/* 585 */ } catch (Exception e) {\n/* 586 */ recordException(e);\n/* */ } \n/* */ }", "abstract void doTaskOnRun();", "public void schedule(Runnable job, long delay, TimeUnit unit);", "private static void executeTask02() {\n }", "@Override\n\tpublic void execute() {\n\t\tif (!Variables.decreaseTask) {\n\t\t\tVariables.decreaseTask = true;\n\t\t} else {\n\t\t\tVariables.taskAmount--;\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Killing npcs\");\n\t\t\n\t\tif (Variables.status != \"Completing task...\") {\n\t\tVariables.status = \"Completing task...\";\n\t\t}\n\t\t\n\t\tNpc[] slayerMonster = Npcs.getNearest(slayerMonsterFilter);\n\n\t\ttry {\n\t\tslayerMonster[0].interact(1);\n\t\t} catch (ArrayIndexOutOfBoundsException | NullPointerException e) {\n\t\t\t\n\t\t} \n\t\t\n\t\tTime.sleep(new SleepCondition() {\n\t\t\t@Override\n\t\t\tpublic boolean isValid() {\n\t\t\t\treturn Players.getMyPlayer().isInCombat();\n\t\t\t}\n\t\t}, 5000);\n\t\t\n\t\tTime.sleep(new SleepCondition() {\n\t\t\t@Override\n\t\t\tpublic boolean isValid() {\n\t\t\t\treturn !Players.getMyPlayer().isInCombat();\n\t\t\t}\n\t\t}, 5000);\n\t}", "public void delayNext()\n {\n\tif (toDo.size() > 1)\n\t {\n\t\tTask t = toDo.get(0);\n\t\ttoDo.set(0, toDo.get(1));\n\t\ttoDo.set(1, t);\n\t }\n }", "public abstract int delay();", "protected void execute() {\n super.execute ();\n \n // processTasks is ordinarily only called when tasks have accumulated\n // in the buffer and the buffer dispatch condition has been met.\n // \n // This ensures that if there are delayed tasks, they are re-examined,\n // whether there's something in the buffer or not.\n //\n // Fix for bug #13455\n\n if (!delayedTasks.isEmpty ()) {\n processTasks (new ArrayList());\n }\n }", "public void run() {\n loadAlertAnimationDelay(aType);\n }", "public void performOtherTasks() {\n\t\t\tSystem.out.println(\"performing tasks other than servicing\");\n\t\t\t// do whatever you want to do in the servicing package\n\t\t}", "@Override\n\tpublic void launchTasks() throws Exception {\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).switchFridgeOn();\n\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t1000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).setOndulatorPolicy(\"default\");\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t1000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).getFridgeTemperature();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t2000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).getBatteryEnergy();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t3000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTaskWithFixedDelay(\t\t\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).controllFridge();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 4000, 1000 // délai entre la fin d'une exécution et la suivante, à modifier \n\t\t\t\t\t\t,TimeUnit.MILLISECONDS) ;\n\t\t\t\t\n\t\t\t\tthis.scheduleTaskWithFixedDelay(\t\t\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).getEPConsommation();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000, 4000 // délai entre la fin d'une exécution et la suivante, à modifier \n\t\t\t\t\t\t,TimeUnit.MILLISECONDS) ;\n\t}", "void restartEventsWithDelay(final boolean longDelay, final boolean alsoRescan, final boolean unblockEventsRun,\n final int logType)\n {\n if (longDelay) {\n\n Data workData = new Data.Builder()\n .putBoolean(PhoneProfilesService.EXTRA_ALSO_RESCAN, alsoRescan)\n .putBoolean(PhoneProfilesService.EXTRA_UNBLOCK_EVENTS_RUN, unblockEventsRun)\n .putInt(PhoneProfilesService.EXTRA_LOG_TYPE, logType)\n .build();\n\n OneTimeWorkRequest restartEventsWithDelayWorker;\n restartEventsWithDelayWorker =\n new OneTimeWorkRequest.Builder(RestartEventsWithDelayWorker.class)\n .addTag(RestartEventsWithDelayWorker.WORK_TAG_2)\n .setInputData(workData)\n .setInitialDelay(15, TimeUnit.SECONDS)\n .build();\n try {\n if (PPApplicationStatic.getApplicationStarted(true, true)) {\n WorkManager workManager = PPApplication.getWorkManagerInstance();\n if (workManager != null) {\n\n// //if (PPApplicationStatic.logEnabled()) {\n// ListenableFuture<List<WorkInfo>> statuses;\n// statuses = workManager.getWorkInfosForUniqueWork(RestartEventsWithDelayWorker.WORK_TAG);\n// try {\n// List<WorkInfo> workInfoList = statuses.get();\n// } catch (Exception ignored) {\n// }\n// //}\n\n// PPApplicationStatic.logE(\"[WORKER_CALL] DataWrapper.restartEventsWithDelay\", \"xxx\");\n //workManager.enqueue(restartEventsWithDelayWorker);\n //if (replace)\n workManager.enqueueUniqueWork(RestartEventsWithDelayWorker.WORK_TAG_2, ExistingWorkPolicy.REPLACE, restartEventsWithDelayWorker);\n //else\n // workManager.enqueueUniqueWork(RestartEventsWithDelayWorker.WORK_TAG_APPEND, ExistingWorkPolicy.APPEND_OR_REPLACE, restartEventsWithDelayWorker);\n }\n }\n } catch (Exception e) {\n PPApplicationStatic.recordException(e);\n }\n } else {\n// PPApplicationStatic.logE(\"[EXECUTOR_CALL] ***** DataWrapper.restartEventsWithDelay\", \"schedule\");\n\n final Context appContext = context.getApplicationContext();\n //final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();\n Runnable runnable = () -> {\n// long start = System.currentTimeMillis();\n// PPApplicationStatic.logE(\"[IN_EXECUTOR] ***** DataWrapper.restartEventsWithDelay\", \"--------------- START\");\n\n PowerManager powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE);\n PowerManager.WakeLock wakeLock = null;\n try {\n if (powerManager != null) {\n wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, PPApplication.PACKAGE_NAME + \":DataWrapper_restartEventsWithDelay\");\n wakeLock.acquire(10 * 60 * 1000);\n }\n\n //PPExecutors.doRestartEventsWithDelay(alsoRescan, unblockEventsRun, logType, context);\n\n DataWrapper dataWrapper = new DataWrapper(appContext, false, 0, false, 0, 0, 0f);\n if (logType != PPApplication.ALTYPE_UNDEFINED)\n PPApplicationStatic.addActivityLog(appContext, logType, null, null, \"\");\n //dataWrapper.restartEvents(unblockEventsRun, true, true, false);\n dataWrapper.restartEventsWithRescan(alsoRescan, unblockEventsRun, false, false, true, false);\n //dataWrapper.invalidateDataWrapper();\n\n\n// long finish = System.currentTimeMillis();\n// long timeElapsed = finish - start;\n// PPApplicationStatic.logE(\"[IN_EXECUTOR] ***** DataWrapper.restartEventsWithDelay\", \"--------------- END - timeElapsed=\"+timeElapsed);\n } catch (Exception e) {\n// PPApplicationStatic.logE(\"[IN_EXECUTOR] PPApplication.startHandlerThread\", Log.getStackTraceString(e));\n PPApplicationStatic.recordException(e);\n } finally {\n if ((wakeLock != null) && wakeLock.isHeld()) {\n try {\n wakeLock.release();\n } catch (Exception ignored) {\n }\n }\n //worker.shutdown();\n }\n };\n PPApplicationStatic.createDelayedEventsHandlerExecutor();\n PPApplication.delayedEventsHandlerExecutor.schedule(runnable, 5, TimeUnit.SECONDS);\n }\n }", "void executeStraight(Runnable task);", "abstract void execute(TaskList tasks, Ui ui, Storage storage) throws IOException;", "@Override\n public void execute() {\n Time.sleep(3000);\n Starting.execute();\n }", "@SneakyThrows public void modifyTempflyDuration(TempflyTask type, long duration) {\n switch (type) {\n case ADD:\n tempflyTimer.addTimeLeft(duration);\n break;\n case REMOVE:\n tempflyTimer.addElapsedTime(duration);\n break;\n case SET:\n tempflyTimer.setTotalTime(duration);\n break;\n case DISABLE:\n tempflyTimer.reset();\n break;\n default:\n break;\n }\n\n // Start if always running/currently flying\n if (type != TempflyTask.REMOVE\n && (Timer.alwaysDecrease\n || getPlayer().isFlying())) {\n tempflyTimer.start();\n }\n\n // Prevent NPE for data migration\n if (data != null) {\n data.set(\"tempfly\", tempflyTimer.getTimeLeft());\n data.save(dataFile);\n }\n }", "private void onComplete(int duration) {\n\t\t\n\t\tservice = Executors.newSingleThreadExecutor();\n\n\t\ttry {\n\t\t Runnable r = new Runnable() {\n\t\t @Override\n\t\t public void run() {\n\t\t // Database task\n\t\t \tcontrollerVars.setPlays(false);\n\t\t }\n\t\t };\n\t\t Future<?> f = service.submit(r);\n\n\t\t f.get(duration, TimeUnit.MILLISECONDS); // attempt the task for two minutes\n\t\t}\n\t\tcatch (final InterruptedException e) {\n\t\t // The thread was interrupted during sleep, wait or join\n\t\t}\n\t\tcatch (final TimeoutException e) {\n\t\t // Took too long!\n\t\t}\n\t\tcatch (final ExecutionException e) {\n\t\t // An exception from within the Runnable task\n\t\t}\n\t\tfinally {\n\t\t service.shutdown();\n\t\t}\t\t\n\t}", "ScheduledFuture<?> scheduleTask(long delay, Runnable runnable) {\n return timeoutTaskExecutor.schedule(runnable, delay, TimeUnit.MILLISECONDS);\n }", "protected abstract void afterWait();", "public <T> ValueFuture<T> schedule(Callable<T> job, long delay, TimeUnit unit);", "private void makeDelayedTask(final Player player, final Player recipient, final double amountToHeal,\n\t\t\t\t\t\t\t\t final String item, final String profession, final Location playerLoc,\n\t\t\t\t\t\t\t\t final Location recipientLoc)\n\t{\n\t\tplugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() \n\t\t{\n\t\t\tpublic void run() \n\t\t\t{\t\t\t\t\n\t\t\t\t//Check that the player is still in roughly the same location\n\t\t\t\tif (Math.abs(player.getLocation().getX() - playerLoc.getX()) > 1\n\t\t\t\t\t\t|| Math.abs(player.getLocation().getY() - playerLoc.getY()) > 1\n\t\t\t\t\t\t|| Math.abs(player.getLocation().getZ() - playerLoc.getZ()) > 1)\n\t\t\t\t{\n\t\t\t\t\tplayer.sendMessage(ChatColor.YELLOW + \"You cannot move while bandaging!\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tString name = player.getCustomName();\n\t\t\t\tif (name == null)\n\t\t\t\t\tname = player.getName();\n\t\t\t\t\n\t\t\t\t//Check that the recipient is still in roughly the same location\n\t\t\t\t//Skip if self-heal\n\t\t\t\tif (!player.equals(recipient))\n\t\t\t\t\tif (Math.abs(recipient.getLocation().getX() - recipientLoc.getX()) > 1\n\t\t\t\t\t\t|| Math.abs(recipient.getLocation().getY() - recipientLoc.getY()) > 1\n\t\t\t\t\t\t|| Math.abs(recipient.getLocation().getZ() - recipientLoc.getZ()) > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayer.sendMessage(ChatColor.YELLOW + \"You cannot bandage your patient while they are moving!\");\n\t\t\t\t\t\trecipient.sendMessage(ChatColor.YELLOW + name + \" cannot bandage you while you are moving!\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Remove item from player's inventory.\n\t \t\tplayer.getInventory().removeItem(new ItemStack(Material.getMaterial(item.toUpperCase()), 1));\n\t \t\tplayer.updateInventory();\n\t \t\t\t\n\t \t\t//Heal the other player.\n\t \t\trecipient.setHealth(recipient.getHealth() + amountToHeal);\n\n\t \t\t//Award experience.\n\t \t\tProfessionStats prof = new ProfessionStats(perms, data, config, player.getUniqueId());\n\t \t\t\n\t \t\tif (!prof.isPracticeFatigued(profession))\n\t \t\t\taddExperience(player, profession, config.getInt(\"healing.\" + item + \".exp\"));\n\t \t\t\t\n\t \t\t//Notify both parties.\n\t \t\tif (!player.equals(recipient))\n\t \t\t{\t \t\t\n\t \t\t\tplayer.sendMessage(ChatColor.YELLOW + \"You bandaged \" + recipient.getName() + \"'s wounds.\");\n\t \t\t\trecipient.sendMessage(ChatColor.YELLOW + player.getName() + \" bandaged your wounds.\");\n\t \t\t}\n\t \t\telse\n\t \t\t\tplayer.sendMessage(ChatColor.YELLOW + \"You bandaged your wounds.\");\n\t\t\t }\n\t\t\t}, 20);\n\t}", "private void async(Runnable runnable) {\n Bukkit.getScheduler().runTaskAsynchronously(KitSQL.getInstance(), runnable);\n }", "public void scheduleTask(Class<? extends TransactionalTask> taskType) {\n checkTransactionalAnnotation(taskType);\n final TransactionalTask task = injector.getInstance(taskType);\n task.setWorker(this);\n tasks.add(task);\n }", "@Override\r\n public void exec(String className, int[] sound) {\r\n TaskRequester requester = taskRequesterMap.get(className);\r\n if (requester != null) {\r\n try {\r\n requester.getTask().exec(sound);\r\n } catch (RemoteException e) {\r\n Log.e(TAG, e.getMessage());\r\n }\r\n } else {\r\n Log.e(TAG, \"No task requester for \"+className);\r\n }\r\n }", "public interface TaskBase {\n public void executeTask();\n\n}", "@Override\r\n\tpublic List<ExecuteTask> getByType(String taskType) {\n\t\tString sql = \"SELECT et_id id,et_member_id memberId,et_task_id taskId,et_comments comments FROM executetask \"\r\n\t\t\t\t+ \"WHERE et_task_id IN(SELECT task_id FROM task WHERE task_type = ?)\";\r\n\t\treturn getForList(sql,taskType);\r\n\t}", "private void runPeriodic() {\n boolean ok = ScheduledFutureTask.super.runAndReset();\n boolean down = isShutdown();\n // Reschedule if not cancelled and not shutdown or policy allows\n if (ok && !down) {\n updateNextExecutionTime();\n MeasurableScheduler.super.getQueue().add(this);\n }\n // This might have been the final executed delayed\n // task. Wake up threads to check.\n else if (down)\n interruptIdleWorkers();\n }", "abstract void run(TaskList tasks, MainWindow ui, Storage storage);", "public void run() {\n long start = System.nanoTime();\n try {\n activeCount.inc();\n long delay = start - nextExecutionTime;//实践执行时间-理论应该执行的实际点\n taskExecutionDelay.record(delay, TimeUnit.NANOSECONDS);\n // real logic\n if (isPeriodic())\n runPeriodic();\n else\n ScheduledFutureTask.super.run();\n } finally {\n activeCount.dec();\n taskExecutionTime.record(System.currentTimeMillis() - start, TimeUnit.MILLISECONDS);\n }\n }", "public void doTask(Entity e) {\r\n\t\tif (getTask().equals(\"heal\")) {\r\n\t\t\tRandom rand = new Random();\r\n\t\t\tint healing = rand.nextInt(50) + 1;\r\n\t\t\tif (getNumTasks() > 0) {\r\n\t\t\t\tuseTask();\r\n\t\t\t\tif (Jedi.class.isInstance(e)) {\r\n\t\t\t\t\tJedi healMe = (Jedi) e;\r\n\t\t\t\t\thealMe.heal(healing);\r\n\t\t\t\t} else if (Rebel.class.isInstance(e)) {\r\n\t\t\t\t\tRebel healMe = (Rebel) e;\r\n\t\t\t\t\thealMe.heal(healing);\r\n\t\t\t\t}\r\n\t\t\t\tSystem.out.println(\"Medical droid heals \" + e.getName()\r\n\t\t\t\t\t\t+ \" with \" + healing + \" hp.\");\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out\r\n\t\t\t\t\t\t.println(\"Medical Droid \"\r\n\t\t\t\t\t\t\t\t+ getName()\r\n\t\t\t\t\t\t\t\t+ \" has run out of number of tasks available to perform.\");\r\n\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tSystem.out.println(\"Medical Droid \" + getName()\r\n\t\t\t\t\t+ \" has no tasks upon which to perform.\");\r\n\t\t}\r\n\t}", "@Override\r\n\tvoid execute(Runnable task);", "public interface Task {\n void execute() ;\n}", "public void updateTimedTasks() {\n if (TimedEventQueue.validTask(this)) {\n String action = TimedEventQueue.getTask().getAction();\n if (action.equals(\"gravityCancelOver\")) {\n this.gravityCancel = false;\n this.yVel = 0;\n } else if (action.equals(\"dodgeCoolDownOver\")) {\n this.dodgeCoolDown = false;\n } else if (action.equals(\"breakSpecialState\")) {\n this.breakSpecialState();\n } else if (action.equals(\"activeAttackState\")) {\n this.activeAttackState = true;\n } else if (action.equals(\"activeAttackStateOver\")) {\n this.activeAttackState = false;\n } else if (action.equals(\"heavySideSpeedUp\")) {\n this.setxTargetSpeed(Util.scaleX(25));\n } else if (action.equals(\"resetXMovement\")) {\n this.resetXMovement();\n }\n } \n }", "public void execute(int messageType) {\n if (messageType == 1) {\n removeCallbacksAndMessages(null);\n sendEmptyMessage(1);\n }\n }", "@Scheduled(fixedDelay=5000) //indicamos que esta tarea se repetira cada 5 segundos \n\tpublic void doTask() {\n\t\tLOGGER.info(\"Time is: \"+ new Date());\n\t}", "public String scheduleAOneTimeJob(Object instance,\n String methodName,\n Class<?>[] inputTypes,\n Object[] inputParams,\n long initialDelay,\n TimeUnit timeUnit);", "public synchronized void execute() {\n\t\tthis.timeoutFuture = SCHEDULER.schedule(this::processTimeout, 5, TimeUnit.SECONDS);\n\t\tthis.statuses.put(this.localNode.getInfo(), NodeStatus.Unasked);\n\t\tcheckFinishAndProcess();\n\t}", "@Override\r\n\tpublic List<ExecuteTask> getByTypeByTime(String taskType, String time1, String time2) {\n\t\tString sql = \"SELECT et_id id,et_member_id memberId,et_task_id taskId,et_comments comments FROM executetask\"\r\n\t\t\t\t+ \" WHERE et_task_id IN(SELECT task_id FROM task WHERE task_type = ? AND \"\r\n\t\t\t\t+ \" task_start_time >= ? AND task_start_time <= ?)\";\r\n\t\treturn getForList(sql,taskType,time1,time2);\r\n\t}", "public String getType() {\n return \"Task\";\n }", "private void scheduledTask() {\n connectToNewViews();\n removeDisconnectedViews();\n try {\n Thread.sleep(SCHEDULED_TASK_PERIOD);\n // Scheduling future execution\n\n synchronized (threadPool) {\n if (!threadPool.isShutdown()) {\n threadPool.execute(this::scheduledTask);\n }\n }\n } catch (InterruptedException e) {\n Thread.currentThread().interrupt();\n }\n }", "protected abstract void doAfter(T result);", "public <T> List<T> massExec(Callable<? extends T> task);", "@Override\r\n\tpublic void doTask() {\n\t}", "void scheduleGarbageCollection(GCType type, long delay);", "@Override\n public void execute(TaskList tasks, Storage storage) throws DukeException {\n this.task = tasks.doneTask(storage, this.index);\n }", "private void startrun() {\n mHandler.postDelayed(mPollTask, POLL_INTERVAL);\n\t}", "public void upLoad(NubisDelayedAnswer delayedAnswer, boolean wait, int deleteId, int communicationType) {\n try {\n NubisHTTP httpCom = new NubisHTTP(this, delayedAnswer, null, deleteId, communicationType, settings);\n if (wait) {\n httpCom.serverInstructions = \"\";\n httpCom.execute(); //doInBackground();//.get(210000, TimeUnit.MILLISECONDS);\n\n HTTPReturnString = httpCom.serverInstructions;\n\n } else {\n httpCom.execute();\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "@Override\n public void execute(final Task<T> task) {\n }", "public void calibrateAndRunTask(){\n calibrateMaxConcurrentActions();\n\n runTasks();\n }", "@Test\n public void testInvokeEffectorStartFailing_MethodInDynamicTask() {\n Task<Void> task = app.getExecutionContext().submit(Tasks.<Void>builder().dynamic(true).body(new Callable<Void>() {\n @Override public Void call() throws Exception {\n testInvokeEffectorStartFailing_Method();\n return null;\n }\n }).build());\n \n assertTaskSucceeds(task);\n assertTaskHasFailedChild(task);\n }", "void schedule(long delay, TimeUnit unit) {\r\n\t\tthis.delay = delay;\r\n\t\tthis.unit = unit;\r\n\t\tif (monitor != null) {\r\n\t\t\tmonitor.cancel(false);\r\n\t\t\tmonitor = pool.scheduleWithFixedDelay(sync, delay, delay, unit);\r\n\t\t}\r\n\t}", "protected abstract void scheduleSuspicions();", "public abstract List<T1> executeBlocking();", "public static void launchTask(Task tsk)\n {\n getInstance().doExecute(tsk);\n }", "DurationTracker timeSpentTaskWait();", "public String createTask(JSONRequest request, long delay, boolean interval, boolean sequential);", "public abstract void onWait();", "public void updateTask() {}", "String getAsyncDelayedRedelivery();", "public interface Task<T> {\n T execute();\n}", "public static void main(String[] args) {\n\n ScheduledExecutorService service = Executors.newScheduledThreadPool(4);\n\n //task to run after 10 seconds delay\n service.schedule(new Task(), 10, TimeUnit.SECONDS);\n\n //task to repeatedly every 10 seconds\n service.scheduleAtFixedRate(new Task(), 15, 10, TimeUnit.SECONDS);\n\n //task to run repeatedly 10 seconds after previous task completes\n service.scheduleWithFixedDelay(new Task(), 15, 10, TimeUnit.SECONDS);\n\n\n for (int i = 0; i < 100; i++) {\n System.out.println(\"task number - \" + i + \" \");\n service.execute(new Task());\n }\n System.out.println(\"Thread name: \" + Thread.currentThread().getName());\n\n }", "public void addTask(String type, String name) {\n Task taskToAdd = new Task(type, name);\n storage.add(taskToAdd);\n if (taskToAdd.hasDate()) {\n if (!dateStorage.containsKey(taskToAdd.getDate())) {\n dateStorage.put(taskToAdd.getDate(), new ArrayList<>());\n }\n dateStorage.get(taskToAdd.getDate()).add(taskToAdd);\n }\n taskAdded(taskToAdd, storage);\n }", "void executeCallbacks(CallbackType callbackType) {\n System.out.println(\"Executing callbacks: \" + callbackType);\n List<Method> methods = callbacks.get(callbackType);\n if (methods == null) return;\n for (Method m : methods) {\n try {\n m.setAccessible(true);\n m.invoke(this);\n } catch (IllegalAccessException e) {\n throw new ActiveRecordException(e);\n } catch (InvocationTargetException e) {\n throw new ActiveRecordException(e);\n } finally {\n m.setAccessible(false);\n }\n }\n }", "public abstract void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException;", "public void actions() {\n\t\t\tProvider p = array_provider[theTask.int_list_providers_that_tried_task.get(0)];\n\t\t\t\n\t\t\t//there is a percentage of probability that the user will fail to complete the task\n\t\t\tif(random.draw((double)PERCENTAGE_TASK_FAILURE/100)){ // SUCCESS\n\n\t\t\t\ttot_success_tasks++;\n\t \tthrough_time += time() - theTask.entryTime;\n\t\t\t\ttheTask.out();\n\t\t\t\t\n\t\t\t\tif(FIXED_EARNING_FOR_TASK) earning_McSense = earning_McSense + FIXED_EARNING_VALUE;\n\t\t\t\telse {\n\n\t\t\t\t\t//Provider p = (Provider) theTask.providers_that_tried_task.first();\n\t\t\t\t\tearning_McSense = earning_McSense + (p.min_price*PERCENTAGE_EARNING)/100;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\t\t\telse { // FAILURE\n\t\t\t\t//we should check again and if the check fails insert the task in rescheduled_waiting\n\t\t\t\ttheTask.into(taskrescheduled);\n\t\t\t\ttot_failed_tasks++;\n\t\t\t\t//new StartTaskExecution(theTask).schedule(time());\n\n\t\t\t}\n\t\t\t// the provider frees one slot\n\t\t\tp.number_of_task_executing--;\n\t\t\ttot_scheduled_completed_in_good_or_bad_tasks++;\n\n \t}", "public static void aroundForTime(Task t, long time) {\n\t\ttry {\n\t\t\tThread.sleep(time);\n\t\t\tt.complete();\n\t\t\tThread.sleep(time);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private TaskType getType(String type) {\r\n\t\tfor (TaskType tt : taskTypes) {\r\n\t\t\tif (tt.name.equals(type))\r\n\t\t\t\treturn tt;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "private void scheduleDriver(Order order) {\n val pickupTask = newPickupTask(this, order.getId());\n driverDepot.schedulePickup(pickupTask, order);\n }", "public void show(int delayTime) {\n\n new Handler().postDelayed(new Runnable() {\n @Override\n public void run() {\n switch (mType) {\n case TYPE_First:\n mNewbieGuide.addIndicateImg(R.mipmap.guide_right,\n ScreenUtils.dpToPx(mActivity, -50),\n ScreenUtils.dpToPx(mActivity, 110))\n .addMessage(mActivity.getString(R.string.switch_map),\n ScreenUtils.dpToPx(mActivity, -40)\n ,ScreenUtils.dpToPx(mActivity, 130))\n .addIndicateImg(R.mipmap.guide_left,\n ScreenUtils.dpToPx(mActivity,60),\n ScreenUtils.dpToPx(mActivity,40))\n .addMessage(mActivity.getString(R.string.open_menu),\n ScreenUtils.dpToPx(mActivity,85),\n ScreenUtils.dpToPx(mActivity,60)).show();\n\n break;\n\n case TYPE_TWICE:\n mNewbieGuide.addIndicateImg(R.mipmap.guide_right2,\n ScreenUtils.dpToPx(mActivity, -50),\n ScreenUtils.dpToPx(mActivity, -170))\n\n .addMessage(mActivity.getString(R.string.see_the_history),\n ScreenUtils.dpToPx(mActivity, -50),\n ScreenUtils.dpToPx(mActivity,-185)).\n\n addIndicateImg(R.mipmap.guide_down,\n ScreenUtils.dpToPx(mActivity,-105),\n ScreenUtils.dpToPx(mActivity,-135))\n\n .addMessage(mActivity.getString(R.string.navigate_to_the_watch),\n ScreenUtils.dpToPx(mActivity,-115),\n ScreenUtils.dpToPx(mActivity,-160)).show();\n break;\n\n case TYPE_THIRD:\n mNewbieGuide.addIndicateImg(R.mipmap.guide_right2,\n ScreenUtils.dpToPx(mActivity, -50),\n ScreenUtils.dpToPx(mActivity,-230))\n .addMessage(\"设置安全区域\",\n ScreenUtils.dpToPx(mActivity,-50),\n ScreenUtils.dpToPx(mActivity,-250))\n .addIndicateImg(R.mipmap.guide_down,\n ScreenUtils.dpToPx(mActivity, -50),\n ScreenUtils.dpToPx(mActivity, -130))\n .addMessage(\"立即刷新位置\",\n ScreenUtils.dpToPx(mActivity, -50),\n ScreenUtils.dpToPx(mActivity,-155))\n .show();\n }\n }\n }, delayTime);\n }", "private static void taskProcess(String input)\r\n\t{\r\n\t\tswitch (input.toUpperCase())\r\n\t\t{\r\n\t\t\tcase CREATE:\r\n\t\t\t{\r\n\t\t\t\tPostTaskService postTask = new PostTaskService();\r\n\t\t\t\tpostTask.createTask();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tcase GET:\r\n\t\t\t{\r\n\t\t\t\tGetTaskService getTask = new GetTaskService();\r\n\t\t\t\tList<Task> taskList = getTask.getAllTasks();\r\n\t\t\t\tTaskSchedulerUtil.getInstance().printTasks(taskList);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tcase START:\r\n\t\t\t{\r\n\t\t\t\tStartTaskService startTask = new StartTaskService();\r\n\t\t\t\tstartTask.startTask();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tcase END:\r\n\t\t\t{\r\n\t\t\t\tEndTaskService endTask = new EndTaskService();\r\n\t\t\t\tendTask.endTask();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void loadEvent(String type) {\n String description = parser.parseDeadlineEventDescription(type);\n String timeString = parser.parseDateTimeEvent(type);\n LocalDate time = LocalDate.parse(timeString,\n DateTimeFormatter.ofPattern(\"dd/MM/yyyy\"));\n Task toAdd = new Event(description, time);\n if (type.contains(\"\\u2713\")) {\n toAdd.markAsDone();\n }\n tasks.add(toAdd);\n }", "private void sendAsyncEvent(double event_type) {\n\t\tint dsMapIndex = RunnerJNILib.jCreateDsMap(null, null, null);\n\t\tRunnerJNILib.DsMapAddString( dsMapIndex, \"type\", \"kidoz_sdk\" );\n\t\tRunnerJNILib.DsMapAddDouble( dsMapIndex, \"event_type\", event_type);\n\t\tRunnerJNILib.CreateAsynEventWithDSMap(dsMapIndex, EVENT_OTHER_SOCIAL);\n\t}", "@Override\n public void addTasksToRun() {\n //gets the tasks that are ready for execution from the list with new tasks\n List<Task> collect = tasks.stream().filter((task) -> (task.getDate() == TIME))\n .collect(Collectors.toList());\n //sort the tasks inserted. The sort is based in \"priority\" value for all the tasks.\n collect.sort(new Comparator<Task>() {\n @Override\n public int compare(Task o1, Task o2) {\n return o1.getPriority() - o2.getPriority();\n }\n });\n //Change the status of tasks for READY\n collect.stream().forEach((task) -> {\n task.setStatus(Task.STATUS_READY);\n });\n //Adds the tasks to the queue of execution\n tasksScheduler.addAll(collect);\n\n //Removes it from list of new tasks\n tasks.removeAll(collect);\n }", "private void delay() {\n\t\tDelay.msDelay(1000);\n\t}", "@Override\n\tpublic void execute() {\n\t\tThreadPool pool=ThreadPool.getInstance();\n\t\tpool.beginTaskRun(this);\n\t}", "public final void execute() {\n\t\tLogUtils.i(TAG, \"execute\");\n\t\tpurelySetState(TaskState.Preparing);\n\t\tTaskQueue.addTask(this);\n\t}", "public long runScheduledPendingTasks() {\n/* */ try {\n/* 597 */ return this.loop.runScheduledTasks();\n/* 598 */ } catch (Exception e) {\n/* 599 */ recordException(e);\n/* 600 */ return this.loop.nextScheduledTask();\n/* */ } \n/* */ }", "public TaskReturnType Run();", "private Task getTask(int tasktype, UserInfo userInfo){\n switch(tasktype){\n case Task.TASK_TYPE_BACKUP_CELLLOG:\n return new BackupCallLogTask(mContext, userInfo, BaseTask.TASK_BASETYPE_BACKUP);\n case Task.TASK_TYPE_RESTORE_CALLLOG:\n return new BackupCallLogTask(mContext, userInfo, BaseTask.TASK_BASETYPE_RESTORE);\n case Task.TASK_TYPE_BACKUP_CONTACTS:\n return new BackupContactsTask(mContext, userInfo, BaseTask.TASK_BASETYPE_BACKUP);\n case Task.TASK_TYPE_RESTORE_CONTACTS:\n return new BackupContactsTask(mContext, userInfo, BaseTask.TASK_BASETYPE_RESTORE);\n case Task.TASK_TYPE_BACKUP_SMS:\n return new BackupSmsTask(mContext, userInfo, BaseTask.TASK_BASETYPE_BACKUP);\n case Task.TASK_TYPE_RESTORE_SMS:\n return new BackupSmsTask(mContext, userInfo, BaseTask.TASK_BASETYPE_RESTORE);\n }\n return null;\n }", "void retry(Task task);", "public TaskAdapter(java.lang.String taskType, java.lang.Object worker) throws org.apache.ant.common.util.ExecutionException {\n this.worker = worker;\n try {\n java.lang.Class workerClass = worker.getClass();\n executeMethod = workerClass.getMethod(\"execute\", new java.lang.Class[0]);\n if (executeMethod == null) {\n throw new org.apache.ant.common.util.ExecutionException(((\"No execute method in the class\" + \" for the <\") + taskType) + \"> task.\");\n }\n } catch (java.lang.NoSuchMethodException e) {\n throw new org.apache.ant.common.util.ExecutionException(e);\n }\n }", "public void runSerial(List<Callable<?>> tasks) {\n\t\tfor (Callable<?> t : tasks) {\n\t\t\ttry {\n\t\t\t\tt.call();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t}", "private void invokePostRefreshTasks(boolean success) {\r\n Vector tasksToRun = null;\r\n \r\n synchronized(postRefreshTasks) {\r\n int size = postRefreshTasks.size();\r\n if(size > 0) {\r\n tasksToRun = new Vector(size);\r\n for(int i=0; i<size; i++) {\r\n Object[] element = (Object[])postRefreshTasks.elementAt(i);\r\n // Add the task if the refresh was successful, or if the\r\n // task does not depend on a successful refresh.\r\n if(success || !((Boolean)element[1]).booleanValue()) {\r\n tasksToRun.addElement((Runnable)element[0]);\r\n }\r\n }\r\n postRefreshTasks.removeAllElements();\r\n }\r\n }\r\n \r\n if(tasksToRun != null) {\r\n int size = tasksToRun.size();\r\n for(int i=0; i<size; i++) {\r\n mailStoreServices.invokeLater((Runnable)tasksToRun.elementAt(i));\r\n }\r\n }\r\n }", "public static void LaunchFirework(final Location spawnLocation, final FireworkEffect.Type type, final int power, final Color color, final int launchdelay, final int detonatedelay) {\n final ArrayList<Color> colors = new ArrayList<>();\n\t\tcolors.add(color);\n\t\t\n\t\tLaunchFirework(spawnLocation, type, power, colors, colors, true, true, launchdelay, detonatedelay);\n\t}", "public void execute() {\r\n\r\n\t\t// Fetch the 10 records from DB\r\n\t\t// Iterate over them\r\n\t\t// Fetch the ImageActionObject\r\n\t\t// Get the first task to work on\r\n\t\t// Inastantiate the task by ImageActionTaskFactory.getImageActionTask\r\n\t\t// Set the ImageActionObject\r\n\t\t// Submit the task to the executor\r\n\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(\r\n\t\t\t\t\"dd/MM/yyyy HH:mm:ss\");\r\n\t\tlog.info(\"*** Executing poller at : \" + dateFormat.format(new Date()));\r\n\t\tList<ImageActionObject> incompleteImageActionObjects = new ArrayList<ImageActionObject>();\r\n\t\t// Fetching the 10 records from DB\r\n\t\ttry {\r\n\t\t\tincompleteImageActionObjects = imageActionImpl\r\n\t\t\t\t\t.searchIncompleteImageAction(5);\r\n\t\t\tlog.debug(\"*** Got \" + incompleteImageActionObjects.size()\r\n\t\t\t\t\t+ \" to process\");\r\n\t\t} catch (DbException e) {\r\n\t\t\t// TODO Handle Error\r\n\t\t\tlog.error(\"searchIncompleteImageAction failed\", e);\r\n\t\t}\r\n\t\t// iterate over list of image action objects\r\n\t\tlog.debug(\"incompleteImageActionObjects::\"\r\n\t\t\t\t+ incompleteImageActionObjects);\r\n\r\n\t\tfor (ImageActionObject imageActionObj : incompleteImageActionObjects) {\r\n\t\t\tlog.info(\"ImageAction Object in poller (\" + imageActionObj.getId()\r\n\t\t\t\t\t+ \"): Number of tasks: \"\r\n\t\t\t\t\t+ imageActionObj.getActions().size());\r\n\t\t\tlog.info(\"Current status of image action object:\"\r\n\t\t\t\t\t+ imageActionObj.getCurrent_task_status());\r\n\t\t\t\r\n\t\t\tif(imageActionToRunCountMap.containsKey(imageActionObj.getId())){\r\n\t\t\t\tInteger currentCount = imageActionToRunCountMap.get(imageActionObj.getId());\r\n\t\t\t\tif(currentCount < 10){\r\n\t\t\t\t\taddEntryFromImageActionCountMap(imageActionObj.getId(), ++currentCount);\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//mark error\r\n\t\t\t\t\tlog.info(\"mark image action {} to error after 10 tries\", imageActionObj.getId());\r\n\t\t\t\t\timageIdsInProcess.remove(imageActionObj.getImage_id());\r\n\t\t\t\t\timageActionObj.setCurrent_task_status(Constants.ERROR);\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tpersistService.updateImageAction(imageActionObj);\r\n\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t} catch (DbException e) {\r\n\t\t\t\t\t\tlog.error(\"Error in Poller\",e);\r\n\t\t\t\t\t}\t\r\n\t\t\t\t\tfinally{\r\n\t\t\t\t\t\tremoveEntryFromImageActionCountMap(imageActionObj.getId());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}else{\t\t\t\t\r\n\t\t\t\taddEntryFromImageActionCountMap(imageActionObj.getId(), 1);\r\n\t\t\t}\r\n\r\n\t\t\tif (imageIdsInProcess.contains(imageActionObj.getImage_id())) {\r\n\t\t\t\tlog.info(\"Image already in process. Skipping\");\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\timageIdsInProcess.add(imageActionObj.getImage_id());\r\n\r\n\t\t\tif (imageActionObj.getCurrent_task_status() != null\r\n\t\t\t\t\t&& imageActionObj.getCurrent_task_status().equals(\r\n\t\t\t\t\t\t\tConstants.INCOMPLETE)) {\r\n\t\t\t\tExecuteActions task = new ExecuteActions(imageActionObj);\r\n\t\t\t\tImageActionExecutor.submitTask(task);\r\n\t\t\t\tlog.info(\"Submitted task for ExecuteActions for id: \"\r\n\t\t\t\t\t\t+ imageActionObj.getId());\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}" ]
[ "0.62470347", "0.5657479", "0.555443", "0.5553281", "0.5520438", "0.54860175", "0.5485451", "0.5475089", "0.5467169", "0.53451544", "0.5341717", "0.5332392", "0.5310486", "0.53068984", "0.5297709", "0.52960724", "0.52876544", "0.52531976", "0.5232297", "0.5226146", "0.5212341", "0.52092797", "0.51919097", "0.5148899", "0.51295745", "0.5127283", "0.5113758", "0.5103582", "0.5079518", "0.5052751", "0.5031159", "0.50136685", "0.5011326", "0.50092447", "0.50060064", "0.49886602", "0.4981382", "0.49748847", "0.4974165", "0.49687394", "0.4959483", "0.49480793", "0.49424243", "0.49354097", "0.49094635", "0.49082953", "0.49057436", "0.49052405", "0.49050418", "0.4902224", "0.48875347", "0.4882161", "0.48668057", "0.4866371", "0.48462474", "0.48332173", "0.48199144", "0.48195237", "0.48187253", "0.4818093", "0.481776", "0.48102248", "0.4806278", "0.47881588", "0.47864658", "0.47783595", "0.47780472", "0.4767657", "0.4750087", "0.4747219", "0.47457528", "0.473817", "0.47367996", "0.47319937", "0.4727258", "0.4725101", "0.47213846", "0.47085294", "0.47051874", "0.47048795", "0.469671", "0.46926925", "0.46836627", "0.46720994", "0.46704835", "0.4669439", "0.46688962", "0.4666826", "0.46620315", "0.4661242", "0.46599394", "0.4656989", "0.46500823", "0.4647801", "0.46428847", "0.46421638", "0.46389207", "0.46359995", "0.46348283", "0.46285695" ]
0.6177811
1
Serialize the execution of all tasks in the queue. If one tasks create a new task, it will be executed too. This method will return when the tasks list is empty
public void serializeExecutionOfTasks(Collection<Task> tasks, Class<? extends Task> taskClass) { int tasksRun = 1; while (tasksRun > 0) { tasksRun = 0; for (Iterator<Task> it = tasks.iterator(); it.hasNext(); ) { int attempts = 0; Task t = it.next(); while (true) { try { if (taskClass.isAssignableFrom(t.getClass())) { tasksRun++; run(t); it.remove(); } break; } catch (RuntimeException e) { if (attempts++ >= retries) { throw e; } log.error(e.toString(), e); log.info("Retrying " + attempts + " of " + retries); } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void executeQueue() {\n\tLog.d(TaskExecutor.class.getName(), \"Execute \" + mQueue.size() + \" Tasks\");\n\tfor (Task task : mQueue) {\n\t if (!mTaskExecutor.getQueue().contains(task))\n\t\texecuteTask(task);\n\t}\n }", "public ArrayList<Task> getFinishedTasks(){\r\n return finished;\r\n }", "@Override\n public CommandResult execute() {\n tasks.add(taskToAdd);\n try {\n storage.appendToFile(taskToAdd);\n return new CommandResult(String.format(MESSAGE_SUCCESS, taskToAdd));\n } catch (IOException e) {\n return new CommandResult(e.getMessage());\n }\n }", "@Override\n\tpublic List<Task> getTasks() {\n\t\treturn details.getPendingTasks();\n\t}", "public String toString() {\n String str = \"\";\n for (int i = 0; i < size; i++) {\n str += tasks[i].toString() + \"\\n\";\n }\n return str;\n }", "@Override\r\n public List getExecutingTask() {\n return null;\r\n }", "public ArrayList<Task> getAllTasks() {\n \treturn this.taskBuffer.getAllContents();\n }", "@Override\r\n\tpublic ArrayList<Task> getAllTasks() {\n\t\treturn null;\r\n\t}", "public String listOfTasks() {\n String listOfTasks = Messages.LIST_TASKS_MESSAGE;\n for (int i = 0; i < Parser.getOrderAdded(); i++) {\n listOfTasks += recordedTask.get(i).getTaskNum() + DOT_OPEN_SQUARE_BRACKET\n + recordedTask.get(i).getCurrentTaskType() + CLOSE_SQUARE_BRACKET + OPEN_SQUARE_BRACKET\n + recordedTask.get(i).taskStatus() + CLOSE_SQUARE_BRACKET + Messages.BLANK_SPACE\n + recordedTask.get(i).getTaskName()\n + ((i == Parser.getOrderAdded() - 1) ? Messages.EMPTY_STRING : Messages.NEW_LINE);\n }\n return listOfTasks;\n }", "@Override\n public void flushFlows() {\n LOG.info(\"flushFlows: creating flowWriter task, writing [{}] flows.\",\n setOfFlowsToAdd.size());\n\n FlowSetWriterTask writerThread = new FlowSetWriterTask(setOfFlowsToAdd);\n\n try {\n threadPoolExecutorService.execute(writerThread);\n } catch (Exception ex) {\n LOG.error(LOGSTR_THREAD_EXCEPTION, ex.toString());\n }\n\n // Clear the entries\n setOfFlowsToAdd.clear();\n }", "private void addTaskToServer() {\n\t\twriter.println();\n\t\tSystem.out.println();\n\t\tNumberFormat formatter = new DecimalFormat(\"#0.00000\");\n\t\tfor (Iterator<Task> iterator = this.generatedTasks.iterator(); iterator.hasNext();) {\n\t\t\tTask t = iterator.next();\n\t\t\twriter.println(\"current time=\" + currentTime + \" ,tasks not assigned \" + t.getArrivalTime() + \" \"\n\t\t\t\t\t+ t.getprocessingTime());\n\t\t\tSystem.out.println(\"current time=\" + currentTime + \" ,tasks not assigned \" + t.getArrivalTime() + \" \"\n\t\t\t\t\t+ t.getprocessingTime());\n\t\t\tif (t.getArrivalTime() == currentTime || t.isLateProcessing()) {\n\t\t\t\t// if it can be dispatched\n\t\t\t\tif (this.scheduler.dispatchTask(t) == true)\n\t\t\t\t\titerator.remove();\n\t\t\t\telse\n\t\t\t\t\tt.setLateProcessing(true);\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void addTasksToRun() {\n //gets the tasks that are ready for execution from the list with new tasks\n List<Task> collect = tasks.stream().filter((task) -> (task.getDate() == TIME))\n .collect(Collectors.toList());\n //sort the tasks inserted. The sort is based in \"priority\" value for all the tasks.\n collect.sort(new Comparator<Task>() {\n @Override\n public int compare(Task o1, Task o2) {\n return o1.getPriority() - o2.getPriority();\n }\n });\n //Change the status of tasks for READY\n collect.stream().forEach((task) -> {\n task.setStatus(Task.STATUS_READY);\n });\n //Adds the tasks to the queue of execution\n tasksScheduler.addAll(collect);\n\n //Removes it from list of new tasks\n tasks.removeAll(collect);\n }", "public void printTasks() {\n int i = 0;\n for (Task task : tasks) {\n StringBuilder message = new StringBuilder()\n .append(\"Task \").append(i++).append(\": \").append(task);\n\n for (Task blocker : task.firstToFinish) {\n message.append(\"\\n depends on completed task: \").append(blocker);\n }\n\n for (Task blocker : task.firstToSuccessfullyFinish) {\n message.append(\"\\n depends on successful task: \").append(blocker);\n }\n\n stdout.println(message.toString());\n }\n }", "public String toString() {\n\n\t\tString output = \"\";\n\n\t\tfor (Task i : tasks) {\n\t\t\toutput += i.toString() + \"\\n \\n\";\n\t\t}\n\n\t\treturn output;\n\t}", "public void saveTasks() {\n try {\n BufferedWriter taskWriter = new BufferedWriter(new FileWriter(path));\n String tasks = \"\";\n for (Task task : TaskList.getTaskLists()) {\n tasks += task.toSaveString() + \"\\n\";\n }\n taskWriter.write(tasks);\n taskWriter.close();\n } catch (IOException e) {\n System.out.println(\"Sorry Boss, \" + e.getMessage());\n }\n }", "public ArrayList<Task> list() {\r\n return tasks;\r\n }", "public Map call() {\n\t\tMap result=null;\n\t\tint i=tasks.size();\n\t\tint j=0;\n\t\tint groupId=0;\n\t\ttry {\n\t\t\tfor(Task t:tasks){\n\t\t\t\t\t\tgroupId=t.getGroupId();\n\t\t\t\t\t\tresult=this.excuteTask(t);\n\t\t\t\t\t\tj++;\t\t\n\t\t\t}\n\t\t} catch (BusinessException e) {\n\t\t\tString errorMessage=\"Task execute error--task name:\"+tasks.get(j).getTaskName()+\",task catalog name:\"+tasks.get(j).getCatalogName()+\",task parameter:\"+tasks.get(j).getTaskParameter()+\",Exception details:\"+e.getMessage();\n\t\t\tlog.error(errorMessage);\n\t\t\ttaskService.addTaskLog(tasks.get(j), errorMessage, PandaConstants.TASK_FAILED);\n\t\t} catch (Exception e) {\n\t\t\tString errorMessage=\"Task execute error--task name:\"+tasks.get(j).getTaskName()+\",task catalog name:\"+tasks.get(j).getCatalogName()+\",task parameter:\"+tasks.get(j).getTaskParameter()+\",Exception details:\"+e.getMessage();\n\t\t\tlog.error(errorMessage);\n\t\t\ttaskService.addTaskLog(tasks.get(j),errorMessage, PandaConstants.TASK_FAILED);\n\t\t}finally{\n\t\t\tcleanUp();\n\t\t}\n\t\tif(i==j){\n\t\t\tStringBuffer sb=new StringBuffer();\n\t\t\tfor(Task t:tasks){\n\t\t\t\tString temp=\">>Task execute -- Task Id:\"+t.getTaskId()+\",Task Name:\"+t.getTaskName()+\",Task Catalog Name:\"+t.getCatalogName()+\",Task Parameter:\"+t.getTaskParameter();\n\t\t\t\tsb.append(temp+\"\\n\");\n\t\t\t\tsb.append(Utils.getExecuteResult(t, result)+\"\\n\\n\");\n\t\t\t}\n\t\t\ttaskService.addTaskLog(tasks.get(0), sb.toString(), PandaConstants.TASK_SUCCESS);\n\t\t}\n\t\treturn result;\n\t}", "@Override\n public String execute(TaskList tasks, Storage storage) {\n return \"Here are the tasks in your list:\\n\" + tasks.toString();\n }", "@Override\r\n\tpublic List<ExecuteTask> getAll() {\n\t\tString sql = \"SELECT et_id id,et_member_id memberId,et_task_id taskId,et_comments comments FROM executetask\";\r\n\t\treturn getForList(sql);\r\n\t}", "public XmlSerializableTaskList() {\n task = new ArrayList<>();\n tags = new ArrayList<>();\n }", "public List<Task> getTasks() {\n return this.tasks;\n }", "public ArrayList<Task> getTasks() {\n return tasks;\n }", "public List<Task> getTasks() {\n return tasks;\n }", "public List<Task> getTasks() {\n return tasks;\n }", "public List<Task> getTasks() {\n return tasks;\n }", "public List<Runnable> shutdownNow() {\n lock.lock();\n try {\n shutdown();\n List<Runnable> result = new ArrayList<>();\n for (SerialExecutor serialExecutor : serialExecutorMap.values()) {\n serialExecutor.tasks.drainTo(result);\n }\n result.addAll(executor.shutdownNow());\n return result;\n } finally {\n lock.unlock();\n }\n }", "void addDoneTasks(List<Task> task);", "public int getTasks() {\r\n return tasks;\r\n }", "@Override\n public String execute(TaskList tasks, Storage storage, Statistics stats) throws DukeException {\n\n Task task = tasks.doneTask(taskNum);\n storage.editTaskList(task.saveToString(), taskNum, false);\n storage.updateStats(2);\n stats.incrementDoneStats();\n return String.format(\"%s\\n%s\\n%s\", MESSAGE_DONE_ACKNOWLEDGEMENT,\n task.toString(), MESSAGE_DONE_END);\n\n\n }", "public ArrayList<Task> getTaskList() {\n return tasks;\n }", "@Override\n\tpublic synchronized void waitAllTasks() throws ExecutionException, InterruptedException {\n\t\twaitTasks(key -> true);\n\t}", "@Override\n public String execute(ArrayList<Task> tasks, Layout layout) {\n return layout.printTaskList(false, tasks);\n }", "public Set<Task> getUnfinishedTasks(){\r\n return unfinished;\r\n }", "public ArrayList<Task> getTaskList() {\n\t\treturn tasks;\n\t}", "public int size()\n {\n return tasks.size();\n }", "public void clearFinishedTasks(){\n todayLayout.removeAllViewsInLayout();\n tomorrowLayout.removeAllViewsInLayout();\n weekLayout.removeAllViewsInLayout();\n laterLayout.removeAllViewsInLayout();\n expiredLayout.removeAllViewsInLayout();\n tasksNumber = 0;\n taskManager.updateTasksTimeTag();\n for (Task t : taskManager.getTasksList()){\n t.setIdInView(tasksNumber);\n updateTaskInDatabase(t);\n submit(t.getName(), tasksNumber, t.getTimeForTask(), t.isFinished());\n tasksNumber++;\n }\n }", "private void sendTasks(ArrayList<Task> list) {\n output.println(list.size());\n for (Task t : list) {\n output.println(t.getDateString() + \" \" + t.getName());\n }\n }", "public int getTasksSize() {\n return tasks.size();\n }", "@Override\n public String execute(TaskList tasks, Storage storage) throws DukeException {\n tasks.markAsDone(index);\n storage.save(tasks);\n\n StringBuilder builder = new StringBuilder();\n builder.append(\"Nice! I've marked this task as done:\\n\");\n builder.append(\" \" + tasks.get(index) + \"\\n\");\n return builder.toString();\n }", "protected void execute() {\n super.execute ();\n \n // processTasks is ordinarily only called when tasks have accumulated\n // in the buffer and the buffer dispatch condition has been met.\n // \n // This ensures that if there are delayed tasks, they are re-examined,\n // whether there's something in the buffer or not.\n //\n // Fix for bug #13455\n\n if (!delayedTasks.isEmpty ()) {\n processTasks (new ArrayList());\n }\n }", "private void saveTasks() {\n try {\n Writer writer = new Writer(new File(TASKS_FILE));\n for (Task t1: todoList.getListOfTasks()) {\n writer.write(t1);\n }\n writer.close();\n System.out.println(\"Tasks saved to file \" + TASKS_FILE);\n } catch (FileNotFoundException e) {\n System.out.println(\"Unable to save tasks to \" + TASKS_FILE);\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n }", "public TaskQueue(){\n this(\n new PrintWriter(System.out, true),\n new PrintWriter(System.err, true),\n DEFAULT_CONCURRENT_ACTIONS\n );\n }", "@Override\n public String execute(TaskList tasks, Ui ui, Storage storage) \n throws UnableToSaveException, NoSuchTaskException, NotNumberException {\n int taskNo;\n try {\n taskNo = Integer.parseInt(inputArr[1]) - 1;\n } catch (NumberFormatException e) {\n throw new NotNumberException();\n }\n if (taskNo > tasks.size()) {\n throw new NoSuchTaskException();\n }\n tasks.setDone(taskNo);\n storage.saveToSave(tasks);\n return ui.reply(\"Okcan, I mark this task as done:\\n \" + Constant.SPACE + tasks.getTask(taskNo));\n }", "public void runTasks() {\n promoteBlockedTasks();\n\n final AtomicInteger counter = new AtomicInteger(0);\n\n ExecutorService runners = threadPerCpuExecutor(stderr, \"TaskQueue\");\n\n for (int i = 0; i < Runtime.getRuntime().availableProcessors(); i++) {\n runners.execute(() -> {\n while (runOneTask()) {\n // running one task at a time\n counter.getAndIncrement();\n }\n });\n }\n\n runners.shutdown();\n\n try {\n runners.awaitTermination(FOREVER, TimeUnit.SECONDS);\n\n stdout.println(String.format(\"Executed tasks: %d\", counter.get()));\n\n } catch (InterruptedException e) {\n stdout.println(\"failed task: \" + e.getMessage());\n e.printStackTrace(stderr);\n throw new AssertionError();\n }\n }", "@Override\r\n public void tasksFinished()\r\n {\n }", "@Override\r\n public String execute(TaskList tasks, Ui ui, Storage storage) {\r\n String output = \"\";\r\n output += \"Here are the tasks in your list:\\n\";\r\n output += iterateTaskList(tasks.getList());\r\n\r\n assert !output.equals(\"\") : \"Output should not be empty\";\r\n\r\n return output;\r\n }", "@Override\n\tpublic Object[] splitTasks() {\n\t\tif (tasks == null) {\n\t\t\tSystem.out.println(\"There are \"+taskNum +\" tasks, and handled by \"+clientsNum+\" clients\");\n\t\t}\t\t\n\t\ttasks = new SimpleTask[clientsNum];\n\t\ttq = taskNum / clientsNum;\n//\t\tbatchSize = tq;\n\t\tint left = taskNum - tq * clientsNum;\n\t\t\n\t\tfor (int i = 0; i < tasks.length; i++) {\n\t\t\tint l = 0;\n\t\t\tif (left >= i+1) {\n\t\t\t\tl = 1;\n\t\t\t}\n\t\t\tif (i == 0) {\n\t\t\t\ttasks[i] = new SimpleTask(1, tq + l, batchSize);\n\t\t\t} else {\n\t\t\t\ttasks[i] = new SimpleTask(\n\t\t\t\t\t\ttasks[i - 1].getEnd()+ 1, tasks[i - 1].getEnd() + tq + l, batchSize);\n\t\t\t}\t\t\t\n\t\t}\n//\t\tSystem.out.println(\"done .\"+clientsNum);\n\t\tthis.srvQ2QLSTM.getCfg().getQlSTMConfigurator().setMBSize(batchSize);\n\t\tthis.srvQ2QLSTM.getCfg().getAlSTMConfigurator().setMBSize(batchSize);\t\t\n\t\treturn tasks;\n\t}", "public synchronized void execute(Runnable task) throws Exception{\n \n if(threadPoolExecutor.isShutdown()){\n \tSystem.out.println(\"Thread pool \" + \"\" + \" is being Shutdown.\\n\"\n \t\t\t\t\t+ \"No tasks are allowed to be scheduled.\");\n \n }\n //add the task to the queue\n //this will cause a thread in the work pool to pick this up and execute\n queue.put(task);\n System.out.println(\"task has been added.\");\n }", "public List<ScheduledTask> getAllPendingTasks() {\n \t\tSet<String> smembers = jedisConn.smembers(ALL_TASKS);\n \t\tList<ScheduledTask> alltasks = new ArrayList<>();\n \t\tGson gson = new Gson();\n \t\t// the get actual tasks by the ids\n \t\tfor (String member : smembers) {\n \t\t\tString string = jedisConn.get(PENDING_TASK(member));\n \t\t\tScheduledTask task = gson.fromJson(string, ScheduledTask.class);\n \t\t\talltasks.add(task);\n \t\t}\n \t\treturn alltasks;\n \t}", "public List<File> getTasks() {\n return tasks;\n }", "@Override\n\tpublic boolean done() {\n\t\tfor(Task t : details.getPendingTasks()){\n\t\t\tif(!t.isComplete())\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public ArrayList<Task> list() {\n return this.list;\n }", "public ArrayList<Task> getTaskList() {\n return taskList;\n }", "@Override\n public void execute(TaskListHandler handler, Storage storage, String input) throws DukeException {\n ArrayList<Task> taskList;\n taskList = handler.clearList();\n for (Task t1 : taskList) {\n System.out.println(t1);\n }\n handler.saveCurrentTaskList(input);\n storage.saveToFile(taskList);\n }", "public static List<Task> findAllRunningTasks() {\r\n List<Task> outTasks = new ArrayList<Task>();\r\n List<ITask> iTasks = findAllTasks(DEFAULT_INDEX, DEFAULT_PAGESIZE, null, SortOrder.ASCENDING, RUNNING_MODE, null);\r\n\r\n for (ITask iTask : iTasks) {\r\n outTasks.add(convertITaskToTask(iTask));\r\n }\r\n return outTasks;\r\n }", "public void outputTasks ()\n\t{\n\t\toutput (\"\\n> (all-tasks)\\n\");\n\t\tString[] tasks = Task.allTaskClasses();\n\t\tfor (int i=0 ; i<tasks.length ; i++) output (tasks[i]);\n\t}", "public ArrayList<Task> allTasks() {\n ArrayList<Task> tasks = new ArrayList<>();\n for (Role role : this.roles) {\n if (role instanceof Worker) {\n tasks.add(((Worker) role).getTask());\n } else if (role instanceof Supervisor) {\n tasks.add(((Worker) role).getTask());\n }\n }\n return tasks;\n }", "@Override\n\tpublic Collection<TaskStatus> getTaskStatus(){\n \tcheckInitialized();\n \t\n \t@SuppressWarnings(\"unchecked\")\n\t\tCollection<Collection<TaskStatus>> statusTree=Collections.EMPTY_LIST;\n \tfinal MultiTask<Collection<TaskStatus>> mtask;\n \ttry {\n\t\t\t mtask = breeder.executeCallable(new GetTaskStatus(this));\n\t\t\t statusTree = mtask.get();\n \t} catch (ExecutionException ex){\n \t\tlog.fatal(\"Could not get status of tasks for job \"+this.getId(), ex);\n \t} catch(InterruptedException ex) {\n \t\tlog.fatal(\"Could not get status of tasks for job \"+this.getId(), ex);\n \t}\n\t\t\t\n\t\t// Flatten into single collection\n\t\tList<TaskStatus> result = new ArrayList<TaskStatus>((int)(statusTree.size()*this.getThreadCount()));\n\t\tfor(Collection<TaskStatus> statusForNode: statusTree) {\n\t\t\tresult.addAll(statusForNode);\n\t\t}\n\t\t\n\t\treturn result;\n \n\t}", "public void listAllTasks() {\n System.out.println(LINEBAR);\n if (tasks.taskIndex == 0) {\n ui.printNoItemInList();\n System.out.println(LINEBAR);\n return;\n }\n\n int taskNumber = 1;\n for (Task t : tasks.TaskList) {\n System.out.println(taskNumber + \". \" + t);\n taskNumber++;\n }\n System.out.println(LINEBAR);\n }", "@SuppressWarnings(\"unchecked\")\n\tprivate void processQueue() throws DatabaseException {\n\t\tString qs = \"from PendingTask pt order by pt.created\";\n\t\tGson gson = new Gson();\n\t\tSession session = null;\n\t\t\n\t\ttry {\n\t\t\tsession = HibernateUtil.getSessionFactory().openSession();\n\t\t\tQuery q = session.createQuery(qs);\n\t\t\t\n\t\t\tfor (PendingTask pt : (List<PendingTask>) q.list()) {\n\t\t\t\tif (!runningTasks.contains(pt.getId())) {\n\t\t\t\t\tlog.info(\"Processing {}\", pt);\n\t\t\t\t\t\n\t\t\t\t\tif (PendingTask.TASK_UPDATE_PATH.equals(pt.getTask())) {\n\t\t\t\t\t\tif (Config.STORE_NODE_PATH) {\n\t\t\t\t\t\t\texecutor.execute(new PendingTaskThread(pt, new UpdatePathTask()));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (PendingTask.TASK_CHANGE_SECURITY.equals(pt.getTask())) {\n\t\t\t\t\t\tChangeSecurityParams params = gson.fromJson(pt.getParams(), ChangeSecurityParams.class);\n\t\t\t\t\t\texecutor.execute(new PendingTaskThread(pt, new ChangeSecurityTask(params)));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.warn(\"Unknown pending task: {}\", pt.getTask());\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlog.info(\"Task already running: {}\", pt);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (HibernateException e) {\n\t\t\tthrow new DatabaseException(e.getMessage(), e);\n\t\t} finally {\n\t\t\tHibernateUtil.close(session);\n\t\t}\n\t}", "public int getSize() {\n return tasks.size();\n }", "public int getNumTasks() {\n return tasks.size();\n }", "private List<TaskObject> getAllTasks(){\n RealmQuery<TaskObject> query = realm.where(TaskObject.class);\n RealmResults<TaskObject> result = query.findAll();\n result.sort(\"completed\", RealmResults.SORT_ORDER_DESCENDING);\n\n tasks = new ArrayList<TaskObject>();\n\n for(TaskObject task : result)\n tasks.add(task);\n\n return tasks;\n }", "private synchronized boolean taskIsEmpty() {\n\t\treturn taskList.isEmpty();\n\t}", "public List<PendingClusterTask> pendingTasks() {\n final var currentTimeMillis = threadPool.relativeTimeInMillis();\n return allBatchesStream().flatMap(e -> e.getPending(currentTimeMillis)).toList();\n }", "public interface TaskManager {\n\t/**\n\t * @return all the tasks that have to be executed\n\t */\n\tvoid getTasks();\n}", "public long getCompletedTasks()\n {\n return getCompletedTaskCount();\n }", "public List<ScheduledTask> fullSchedule() {\n List<ScheduledTask> scheduledTaskList = new LinkedList<>();\n for (ScheduledTask task : this) {\n if (!task.getNode().getId().equals(\"end\")) {\n scheduledTaskList.add(task);\n }\n }\n return scheduledTaskList;\n }", "private void scheduleNext() {\n lock.lock();\n try {\n active = tasks.poll();\n if (active != null) {\n executor.execute(active);\n terminating.signalAll();\n } else {\n //As soon as a SerialExecutor is empty, we remove it from the executors map.\n if (lock.isHeldByCurrentThread() && isEmpty() && this == serialExecutorMap.get(identifier)) {\n serialExecutorMap.remove(identifier);\n terminating.signalAll();\n if (state == State.SHUTDOWN && serialExecutorMap.isEmpty()) {\n executor.shutdown();\n }\n }\n }\n } finally {\n lock.unlock();\n }\n }", "public CommandResult execute() {\n String message = tasks.listTasks(keyWord);\n return new CommandResult(message);\n }", "public int getSize() {\n return this.tasks.size();\n }", "long getExcutorTasksInWorkQueueCount();", "public ArrayList<Task> listNotStarted() {\n ArrayList<Task> tasks = new ArrayList<>();\n for (Task t : this.tasks) {\n if (t.getStatus() == 0) {\n tasks.add(t);\n }\n }\n return tasks;\n }", "public String getTasks() {\n StringJoiner result = new StringJoiner(\"\\n\");\n for (int i = 0; i < tasks.size(); i++) {\n Task t = tasks.get(i);\n result.add(String.format(\"%d.%s\", i + 1, t));\n }\n\n return result.toString();\n }", "public List<TaskDescription> getActiveTasks();", "public ArrayList<Task> getList() {\n return tasks;\n }", "TaskList() {\r\n tasks = new ArrayList<>();\r\n }", "@Override\n public void execute(TaskList tasks, Storage storage) throws DukeException {\n this.task = tasks.doneTask(storage, this.index);\n }", "public TaskList() {\n tasks = new ArrayList<>();\n cachedTasks = new Stack<>();\n }", "List<Task> getAllTasks();", "public List<String> getRunningESBTaskList() throws Exception {\n return ntaskManager.getRunningTaskList();\n }", "public static void printTasks(){\n int totalTime = 0;\n int totalWait = 0;\n for(Task t : taskList){\n\n if(t.isAborted){\n System.out.println(\"TASK \" + t.taskNumber + \" aborted\" );\n }else{\n System.out.println(\"TASK \" + t.taskNumber + \" \" + t.terminateTime + \" \" + t.waitingCount + \" %\" + 100 * ((float)t.waitingCount / t.terminateTime));\n totalTime += t.terminateTime;\n totalWait += t.waitingCount;\n }\n }\n System.out.println(\"TOTAL\" + \" \" + totalTime + \" \" + totalWait + \" %\" + 100 *((float)totalWait / totalTime));\n\n }", "public ArrayList<Task> getVisibleTasks() {\n return this.mTaskStackContainers.getVisibleTasks();\n }", "public ArrayList<Task> retrieveTaskList() {\r\n\r\n\r\n return taskList;\r\n }", "public void a() {\n NamedRunnable active;\n synchronized (this.mTasks) {\n if (!this.mTasks.isEmpty()) {\n this.mActive = this.mTasks.remove(0);\n } else {\n this.mActive = null;\n com.alipay.mobile.common.task.Log.v(TAG, \"mTasks is empty.\");\n }\n active = this.mActive;\n }\n if (active != null) {\n com.alipay.mobile.common.task.Log.d(TAG, \"StandardPipeline.scheduleNext()\");\n if (this.a != null) {\n this.a.execute(active);\n return;\n }\n throw new RuntimeException(\"The StandardPipeline's Executor is null.\");\n }\n com.alipay.mobile.common.task.Log.d(TAG, \"StandardPipeline.scheduleNext(mTasks is empty)\");\n }", "public void tostring(){\n\t\tfor(int i=0;i<taskList.size();i++){\n\t\t\tSystem.out.println(taskList.get(i).getPrint()); \n\t\t}\n\t}", "@Override\n public ArrayList<String> execute(TaskList tasks, Ui ui, Storage storage) throws DukeException {\n ArrayList<String> returnMsg = new ArrayList<>();\n int currentTasksSize = tasks.size();\n if (index < 0 || index >= tasks.size()) {\n throw new DukeException(\"The task number does not exist, try again?\");\n }\n Task deleteTask = tasks.find(index);\n tasks.delete(deleteTask);\n assert(tasks.size() == currentTasksSize - 1) : \"Task has not been deleted, count is not updated\";\n returnMsg.add(ui.speak(\"Aww yes! I've removed this task: \" + deleteTask));\n returnMsg.add(ui.speak(\"Now you have \" + tasks.size() + \" tasks left.\"));\n storage.writeToFile(tasks);\n return returnMsg;\n }", "private void sendTransactionQueue(final List<TransactionData> queue, final Path path) {\n List<Long> setsToIgnore = new ArrayList<Long>();\n for (TransactionData txn : queue) {\n setsToIgnore.add(txn.currentWriteId);\n }\n\n Node latestState = this.getLatestState(path, setsToIgnore);\n Node snapToSend = latestState;\n String latestHash = \"badhash\";\n if (!hijackHash) {\n latestHash = latestState.getHash();\n }\n\n for (TransactionData txn : queue) {\n hardAssert(\n txn.status\n == TransactionStatus.RUN); // sendTransactionQueue: items in queue should all be run.'\n txn.status = TransactionStatus.SENT;\n txn.retryCount++;\n Path relativePath = Path.getRelative(path, txn.path);\n // If we've gotten to this point, the output snapshot must be defined.\n snapToSend = snapToSend.updateChild(relativePath, txn.currentOutputSnapshotRaw);\n }\n\n Object dataToSend = snapToSend.getValue(true);\n\n final Repo repo = this;\n\n // Send the put.\n connection.compareAndPut(\n path.asList(),\n dataToSend,\n latestHash,\n new RequestResultCallback() {\n @Override\n public void onRequestResult(String optErrorCode, String optErrorMessage) {\n DatabaseError error = fromErrorCode(optErrorCode, optErrorMessage);\n warnIfWriteFailed(\"Transaction\", path, error);\n List<Event> events = new ArrayList<Event>();\n\n if (error == null) {\n List<Runnable> callbacks = new ArrayList<Runnable>();\n for (final TransactionData txn : queue) {\n txn.status = TransactionStatus.COMPLETED;\n events.addAll(\n serverSyncTree.ackUserWrite(\n txn.currentWriteId, /*revert=*/ false, /*persist=*/ false, serverClock));\n\n // We never unset the output snapshot, and given that this\n // transaction is complete, it should be set\n Node node = txn.currentOutputSnapshotResolved;\n final DataSnapshot snap =\n InternalHelpers.createDataSnapshot(\n InternalHelpers.createReference(repo, txn.path), IndexedNode.from(node));\n\n callbacks.add(\n new Runnable() {\n @Override\n public void run() {\n txn.handler.onComplete(null, true, snap);\n }\n });\n // Remove the outstanding value listener that we added\n removeEventCallback(\n new ValueEventRegistration(\n Repo.this,\n txn.outstandingListener,\n QuerySpec.defaultQueryAtPath(txn.path)));\n }\n\n // Now remove the completed transactions\n pruneCompletedTransactions(transactionQueueTree.subTree(path));\n\n // There may be pending transactions that we can now send\n sendAllReadyTransactions();\n\n repo.postEvents(events);\n\n // Finally, run the callbacks\n for (int i = 0; i < callbacks.size(); ++i) {\n postEvent(callbacks.get(i));\n }\n } else {\n // transactions are no longer sent. Update their status appropriately\n if (error.getCode() == DatabaseError.DATA_STALE) {\n for (TransactionData transaction : queue) {\n if (transaction.status == TransactionStatus.SENT_NEEDS_ABORT) {\n transaction.status = TransactionStatus.NEEDS_ABORT;\n } else {\n transaction.status = TransactionStatus.RUN;\n }\n }\n } else {\n for (TransactionData transaction : queue) {\n transaction.status = TransactionStatus.NEEDS_ABORT;\n transaction.abortReason = error;\n }\n }\n\n // since we reverted mergedData, we should re-run any remaining\n // transactions and raise events\n rerunTransactions(path);\n }\n }\n });\n }", "public void execute(Runnable task) {\n Objects.requireNonNull(task, \"Task must not be null\");\n if (isStopped) {\n // throw new IllegalStateException(\"WorkerPoolExecutor has been stopped!\");\n System.out.println(\"WorkerPoolExecutor has been stopped!\");\n }\n taskQueue.add(task);\n }", "@Override\n public void execute(TaskList tasks, Ui ui, Storage storage) {\n ui.setMessage(\"Bye. Hope to see you again soon!\\n\");\n System.out.println(\"Bye. Hope to see you again soon!\");\n tasks.sort();\n // saves tasks to filePath\n try {\n storage.saveToCsv(tasks);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public TaskManager() {\n\t\tcompletedTasks = new ArrayList<Tasks>();\n\t}", "public String pendingToString() {\n InterruptibleTask interruptibleTask = this.task;\n if (interruptibleTask == null) {\n return super.pendingToString();\n }\n StringBuilder stringBuilder = new StringBuilder(\"task=[\");\n stringBuilder.append(interruptibleTask);\n stringBuilder.append(\"]\");\n return stringBuilder.toString();\n }", "public boolean cleanDoneTasks(){\n\t\tboolean removedAny = false; \n\t\tCollection<Task> tmp = new ArrayList<Task>();\n\t\t\n\t\tfor( Task task: m_Tasks ){\n\t\t\tif(task.done) {\n\t\t\t\ttmp.add(task);\n\t\t\t\tremovedAny = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(Task task : tmp){\n\t\t\tremoveTask(task);\n\t\t}\n\t\treturn removedAny;\n\t}", "public void executeAll()\n {\n this.queue.clear();\n this.queue_set = false;\n this.resetComputation();\n while(executeNext()) {}\n }", "Set<Task> getAllTasks();", "public static void ser(ArrayList<Task> taskList) {\n try {\n FileOutputStream fileOut = new FileOutputStream(\"taskList.ser\"); // create a space for serializing the ArrayList object\n ObjectOutputStream out = new ObjectOutputStream(fileOut); // object for serializing the ArrayList object\n out.writeObject(taskList); // writing/serializing the ArrayList object (has all the user's task variables)\n out.close(); // closing the serializing object\n fileOut.close(); // closing the serialized file\n System.out.println(\"Tasks saved.\"); // printing that the save was successful\n } catch (IOException ioe) { \n System.err.println(\"Java IO Exception: \" + ioe);\n }\n }", "public String[] getTaskList() {\n String[] tasks = {\"export\"};\n\n return tasks;\n }", "public TaskBookBuilder addUnfinishedTasks() {\n addUnfinishedFloatingTasks();\n addUnfinishedDeadlineTasks();\n addUnfinishedEventTasks();\n return this;\n }", "public long getPendingTasks()\n {\n return getTaskCount() - getCompletedTaskCount();\n }", "public boolean isEmpty() {\r\n return tasks.isEmpty();\r\n }" ]
[ "0.64548385", "0.61380565", "0.61351115", "0.6033739", "0.5962188", "0.59431535", "0.58718705", "0.58550835", "0.58379185", "0.58118933", "0.5779981", "0.5777379", "0.57394373", "0.57213324", "0.57060057", "0.5697746", "0.56757534", "0.5662637", "0.5648283", "0.56430376", "0.5641367", "0.56349856", "0.56328136", "0.56328136", "0.56328136", "0.560191", "0.55896974", "0.5588209", "0.5584503", "0.5570686", "0.55549514", "0.555393", "0.5552557", "0.5535598", "0.5534128", "0.5529647", "0.5510309", "0.5503058", "0.54993945", "0.54816085", "0.5481276", "0.5476103", "0.5470592", "0.54662174", "0.54636544", "0.5446443", "0.54399574", "0.5439852", "0.54389536", "0.5427161", "0.541089", "0.54042673", "0.5400621", "0.53910476", "0.5380664", "0.5379642", "0.5367895", "0.5367699", "0.5360368", "0.5352053", "0.53411627", "0.5334379", "0.5334185", "0.5331843", "0.53288114", "0.5322423", "0.531701", "0.53082025", "0.53047764", "0.5297129", "0.5294727", "0.5281643", "0.5280688", "0.5280187", "0.5243938", "0.52370363", "0.5234152", "0.5231508", "0.52272403", "0.52247715", "0.5222754", "0.5218642", "0.52024305", "0.51722145", "0.51711595", "0.516913", "0.5164737", "0.51597655", "0.5158347", "0.5155682", "0.5153656", "0.51520526", "0.51458496", "0.5143374", "0.51409644", "0.5131634", "0.51237017", "0.51207334", "0.51115596", "0.51083326" ]
0.6104825
3
Returns the State's name
public String toString() { return "PushObstacleState"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic java.lang.String getStateName() {\n\t\treturn _state.getStateName();\n\t}", "public String getStateName() {\n return name;\n }", "String getSelectedStateName();", "public String getNewStateName() {\n\t\tstateCounter.getAndIncrement();\n\t\tString state = makeStateName(stateCounter.get(), false);\n\t\treturn state;\n\t}", "java.lang.String getState();", "String getState();", "String getState();", "String getState();", "public java.lang.String getState() {\n return State;\n }", "public java.lang.String getState() {\n return state;\n }", "public java.lang.String getState() {\n return state;\n }", "public java.lang.String getState() {\r\n return state;\r\n }", "public java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "public String getState() {\n\t\treturn state.toString();\n\t}", "public final String getName() {\n\treturn name.getName();\n }", "String getName() ;", "public String getStateString()\n {\n return stateString;\n }", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();", "String getName();" ]
[ "0.857209", "0.85125947", "0.77936333", "0.76397043", "0.7322897", "0.7123637", "0.7123637", "0.7123637", "0.703015", "0.7017222", "0.7017222", "0.6995157", "0.68865377", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6870165", "0.6840712", "0.68312967", "0.67943984", "0.67937803", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574", "0.67808574" ]
0.0
-1
Initializes the test fixture.
@BeforeEach void setUp() { testObject = new TestObject(1, "stringValue"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Before\n public void init() {\n this.testMethodName = this.getTestMethodName();\n this.initialize();\n }", "@Before\n public void init() {\n }", "@Test\n\tpublic void testInit() {\n\t\t/*\n\t\t * This test is just use to initialize everything and ensure a better\n\t\t * performance measure for all the other tests.\n\t\t */\n\t}", "@Before\n\tpublic void init() {\n\t}", "protected void setUp()\r\n {\r\n /* Add any necessary initialization code here (e.g., open a socket). */\r\n }", "@BeforeSuite(alwaysRun=true)\r\n\tpublic void initSetUp() throws FileNotFoundException, IOException {\r\n\t\tinitialize();\r\n\t}", "@Test\n public void init() {\n }", "@Before\n @Override\n public void init() {\n }", "protected void setUp()\n {\n /* Add any necessary initialization code here (e.g., open a socket). */\n }", "@Before\n public void setUp() {\n fixture = new WordCounter(testMap);\n }", "@Test\n public void testInitialize() {\n \n \n }", "@Before\n public void init() {\n final Map<String, DataType> defaultTypes = new HashMap<>();\n defaultTypes.put(\"frieda\", StringCell.TYPE);\n defaultTypes.put(\"berta\", StringCell.TYPE);\n ReadAdapterFactory<String, String> readAdapterFactory = new ReadAdapterFactory<String, String>() {\n\n @Override\n public ReadAdapter<String, String> createReadAdapter() {\n return new TestReadAdapter();\n }\n\n @Override\n public ProducerRegistry<String, ? extends ReadAdapter<String, String>> getProducerRegistry() {\n return m_producerRegistry;\n }\n\n @Override\n public Map<String, DataType> getDefaultTypeMap() {\n return defaultTypes;\n }\n\n };\n m_testInstance = new DefaultTypeMappingFactory<>(readAdapterFactory);\n }", "public SwerveAutoTest() {\n // Initialize base classes.\n // All via self-construction.\n\n // Initialize class members.\n // All via self-construction.\n }", "@Override\r\n\tpublic void setUp() {\n\t\t\r\n\t}", "protected void setUp() {\n\t}", "public void setUp()\r\n {\r\n //empty on purpose\r\n }", "protected void setUp() {\n\n }", "public void setUp() {\n\n\t}", "protected void setUp()\n {\n }", "protected void setUp()\n {\n }", "@Before\n public void init(){\n }", "@BeforeClass\n public static void init() {\n InitializrMetadataBuilder initializrMetadataBuilder = InitializrMetadataBuilder.fromInitializrProperties(\n InitializerMetadataTest.load(\n InitializerMetadataTest.loadProperties(new ClassPathResource(\"application-test-default.yml\"))));\n initializrMetadata = initializrMetadataBuilder.build();\n }", "@Before public void setUp() { }", "@BeforeEach\n\tvoid init() {\n\t\tthis.repo.deleteAll();\n\t\tthis.testLists = new TDLists(listTitle, listSubtitle);\n\t\tthis.testListsWithId = this.repo.save(this.testLists);\n\t\tthis.tdListsDTO = this.mapToDTO(testListsWithId);\n\t\tthis.id = this.testListsWithId.getId();\n\t}", "@BeforeEach\n void init() {\n carte = new Carte();\n planning = new Planning(carte);\n }", "protected void testInit() {\n this.auths = CitiesDataType.getTestAuths();\n this.documentKey = CityField.EVENT_ID.name();\n }", "protected void testInit() {\n this.auths = CitiesDataType.getTestAuths();\n this.documentKey = CityField.EVENT_ID.name();\n }", "@Before\n\tpublic void setUp() {\n\t\t/*\n\t\t * TODO: initialize the text fixture. For the initial pattern, use the \"blinker\"\n\t\t * pattern shown in:\n\t\t * https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#Examples_of_patterns\n\t\t * The actual pattern GIF is at:\n\t\t * https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#/media/File:Game_of_life_blinker.gif\n\t\t * Start from the vertical bar on a 5X5 matrix as shown in the GIF.\n\t\t */\n\t}", "@Override\n public void setUp() {\n }", "@BeforeClass\n\t public void setUp() {\n\t }", "@Override\r\n\tpublic void setUp() {\n\r\n\t}", "@Before public void setUp() {\n }", "@Before public void setUp() {\n }", "@Before public void setUp() {\n }", "@Before public void setUp() {\n }", "@Before public void setUp() {\n }", "@Before\n public void initTest() {\n tmpDir=new File(\"/tmp/luc/test\");\n //Setup System properties\n System.getProperties().remove(JNILoader.customPathKEY); //remove any \"old\" stuff\n System.setProperty(JNILoader.customPathKEY,tmpDir.getAbsolutePath());\n }", "@Test\n public void testInitialize() {\n }", "@Test\n public void testInitialize() {\n }", "@Before\n\t public void setUp() {\n\t }", "@BeforeClass\n public static void startUp() {\n // \"override\" parent startUp\n resourceInitialization();\n }", "@BeforeClass\n\tpublic static void init() {\n\t\ttestProduct = new Product();\n\t\ttestProduct.setPrice(1000);\n\t\ttestProduct.setName(\"Moto 360\");\n\t\ttestProduct.setDescrip(\"Moto 360 smart watch for smart generation.\");\n\n\t\ttestReview = new Review();\n\t\ttestReview.setHeadline(\"Excellent battery life\");\n\t\ttestReview.setContent(\"Moto 360 has an excellent battery life of 10 days per full charge.\");\n\t}", "@Before\n\t\t public void setUp() throws Exception {\n\t\t\t testHelper.setUp();\n\t\t }", "@Before\n public void setup() {\n Helpers.fillData();\n }", "@Before\r\n public void setupTestCases() {\r\n instance = new ShoppingListArray();\r\n }", "@Before\r\n\t public void setUp(){\n\t }", "@BeforeClass public static void initialiseScenario(){\n SelectionScenario.initialiseScenario();\n }", "@BeforeAll\n static void init() {\n }", "@Before\n\tpublic void setUp()\n\t{\n\t\tOptionsManager.getSingleton().setTestMode(true);\n\t\tQuestManager.resetSingleton();\n\t}", "@Override\r\n protected void setUp()\r\n {\r\n island = new Island(5,5);\r\n position = new Position(island, 4,4);\r\n seed = new BirdFood(position, \"seed\", \"Crunchy Seeds\", 1.0, 2.0, 1.5);\r\n }", "@Override\r\n protected void setUp() {\r\n // nothing yet\r\n }", "@Before\n public void initJUnitTest() {\n final double[] location = {0, 0};\n final String bodyFace = \"initial back\";\n final String bodyLocation = \"initial arm\";\n body = new BodyLocation(location, bodyFace, bodyLocation);\n }", "@BeforeClass\n\tpublic static void setup() {\n\t\tdataMunger = new DataMunger();\n\n\t}", "protected void setUp() {\n config = new ContestConfig();\n }", "@Before\r\n public void setUp()\r\n {\r\n }", "@Before\r\n public void setUp()\r\n {\r\n }", "@Before\r\n public void setUp()\r\n {\r\n }", "@Before\r\n public void setUp()\r\n {\r\n }", "@Before\n\tpublic void initBeforeEachTestMethod()\n\t{\n\t\ttileScorer_STUDENT = new TileScorerImpl_Moran(ScrabbleEliteConfiguration_Moran.getEliteTileToPointsMap());\n\t\ttileTranslator_STUDENT = new TileTranslatorImpl_Moran(ScrabbleEliteConfiguration_Moran.getEliteTileToTranslationSetMap());\n\t\tdictionary_STUDENT = new DictionaryImpl_Moran(ScrabbleEliteConfiguration_Moran.getEliteWordList());\n\t\tscrabbleWordScorer_STUDENT = new ScrabbleWordScorerImpl_Moran(tileScorer_STUDENT, tileTranslator_STUDENT, dictionary_STUDENT);\n\t}", "@BeforeEach\n public void setup() {\n testTaskList = new TaskList();\n testUi = new Ui();\n\n Event testEvent = new Event(\"Daily Work\", \"CS2113T\", Parser.parseDate(\"31/01/20 0800\"),\n Parser.parseDate(\"31/01/20 1200\"), \"testing\");\n Assignment testAssign = new Assignment(\"Daily Work\", \"CS2113T\", Parser.parseDate(\"20/03/20 0000\"),\n \"testing\");\n testTaskList.addTask(testEvent);\n testTaskList.addTask(testAssign);\n }", "@BeforeEach\n void init() {\n log.info(\"init\");\n }", "protected void setUp() throws Exception {\n \n }", "protected void setUp() throws Exception {\n }", "@Before\n public void setUp() {\n }", "@Before\n public void setUp() {\n }", "@Before\n public void setUp() {\n }", "@Before\n public void setUp() {\n }", "@Before\n public void setUp() {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp()\n {\n }", "@Before\n public void setUp () {\n }", "protected void setUp() throws Exception {\r\n super.setUp();\r\n\r\n testObject = new TestObject(1, \"stringValue\");\r\n }", "@Before\r\n\tpublic void setUp() throws Exception {\r\n\t\t// Get the current FileSystem\r\n\t\tfs = MockFileSystem.getMockFileSys(\"MOCKENV\");\r\n\t\t// Initializes a Cd Object\r\n\t\tcd = new Cd();\r\n\t}", "@Before\n public void init() {\n Cache cache = cacheManager.getCache(\"default-test\");\n cache.clear();\n\n }", "@Before\r\n\tpublic void setUp() {\n\t}", "protected void setUp() throws Exception {\n super.setUp();\n }", "@Before\n\tpublic void setUp() throws Exception {\n\t\tsubGen = new SubsetGenerator();\n\t}", "@Before\n public void initialize() {\n kata4 = new Kata4();\n }", "@Before\n\tpublic void setUp() {\n\t}", "@BeforeClass\n\tpublic static void init() {\n\t\ttry {\n\t\t\tif (emf == null) {\n\t\t\t\temf = Persistence.createEntityManagerFactory(\"application\");\n\t\t\t\tif (em == null) {\n\t\t\t\t\tem = loadConfiguration(emf);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (ClassNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "@BeforeClass\n public static void setUp() throws Exception {\n game = ((StonePits) Gdx.app.getApplicationListener());\n soundMan = game.getSoundManager();\n assetMan = game.getAssetManager();\n }", "public void setUpTestdata() {\n\t\tsetDefaultUserName(Config.getProperty(\"defaultUserName\"));\r\n\t\tsetDefaultPassword(Config.getProperty(\"defaultPassword\"));\r\n\t\tsetTestsiteurl(Config.getProperty(\"testsiteurl\"));\r\n\t\tsetChromeDriverPath(Config.getProperty(\"chromeDriverPath\"));\r\n\t\tsetGeckoDriverPath(Config.getProperty(\"geckoDriverPath\"));\r\n\t\tsetIeDriverPath(Config.getProperty(\"ieDriverPath\"));\r\n\t}", "@BeforeClass\n public static void initTestFixture() throws Exception {\n entityManagerFactory = Persistence.createEntityManagerFactory(\"test\");\n entityManager = entityManagerFactory.createEntityManager();\n }", "@BeforeSuite\n public void initiateData() throws FileNotFoundException, IOException {\n jsonTestData = new JsonClass();\n userDirectory = System.getProperty(\"user.dir\");\n String log4jConfigFile = userDirectory + File.separator + \"src\" + File.separator + \"test\" + File.separator + \"resources\" + File.separator\n + \"log4j.properties\";\n ConfigurationSource source = new ConfigurationSource(new FileInputStream(log4jConfigFile));\n Configurator.initialize(null, source);\n logger = Logger.getLogger(getClass());\n }", "private void initSetUp()\n\t{\n\t\tthis.setActionName(NAME);\n\t\tthis.setDescription(DESCRIPTION);\n\t\tthis.setMagic(IS_MAGIC);\n\t\tthis.setAttack(IS_ATTACK);\n\t\tthis.setTargetSelf(IS_TARGET_SELF);\n\t\tthis.setInternalName(INTERNAL_NAME);\n\t}" ]
[ "0.72882044", "0.7281541", "0.72811836", "0.72547", "0.7230518", "0.7222831", "0.72018826", "0.71952087", "0.71931404", "0.71515095", "0.71432495", "0.7134718", "0.7134325", "0.7132657", "0.71119773", "0.70998466", "0.7092837", "0.70882905", "0.70714474", "0.70714474", "0.70552003", "0.70517915", "0.7037513", "0.7037347", "0.70241714", "0.6991833", "0.6991833", "0.6966823", "0.696238", "0.6956049", "0.6937954", "0.6915718", "0.6915718", "0.6915718", "0.6915718", "0.6915718", "0.6912599", "0.6911321", "0.6911321", "0.690545", "0.689585", "0.68922454", "0.68831307", "0.6879084", "0.6868443", "0.68668234", "0.6863056", "0.6859205", "0.6856626", "0.68437755", "0.6837735", "0.6831082", "0.6817151", "0.68059576", "0.68049276", "0.68049276", "0.68049276", "0.68049276", "0.6803132", "0.68018556", "0.67811227", "0.6762266", "0.67525715", "0.673764", "0.673764", "0.673764", "0.673764", "0.673764", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6731538", "0.6728245", "0.6719893", "0.6714177", "0.671348", "0.6711927", "0.6709109", "0.67059547", "0.67049605", "0.6702497", "0.6702144", "0.6700899", "0.66900766", "0.66876674", "0.66794896", "0.66663855" ]
0.0
-1
Test for equal property value.
@Test void testAssertPropertyReflectionEquals_equals() { assertPropertyReflectionEquals("stringProperty", "stringValue", testObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean equals(Object o) {\n if (o instanceof TestElementProperty) {\n if (this == o) {\n return true;\n }\n if (value != null) {\n return value.equals(((JMeterProperty) o).getObjectValue());\n }\n }\n return false;\n }", "public boolean equalsTo(String property) {\n\t\t\treturn this.value.equals(property);\n\t\t}", "@Test\n void getByPropertyEqualSuccess() {\n List<Order> orders = dao.getByPropertyEqual(\"description\", \"February Large Long-Sleeve\");\n assertEquals(1, orders.size());\n assertEquals(2, orders.get(0).getId());\n }", "@Override\n\tpublic boolean equal() {\n\t\treturn false;\n\t}", "boolean equalProps(InstanceProperties props) {\n String propsName = props.getString(PROPERTY_NAME, null);\n return propsName != null\n ? propsName.equals(name)\n : name == null;\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<User> users = dao.findByPropertyEqual(\"firstName\", \"Mark\");\n assertEquals(1, users.size());\n assertEquals(2, users.get(0).getId());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> roles = genericDAO.getByPropertyEqual(\"userName\", \"admin\");\n assertEquals(1, roles.size());\n assertEquals(1, roles.get(0).getUserRoleId());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Event> events = genericDao.getByPropertyEqual(\"name\", \"Dentist\");\n assertEquals(1, events.size());\n assertEquals(2, events.get(0).getId());\n }", "@Override\n\tpublic boolean equals(Object other){\n\t if (other == null) return false;\n\t if (other == this) return true;\n\t if (!(other instanceof Property))return false;\n\t Property otherProperty = (Property)other;\n\t \n\t if(this.number == otherProperty.number) {\n\t \treturn true;\n\t } else {\n\t \treturn false;\n\t }\n\t}", "@Override\n public boolean equals(final Object obj)\n {\n return this.value.equals(obj);\n }", "String getEqual();", "public void testAssertPropertyLenientEquals_equals() {\r\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n public void mainTests(){\n assertTrue(property1.getPropertyId() == id1);\n if(property1.getPropertyId() != id1) {\n property2.setPropertyId(id1);\n }\n else {\n assertTrue(property2.getPropertyId() == id2);\n }\n //Getter works Correct for ID\n }", "@Test\n void testAssertPropertyLenientEquals_equals() {\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "public boolean eqValue(E that) {\n return this.value.compareTo(that) == 0;\n }", "public boolean equals(Property inProperty){\n return (inProperty.getName().equals(this.getName()));\n }", "@Test\n void getByPropertyExactSuccess() {\n List<Car> carList = carDao.getByPropertyEqual(\"make\", \"Jeep\");\n assertEquals(1, carList.size());\n }", "@Override\n public boolean equals(Object obj) {\n // this code provided by Dave Houtman [2020] personal communication\n if (!(obj instanceof Property))\n return false;\n Property prop = (Property) obj;\n return this.getXLeft() == prop.getXLeft() && this.getYTop() == prop.getYTop() && hasSameSides(prop);\n }", "@Test\r\n public void testEquals() {\r\n Articulo art = new Articulo();\r\n articuloPrueba.setCodigo(1212);\r\n art.setCodigo(1212);\r\n boolean expResult = true;\r\n boolean result = articuloPrueba.equals(art);\r\n assertEquals(expResult, result);\r\n }", "public void testAssertPropertyReflectionEquals_equals() {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n\tpublic void testEqualsVerdadeiro() {\n\t\t\n\t\tassertTrue(contato1.equals(contato3));\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings(), settings);\n }", "@TestProperties(name=\"test equal sign parameters for test\")\n\tpublic void testParametersWithEquals() throws Exception {\n\t\tjsystem.launch();\n//\t\tScenarioUtils.createAndCleanScenario(jsystem, ScenariosManager.getInstance().getCurrentScenario().getScenarioName());\n\t\tScenarioUtils.createAndCleanScenario(jsystem, jsystem.getCurrentScenario());\n\t\tjsystem.addTest(\"testWithInclueParametersNewLine\", \"ParamaetersHandlingSection\", true);\n\t\tjsystem.setTestParameter(1, \"General\", \"Str8\", \"x=2=3=4, v b n eee=,\", false);\n\t\tjsystem.play();\n\t\tjsystem.waitForRunEnd();\n\t\tjsystem.checkNumberOfTestsPass(1);\n\t\tString propValue = \n\t\t\tgetRunProperties().getProperty(\"testWithInclueParametersNewLine_str8\");\n\t\tassertEquals(\"x=2=3=4, v b n eee=,\", propValue);\n\t}", "@Test\n void getByPropertySuccess() {\n List<User> users = genericDao.findByPropertyEqual(\"userName\", \"BigAl\");\n // should only find one entry with the username \"BigAl\"\n assertEquals(users.size(), 1);\n }", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Receta instance = new Receta();\n instance.setNombre(\"nom1\");\n Receta instance2 = new Receta();\n instance.setNombre(\"nom2\");\n boolean expResult = false;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Test\r\n public void testObjectPropertyWithEqualOrSameList() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ObjectProperty<ObservableList<String>> otherPropertySameList = new SimpleObjectProperty<>(list);\r\n assertFalse(\"sanity: two properties with same list are not equal\", \r\n property.equals(otherPropertySameList));\r\n ObjectProperty<ObservableList<String>> otherPropertyEqualList =\r\n new SimpleObjectProperty(createObservableList(true));\r\n assertFalse(\"sanity: two properties with equal list are not equal\", \r\n property.equals(otherPropertyEqualList));\r\n }", "@Test\n void getByPropertyEqualUnique() {\n UserRoles role = (UserRoles)genericDAO.getByPropertyEqualUnique(\"userName\", \"admin\");\n assertEquals(\"admin\", role.getUserName());\n }", "@Test\n public void testEquals_1() {\n LOGGER.info(\"testEquals_1\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hello\");\n final boolean actual = atomString.equals(atom);\n assertTrue(actual);\n }", "public boolean equals(Object o) {\r\n\t\t// TODO and replace return false with the appropriate code.\r\n\t\tif (o == null || o.getClass() != this.getClass())\r\n\t\t\treturn false;\r\n\t\tProperty p = (Property) o;\r\n\t\treturn Arrays.deepEquals(p.positive, this.positive)\r\n\t\t\t\t&& Arrays.deepEquals(p.negative, this.negative)\r\n\t\t\t\t&& Arrays.deepEquals(p.stop, this.stop)\r\n\t\t\t\t&& p.scoringmethod == this.scoringmethod\r\n\t\t\t\t&& Math.abs(p.mindistance - this.mindistance) < 0.000001;\r\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings().hashCode(), settings.hashCode());\n }", "@Override\r\n\tpublic boolean isEqual(Node node) {\n\t\treturn false;\r\n\t}", "private boolean isValuesEqual(BinaryMessage tocmp, BinaryMessage original) {\n\t\tif(tocmp.getValue().equals(original.getValue())) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n public void equals_trulyEqual() {\n SiteInfo si1 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n SiteInfo si2 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n\n Assert.assertEquals(si1, si2);\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Commissioner instance = new Commissioner();\n Commissioner instance2 = new Commissioner();\n instance.setLogin(\"genie\");\n instance2.setLogin(\"genie\");\n boolean expResult = true;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> usersRoles = genericDao.getByPropertyEqual(\"roleName\", \"admin\");\n assertEquals(1, usersRoles.size());\n assertEquals(3, usersRoles.get(0).getId());//not sure about this one\n }", "private boolean equals() {\r\n return MARK(EQUALS) && CHAR('=') && gap();\r\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Object object = null;\n Paciente instance = new Paciente();\n boolean expResult = false;\n boolean result = instance.equals(object);\n assertEquals(expResult, result);\n\n }", "@Test\n public void testEquals() {\n \n Beneficiaire instance = ben2;\n Beneficiaire unAutreBeneficiaire = ben3;\n boolean expResult = false;\n boolean result = instance.equals(unAutreBeneficiaire);\n assertEquals(expResult, result);\n\n unAutreBeneficiaire = ben2;\n expResult = true;\n result = instance.equals(unAutreBeneficiaire);\n assertEquals(expResult, result);\n }", "static private <T> boolean setIfDifferent(Channel<T> ch, T value) throws CAException, TimeoutException {\n if (!value.equals(ch.getFirst())) {\n ch.setValue(value);\n return true;\n } else {\n return false;\n }\n }", "@Test\n \tpublic void testEqual() {\n \t\tAssert.assertTrue(f1.equals(f1));\n \t}", "@Test\r\n public void testEquals() throws Exception\r\n {\r\n Object expectedValueToEqual = new Object();\r\n ValueEquals sut = new ValueEquals(\"MyReplaceId\", expectedValueToEqual);\r\n assertEquals(sut.compareDataSetElementTo(expectedValueToEqual), 0);\r\n ;\r\n }", "@Test\n void equals1() {\n Student s1=new Student(\"emina\",\"milanovic\",18231);\n Student s2=new Student(\"emina\",\"milanovic\",18231);\n assertEquals(true,s1.equals(s2));\n }", "boolean equalTo(ObjectPassDemo o) {\n return (o.a == a && o.b == b);\n }", "public void testEqualsObject() {\n\t\t\tTipoNodoLeisure tipo1 = new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.0\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo2= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.1\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo3= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.2\")); //$NON-NLS-1$\n\t\t\tif (tipo1 != tipo1)\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.3\")); //$NON-NLS-1$\n\t\t\tif (!tipo1.equals(tipo2))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.4\"));\t\t\t //$NON-NLS-1$\n\t\t\tif (tipo1.equals(tipo3))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.5\"));\t //$NON-NLS-1$\n\t\t}", "<T> boolean containsValue(Property<T> property);", "@Test\n public void testEqualsReturnsFalseOnDifferentIdVal() throws Exception {\n setRecordFieldValue(otherRecord, \"id\", 42L);\n\n boolean equals = record.equals(otherRecord);\n\n assertThat(equals, is(false));\n }", "boolean hasSetProperty();", "@Test\n public void testEquals_2() {\n LOGGER.info(\"testEquals_2\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hej\");\n final boolean actual = atomString.equals(atom);\n assertFalse(actual);\n }", "public static <T> EqSpecification<T> eq( Property<T> property, T value )\n {\n return new EqSpecification<>( property( property ), value );\n }", "public void testEqualsObject()\n {\n Mana meme = new Mana( myMise );\n Assert.assertEquals( myMise, meme );\n \n System.out.println( myMise.toString());\n Mana autre = new Mana( 49 );\n Assert.assertFalse( myMise.equals( autre ));\n autre = new Mana( 50 );\n Assert.assertTrue( myMise.equals( autre ));\n }", "@Test\n\tpublic void testEquals6(){\n\t\tTemperature data1 = new Temperature (100, Temperature.Units.KELVIN);\n\t\tTemperature data2 = new Temperature (100, Temperature.Units.CELCIUS);\n\t\tassertEquals(data1.equals(data2), false);\t//Since '100 kelvin' and '100 celcius' are different, equals() function should return false \n\t\tassertTrue(data1.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\n\t\tassertTrue(data2.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\t\n\t}", "@Test\n @DisplayName(\"Test should detect equality between equal states.\")\n public void testShouldResultInEquality() {\n ObjectBag os1 = new ObjectBag(null, \"Hi\");\n ObjectBag os2 = new ObjectBag(null, \"Hi\");\n\n Assertions.assertThat(os1).isEqualTo(os2);\n }", "public abstract QueryElement addEquals(String property, Object value);", "public void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\r\n try {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject);\r\n fail(\"Expected AssertionFailedError\");\r\n } catch (AssertionFailedError a) {\r\n // expected\r\n }\r\n }", "@Test\n public void testEquals_4()\n throws Exception {\n ColumnPreferences fixture = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n fixture.setVisible(true);\n Object obj = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n\n boolean result = fixture.equals(obj);\n\n assertEquals(true, result);\n }", "@Test\n\tpublic void testEqualsFalso() {\n\t\t\n\t\tassertFalse(contato1.equals(contato2));\n\t}", "@Override\n public boolean equals(Object obj) {\n if (obj instanceof Percentage) {\n Percentage other = (Percentage) obj;\n return amount.equals(other.amount);\n }\n return false;\n }", "@Test\n void testEquals() {\n final boolean expected_boolean = true;\n\n // Properties for the objects\n final String username = \"username\";\n final String name = \"their_name\";\n final String password = \"password\";\n\n // Create two LoginAccount objects\n LoginAccount first_account = new LoginAccount(username, name, password);\n LoginAccount second_account = new LoginAccount(username, name, password);\n\n // Variable to check\n boolean objects_are_equal = first_account.equals(second_account);\n\n // Assert that the two boolean values are the same\n assertEquals(expected_boolean, objects_are_equal);\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }" ]
[ "0.71675956", "0.66831696", "0.6568936", "0.6514604", "0.64192986", "0.64023435", "0.63786006", "0.63124824", "0.6287913", "0.6230566", "0.62301105", "0.6225949", "0.6195938", "0.61822426", "0.6168125", "0.6146655", "0.6115958", "0.6113818", "0.60357493", "0.60333323", "0.60032946", "0.6001758", "0.59942096", "0.59928656", "0.5953585", "0.5942897", "0.59398806", "0.59301156", "0.5900318", "0.5896896", "0.5876442", "0.5861075", "0.584881", "0.5846964", "0.58171475", "0.58166677", "0.57881343", "0.5783383", "0.5766516", "0.57446116", "0.57431316", "0.57422405", "0.5739205", "0.5726783", "0.5717903", "0.57134014", "0.5706703", "0.5685065", "0.5680691", "0.5674422", "0.5671943", "0.56632173", "0.565611", "0.56520414", "0.56287867", "0.56279534", "0.5624449", "0.5612883", "0.5611672", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447" ]
0.5850429
32
Test for equal property value (message version).
@Test void testAssertPropertyReflectionEquals_equalsMessage() { assertPropertyReflectionEquals("a message", "stringProperty", "stringValue", testObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testAssertPropertyLenientEquals_equalsMessage() {\r\n assertPropertyLenientEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\r\n }", "public void testAssertPropertyReflectionEquals_equalsMessage() {\r\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\r\n }", "private boolean isValuesEqual(BinaryMessage tocmp, BinaryMessage original) {\n\t\tif(tocmp.getValue().equals(original.getValue())) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n void testAssertPropertyLenientEquals_equalsMessage() {\n assertPropertyLenientEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\n }", "public void testGetProperty()\n {\n assertEquals(\"MSM Extension not present, or incorrect specification version -\", MSM_SPECIFICATION_VERSION,\n System.getProperty(MSM_PROPERTY_NAME));\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Order> orders = dao.getByPropertyEqual(\"description\", \"February Large Long-Sleeve\");\n assertEquals(1, orders.size());\n assertEquals(2, orders.get(0).getId());\n }", "String getEqual();", "public void testAssertPropertyLenientEquals_equals() {\r\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n\t\t\tpublic void setMessageTest() {\n\t\t\t\tMessage msgjunit = new Message();\n\t\t\t\tString expectedmsg = msgjunit.getMessage();\n\t\t\t\tString actualmsg = msgjunit.getMessage();\n\t\t\t\tassertSame(expectedmsg, actualmsg);\n\t\t\t\tif (expectedmsg == actualmsg) {\n\n\t\t\t\t\tSystem.out.println(\"Both expected message and actual message are equal:\" + \" \" + expectedmsg\n\t\t\t\t\t\t\t+ \" \" + \"=\" + \" \" + actualmsg);\n\t\t\t\t}\n\t\t\t}", "public static void ensureEquivalent(Message m1, JBossMessage m2) throws JMSException\n {\n assertTrue(m1 != m2);\n \n //Can't compare message id since not set until send\n \n assertEquals(m1.getJMSTimestamp(), m2.getJMSTimestamp());\n \n byte[] corrIDBytes = null;\n String corrIDString = null;\n \n try\n {\n corrIDBytes = m1.getJMSCorrelationIDAsBytes();\n }\n catch(JMSException e)\n {\n // correlation ID specified as String\n corrIDString = m1.getJMSCorrelationID();\n }\n \n if (corrIDBytes != null)\n {\n assertTrue(Arrays.equals(corrIDBytes, m2.getJMSCorrelationIDAsBytes()));\n }\n else if (corrIDString != null)\n {\n assertEquals(corrIDString, m2.getJMSCorrelationID());\n }\n else\n {\n // no correlation id\n \n try\n {\n byte[] corrID2 = m2.getJMSCorrelationIDAsBytes();\n assertNull(corrID2);\n }\n catch(JMSException e)\n {\n // correlatin ID specified as String\n String corrID2 = m2.getJMSCorrelationID();\n assertNull(corrID2);\n }\n }\n assertEquals(m1.getJMSReplyTo(), m2.getJMSReplyTo());\n assertEquals(m1.getJMSDestination(), m2.getJMSDestination());\n assertEquals(m1.getJMSDeliveryMode(), m2.getJMSDeliveryMode());\n //We don't check redelivered since this is always dealt with on the proxy\n assertEquals(m1.getJMSType(), m2.getJMSType());\n assertEquals(m1.getJMSExpiration(), m2.getJMSExpiration());\n assertEquals(m1.getJMSPriority(), m2.getJMSPriority());\n \n int m1PropertyCount = 0, m2PropertyCount = 0;\n for(Enumeration p = m1.getPropertyNames(); p.hasMoreElements(); m1PropertyCount++)\n {\n p.nextElement();\n }\n for(Enumeration p = m2.getPropertyNames(); p.hasMoreElements(); m2PropertyCount++)\n {\n p.nextElement();\n }\n \n assertEquals(m1PropertyCount, m2PropertyCount);\n \n for(Enumeration props = m1.getPropertyNames(); props.hasMoreElements(); )\n {\n boolean found = false;\n \n String name = (String)props.nextElement();\n \n boolean booleanProperty = false;\n try\n {\n booleanProperty = m1.getBooleanProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a boolean\n }\n \n if (found)\n {\n assertEquals(booleanProperty, m2.getBooleanProperty(name));\n continue;\n }\n \n byte byteProperty = 0;\n try\n {\n byteProperty = m1.getByteProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a byte\n }\n \n if (found)\n {\n assertEquals(byteProperty, m2.getByteProperty(name));\n continue;\n }\n \n short shortProperty = 0;\n try\n {\n shortProperty = m1.getShortProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a short\n }\n \n if (found)\n {\n assertEquals(shortProperty, m2.getShortProperty(name));\n continue;\n }\n \n \n int intProperty = 0;\n try\n {\n intProperty = m1.getIntProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a int\n }\n \n if (found)\n {\n assertEquals(intProperty, m2.getIntProperty(name));\n continue;\n }\n \n \n long longProperty = 0;\n try\n {\n longProperty = m1.getLongProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a long\n }\n \n if (found)\n {\n assertEquals(longProperty, m2.getLongProperty(name));\n continue;\n }\n \n \n float floatProperty = 0;\n try\n {\n floatProperty = m1.getFloatProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a float\n }\n \n if (found)\n {\n assertTrue(floatProperty == m2.getFloatProperty(name));\n continue;\n }\n \n double doubleProperty = 0;\n try\n {\n doubleProperty = m1.getDoubleProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a double\n }\n \n if (found)\n {\n assertTrue(doubleProperty == m2.getDoubleProperty(name));\n continue;\n }\n \n String stringProperty = null;\n try\n {\n stringProperty = m1.getStringProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a String\n }\n \n if (found)\n {\n assertEquals(stringProperty, m2.getStringProperty(name));\n continue;\n }\n \n \n fail(\"Cannot identify property \" + name);\n }\n }", "@Test\n void testAssertPropertyLenientEquals_equals() {\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "@Test\n public void testEquals() {\n assertTrue(chatMessage.equals(chatMessage));\n assertFalse(chatMessage.equals(new ChatMessage(author, \"JaJa!\")));\n assertFalse(chatMessage.equals(new ChatMessage(\"Javache\", text)));\n assertFalse(chatMessage.equals(new ChatMessage(\"Javache\", \"JaJa!\")));\n }", "boolean equalProps(InstanceProperties props) {\n String propsName = props.getString(PROPERTY_NAME, null);\n return propsName != null\n ? propsName.equals(name)\n : name == null;\n }", "public void testAssertPropertyReflectionEquals_equals() {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "public boolean equalsTo(String property) {\n\t\t\treturn this.value.equals(property);\n\t\t}", "@Test\r\n\tpublic void equalsTest() throws Exception {\r\n\t\t\r\n\t\tUMLMessageArgument msgArg1 = new UMLMessageArgument(\"name1\",\"datatype1\",\"initVal\",false);\r\n\t\tUMLMessageArgument msgArg2 = new UMLMessageArgument(\"name1\",\"datatype1\",\"initVal\",false);\r\n\t\tUMLMessageArgument msgArg3 = new UMLMessageArgument(\"name1\",\"datatype1\",\"initVal\",false);\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the datatype\r\n\t\tmsgArg2.setDataType(\"datatype2\");\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setDataType(\"datatype1\");\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the name\r\n\t\tmsgArg2.setName(\"name2\");\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setName(\"name1\");\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the initial value\r\n\t\tmsgArg2.setInitializedTo(\"initVal2\");\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setInitializedTo(\"initVal\");\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the variable arguments flag\r\n\t\tmsgArg2.setHasVarArgs(true);\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setHasVarArgs(false);\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// verify that IllegalArgumentException is detected\r\n\t\tObject o = new Object();\r\n\t\tException ee = null; \r\n\t\ttry {\r\n\t\t\tassertFalse(msgArg1.equals(o));\r\n\t\t}catch(Exception e) {\r\n\t\t\tee = e;\r\n\t\t}\r\n\t\tassertNull(ee);\r\n\t\t\r\n\t\t// verify that IllegalArgumentException is detected\r\n\t\tException ee2 = null;\r\n\t\tUMLSymbol umlSymbol = new UMLActor(\"1\",\"2\", new UMLSequenceDiagram());\r\n\t\ttry {\r\n\t\t\tassertFalse(msgArg1.equals(umlSymbol));\r\n\t\t}catch(Exception e) {\r\n\t\t\tee2 = e;\r\n\t\t}\r\n\t\tassertNull(ee2);\r\n\t}", "@Test\n public void testIntProperty() throws JMSException {\n int messageCount = responseMessage.getIntProperty(\n ServerListener.MESSAGE_COUNT);\n\n assertTrue(\"The message count should've been equal to or greater than\" +\n \" 1\", (messageCount >= 1));\n }", "@SuppressWarnings({ \"static-method\", \"nls\" })\n @Test\n public final void testGetProperty()\n {\n TestEasyPropertiesObject object = new TestEasyPropertiesObject();\n Assert.assertEquals(\"1.2.3\", object.getVersion());\n }", "public void testIsCompatible() {\n System.out.println(\"isCompatible\"); // NOI18N\n \n TypeID requiredType = TYPEID_JAVA_LANG_STRING; // NOI18N\n PropertyValue instance = TypesSupport.createStringValue(FirstCD.PROPERTY_TEST); // NOI18N\n boolean expResult = true;\n boolean result = instance.isCompatible(requiredType);\n \n assertEquals(expResult, result);\n }", "public void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\r\n try {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject);\r\n fail(\"Expected AssertionFailedError\");\r\n } catch (AssertionFailedError a) {\r\n // expected\r\n }\r\n }", "@Override\n public boolean equals(Object o) {\n if (o instanceof TestElementProperty) {\n if (this == o) {\n return true;\n }\n if (value != null) {\n return value.equals(((JMeterProperty) o).getObjectValue());\n }\n }\n return false;\n }", "@Test\n public void testGetProperty_String() throws DatabaseException {\n String key = \"version\";\n DatabaseProperties instance = cveDb.getDatabaseProperties();\n String result = instance.getProperty(key);\n \n int major = Integer.parseInt(result.substring(0, result.indexOf('.')));\n \n assertTrue(major >= 5);\n }", "@Override\n public boolean equivalent(ExampleProtocolConfiguration latest, ExampleProtocolConfiguration previous) {\n return latest.getStubData().equals(previous.getStubData());\n }", "@Override\n\tpublic boolean equal() {\n\t\treturn false;\n\t}", "@Test\n public void testEquals_1() {\n LOGGER.info(\"testEquals_1\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hello\");\n final boolean actual = atomString.equals(atom);\n assertTrue(actual);\n }", "@Test\n\tpublic void testEqualsVerdadeiro() {\n\t\t\n\t\tassertTrue(contato1.equals(contato3));\n\t}", "@Test\n public void testEquals_2() {\n LOGGER.info(\"testEquals_2\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hej\");\n final boolean actual = atomString.equals(atom);\n assertFalse(actual);\n }", "@Test\n void testAssertPropertyReflectionEquals_equals() {\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "public void test_getMessage() {\n assertEquals(\"'message' value should be properly retrieved.\", message, instance.getMessage());\n }", "static private <T> boolean setIfDifferent(Channel<T> ch, T value) throws CAException, TimeoutException {\n if (!value.equals(ch.getFirst())) {\n ch.setValue(value);\n return true;\n } else {\n return false;\n }\n }", "@Override\n\tpublic boolean equals(Object other){\n\t if (other == null) return false;\n\t if (other == this) return true;\n\t if (!(other instanceof Property))return false;\n\t Property otherProperty = (Property)other;\n\t \n\t if(this.number == otherProperty.number) {\n\t \treturn true;\n\t } else {\n\t \treturn false;\n\t }\n\t}", "public void equals(String message, Object expected, Object actual)\n {\n assertEquals(expected, actual, message);\n }", "public void testGetMessage() {\n assertEquals(\"Message should be got correctly.\", event.getMessage(), message);\n }", "@TestProperties(name=\"test equal sign parameters for test\")\n\tpublic void testParametersWithEquals() throws Exception {\n\t\tjsystem.launch();\n//\t\tScenarioUtils.createAndCleanScenario(jsystem, ScenariosManager.getInstance().getCurrentScenario().getScenarioName());\n\t\tScenarioUtils.createAndCleanScenario(jsystem, jsystem.getCurrentScenario());\n\t\tjsystem.addTest(\"testWithInclueParametersNewLine\", \"ParamaetersHandlingSection\", true);\n\t\tjsystem.setTestParameter(1, \"General\", \"Str8\", \"x=2=3=4, v b n eee=,\", false);\n\t\tjsystem.play();\n\t\tjsystem.waitForRunEnd();\n\t\tjsystem.checkNumberOfTestsPass(1);\n\t\tString propValue = \n\t\t\tgetRunProperties().getProperty(\"testWithInclueParametersNewLine_str8\");\n\t\tassertEquals(\"x=2=3=4, v b n eee=,\", propValue);\n\t}", "@Test\n public void equals_trulyEqual() {\n SiteInfo si1 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n SiteInfo si2 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n\n Assert.assertEquals(si1, si2);\n }", "@Test\n\tpublic void testVersion() {\n\t\tassertEquals(\"HTTP/1.0\", myReply.getVersion());\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings().hashCode(), settings.hashCode());\n }", "@Test\n\tpublic void testEquals_fixture_3()\n\t\tthrows Exception {\n\t\tVersion fixture2 = getFixture();\n\t\tObject other = new Version(\"1\");\n\n\t\tboolean result = fixture2.equals(other);\n\n\t\t// add additional test code here\n\t\tassertEquals(true, result);\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings(), settings);\n }", "@Test\n public void testVersion() {\n PowerMock.replayAll();\n assertEquals(Version.getVersion(), connector.version());\n PowerMock.verifyAll();\n }", "@Test\n public void mainTests(){\n assertTrue(property1.getPropertyId() == id1);\n if(property1.getPropertyId() != id1) {\n property2.setPropertyId(id1);\n }\n else {\n assertTrue(property2.getPropertyId() == id2);\n }\n //Getter works Correct for ID\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> roles = genericDAO.getByPropertyEqual(\"userName\", \"admin\");\n assertEquals(1, roles.size());\n assertEquals(1, roles.get(0).getUserRoleId());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Event> events = genericDao.getByPropertyEqual(\"name\", \"Dentist\");\n assertEquals(1, events.size());\n assertEquals(2, events.get(0).getId());\n }", "@BusProperty(name = \"Version\", signature = \"u\")\n int getVersion() throws BusException;", "@Test\n public void equalsSameTest() {\n Device device2 = new Device(deviceID, token);\n assertEquals(device, device2);\n }", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof MsgExternalizePK)) {\n return false;\n }\n MsgExternalizePK other = (MsgExternalizePK) object;\n if ((this.mesgId == null && other.mesgId != null) || (this.mesgId != null && !this.mesgId.equals(other.mesgId))) {\n return false;\n }\n if (this.version != other.version) {\n return false;\n }\n if ((this.payloadType == null && other.payloadType != null) || (this.payloadType != null && !this.payloadType.equals(other.payloadType))) {\n return false;\n }\n if ((this.partId == null && other.partId != null) || (this.partId != null && !this.partId.equals(other.partId))) {\n return false;\n }\n return true;\n }", "@Test\r\n public void testObjectPropertyWithEqualOrSameList() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ObjectProperty<ObservableList<String>> otherPropertySameList = new SimpleObjectProperty<>(list);\r\n assertFalse(\"sanity: two properties with same list are not equal\", \r\n property.equals(otherPropertySameList));\r\n ObjectProperty<ObservableList<String>> otherPropertyEqualList =\r\n new SimpleObjectProperty(createObservableList(true));\r\n assertFalse(\"sanity: two properties with equal list are not equal\", \r\n property.equals(otherPropertyEqualList));\r\n }", "public void testAssertPropertyReflectionEquals_equalsIgnoredDefault() {\r\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", null, testObject, IGNORE_DEFAULTS);\r\n }", "@Test\n void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\n assertFailing(() ->\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject)\n );\n }", "private static void compareVersioningHeader(Object headerValue, HttpResponse<InputStream> jsonResponse) {\n AbstractMap<String, String> headersToTest = RequestAnswer.parser(headerValue);\n resultVersioningHeader = new HashMap<>();\n resultVersioningHeader.put(\"Versioning test\", null);\n for (Map.Entry<String, String> entry : headersToTest.entrySet()) {\n if (jsonResponse.getHeaders().keySet().contains(entry.getKey().toLowerCase())) {\n resultVersioningHeader.put(entry.getKey(), jsonResponse.getHeaders().get(entry.getKey().toLowerCase()).contains(entry.getValue()));\n } else {\n resultVersioningHeader.put(entry.getKey(), false);\n }\n }\n }", "public void testGetNewValue_Accuracy() {\r\n String newValue = \"newValue\";\r\n UnitTestHelper.setPrivateField(AuditDetail.class, auditDetail, \"newValue\", newValue);\r\n assertEquals(\"The newValue value should be got properly.\", newValue, auditDetail.getNewValue());\r\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<User> users = dao.findByPropertyEqual(\"firstName\", \"Mark\");\n assertEquals(1, users.size());\n assertEquals(2, users.get(0).getId());\n }", "@Test\n public void testGetDuplicateTranslationKeys() throws Exception {\n final File testFile = getTestFile(\"messages.properties\");\n FileUtils.writeLines(testFile, Arrays.asList(\"dup=foo\", \"not.dup=bar\", \"dup=fizzbuzz\"));\n assertThat(parser.getDuplicateTranslationKeys(testFile)).hasSize(1).contains(\"dup\");\n }", "@Test\n \tpublic void testEqual() {\n \t\tAssert.assertTrue(f1.equals(f1));\n \t}", "@Test\n\tpublic void testEquals_fixture_1()\n\t\tthrows Exception {\n\t\tVersion fixture2 = getFixture();\n\t\tObject other = \"1\";\n\n\t\tboolean result = fixture2.equals(other);\n\n\t\t// add additional test code here\n\t\tassertEquals(false, result);\n\t}", "@Test\n\tpublic void testEquals6(){\n\t\tTemperature data1 = new Temperature (100, Temperature.Units.KELVIN);\n\t\tTemperature data2 = new Temperature (100, Temperature.Units.CELCIUS);\n\t\tassertEquals(data1.equals(data2), false);\t//Since '100 kelvin' and '100 celcius' are different, equals() function should return false \n\t\tassertTrue(data1.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\n\t\tassertTrue(data2.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\t\n\t}", "@Test\n void getByPropertyExactSuccess() {\n List<Car> carList = carDao.getByPropertyEqual(\"make\", \"Jeep\");\n assertEquals(1, carList.size());\n }", "public void testGetManagementSpecVersion() {\n String specVersion = mb.getManagementSpecVersion();\n assertNotNull(specVersion);\n assertTrue(specVersion.length() > 0);\n }", "private boolean compareAndSet(long version, V newValue) {\n VersionedValue<V> result =\n versionedValue.updateAndGet(prev -> prev.getVersion()==version ?\n new VersionedValue<>(prev.getVersion() + 1, newValue) : prev);\n return result.getVersion()!=version;\n }", "public boolean isEqual(Edge e){\n if(v1.equals(e.v1) && v2.equals(e.v2)){\n return true;\n }\n else if(v1.equals(e.v2) && v2.equals(e.v1)){\n return true;\n }\n else{\n return false;\n }\n }", "@Test\n\tpublic void test_equals1() {\n\tTennisPlayer c1 = new TennisPlayer(11,\"Joe Tsonga\");\n\tTennisPlayer c2 = new TennisPlayer(11,\"Joe Tsonga\");\n\tassertTrue(c1.equals(c2));\n }", "@Test\n @DisplayName(\"Test should detect equality between equal states.\")\n public void testShouldResultInEquality() {\n ObjectBag os1 = new ObjectBag(null, \"Hi\");\n ObjectBag os2 = new ObjectBag(null, \"Hi\");\n\n Assertions.assertThat(os1).isEqualTo(os2);\n }", "private void verifyMessageDigestAttribute()\n throws CMSException\n {\n ASN1Primitive validMessageDigest = getSingleValuedSignedAttribute(\n CMSAttributes.messageDigest, \"message-digest\");\n if (validMessageDigest == null)\n {\n if (signedAttributeSet != null)\n {\n throw new CMSException(\"the message-digest signed attribute type MUST be present when there are any signed attributes present\");\n }\n }\n else\n {\n if (!(validMessageDigest instanceof ASN1OctetString))\n {\n throw new CMSException(\"message-digest attribute value not of ASN.1 type 'OCTET STRING'\");\n }\n\n ASN1OctetString signedMessageDigest = (ASN1OctetString)validMessageDigest;\n\n if (!Arrays.constantTimeAreEqual(resultDigest, signedMessageDigest.getOctets()))\n {\n throw new CMSSignerDigestMismatchException(\"message-digest attribute value does not match calculated value\");\n }\n }\n }", "boolean hasProperty2();", "public boolean hasProperty2() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "@Override\n public boolean equals(Object o) {\n if (o instanceof ModelMessage) {\n ModelMessage m = (ModelMessage) o;\n if (sourceId.equals(m.sourceId)\n && getId().equals(m.getId())\n && messageType == m.messageType) {\n return super.equals(m);\n }\n }\n return false;\n }", "public boolean hasProperty2() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "@Test\n public void equal() {\n assertTrue(commandItem.equals(commandItemCopy));\n assertTrue(commandItem.isSameCommand(commandItemCopy));\n //not commanditem return false\n assertFalse(commandItem.equals(commandWord));\n }", "public boolean hasProperty1() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "@Test\n public void equals() {\n Command commandCopy = new McqInputCommand(\"a\", mcqTest);\n assertTrue(G_MCQ_COMMAND.equals(commandCopy));\n\n // same object -> returns true\n assertTrue(commandCopy.equals(commandCopy));\n\n assertFalse(commandCopy.equals(null));\n\n // different type -> returns false\n assertFalse(commandCopy.equals(10));\n assertFalse(commandCopy.equals(\"TestString\"));\n }", "public void testAssertPropertyLenientEquals_equalsIgnoredDefault() {\r\n assertPropertyLenientEquals(\"stringProperty\", null, testObject);\r\n }", "@Test\r\n public void testEquals() throws Exception\r\n {\r\n Object expectedValueToEqual = new Object();\r\n ValueEquals sut = new ValueEquals(\"MyReplaceId\", expectedValueToEqual);\r\n assertEquals(sut.compareDataSetElementTo(expectedValueToEqual), 0);\r\n ;\r\n }", "@Test\r\n public void testNotificationSetEqualElement() {\r\n ObservableList first = FXCollections.observableArrayList(getPerson1());\r\n ObservableList second = FXCollections.observableArrayList(getPerson2());\r\n int index = 0;\r\n assertEquals(\"sanity: \", first.get(index), second.get(index));\r\n ListChangeReport report = new ListChangeReport(first);\r\n first.set(index, second.get(index));\r\n assertEquals(\"list must have fired on setting equal item\", 1, report.getEventCount());\r\n \r\n }", "public boolean equals(Property inProperty){\n return (inProperty.getName().equals(this.getName()));\n }", "public void assertUpdateChangesMessage() {\r\n\t\tprint(\"Assert Updates Changes Confirmation Message\");\r\n\t\tlocator = Locator.MyTrader.Updated_Changes_Messages.value;\r\n\t\tAssert.assertTrue(isElementPresent(locator));\r\n\t}", "public static boolean sameVersion(Object o1, Object o2) {\r\n checkVersionable(o1);\r\n checkVersionable(o2);\r\n return ((Versionable) o1).getVersionId() ==\r\n ((Versionable) o2).getVersionId();\r\n }", "public boolean hasProperty1() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "public static void massertEqual(Object a, Object b, String pfmessg, Object... pfargs)\r\n\t{\r\n\t\tif(!a.equals(b))\r\n\t\t{\r\n\t\t\tObject[] vargar = new Object[pfargs.length+2];\r\n\t\t\t\r\n\t\t\tvargar[0] = a; \r\n\t\t\tvargar[1] = b;\r\n\t\t\t\r\n\t\t\tfor(int i : Util.range(pfargs.length))\r\n\t\t\t\t{ vargar[i+2] = pfargs[i]; }\r\n\t\t\t\r\n\t\t\tthrow new RuntimeException(\"\\nEquality Assertion failed: \" + sprintf(pfmessg, vargar));\t\t\t\r\n\t\t}\r\n\t}", "private boolean checkForVersionProperties(DeployBeanDescriptor<?> desc) {\n for (DeployBeanProperty prop : desc.propertiesBase()) {\n if (prop.isVersionColumn()) {\n return true;\n }\n }\n return false;\n }", "@Test\n public void checkEquals() {\n EqualsVerifier.forClass(GenericMessageDto.class).usingGetClass()\n .suppress(Warning.NONFINAL_FIELDS).verify();\n }", "private boolean compareProperties (Properties props1 , Properties props2){\n boolean propertiesAreEqual = true;\n Properties props2Clone = (Properties)props2.clone();\n Iterator<Object> itProps1Name = props1.keySet().iterator();\n while (propertiesAreEqual && itProps1Name.hasNext()){\n String propertyName = (String)itProps1Name.next();\n if (props2Clone.containsKey(propertyName)){\n propertiesAreEqual = props1.getProperty(propertyName).trim()\n .equals(props2Clone.getProperty(propertyName).trim());\n // Remove checked property from props2Clone properties\n props2Clone.remove(propertyName);\n }\n else{\n propertiesAreEqual = false;\n }\n }\n // If there are left properties in CSS file then files are not equal\n if (props2Clone.size() > 0){\n propertiesAreEqual = false;\n }\n \n return propertiesAreEqual;\n \n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Commissioner instance = new Commissioner();\n Commissioner instance2 = new Commissioner();\n instance.setLogin(\"genie\");\n instance2.setLogin(\"genie\");\n boolean expResult = true;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Test\n public void equals() {\n UpdateCommand.UpdateProfileDescriptor descriptorWithSameValues = new UpdateCommand\n .UpdateProfileDescriptor(UPDESC_1);\n assertTrue(UPDESC_1.equals(descriptorWithSameValues));\n\n // same object -> returns true\n assertTrue(UPDESC_1.equals(UPDESC_1));\n\n // null -> returns false\n assertFalse(UPDESC_1.equals(null));\n\n // different types -> returns false\n assertFalse(UPDESC_1.equals(5));\n\n // different values -> returns false\n assertFalse(UPDESC_1.equals(UPDESC_2));\n\n // different name -> returns false\n UpdateCommand.UpdateProfileDescriptor editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1)\n .withName(VALID_NAME_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n\n // different id -> returns false\n editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1).withId(VALID_ID_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n\n // different height -> returns false\n editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1).withHeight(VALID_HEIGHT_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n\n // different weight -> returns false\n editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1).withWeight(VALID_WEIGHT_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n }", "public boolean testVerify(byte[] message)\n {\n return false;\n }", "@Test(expected = AssertionError.class)\n public void testSchemaVersionMismatch() {\n PowerMock.replayAll();\n Map<String, String> sampleConfig = new HashMap<>();\n sampleConfig.put(SCHEMA_VERSION, \"1\");\n Map<String, Object> checkConfig = connector.config().parse(sampleConfig);\n assertEquals(2, checkConfig.get(SCHEMA_VERSION));\n PowerMock.verifyAll();\n }", "private boolean isConfPropEqual(String prop, Configuration conf1,\n Configuration conf2) {\n if( (conf1 == null || conf2 == null) && (conf1 != conf2) ){\n return false;\n }\n String str1 = conf1.get(prop);\n String str2 = conf2.get(prop);\n if( (str1 == null || str2 == null) && (str1 != str2) ){\n return false;\n }\n return str1.equals(str2);\n }", "@Test\n\tpublic void ifAppropriateAttributesInDifferentMBeansHaveSameValueReturnsThatValue() throws Exception {\n\t\tMBeanWithSingleIntAttr mbean_1 = new MBeanWithSingleIntAttr(1);\n\t\tMBeanWithSingleIntAttr mbean_2 = new MBeanWithSingleIntAttr(1);\n\n\t\tDynamicMBean mbean = createDynamicMBeanFor(mbean_1, mbean_2);\n\n\t\tassertEquals(1, mbean.getAttribute(\"value\"));\n\t}", "@Test\n void testAssertPropertyLenientEquals_equalsIgnoredDefault() {\n assertPropertyLenientEquals(\"stringProperty\", null, testObject);\n }", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@Test\r\n public void testEquals() {\r\n Articulo art = new Articulo();\r\n articuloPrueba.setCodigo(1212);\r\n art.setCodigo(1212);\r\n boolean expResult = true;\r\n boolean result = articuloPrueba.equals(art);\r\n assertEquals(expResult, result);\r\n }", "public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {\r\n boolean result = false;\r\n\t\t\r\n\t\t// Ensure Papyrus is the active editor\r\n\t\tIEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();\r\n\t\tif((editor == null) || (!(editor instanceof IMultiDiagramEditor))) {\r\n\t\t\t//Activator.log.info(\"returning false\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tObject currentValue = null;\r\n\t\tif(IS_PLASMA_MODEL.equals(property)) {\r\n\t\t\tcurrentValue = testRobotmlModelNature(receiver);\r\n\t\t\tresult = (currentValue == expectedValue);\r\n\t\t}\r\n\t\t//Activator.log.info(\"returning result: \" + result);\r\n\t\treturn result;\r\n\t}", "public void testEqualsObject() {\n\t\t\tTipoNodoLeisure tipo1 = new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.0\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo2= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.1\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo3= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.2\")); //$NON-NLS-1$\n\t\t\tif (tipo1 != tipo1)\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.3\")); //$NON-NLS-1$\n\t\t\tif (!tipo1.equals(tipo2))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.4\"));\t\t\t //$NON-NLS-1$\n\t\t\tif (tipo1.equals(tipo3))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.5\"));\t //$NON-NLS-1$\n\t\t}", "protected boolean evaluateCompleteMatch(SerializationState state, Object containingObject, PropertySerializabilityMetadata metadata, String childPropertyName, Object childPropertyValue) {\r\n if (metadata.getPropertySerializability().equals(PropertySerializability.SERIALIZE_OBJECT_AND_ALL_PRIMITIVES)) {\r\n if (isPrimitiveObject(childPropertyValue)) {\r\n return true;\r\n }\r\n }\r\n return metadata.getSerializableChildProperty(childPropertyName) != null;\r\n }", "@JRubyMethod(name = \"==\", required = 1)\n public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) {\n RubyString str1, str2;\n RubyModule instance = (RubyModule)self.getRuntime().getModule(\"Digest\").getConstantAt(\"Instance\");\n if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {\n str1 = digest(ctx, self, null).convertToString();\n str2 = digest(ctx, oth, null).convertToString();\n } else {\n str1 = to_s(ctx, self).convertToString();\n str2 = oth.convertToString();\n }\n boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2));\n return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse();\n }", "@Test\n void testAssertPropertyReflectionEquals_equalsIgnoredDefault() {\n assertPropertyReflectionEquals(\n \"a message\",\n \"stringProperty\",\n null,\n testObject,\n ReflectionComparatorMode.IGNORE_DEFAULTS\n );\n }", "@Test\r\n @ConditionalIgnore(condition = IgnoreEqualsNotFire.class)\r\n public void testListValuedObjectPropertyChange() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ChangeReport report = new ChangeReport(property);\r\n property.set(createObservableList(true));\r\n assertEquals(\"not supported: \\n list-valued objectProperty must fire on not-same list\", \r\n 1, report.getEventCount());\r\n }", "private static boolean hasPropertyV2(int settings, int property){\n\t\tint bit = -1;\n\t\twhile (property > 0) {\n\t\t\tproperty >>= 1;\n\t\t\tbit ++;\n\t\t}\n\t\treturn ItFromBit.getTheBit(settings, bit);\n\t}", "@Test\n void getByPropertyEqualUnique() {\n UserRoles role = (UserRoles)genericDAO.getByPropertyEqualUnique(\"userName\", \"admin\");\n assertEquals(\"admin\", role.getUserName());\n }", "public boolean equals(Object anObject) {\n\t\t//use short circuit evaluation, so we know that if it gets to isValuesEqual test, anObject is a BinaryMessage\n\t\tif(!isNull(anObject) &&\n\t\t isBinaryMessage(anObject) && \n\t\t isValuesEqual((BinaryMessage)anObject, this)) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "private void assertVersion(Versioned vers)\n {\n final Version v = vers.version();\n assertFalse(\"Should find version information (got \"+v+\")\", v.isUnknownVersion());\n assertEquals(PackageVersion.VERSION, v);\n }" ]
[ "0.649992", "0.6470917", "0.6405151", "0.63374275", "0.5947742", "0.5932827", "0.5914002", "0.5862072", "0.58619654", "0.5806513", "0.5777505", "0.5751783", "0.5640932", "0.56317", "0.55724895", "0.5552187", "0.55511594", "0.55425954", "0.55356485", "0.5517898", "0.55100256", "0.5500925", "0.54986835", "0.54906285", "0.5443568", "0.5420672", "0.54162264", "0.540434", "0.53906435", "0.53863144", "0.53697765", "0.5367719", "0.5314542", "0.53112674", "0.53103477", "0.53101814", "0.5299349", "0.5297562", "0.5295252", "0.5283584", "0.5266427", "0.5264393", "0.5259198", "0.52071714", "0.5160634", "0.5143876", "0.5137639", "0.51330036", "0.51243037", "0.51240987", "0.51183647", "0.51140624", "0.51016116", "0.5097037", "0.5093527", "0.5092352", "0.50902027", "0.5083398", "0.507744", "0.5074005", "0.50690883", "0.506811", "0.50667536", "0.50662565", "0.5065886", "0.50547516", "0.5054358", "0.5041008", "0.5040814", "0.5037276", "0.5031359", "0.5025314", "0.50233537", "0.50219685", "0.50172126", "0.5014685", "0.5008252", "0.5006889", "0.50038743", "0.5002238", "0.500151", "0.49977052", "0.4996575", "0.49919438", "0.4985558", "0.49843305", "0.498419", "0.4983119", "0.49797118", "0.4976654", "0.49744338", "0.4974011", "0.4970097", "0.4962551", "0.49563834", "0.4950537", "0.49460882", "0.49438462", "0.49357334", "0.49278593" ]
0.6235982
4
Test for equal property value.
@Test void testAssertPropertyLenientEquals_equals() { assertPropertyLenientEquals("stringProperty", "stringValue", testObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean equals(Object o) {\n if (o instanceof TestElementProperty) {\n if (this == o) {\n return true;\n }\n if (value != null) {\n return value.equals(((JMeterProperty) o).getObjectValue());\n }\n }\n return false;\n }", "public boolean equalsTo(String property) {\n\t\t\treturn this.value.equals(property);\n\t\t}", "@Test\n void getByPropertyEqualSuccess() {\n List<Order> orders = dao.getByPropertyEqual(\"description\", \"February Large Long-Sleeve\");\n assertEquals(1, orders.size());\n assertEquals(2, orders.get(0).getId());\n }", "@Override\n\tpublic boolean equal() {\n\t\treturn false;\n\t}", "boolean equalProps(InstanceProperties props) {\n String propsName = props.getString(PROPERTY_NAME, null);\n return propsName != null\n ? propsName.equals(name)\n : name == null;\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<User> users = dao.findByPropertyEqual(\"firstName\", \"Mark\");\n assertEquals(1, users.size());\n assertEquals(2, users.get(0).getId());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> roles = genericDAO.getByPropertyEqual(\"userName\", \"admin\");\n assertEquals(1, roles.size());\n assertEquals(1, roles.get(0).getUserRoleId());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Event> events = genericDao.getByPropertyEqual(\"name\", \"Dentist\");\n assertEquals(1, events.size());\n assertEquals(2, events.get(0).getId());\n }", "@Override\n\tpublic boolean equals(Object other){\n\t if (other == null) return false;\n\t if (other == this) return true;\n\t if (!(other instanceof Property))return false;\n\t Property otherProperty = (Property)other;\n\t \n\t if(this.number == otherProperty.number) {\n\t \treturn true;\n\t } else {\n\t \treturn false;\n\t }\n\t}", "@Override\n public boolean equals(final Object obj)\n {\n return this.value.equals(obj);\n }", "String getEqual();", "public void testAssertPropertyLenientEquals_equals() {\r\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n public void mainTests(){\n assertTrue(property1.getPropertyId() == id1);\n if(property1.getPropertyId() != id1) {\n property2.setPropertyId(id1);\n }\n else {\n assertTrue(property2.getPropertyId() == id2);\n }\n //Getter works Correct for ID\n }", "public boolean eqValue(E that) {\n return this.value.compareTo(that) == 0;\n }", "public boolean equals(Property inProperty){\n return (inProperty.getName().equals(this.getName()));\n }", "@Test\n void getByPropertyExactSuccess() {\n List<Car> carList = carDao.getByPropertyEqual(\"make\", \"Jeep\");\n assertEquals(1, carList.size());\n }", "@Override\n public boolean equals(Object obj) {\n // this code provided by Dave Houtman [2020] personal communication\n if (!(obj instanceof Property))\n return false;\n Property prop = (Property) obj;\n return this.getXLeft() == prop.getXLeft() && this.getYTop() == prop.getYTop() && hasSameSides(prop);\n }", "@Test\r\n public void testEquals() {\r\n Articulo art = new Articulo();\r\n articuloPrueba.setCodigo(1212);\r\n art.setCodigo(1212);\r\n boolean expResult = true;\r\n boolean result = articuloPrueba.equals(art);\r\n assertEquals(expResult, result);\r\n }", "public void testAssertPropertyReflectionEquals_equals() {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n\tpublic void testEqualsVerdadeiro() {\n\t\t\n\t\tassertTrue(contato1.equals(contato3));\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings(), settings);\n }", "@TestProperties(name=\"test equal sign parameters for test\")\n\tpublic void testParametersWithEquals() throws Exception {\n\t\tjsystem.launch();\n//\t\tScenarioUtils.createAndCleanScenario(jsystem, ScenariosManager.getInstance().getCurrentScenario().getScenarioName());\n\t\tScenarioUtils.createAndCleanScenario(jsystem, jsystem.getCurrentScenario());\n\t\tjsystem.addTest(\"testWithInclueParametersNewLine\", \"ParamaetersHandlingSection\", true);\n\t\tjsystem.setTestParameter(1, \"General\", \"Str8\", \"x=2=3=4, v b n eee=,\", false);\n\t\tjsystem.play();\n\t\tjsystem.waitForRunEnd();\n\t\tjsystem.checkNumberOfTestsPass(1);\n\t\tString propValue = \n\t\t\tgetRunProperties().getProperty(\"testWithInclueParametersNewLine_str8\");\n\t\tassertEquals(\"x=2=3=4, v b n eee=,\", propValue);\n\t}", "@Test\n void getByPropertySuccess() {\n List<User> users = genericDao.findByPropertyEqual(\"userName\", \"BigAl\");\n // should only find one entry with the username \"BigAl\"\n assertEquals(users.size(), 1);\n }", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Receta instance = new Receta();\n instance.setNombre(\"nom1\");\n Receta instance2 = new Receta();\n instance.setNombre(\"nom2\");\n boolean expResult = false;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Test\r\n public void testObjectPropertyWithEqualOrSameList() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ObjectProperty<ObservableList<String>> otherPropertySameList = new SimpleObjectProperty<>(list);\r\n assertFalse(\"sanity: two properties with same list are not equal\", \r\n property.equals(otherPropertySameList));\r\n ObjectProperty<ObservableList<String>> otherPropertyEqualList =\r\n new SimpleObjectProperty(createObservableList(true));\r\n assertFalse(\"sanity: two properties with equal list are not equal\", \r\n property.equals(otherPropertyEqualList));\r\n }", "@Test\n void getByPropertyEqualUnique() {\n UserRoles role = (UserRoles)genericDAO.getByPropertyEqualUnique(\"userName\", \"admin\");\n assertEquals(\"admin\", role.getUserName());\n }", "@Test\n public void testEquals_1() {\n LOGGER.info(\"testEquals_1\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hello\");\n final boolean actual = atomString.equals(atom);\n assertTrue(actual);\n }", "public boolean equals(Object o) {\r\n\t\t// TODO and replace return false with the appropriate code.\r\n\t\tif (o == null || o.getClass() != this.getClass())\r\n\t\t\treturn false;\r\n\t\tProperty p = (Property) o;\r\n\t\treturn Arrays.deepEquals(p.positive, this.positive)\r\n\t\t\t\t&& Arrays.deepEquals(p.negative, this.negative)\r\n\t\t\t\t&& Arrays.deepEquals(p.stop, this.stop)\r\n\t\t\t\t&& p.scoringmethod == this.scoringmethod\r\n\t\t\t\t&& Math.abs(p.mindistance - this.mindistance) < 0.000001;\r\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings().hashCode(), settings.hashCode());\n }", "@Override\r\n\tpublic boolean isEqual(Node node) {\n\t\treturn false;\r\n\t}", "@Test\n void testAssertPropertyReflectionEquals_equals() {\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "private boolean isValuesEqual(BinaryMessage tocmp, BinaryMessage original) {\n\t\tif(tocmp.getValue().equals(original.getValue())) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n public void equals_trulyEqual() {\n SiteInfo si1 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n SiteInfo si2 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n\n Assert.assertEquals(si1, si2);\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Commissioner instance = new Commissioner();\n Commissioner instance2 = new Commissioner();\n instance.setLogin(\"genie\");\n instance2.setLogin(\"genie\");\n boolean expResult = true;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> usersRoles = genericDao.getByPropertyEqual(\"roleName\", \"admin\");\n assertEquals(1, usersRoles.size());\n assertEquals(3, usersRoles.get(0).getId());//not sure about this one\n }", "private boolean equals() {\r\n return MARK(EQUALS) && CHAR('=') && gap();\r\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Object object = null;\n Paciente instance = new Paciente();\n boolean expResult = false;\n boolean result = instance.equals(object);\n assertEquals(expResult, result);\n\n }", "@Test\n public void testEquals() {\n \n Beneficiaire instance = ben2;\n Beneficiaire unAutreBeneficiaire = ben3;\n boolean expResult = false;\n boolean result = instance.equals(unAutreBeneficiaire);\n assertEquals(expResult, result);\n\n unAutreBeneficiaire = ben2;\n expResult = true;\n result = instance.equals(unAutreBeneficiaire);\n assertEquals(expResult, result);\n }", "static private <T> boolean setIfDifferent(Channel<T> ch, T value) throws CAException, TimeoutException {\n if (!value.equals(ch.getFirst())) {\n ch.setValue(value);\n return true;\n } else {\n return false;\n }\n }", "@Test\n \tpublic void testEqual() {\n \t\tAssert.assertTrue(f1.equals(f1));\n \t}", "@Test\r\n public void testEquals() throws Exception\r\n {\r\n Object expectedValueToEqual = new Object();\r\n ValueEquals sut = new ValueEquals(\"MyReplaceId\", expectedValueToEqual);\r\n assertEquals(sut.compareDataSetElementTo(expectedValueToEqual), 0);\r\n ;\r\n }", "@Test\n void equals1() {\n Student s1=new Student(\"emina\",\"milanovic\",18231);\n Student s2=new Student(\"emina\",\"milanovic\",18231);\n assertEquals(true,s1.equals(s2));\n }", "boolean equalTo(ObjectPassDemo o) {\n return (o.a == a && o.b == b);\n }", "public void testEqualsObject() {\n\t\t\tTipoNodoLeisure tipo1 = new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.0\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo2= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.1\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo3= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.2\")); //$NON-NLS-1$\n\t\t\tif (tipo1 != tipo1)\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.3\")); //$NON-NLS-1$\n\t\t\tif (!tipo1.equals(tipo2))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.4\"));\t\t\t //$NON-NLS-1$\n\t\t\tif (tipo1.equals(tipo3))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.5\"));\t //$NON-NLS-1$\n\t\t}", "<T> boolean containsValue(Property<T> property);", "@Test\n public void testEqualsReturnsFalseOnDifferentIdVal() throws Exception {\n setRecordFieldValue(otherRecord, \"id\", 42L);\n\n boolean equals = record.equals(otherRecord);\n\n assertThat(equals, is(false));\n }", "boolean hasSetProperty();", "@Test\n public void testEquals_2() {\n LOGGER.info(\"testEquals_2\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hej\");\n final boolean actual = atomString.equals(atom);\n assertFalse(actual);\n }", "public static <T> EqSpecification<T> eq( Property<T> property, T value )\n {\n return new EqSpecification<>( property( property ), value );\n }", "public void testEqualsObject()\n {\n Mana meme = new Mana( myMise );\n Assert.assertEquals( myMise, meme );\n \n System.out.println( myMise.toString());\n Mana autre = new Mana( 49 );\n Assert.assertFalse( myMise.equals( autre ));\n autre = new Mana( 50 );\n Assert.assertTrue( myMise.equals( autre ));\n }", "@Test\n\tpublic void testEquals6(){\n\t\tTemperature data1 = new Temperature (100, Temperature.Units.KELVIN);\n\t\tTemperature data2 = new Temperature (100, Temperature.Units.CELCIUS);\n\t\tassertEquals(data1.equals(data2), false);\t//Since '100 kelvin' and '100 celcius' are different, equals() function should return false \n\t\tassertTrue(data1.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\n\t\tassertTrue(data2.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\t\n\t}", "@Test\n @DisplayName(\"Test should detect equality between equal states.\")\n public void testShouldResultInEquality() {\n ObjectBag os1 = new ObjectBag(null, \"Hi\");\n ObjectBag os2 = new ObjectBag(null, \"Hi\");\n\n Assertions.assertThat(os1).isEqualTo(os2);\n }", "public abstract QueryElement addEquals(String property, Object value);", "public void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\r\n try {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject);\r\n fail(\"Expected AssertionFailedError\");\r\n } catch (AssertionFailedError a) {\r\n // expected\r\n }\r\n }", "@Test\n public void testEquals_4()\n throws Exception {\n ColumnPreferences fixture = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n fixture.setVisible(true);\n Object obj = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n\n boolean result = fixture.equals(obj);\n\n assertEquals(true, result);\n }", "@Test\n\tpublic void testEqualsFalso() {\n\t\t\n\t\tassertFalse(contato1.equals(contato2));\n\t}", "@Override\n public boolean equals(Object obj) {\n if (obj instanceof Percentage) {\n Percentage other = (Percentage) obj;\n return amount.equals(other.amount);\n }\n return false;\n }", "@Test\n void testEquals() {\n final boolean expected_boolean = true;\n\n // Properties for the objects\n final String username = \"username\";\n final String name = \"their_name\";\n final String password = \"password\";\n\n // Create two LoginAccount objects\n LoginAccount first_account = new LoginAccount(username, name, password);\n LoginAccount second_account = new LoginAccount(username, name, password);\n\n // Variable to check\n boolean objects_are_equal = first_account.equals(second_account);\n\n // Assert that the two boolean values are the same\n assertEquals(expected_boolean, objects_are_equal);\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }", "public boolean Equal(Element other){\n\tboolean ret_val ;\n\tint aux01 ;\n\tint aux02 ;\n\tint nt ;\n\tret_val = true ;\n\n\taux01 = other.GetAge();\n\tif (!this.Compare(aux01,Age)) ret_val = false ;\n\telse { \n\t aux02 = other.GetSalary();\n\t if (!this.Compare(aux02,Salary)) ret_val = false ;\n\t else \n\t\tif (Married) \n\t\t if (!other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t\telse\n\t\t if (other.GetMarried()) ret_val = false;\n\t\t else nt = 0 ;\n\t}\n\n\treturn ret_val ;\n }" ]
[ "0.71675956", "0.66831696", "0.6568936", "0.6514604", "0.64192986", "0.64023435", "0.63786006", "0.63124824", "0.6287913", "0.6230566", "0.62301105", "0.6225949", "0.6195938", "0.6168125", "0.6146655", "0.6115958", "0.6113818", "0.60357493", "0.60333323", "0.60032946", "0.6001758", "0.59942096", "0.59928656", "0.5953585", "0.5942897", "0.59398806", "0.59301156", "0.5900318", "0.5896896", "0.5876442", "0.5861075", "0.5850429", "0.584881", "0.5846964", "0.58171475", "0.58166677", "0.57881343", "0.5783383", "0.5766516", "0.57446116", "0.57431316", "0.57422405", "0.5739205", "0.5726783", "0.5717903", "0.57134014", "0.5706703", "0.5685065", "0.5680691", "0.5674422", "0.5671943", "0.56632173", "0.565611", "0.56520414", "0.56287867", "0.56279534", "0.5624449", "0.5612883", "0.5611672", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56059265", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447", "0.56048447" ]
0.61822426
13
Test for equal property value (message version).
@Test void testAssertPropertyLenientEquals_equalsMessage() { assertPropertyLenientEquals("a message", "stringProperty", "stringValue", testObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testAssertPropertyLenientEquals_equalsMessage() {\r\n assertPropertyLenientEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\r\n }", "public void testAssertPropertyReflectionEquals_equalsMessage() {\r\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\r\n }", "private boolean isValuesEqual(BinaryMessage tocmp, BinaryMessage original) {\n\t\tif(tocmp.getValue().equals(original.getValue())) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n void testAssertPropertyReflectionEquals_equalsMessage() {\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\n }", "public void testGetProperty()\n {\n assertEquals(\"MSM Extension not present, or incorrect specification version -\", MSM_SPECIFICATION_VERSION,\n System.getProperty(MSM_PROPERTY_NAME));\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Order> orders = dao.getByPropertyEqual(\"description\", \"February Large Long-Sleeve\");\n assertEquals(1, orders.size());\n assertEquals(2, orders.get(0).getId());\n }", "String getEqual();", "@Test\n\t\t\tpublic void setMessageTest() {\n\t\t\t\tMessage msgjunit = new Message();\n\t\t\t\tString expectedmsg = msgjunit.getMessage();\n\t\t\t\tString actualmsg = msgjunit.getMessage();\n\t\t\t\tassertSame(expectedmsg, actualmsg);\n\t\t\t\tif (expectedmsg == actualmsg) {\n\n\t\t\t\t\tSystem.out.println(\"Both expected message and actual message are equal:\" + \" \" + expectedmsg\n\t\t\t\t\t\t\t+ \" \" + \"=\" + \" \" + actualmsg);\n\t\t\t\t}\n\t\t\t}", "public void testAssertPropertyLenientEquals_equals() {\r\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "public static void ensureEquivalent(Message m1, JBossMessage m2) throws JMSException\n {\n assertTrue(m1 != m2);\n \n //Can't compare message id since not set until send\n \n assertEquals(m1.getJMSTimestamp(), m2.getJMSTimestamp());\n \n byte[] corrIDBytes = null;\n String corrIDString = null;\n \n try\n {\n corrIDBytes = m1.getJMSCorrelationIDAsBytes();\n }\n catch(JMSException e)\n {\n // correlation ID specified as String\n corrIDString = m1.getJMSCorrelationID();\n }\n \n if (corrIDBytes != null)\n {\n assertTrue(Arrays.equals(corrIDBytes, m2.getJMSCorrelationIDAsBytes()));\n }\n else if (corrIDString != null)\n {\n assertEquals(corrIDString, m2.getJMSCorrelationID());\n }\n else\n {\n // no correlation id\n \n try\n {\n byte[] corrID2 = m2.getJMSCorrelationIDAsBytes();\n assertNull(corrID2);\n }\n catch(JMSException e)\n {\n // correlatin ID specified as String\n String corrID2 = m2.getJMSCorrelationID();\n assertNull(corrID2);\n }\n }\n assertEquals(m1.getJMSReplyTo(), m2.getJMSReplyTo());\n assertEquals(m1.getJMSDestination(), m2.getJMSDestination());\n assertEquals(m1.getJMSDeliveryMode(), m2.getJMSDeliveryMode());\n //We don't check redelivered since this is always dealt with on the proxy\n assertEquals(m1.getJMSType(), m2.getJMSType());\n assertEquals(m1.getJMSExpiration(), m2.getJMSExpiration());\n assertEquals(m1.getJMSPriority(), m2.getJMSPriority());\n \n int m1PropertyCount = 0, m2PropertyCount = 0;\n for(Enumeration p = m1.getPropertyNames(); p.hasMoreElements(); m1PropertyCount++)\n {\n p.nextElement();\n }\n for(Enumeration p = m2.getPropertyNames(); p.hasMoreElements(); m2PropertyCount++)\n {\n p.nextElement();\n }\n \n assertEquals(m1PropertyCount, m2PropertyCount);\n \n for(Enumeration props = m1.getPropertyNames(); props.hasMoreElements(); )\n {\n boolean found = false;\n \n String name = (String)props.nextElement();\n \n boolean booleanProperty = false;\n try\n {\n booleanProperty = m1.getBooleanProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a boolean\n }\n \n if (found)\n {\n assertEquals(booleanProperty, m2.getBooleanProperty(name));\n continue;\n }\n \n byte byteProperty = 0;\n try\n {\n byteProperty = m1.getByteProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a byte\n }\n \n if (found)\n {\n assertEquals(byteProperty, m2.getByteProperty(name));\n continue;\n }\n \n short shortProperty = 0;\n try\n {\n shortProperty = m1.getShortProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a short\n }\n \n if (found)\n {\n assertEquals(shortProperty, m2.getShortProperty(name));\n continue;\n }\n \n \n int intProperty = 0;\n try\n {\n intProperty = m1.getIntProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a int\n }\n \n if (found)\n {\n assertEquals(intProperty, m2.getIntProperty(name));\n continue;\n }\n \n \n long longProperty = 0;\n try\n {\n longProperty = m1.getLongProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a long\n }\n \n if (found)\n {\n assertEquals(longProperty, m2.getLongProperty(name));\n continue;\n }\n \n \n float floatProperty = 0;\n try\n {\n floatProperty = m1.getFloatProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a float\n }\n \n if (found)\n {\n assertTrue(floatProperty == m2.getFloatProperty(name));\n continue;\n }\n \n double doubleProperty = 0;\n try\n {\n doubleProperty = m1.getDoubleProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a double\n }\n \n if (found)\n {\n assertTrue(doubleProperty == m2.getDoubleProperty(name));\n continue;\n }\n \n String stringProperty = null;\n try\n {\n stringProperty = m1.getStringProperty(name);\n found = true;\n }\n catch(JMSException e)\n {\n // not a String\n }\n \n if (found)\n {\n assertEquals(stringProperty, m2.getStringProperty(name));\n continue;\n }\n \n \n fail(\"Cannot identify property \" + name);\n }\n }", "@Test\n void testAssertPropertyLenientEquals_equals() {\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "@Test\n public void testEquals() {\n assertTrue(chatMessage.equals(chatMessage));\n assertFalse(chatMessage.equals(new ChatMessage(author, \"JaJa!\")));\n assertFalse(chatMessage.equals(new ChatMessage(\"Javache\", text)));\n assertFalse(chatMessage.equals(new ChatMessage(\"Javache\", \"JaJa!\")));\n }", "boolean equalProps(InstanceProperties props) {\n String propsName = props.getString(PROPERTY_NAME, null);\n return propsName != null\n ? propsName.equals(name)\n : name == null;\n }", "public void testAssertPropertyReflectionEquals_equals() {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "public boolean equalsTo(String property) {\n\t\t\treturn this.value.equals(property);\n\t\t}", "@Test\n public void testIntProperty() throws JMSException {\n int messageCount = responseMessage.getIntProperty(\n ServerListener.MESSAGE_COUNT);\n\n assertTrue(\"The message count should've been equal to or greater than\" +\n \" 1\", (messageCount >= 1));\n }", "@Test\r\n\tpublic void equalsTest() throws Exception {\r\n\t\t\r\n\t\tUMLMessageArgument msgArg1 = new UMLMessageArgument(\"name1\",\"datatype1\",\"initVal\",false);\r\n\t\tUMLMessageArgument msgArg2 = new UMLMessageArgument(\"name1\",\"datatype1\",\"initVal\",false);\r\n\t\tUMLMessageArgument msgArg3 = new UMLMessageArgument(\"name1\",\"datatype1\",\"initVal\",false);\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the datatype\r\n\t\tmsgArg2.setDataType(\"datatype2\");\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setDataType(\"datatype1\");\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the name\r\n\t\tmsgArg2.setName(\"name2\");\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setName(\"name1\");\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the initial value\r\n\t\tmsgArg2.setInitializedTo(\"initVal2\");\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setInitializedTo(\"initVal\");\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// vary the variable arguments flag\r\n\t\tmsgArg2.setHasVarArgs(true);\r\n\t\tassertFalse(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\tmsgArg2.setHasVarArgs(false);\r\n\t\tassertTrue(msgArg1.equals(msgArg2));\r\n\t\tassertEqualsTest(msgArg1,msgArg2,msgArg3);\r\n\t\t\r\n\t\t// verify that IllegalArgumentException is detected\r\n\t\tObject o = new Object();\r\n\t\tException ee = null; \r\n\t\ttry {\r\n\t\t\tassertFalse(msgArg1.equals(o));\r\n\t\t}catch(Exception e) {\r\n\t\t\tee = e;\r\n\t\t}\r\n\t\tassertNull(ee);\r\n\t\t\r\n\t\t// verify that IllegalArgumentException is detected\r\n\t\tException ee2 = null;\r\n\t\tUMLSymbol umlSymbol = new UMLActor(\"1\",\"2\", new UMLSequenceDiagram());\r\n\t\ttry {\r\n\t\t\tassertFalse(msgArg1.equals(umlSymbol));\r\n\t\t}catch(Exception e) {\r\n\t\t\tee2 = e;\r\n\t\t}\r\n\t\tassertNull(ee2);\r\n\t}", "@SuppressWarnings({ \"static-method\", \"nls\" })\n @Test\n public final void testGetProperty()\n {\n TestEasyPropertiesObject object = new TestEasyPropertiesObject();\n Assert.assertEquals(\"1.2.3\", object.getVersion());\n }", "public void testIsCompatible() {\n System.out.println(\"isCompatible\"); // NOI18N\n \n TypeID requiredType = TYPEID_JAVA_LANG_STRING; // NOI18N\n PropertyValue instance = TypesSupport.createStringValue(FirstCD.PROPERTY_TEST); // NOI18N\n boolean expResult = true;\n boolean result = instance.isCompatible(requiredType);\n \n assertEquals(expResult, result);\n }", "public void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\r\n try {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject);\r\n fail(\"Expected AssertionFailedError\");\r\n } catch (AssertionFailedError a) {\r\n // expected\r\n }\r\n }", "@Override\n public boolean equals(Object o) {\n if (o instanceof TestElementProperty) {\n if (this == o) {\n return true;\n }\n if (value != null) {\n return value.equals(((JMeterProperty) o).getObjectValue());\n }\n }\n return false;\n }", "@Test\n public void testGetProperty_String() throws DatabaseException {\n String key = \"version\";\n DatabaseProperties instance = cveDb.getDatabaseProperties();\n String result = instance.getProperty(key);\n \n int major = Integer.parseInt(result.substring(0, result.indexOf('.')));\n \n assertTrue(major >= 5);\n }", "@Override\n public boolean equivalent(ExampleProtocolConfiguration latest, ExampleProtocolConfiguration previous) {\n return latest.getStubData().equals(previous.getStubData());\n }", "@Override\n\tpublic boolean equal() {\n\t\treturn false;\n\t}", "@Test\n public void testEquals_1() {\n LOGGER.info(\"testEquals_1\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hello\");\n final boolean actual = atomString.equals(atom);\n assertTrue(actual);\n }", "@Test\n\tpublic void testEqualsVerdadeiro() {\n\t\t\n\t\tassertTrue(contato1.equals(contato3));\n\t}", "@Test\n public void testEquals_2() {\n LOGGER.info(\"testEquals_2\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hej\");\n final boolean actual = atomString.equals(atom);\n assertFalse(actual);\n }", "@Test\n void testAssertPropertyReflectionEquals_equals() {\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "public void test_getMessage() {\n assertEquals(\"'message' value should be properly retrieved.\", message, instance.getMessage());\n }", "static private <T> boolean setIfDifferent(Channel<T> ch, T value) throws CAException, TimeoutException {\n if (!value.equals(ch.getFirst())) {\n ch.setValue(value);\n return true;\n } else {\n return false;\n }\n }", "@Override\n\tpublic boolean equals(Object other){\n\t if (other == null) return false;\n\t if (other == this) return true;\n\t if (!(other instanceof Property))return false;\n\t Property otherProperty = (Property)other;\n\t \n\t if(this.number == otherProperty.number) {\n\t \treturn true;\n\t } else {\n\t \treturn false;\n\t }\n\t}", "public void equals(String message, Object expected, Object actual)\n {\n assertEquals(expected, actual, message);\n }", "public void testGetMessage() {\n assertEquals(\"Message should be got correctly.\", event.getMessage(), message);\n }", "@TestProperties(name=\"test equal sign parameters for test\")\n\tpublic void testParametersWithEquals() throws Exception {\n\t\tjsystem.launch();\n//\t\tScenarioUtils.createAndCleanScenario(jsystem, ScenariosManager.getInstance().getCurrentScenario().getScenarioName());\n\t\tScenarioUtils.createAndCleanScenario(jsystem, jsystem.getCurrentScenario());\n\t\tjsystem.addTest(\"testWithInclueParametersNewLine\", \"ParamaetersHandlingSection\", true);\n\t\tjsystem.setTestParameter(1, \"General\", \"Str8\", \"x=2=3=4, v b n eee=,\", false);\n\t\tjsystem.play();\n\t\tjsystem.waitForRunEnd();\n\t\tjsystem.checkNumberOfTestsPass(1);\n\t\tString propValue = \n\t\t\tgetRunProperties().getProperty(\"testWithInclueParametersNewLine_str8\");\n\t\tassertEquals(\"x=2=3=4, v b n eee=,\", propValue);\n\t}", "@Test\n public void equals_trulyEqual() {\n SiteInfo si1 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n SiteInfo si2 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n\n Assert.assertEquals(si1, si2);\n }", "@Test\n\tpublic void testVersion() {\n\t\tassertEquals(\"HTTP/1.0\", myReply.getVersion());\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings().hashCode(), settings.hashCode());\n }", "@Test\n\tpublic void testEquals_fixture_3()\n\t\tthrows Exception {\n\t\tVersion fixture2 = getFixture();\n\t\tObject other = new Version(\"1\");\n\n\t\tboolean result = fixture2.equals(other);\n\n\t\t// add additional test code here\n\t\tassertEquals(true, result);\n\t}", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings(), settings);\n }", "@Test\n public void testVersion() {\n PowerMock.replayAll();\n assertEquals(Version.getVersion(), connector.version());\n PowerMock.verifyAll();\n }", "@Test\n public void mainTests(){\n assertTrue(property1.getPropertyId() == id1);\n if(property1.getPropertyId() != id1) {\n property2.setPropertyId(id1);\n }\n else {\n assertTrue(property2.getPropertyId() == id2);\n }\n //Getter works Correct for ID\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> roles = genericDAO.getByPropertyEqual(\"userName\", \"admin\");\n assertEquals(1, roles.size());\n assertEquals(1, roles.get(0).getUserRoleId());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Event> events = genericDao.getByPropertyEqual(\"name\", \"Dentist\");\n assertEquals(1, events.size());\n assertEquals(2, events.get(0).getId());\n }", "@BusProperty(name = \"Version\", signature = \"u\")\n int getVersion() throws BusException;", "@Test\n public void equalsSameTest() {\n Device device2 = new Device(deviceID, token);\n assertEquals(device, device2);\n }", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof MsgExternalizePK)) {\n return false;\n }\n MsgExternalizePK other = (MsgExternalizePK) object;\n if ((this.mesgId == null && other.mesgId != null) || (this.mesgId != null && !this.mesgId.equals(other.mesgId))) {\n return false;\n }\n if (this.version != other.version) {\n return false;\n }\n if ((this.payloadType == null && other.payloadType != null) || (this.payloadType != null && !this.payloadType.equals(other.payloadType))) {\n return false;\n }\n if ((this.partId == null && other.partId != null) || (this.partId != null && !this.partId.equals(other.partId))) {\n return false;\n }\n return true;\n }", "@Test\r\n public void testObjectPropertyWithEqualOrSameList() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ObjectProperty<ObservableList<String>> otherPropertySameList = new SimpleObjectProperty<>(list);\r\n assertFalse(\"sanity: two properties with same list are not equal\", \r\n property.equals(otherPropertySameList));\r\n ObjectProperty<ObservableList<String>> otherPropertyEqualList =\r\n new SimpleObjectProperty(createObservableList(true));\r\n assertFalse(\"sanity: two properties with equal list are not equal\", \r\n property.equals(otherPropertyEqualList));\r\n }", "public void testAssertPropertyReflectionEquals_equalsIgnoredDefault() {\r\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", null, testObject, IGNORE_DEFAULTS);\r\n }", "@Test\n void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\n assertFailing(() ->\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject)\n );\n }", "private static void compareVersioningHeader(Object headerValue, HttpResponse<InputStream> jsonResponse) {\n AbstractMap<String, String> headersToTest = RequestAnswer.parser(headerValue);\n resultVersioningHeader = new HashMap<>();\n resultVersioningHeader.put(\"Versioning test\", null);\n for (Map.Entry<String, String> entry : headersToTest.entrySet()) {\n if (jsonResponse.getHeaders().keySet().contains(entry.getKey().toLowerCase())) {\n resultVersioningHeader.put(entry.getKey(), jsonResponse.getHeaders().get(entry.getKey().toLowerCase()).contains(entry.getValue()));\n } else {\n resultVersioningHeader.put(entry.getKey(), false);\n }\n }\n }", "public void testGetNewValue_Accuracy() {\r\n String newValue = \"newValue\";\r\n UnitTestHelper.setPrivateField(AuditDetail.class, auditDetail, \"newValue\", newValue);\r\n assertEquals(\"The newValue value should be got properly.\", newValue, auditDetail.getNewValue());\r\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<User> users = dao.findByPropertyEqual(\"firstName\", \"Mark\");\n assertEquals(1, users.size());\n assertEquals(2, users.get(0).getId());\n }", "@Test\n public void testGetDuplicateTranslationKeys() throws Exception {\n final File testFile = getTestFile(\"messages.properties\");\n FileUtils.writeLines(testFile, Arrays.asList(\"dup=foo\", \"not.dup=bar\", \"dup=fizzbuzz\"));\n assertThat(parser.getDuplicateTranslationKeys(testFile)).hasSize(1).contains(\"dup\");\n }", "@Test\n \tpublic void testEqual() {\n \t\tAssert.assertTrue(f1.equals(f1));\n \t}", "@Test\n\tpublic void testEquals_fixture_1()\n\t\tthrows Exception {\n\t\tVersion fixture2 = getFixture();\n\t\tObject other = \"1\";\n\n\t\tboolean result = fixture2.equals(other);\n\n\t\t// add additional test code here\n\t\tassertEquals(false, result);\n\t}", "@Test\n\tpublic void testEquals6(){\n\t\tTemperature data1 = new Temperature (100, Temperature.Units.KELVIN);\n\t\tTemperature data2 = new Temperature (100, Temperature.Units.CELCIUS);\n\t\tassertEquals(data1.equals(data2), false);\t//Since '100 kelvin' and '100 celcius' are different, equals() function should return false \n\t\tassertTrue(data1.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\n\t\tassertTrue(data2.getValue() == 100);\t\t//equals() function should not affect return value of getValue() function and should return the original value\t\n\t}", "@Test\n void getByPropertyExactSuccess() {\n List<Car> carList = carDao.getByPropertyEqual(\"make\", \"Jeep\");\n assertEquals(1, carList.size());\n }", "public void testGetManagementSpecVersion() {\n String specVersion = mb.getManagementSpecVersion();\n assertNotNull(specVersion);\n assertTrue(specVersion.length() > 0);\n }", "private boolean compareAndSet(long version, V newValue) {\n VersionedValue<V> result =\n versionedValue.updateAndGet(prev -> prev.getVersion()==version ?\n new VersionedValue<>(prev.getVersion() + 1, newValue) : prev);\n return result.getVersion()!=version;\n }", "public boolean isEqual(Edge e){\n if(v1.equals(e.v1) && v2.equals(e.v2)){\n return true;\n }\n else if(v1.equals(e.v2) && v2.equals(e.v1)){\n return true;\n }\n else{\n return false;\n }\n }", "@Test\n @DisplayName(\"Test should detect equality between equal states.\")\n public void testShouldResultInEquality() {\n ObjectBag os1 = new ObjectBag(null, \"Hi\");\n ObjectBag os2 = new ObjectBag(null, \"Hi\");\n\n Assertions.assertThat(os1).isEqualTo(os2);\n }", "boolean hasProperty2();", "@Test\n\tpublic void test_equals1() {\n\tTennisPlayer c1 = new TennisPlayer(11,\"Joe Tsonga\");\n\tTennisPlayer c2 = new TennisPlayer(11,\"Joe Tsonga\");\n\tassertTrue(c1.equals(c2));\n }", "private void verifyMessageDigestAttribute()\n throws CMSException\n {\n ASN1Primitive validMessageDigest = getSingleValuedSignedAttribute(\n CMSAttributes.messageDigest, \"message-digest\");\n if (validMessageDigest == null)\n {\n if (signedAttributeSet != null)\n {\n throw new CMSException(\"the message-digest signed attribute type MUST be present when there are any signed attributes present\");\n }\n }\n else\n {\n if (!(validMessageDigest instanceof ASN1OctetString))\n {\n throw new CMSException(\"message-digest attribute value not of ASN.1 type 'OCTET STRING'\");\n }\n\n ASN1OctetString signedMessageDigest = (ASN1OctetString)validMessageDigest;\n\n if (!Arrays.constantTimeAreEqual(resultDigest, signedMessageDigest.getOctets()))\n {\n throw new CMSSignerDigestMismatchException(\"message-digest attribute value does not match calculated value\");\n }\n }\n }", "public boolean hasProperty2() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "public boolean hasProperty2() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "@Override\n public boolean equals(Object o) {\n if (o instanceof ModelMessage) {\n ModelMessage m = (ModelMessage) o;\n if (sourceId.equals(m.sourceId)\n && getId().equals(m.getId())\n && messageType == m.messageType) {\n return super.equals(m);\n }\n }\n return false;\n }", "public boolean hasProperty1() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "@Test\n public void equal() {\n assertTrue(commandItem.equals(commandItemCopy));\n assertTrue(commandItem.isSameCommand(commandItemCopy));\n //not commanditem return false\n assertFalse(commandItem.equals(commandWord));\n }", "@Test\n public void equals() {\n Command commandCopy = new McqInputCommand(\"a\", mcqTest);\n assertTrue(G_MCQ_COMMAND.equals(commandCopy));\n\n // same object -> returns true\n assertTrue(commandCopy.equals(commandCopy));\n\n assertFalse(commandCopy.equals(null));\n\n // different type -> returns false\n assertFalse(commandCopy.equals(10));\n assertFalse(commandCopy.equals(\"TestString\"));\n }", "public void testAssertPropertyLenientEquals_equalsIgnoredDefault() {\r\n assertPropertyLenientEquals(\"stringProperty\", null, testObject);\r\n }", "@Test\r\n public void testEquals() throws Exception\r\n {\r\n Object expectedValueToEqual = new Object();\r\n ValueEquals sut = new ValueEquals(\"MyReplaceId\", expectedValueToEqual);\r\n assertEquals(sut.compareDataSetElementTo(expectedValueToEqual), 0);\r\n ;\r\n }", "@Test\r\n public void testNotificationSetEqualElement() {\r\n ObservableList first = FXCollections.observableArrayList(getPerson1());\r\n ObservableList second = FXCollections.observableArrayList(getPerson2());\r\n int index = 0;\r\n assertEquals(\"sanity: \", first.get(index), second.get(index));\r\n ListChangeReport report = new ListChangeReport(first);\r\n first.set(index, second.get(index));\r\n assertEquals(\"list must have fired on setting equal item\", 1, report.getEventCount());\r\n \r\n }", "public boolean equals(Property inProperty){\n return (inProperty.getName().equals(this.getName()));\n }", "public void assertUpdateChangesMessage() {\r\n\t\tprint(\"Assert Updates Changes Confirmation Message\");\r\n\t\tlocator = Locator.MyTrader.Updated_Changes_Messages.value;\r\n\t\tAssert.assertTrue(isElementPresent(locator));\r\n\t}", "public static boolean sameVersion(Object o1, Object o2) {\r\n checkVersionable(o1);\r\n checkVersionable(o2);\r\n return ((Versionable) o1).getVersionId() ==\r\n ((Versionable) o2).getVersionId();\r\n }", "public boolean hasProperty1() {\n return ((bitField0_ & 0x00000008) == 0x00000008);\n }", "public static void massertEqual(Object a, Object b, String pfmessg, Object... pfargs)\r\n\t{\r\n\t\tif(!a.equals(b))\r\n\t\t{\r\n\t\t\tObject[] vargar = new Object[pfargs.length+2];\r\n\t\t\t\r\n\t\t\tvargar[0] = a; \r\n\t\t\tvargar[1] = b;\r\n\t\t\t\r\n\t\t\tfor(int i : Util.range(pfargs.length))\r\n\t\t\t\t{ vargar[i+2] = pfargs[i]; }\r\n\t\t\t\r\n\t\t\tthrow new RuntimeException(\"\\nEquality Assertion failed: \" + sprintf(pfmessg, vargar));\t\t\t\r\n\t\t}\r\n\t}", "private boolean checkForVersionProperties(DeployBeanDescriptor<?> desc) {\n for (DeployBeanProperty prop : desc.propertiesBase()) {\n if (prop.isVersionColumn()) {\n return true;\n }\n }\n return false;\n }", "private boolean compareProperties (Properties props1 , Properties props2){\n boolean propertiesAreEqual = true;\n Properties props2Clone = (Properties)props2.clone();\n Iterator<Object> itProps1Name = props1.keySet().iterator();\n while (propertiesAreEqual && itProps1Name.hasNext()){\n String propertyName = (String)itProps1Name.next();\n if (props2Clone.containsKey(propertyName)){\n propertiesAreEqual = props1.getProperty(propertyName).trim()\n .equals(props2Clone.getProperty(propertyName).trim());\n // Remove checked property from props2Clone properties\n props2Clone.remove(propertyName);\n }\n else{\n propertiesAreEqual = false;\n }\n }\n // If there are left properties in CSS file then files are not equal\n if (props2Clone.size() > 0){\n propertiesAreEqual = false;\n }\n \n return propertiesAreEqual;\n \n }", "@Test\n public void checkEquals() {\n EqualsVerifier.forClass(GenericMessageDto.class).usingGetClass()\n .suppress(Warning.NONFINAL_FIELDS).verify();\n }", "@Test\n public void equals() {\n UpdateCommand.UpdateProfileDescriptor descriptorWithSameValues = new UpdateCommand\n .UpdateProfileDescriptor(UPDESC_1);\n assertTrue(UPDESC_1.equals(descriptorWithSameValues));\n\n // same object -> returns true\n assertTrue(UPDESC_1.equals(UPDESC_1));\n\n // null -> returns false\n assertFalse(UPDESC_1.equals(null));\n\n // different types -> returns false\n assertFalse(UPDESC_1.equals(5));\n\n // different values -> returns false\n assertFalse(UPDESC_1.equals(UPDESC_2));\n\n // different name -> returns false\n UpdateCommand.UpdateProfileDescriptor editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1)\n .withName(VALID_NAME_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n\n // different id -> returns false\n editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1).withId(VALID_ID_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n\n // different height -> returns false\n editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1).withHeight(VALID_HEIGHT_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n\n // different weight -> returns false\n editedProfile = new UpdateProfileDescriptorBuilder(UPDESC_1).withWeight(VALID_WEIGHT_2).build();\n assertFalse(UPDESC_1.equals(editedProfile));\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Commissioner instance = new Commissioner();\n Commissioner instance2 = new Commissioner();\n instance.setLogin(\"genie\");\n instance2.setLogin(\"genie\");\n boolean expResult = true;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "public boolean testVerify(byte[] message)\n {\n return false;\n }", "private boolean isConfPropEqual(String prop, Configuration conf1,\n Configuration conf2) {\n if( (conf1 == null || conf2 == null) && (conf1 != conf2) ){\n return false;\n }\n String str1 = conf1.get(prop);\n String str2 = conf2.get(prop);\n if( (str1 == null || str2 == null) && (str1 != str2) ){\n return false;\n }\n return str1.equals(str2);\n }", "@Test\n\tpublic void ifAppropriateAttributesInDifferentMBeansHaveSameValueReturnsThatValue() throws Exception {\n\t\tMBeanWithSingleIntAttr mbean_1 = new MBeanWithSingleIntAttr(1);\n\t\tMBeanWithSingleIntAttr mbean_2 = new MBeanWithSingleIntAttr(1);\n\n\t\tDynamicMBean mbean = createDynamicMBeanFor(mbean_1, mbean_2);\n\n\t\tassertEquals(1, mbean.getAttribute(\"value\"));\n\t}", "@Test\n void testAssertPropertyLenientEquals_equalsIgnoredDefault() {\n assertPropertyLenientEquals(\"stringProperty\", null, testObject);\n }", "@Test(expected = AssertionError.class)\n public void testSchemaVersionMismatch() {\n PowerMock.replayAll();\n Map<String, String> sampleConfig = new HashMap<>();\n sampleConfig.put(SCHEMA_VERSION, \"1\");\n Map<String, Object> checkConfig = connector.config().parse(sampleConfig);\n assertEquals(2, checkConfig.get(SCHEMA_VERSION));\n PowerMock.verifyAll();\n }", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@Test\r\n public void testEquals() {\r\n Articulo art = new Articulo();\r\n articuloPrueba.setCodigo(1212);\r\n art.setCodigo(1212);\r\n boolean expResult = true;\r\n boolean result = articuloPrueba.equals(art);\r\n assertEquals(expResult, result);\r\n }", "public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {\r\n boolean result = false;\r\n\t\t\r\n\t\t// Ensure Papyrus is the active editor\r\n\t\tIEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();\r\n\t\tif((editor == null) || (!(editor instanceof IMultiDiagramEditor))) {\r\n\t\t\t//Activator.log.info(\"returning false\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tObject currentValue = null;\r\n\t\tif(IS_PLASMA_MODEL.equals(property)) {\r\n\t\t\tcurrentValue = testRobotmlModelNature(receiver);\r\n\t\t\tresult = (currentValue == expectedValue);\r\n\t\t}\r\n\t\t//Activator.log.info(\"returning result: \" + result);\r\n\t\treturn result;\r\n\t}", "public void testEqualsObject() {\n\t\t\tTipoNodoLeisure tipo1 = new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.0\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo2= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.1\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo3= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.2\")); //$NON-NLS-1$\n\t\t\tif (tipo1 != tipo1)\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.3\")); //$NON-NLS-1$\n\t\t\tif (!tipo1.equals(tipo2))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.4\"));\t\t\t //$NON-NLS-1$\n\t\t\tif (tipo1.equals(tipo3))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.5\"));\t //$NON-NLS-1$\n\t\t}", "protected boolean evaluateCompleteMatch(SerializationState state, Object containingObject, PropertySerializabilityMetadata metadata, String childPropertyName, Object childPropertyValue) {\r\n if (metadata.getPropertySerializability().equals(PropertySerializability.SERIALIZE_OBJECT_AND_ALL_PRIMITIVES)) {\r\n if (isPrimitiveObject(childPropertyValue)) {\r\n return true;\r\n }\r\n }\r\n return metadata.getSerializableChildProperty(childPropertyName) != null;\r\n }", "@JRubyMethod(name = \"==\", required = 1)\n public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) {\n RubyString str1, str2;\n RubyModule instance = (RubyModule)self.getRuntime().getModule(\"Digest\").getConstantAt(\"Instance\");\n if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {\n str1 = digest(ctx, self, null).convertToString();\n str2 = digest(ctx, oth, null).convertToString();\n } else {\n str1 = to_s(ctx, self).convertToString();\n str2 = oth.convertToString();\n }\n boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2));\n return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse();\n }", "@Test\n void testAssertPropertyReflectionEquals_equalsIgnoredDefault() {\n assertPropertyReflectionEquals(\n \"a message\",\n \"stringProperty\",\n null,\n testObject,\n ReflectionComparatorMode.IGNORE_DEFAULTS\n );\n }", "@Test\r\n @ConditionalIgnore(condition = IgnoreEqualsNotFire.class)\r\n public void testListValuedObjectPropertyChange() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ChangeReport report = new ChangeReport(property);\r\n property.set(createObservableList(true));\r\n assertEquals(\"not supported: \\n list-valued objectProperty must fire on not-same list\", \r\n 1, report.getEventCount());\r\n }", "private static boolean hasPropertyV2(int settings, int property){\n\t\tint bit = -1;\n\t\twhile (property > 0) {\n\t\t\tproperty >>= 1;\n\t\t\tbit ++;\n\t\t}\n\t\treturn ItFromBit.getTheBit(settings, bit);\n\t}", "@Test\n void getByPropertyEqualUnique() {\n UserRoles role = (UserRoles)genericDAO.getByPropertyEqualUnique(\"userName\", \"admin\");\n assertEquals(\"admin\", role.getUserName());\n }", "public boolean equals(Object anObject) {\n\t\t//use short circuit evaluation, so we know that if it gets to isValuesEqual test, anObject is a BinaryMessage\n\t\tif(!isNull(anObject) &&\n\t\t isBinaryMessage(anObject) && \n\t\t isValuesEqual((BinaryMessage)anObject, this)) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "private void assertVersion(Versioned vers)\n {\n final Version v = vers.version();\n assertFalse(\"Should find version information (got \"+v+\")\", v.isUnknownVersion());\n assertEquals(PackageVersion.VERSION, v);\n }" ]
[ "0.6501035", "0.6472326", "0.6406476", "0.62374187", "0.59490466", "0.5933179", "0.5914229", "0.5862983", "0.58628535", "0.5806853", "0.5778249", "0.57512623", "0.5640886", "0.5632631", "0.55737466", "0.55527246", "0.5552561", "0.5544223", "0.553614", "0.55188656", "0.55119634", "0.55012536", "0.5497282", "0.54902405", "0.544209", "0.54191214", "0.5415152", "0.5405227", "0.53917134", "0.5386386", "0.537135", "0.5368327", "0.53149724", "0.5311546", "0.53092873", "0.53087354", "0.52983344", "0.52952963", "0.52946264", "0.5282476", "0.5267673", "0.52650416", "0.52589685", "0.5206687", "0.51592857", "0.51435083", "0.51386493", "0.5134605", "0.51249975", "0.5123346", "0.51201004", "0.51147705", "0.51007473", "0.50960493", "0.509152", "0.5091387", "0.5090279", "0.5082235", "0.5076865", "0.50737005", "0.5067715", "0.50676805", "0.5067211", "0.506687", "0.5066808", "0.50552475", "0.50550735", "0.50412405", "0.50399125", "0.5035888", "0.5032396", "0.50250417", "0.5023625", "0.50228816", "0.501697", "0.5013058", "0.500864", "0.50076634", "0.50038475", "0.50020903", "0.5001991", "0.49970114", "0.49969858", "0.49919608", "0.49848366", "0.49847203", "0.49840719", "0.49833933", "0.49795112", "0.4975477", "0.49753964", "0.49735817", "0.49705663", "0.49620712", "0.49580443", "0.4952093", "0.4947685", "0.4944072", "0.49367386", "0.49260104" ]
0.63385475
3
Test for equal primitive property value.
@Test void testAssertPropertyReflectionEquals_equalsPrimitive() { assertPropertyReflectionEquals("primitiveProperty", 1L, testObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testAssertPropertyReflectionEquals_equalsPrimitive() {\r\n assertPropertyReflectionEquals(\"primitiveProperty\", 1L, testObject);\r\n }", "@Override\n public boolean equals(Object o) {\n if (o instanceof TestElementProperty) {\n if (this == o) {\n return true;\n }\n if (value != null) {\n return value.equals(((JMeterProperty) o).getObjectValue());\n }\n }\n return false;\n }", "public void testAssertPropertyLenientEquals_equals() {\r\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n void testAssertPropertyLenientEquals_equals() {\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "public boolean equalsTo(String property) {\n\t\t\treturn this.value.equals(property);\n\t\t}", "public void testAssertPropertyReflectionEquals_equals() {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Override\n\tpublic boolean equal() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean equals(Object other){\n\t if (other == null) return false;\n\t if (other == this) return true;\n\t if (!(other instanceof Property))return false;\n\t Property otherProperty = (Property)other;\n\t \n\t if(this.number == otherProperty.number) {\n\t \treturn true;\n\t } else {\n\t \treturn false;\n\t }\n\t}", "String getEqual();", "@Test\n void testAssertPropertyReflectionEquals_equals() {\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "@Override\n public boolean equals(final Object obj)\n {\n return this.value.equals(obj);\n }", "@Override\n public boolean raweq(LuaValue val) {\n return val.raweq(v);\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> roles = genericDAO.getByPropertyEqual(\"userName\", \"admin\");\n assertEquals(1, roles.size());\n assertEquals(1, roles.get(0).getUserRoleId());\n }", "@Override\n public boolean equals(Object obj) {\n // this code provided by Dave Houtman [2020] personal communication\n if (!(obj instanceof Property))\n return false;\n Property prop = (Property) obj;\n return this.getXLeft() == prop.getXLeft() && this.getYTop() == prop.getYTop() && hasSameSides(prop);\n }", "public void testEqualsObject() {\n\t\t\tTipoNodoLeisure tipo1 = new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.0\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo2= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.1\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo3= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.2\")); //$NON-NLS-1$\n\t\t\tif (tipo1 != tipo1)\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.3\")); //$NON-NLS-1$\n\t\t\tif (!tipo1.equals(tipo2))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.4\"));\t\t\t //$NON-NLS-1$\n\t\t\tif (tipo1.equals(tipo3))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.5\"));\t //$NON-NLS-1$\n\t\t}", "public PrimitivePropertyTest(String testName)\n {\n super(testName);\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Order> orders = dao.getByPropertyEqual(\"description\", \"February Large Long-Sleeve\");\n assertEquals(1, orders.size());\n assertEquals(2, orders.get(0).getId());\n }", "@Test\n public void testEquals_1() {\n LOGGER.info(\"testEquals_1\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hello\");\n final boolean actual = atomString.equals(atom);\n assertTrue(actual);\n }", "public void testObjEqual()\n {\n assertEquals( true, Util.objEqual(null,null) );\n assertEquals( false,Util.objEqual(this,null) );\n assertEquals( false,Util.objEqual(null,this) );\n assertEquals( true, Util.objEqual(this,this) );\n assertEquals( true, Util.objEqual(\"12\",\"12\") );\n }", "@Test\n\tpublic void testPropertyIntegralType() {\n\t\tfinal Base base = context.mock(Base.class);\n\t\tcontext.checking(new PropertyEnabledExpectations() {\n\t\t\t{\n\t\t\t\tallowingProperty(base).isValid();\n\t\t\t\twill(returnValue(true));\n\t\t\t}\n\t\t});\n\n\t\tassertTrue(\"Initial value was not set\", base.isValid());\n\t\tbase.setValid(false);\n\t\tassertFalse(\"Value didn't change\", base.isValid());\n\t}", "@Test\r\n public void testEquals() {\r\n Articulo art = new Articulo();\r\n articuloPrueba.setCodigo(1212);\r\n art.setCodigo(1212);\r\n boolean expResult = true;\r\n boolean result = articuloPrueba.equals(art);\r\n assertEquals(expResult, result);\r\n }", "public boolean equals(Object o) {\r\n\t\t// TODO and replace return false with the appropriate code.\r\n\t\tif (o == null || o.getClass() != this.getClass())\r\n\t\t\treturn false;\r\n\t\tProperty p = (Property) o;\r\n\t\treturn Arrays.deepEquals(p.positive, this.positive)\r\n\t\t\t\t&& Arrays.deepEquals(p.negative, this.negative)\r\n\t\t\t\t&& Arrays.deepEquals(p.stop, this.stop)\r\n\t\t\t\t&& p.scoringmethod == this.scoringmethod\r\n\t\t\t\t&& Math.abs(p.mindistance - this.mindistance) < 0.000001;\r\n\t}", "@Override\n\tpublic boolean contient(T val) {\n\t\treturn val.equals(val);\n\t}", "public boolean equals(Scalar s) {\n\t\tif(getValue() == ((RealScalar)s).getValue())\n\t\t\treturn true;\n\t\treturn false; \n\t}", "@Test\n public void testBooleanProperty() {\n try (ReleasableVariant started = classObject.get(\"Started\")) {\n Assertions.assertTrue(started.booleanValue());\n }\n }", "boolean canEqual(Object obj);", "@Test\n void getByPropertyExactSuccess() {\n List<Car> carList = carDao.getByPropertyEqual(\"make\", \"Jeep\");\n assertEquals(1, carList.size());\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<User> users = dao.findByPropertyEqual(\"firstName\", \"Mark\");\n assertEquals(1, users.size());\n assertEquals(2, users.get(0).getId());\n }", "@Test\n void testAssertPropertyLenientEquals_equalsIgnoredDefault() {\n assertPropertyLenientEquals(\"stringProperty\", null, testObject);\n }", "public boolean\tequals(Object o) {\n\treturn ( o != null && o instanceof Num\n\t && ((Num) o).value == value );\n }", "@Test\n public void testEquals_1()\n throws Exception {\n ColumnPreferences fixture = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n fixture.setVisible(true);\n Object obj = null;\n\n boolean result = fixture.equals(obj);\n\n assertEquals(false, result);\n }", "public void testAssertPropertyLenientEquals_equalsIgnoredDefault() {\r\n assertPropertyLenientEquals(\"stringProperty\", null, testObject);\r\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Object object = null;\n Paciente instance = new Paciente();\n boolean expResult = false;\n boolean result = instance.equals(object);\n assertEquals(expResult, result);\n\n }", "@Test\n public void testEquals_4()\n throws Exception {\n ColumnPreferences fixture = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n fixture.setVisible(true);\n Object obj = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n\n boolean result = fixture.equals(obj);\n\n assertEquals(true, result);\n }", "public boolean eqValue(E that) {\n return this.value.compareTo(that) == 0;\n }", "<T> boolean containsValue(Property<T> property);", "public void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\r\n try {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject);\r\n fail(\"Expected AssertionFailedError\");\r\n } catch (AssertionFailedError a) {\r\n // expected\r\n }\r\n }", "@Test\n public void mainTests(){\n assertTrue(property1.getPropertyId() == id1);\n if(property1.getPropertyId() != id1) {\n property2.setPropertyId(id1);\n }\n else {\n assertTrue(property2.getPropertyId() == id2);\n }\n //Getter works Correct for ID\n }", "@Test\n public void testBooleanPropertyQuick() {\n Assertions.assertTrue(classObject.getBoolean(\"Started\"));\n }", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@TestProperties(name=\"test equal sign parameters for test\")\n\tpublic void testParametersWithEquals() throws Exception {\n\t\tjsystem.launch();\n//\t\tScenarioUtils.createAndCleanScenario(jsystem, ScenariosManager.getInstance().getCurrentScenario().getScenarioName());\n\t\tScenarioUtils.createAndCleanScenario(jsystem, jsystem.getCurrentScenario());\n\t\tjsystem.addTest(\"testWithInclueParametersNewLine\", \"ParamaetersHandlingSection\", true);\n\t\tjsystem.setTestParameter(1, \"General\", \"Str8\", \"x=2=3=4, v b n eee=,\", false);\n\t\tjsystem.play();\n\t\tjsystem.waitForRunEnd();\n\t\tjsystem.checkNumberOfTestsPass(1);\n\t\tString propValue = \n\t\t\tgetRunProperties().getProperty(\"testWithInclueParametersNewLine_str8\");\n\t\tassertEquals(\"x=2=3=4, v b n eee=,\", propValue);\n\t}", "@Override\n public boolean equals(Object obj) {\n if (!canonicalizing) // use object identity as equality, except during canonicalization\n return obj == this;\n if (obj == this)\n return true;\n if (!(obj instanceof Value))\n return false;\n Value v = (Value) obj;\n // noinspection StringEquality\n return flags == v.flags\n && (var == v.var || (var != null && v.var != null && var.equals(v.var)))\n && ((num == null && v.num == null) || (num != null && v.num != null && num.equals(v.num)))\n && (str == v.str || (str != null && v.str != null && str.equals(v.str)))\n && (object_labels == v.object_labels || (object_labels != null && v.object_labels != null && object_labels.equals(v.object_labels)))\n && (getters == v.getters || (getters != null && v.getters != null && getters.equals(v.getters)))\n && (setters == v.setters || (setters != null && v.setters != null && setters.equals(v.setters)))\n && (excluded_strings == v.excluded_strings || (excluded_strings != null && v.excluded_strings != null && excluded_strings.equals(v.excluded_strings)))\n && (included_strings == v.included_strings || (included_strings != null && v.included_strings != null && included_strings.equals(v.included_strings)))\n && Objects.equals(functionPartitions, v.functionPartitions)\n && Objects.equals(functionTypeSignatures, v.functionTypeSignatures);\n }", "boolean isSimpleValue();", "@Test\n void getByPropertyEqualSuccess() {\n List<Event> events = genericDao.getByPropertyEqual(\"name\", \"Dentist\");\n assertEquals(1, events.size());\n assertEquals(2, events.get(0).getId());\n }", "@Test\n public void testEqualsReturnsFalseOnDifferentIdVal() throws Exception {\n setRecordFieldValue(otherRecord, \"id\", 42L);\n\n boolean equals = record.equals(otherRecord);\n\n assertThat(equals, is(false));\n }", "@Test\n void testAssertPropertyLenientEquals_equalsMessage() {\n assertPropertyLenientEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\n }", "boolean equalProps(InstanceProperties props) {\n String propsName = props.getString(PROPERTY_NAME, null);\n return propsName != null\n ? propsName.equals(name)\n : name == null;\n }", "@JRubyMethod(name = \"==\", required = 1)\n public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) {\n RubyString str1, str2;\n RubyModule instance = (RubyModule)self.getRuntime().getModule(\"Digest\").getConstantAt(\"Instance\");\n if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {\n str1 = digest(ctx, self, null).convertToString();\n str2 = digest(ctx, oth, null).convertToString();\n } else {\n str1 = to_s(ctx, self).convertToString();\n str2 = oth.convertToString();\n }\n boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2));\n return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse();\n }", "@Test\n\tpublic void testEqualsVerdadeiro() {\n\t\t\n\t\tassertTrue(contato1.equals(contato3));\n\t}", "public void testAssertPropertyLenientEquals_equalsMessage() {\r\n assertPropertyLenientEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\r\n }", "public boolean isValue() {\n switch(this.getType()) {\n case CONSTANT_INTEGER : \n case CONSTANT_FLOAT :\n case CONSTANT_DOUBLE : \n case CONSTANT_LONG : \n case CONSTANT_STRING:\n return true ;\n default :\n return false;\n }\n }", "boolean equalTo(ObjectPassDemo o) {\n return (o.a == a && o.b == b);\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Receta instance = new Receta();\n instance.setNombre(\"nom1\");\n Receta instance2 = new Receta();\n instance.setNombre(\"nom2\");\n boolean expResult = false;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Test\n public void equals_trulyEqual() {\n SiteInfo si1 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n SiteInfo si2 = new SiteInfo(\n Amount.valueOf(12000, SiteInfo.CUBIC_FOOT),\n Amount.valueOf(76, NonSI.FAHRENHEIT),\n Amount.valueOf(92, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n Amount.valueOf(100, NonSI.FAHRENHEIT),\n 56,\n Damage.CLASS2,\n Country.USA,\n \"Default Site\"\n );\n\n Assert.assertEquals(si1, si2);\n }", "@Test\n public void testIntProperty() {\n try (ReleasableVariant procId = classObject.get(\"ProcessId\")) {\n Assertions.assertNotEquals(0, procId.intValue());\n }\n }", "@Test\n public void testEquals_2()\n throws Exception {\n ColumnPreferences fixture = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n fixture.setVisible(true);\n Object obj = new Object();\n\n boolean result = fixture.equals(obj);\n\n assertEquals(false, result);\n }", "boolean hasProperty2();", "@Override\n public boolean equals(Object o) {\n return o instanceof LuaInteger ? ((LuaInteger) o).v == v : false;\n }", "@Test\n public void testEquals_3()\n throws Exception {\n ColumnPreferences fixture = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n fixture.setVisible(true);\n Object obj = new ColumnPreferences(\"\", \"\", 1, ColumnPreferences.Visibility.HIDDEN, ColumnPreferences.Hidability.HIDABLE);\n\n boolean result = fixture.equals(obj);\n\n assertEquals(true, result);\n }", "public boolean isProperty();", "@Override\r\n\tpublic boolean isEqual(Node node) {\n\t\treturn false;\r\n\t}", "@Test\n void getByPropertySuccess() {\n List<User> users = genericDao.findByPropertyEqual(\"userName\", \"BigAl\");\n // should only find one entry with the username \"BigAl\"\n assertEquals(users.size(), 1);\n }", "public void testAssertPropertyReflectionEquals_equalsMessage() {\r\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\r\n }", "@Test\n @DisplayName(\"Matched\")\n public void testEqualsMatched() throws BadAttributeException {\n Settings settings = new Settings();\n assertEquals(new Settings(), settings);\n }", "@Test\n void getByPropertyEqualUnique() {\n UserRoles role = (UserRoles)genericDAO.getByPropertyEqualUnique(\"userName\", \"admin\");\n assertEquals(\"admin\", role.getUserName());\n }", "@Test\n\tpublic void testPropertyInSuper() {\n\t\tfinal Valuable valuable = context.mock(Valuable.class);\n\t\tcontext.checking(new PropertyEnabledExpectations() {\n\t\t\t{\n\t\t\t\tallowingProperty(valuable).getId();\n\t\t\t\twill(returnValue(INITIAL));\n\t\t\t}\n\t\t});\n\n\t\tassertEquals(\"Initial value not set\", INITIAL, valuable.getId());\n\t}", "public void testIsCompatible() {\n System.out.println(\"isCompatible\"); // NOI18N\n \n TypeID requiredType = TYPEID_JAVA_LANG_STRING; // NOI18N\n PropertyValue instance = TypesSupport.createStringValue(FirstCD.PROPERTY_TEST); // NOI18N\n boolean expResult = true;\n boolean result = instance.isCompatible(requiredType);\n \n assertEquals(expResult, result);\n }", "@Test\n void equals1() {\n Student s1=new Student(\"emina\",\"milanovic\",18231);\n Student s2=new Student(\"emina\",\"milanovic\",18231);\n assertEquals(true,s1.equals(s2));\n }", "@SuppressWarnings({ \"static-method\", \"nls\" })\n @Test\n public final void testGetProperty()\n {\n TestEasyPropertiesObject object = new TestEasyPropertiesObject();\n Assert.assertEquals(\"1.2.3\", object.getVersion());\n }", "public boolean equals(Object other) {\n return super.equals(other) &&\n requiredPrimitiveType == ((AtomicSequenceConverter)other).requiredPrimitiveType;\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Object object = null;\n Reserva instance = new Reserva();\n boolean expResult = false;\n boolean result = instance.equals(object);\n assertEquals(expResult, result);\n \n }", "public void testEqualsObject()\n {\n Mana meme = new Mana( myMise );\n Assert.assertEquals( myMise, meme );\n \n System.out.println( myMise.toString());\n Mana autre = new Mana( 49 );\n Assert.assertFalse( myMise.equals( autre ));\n autre = new Mana( 50 );\n Assert.assertTrue( myMise.equals( autre ));\n }", "boolean hasCustomValue();", "boolean hasProperty();", "boolean hasProperty();", "boolean hasProperty();", "@Test\n public void testEquals_2() {\n LOGGER.info(\"testEquals_2\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = new AtomString(\"Hej\");\n final boolean actual = atomString.equals(atom);\n assertFalse(actual);\n }", "public boolean equals(Property inProperty){\n return (inProperty.getName().equals(this.getName()));\n }", "@Test\r\n public void testEquals() {\r\n System.out.println(\"equals\");\r\n Object obj = null;\r\n RevisorParentesis instance = null;\r\n boolean expResult = false;\r\n boolean result = instance.equals(obj);\r\n assertEquals(expResult, result);\r\n // TODO review the generated test code and remove the default call to fail.\r\n fail(\"The test case is a prototype.\");\r\n }", "@Test\n void testAssertPropertyReflectionEquals_equalsMessage() {\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", \"stringValue\", testObject);\n }", "@Test\r\n public void testEquals() throws Exception\r\n {\r\n Object expectedValueToEqual = new Object();\r\n ValueEquals sut = new ValueEquals(\"MyReplaceId\", expectedValueToEqual);\r\n assertEquals(sut.compareDataSetElementTo(expectedValueToEqual), 0);\r\n ;\r\n }", "public boolean equal(Inatnum B) {return(this.n==B.getVal());}", "public void testAssertPropertyReflectionEquals_equalsIgnoredDefault() {\r\n assertPropertyReflectionEquals(\"a message\", \"stringProperty\", null, testObject, IGNORE_DEFAULTS);\r\n }", "@Override public boolean equals(final Object value) {\n if (value == null) {\n return false;\n }\n //if (Tools.isStringClass(value)) {\n // return getDrbdResource().getValue(DRBD_RES_PARAM_DEV).equals(\n // value.toString());\n //} else {\n if (toString() == null) {\n return false;\n }\n return toString().equals(value.toString());\n //}\n }", "public abstract QueryElement addEquals(String property, Object value);", "@Test\n \tpublic void testEqual() {\n \t\tAssert.assertTrue(f1.equals(f1));\n \t}", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Vproperty)) {\n return false;\n }\n Vproperty other = (Vproperty) object;\n if ((this.vpropertyPK == null && other.vpropertyPK != null) || (this.vpropertyPK != null && !this.vpropertyPK.equals(other.vpropertyPK))) {\n return false;\n }\n return true;\n }", "boolean hasProperty0();", "@Test\n public void testEquals() {\n\tSystem.out.println(\"equals\");\n\tObject obj = null;\n\tJenkinsBuild instance = new JenkinsBuild();\n\tboolean expResult = false;\n\tboolean result = instance.equals(obj);\n\tassertEquals(expResult, result);\n\tJenkinsBuild newObj = new JenkinsBuild();\n\tnewObj.setBuildNumber(0);\n\tnewObj.setSystemLoadId(\"\");\n\tnewObj.setJobName(\"\");\n\tassertEquals(expResult, instance.equals(newObj));\n }", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Setting s = Setting.factory();\n Setting s1 = Setting.factory();\n Setting s2 = Setting.factory();\n Setting s3 = Setting.getSetting(\"test1\");\n Setting s4 = Setting.getSetting(\"test1\");\n\n Object o = null;\n Setting instance = s;\n assertFalse(s.equals(o));\n o = new Object();\n assertFalse(s.equals(o));\n assertFalse(s.equals(s1));\n assertEquals(s3, s4);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype. need more tests\");\n }", "boolean hasValue(PropertyValue<?, ?> value);", "@Test\r\n public void testObjectPropertyWithEqualOrSameList() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ObjectProperty<ObservableList<String>> otherPropertySameList = new SimpleObjectProperty<>(list);\r\n assertFalse(\"sanity: two properties with same list are not equal\", \r\n property.equals(otherPropertySameList));\r\n ObjectProperty<ObservableList<String>> otherPropertyEqualList =\r\n new SimpleObjectProperty(createObservableList(true));\r\n assertFalse(\"sanity: two properties with equal list are not equal\", \r\n property.equals(otherPropertyEqualList));\r\n }", "boolean hasProperty1();", "@Test\n public void testEquals_3() {\n LOGGER.info(\"testEquals_3\");\n final AtomString atomString = new AtomString(\"Hello\");\n final Atom atom = null;\n final boolean actual = atomString.equals(atom);\n assertFalse(actual);\n }", "@Test\n\tpublic void test_TCM__boolean_equals_Object() {\n\t\tfinal Attribute attribute = new Attribute(\"test\", \"value\");\n\n assertFalse(\"attribute equal to null\", attribute.equals(null));\n\n final Object object = attribute;\n assertTrue(\"object not equal to attribute\", attribute.equals(object));\n assertTrue(\"attribute not equal to object\", object.equals(attribute));\n\n // current implementation checks only for identity\n// final Attribute clonedAttribute = (Attribute) attribute.clone();\n// assertTrue(\"attribute not equal to its clone\", attribute.equals(clonedAttribute));\n// assertTrue(\"clone not equal to attribute\", clonedAttribute.equals(attribute));\n\t}", "PrimitiveProperty createPrimitiveProperty();", "@Test\n void testAssertPropertyReflectionEquals_equalsIgnoredDefault() {\n assertPropertyReflectionEquals(\n \"a message\",\n \"stringProperty\",\n null,\n testObject,\n ReflectionComparatorMode.IGNORE_DEFAULTS\n );\n }", "@Test\r\n public void testEquals() {\r\n System.out.println(\"equals\");\r\n Object object = null;\r\n Integrante instance = new Integrante();\r\n boolean expResult = false;\r\n boolean result = instance.equals(object);\r\n assertEquals(expResult, result);\r\n // TODO review the generated test code and remove the default call to fail.\r\n fail(\"The test case is a prototype.\");\r\n }", "@Test\n public void testEquals_1()\n throws Exception {\n Project fixture = new Project();\n fixture.setWorkloadNames(\"\");\n fixture.setName(\"\");\n fixture.setScriptDriver(ScriptDriver.SilkPerformer);\n fixture.setWorkloads(new LinkedList());\n fixture.setComments(\"\");\n fixture.setProductName(\"\");\n Object obj = new Object();\n\n boolean result = fixture.equals(obj);\n\n assertEquals(false, result);\n }", "@Override\n\tpublic boolean equals(Object o) {\n\t\tif (o == null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (o == this) {\n\t\t\treturn true;\n\t\t}\n\t\tif (o.getClass() != getClass()) {\n\t\t\treturn false;\n\t\t}\n\t\tScalar<?> other = (Scalar<?>) o;\n\t\treturn Objects.equals(getValue(), other.getValue());\n\t}" ]
[ "0.6920388", "0.6462553", "0.6197065", "0.6170591", "0.61375433", "0.61000407", "0.6049103", "0.5981299", "0.5948726", "0.59349054", "0.59346485", "0.5922856", "0.59104127", "0.59060353", "0.59045005", "0.58674014", "0.5851378", "0.58420163", "0.58320516", "0.5815739", "0.5811797", "0.58094335", "0.5777542", "0.57622534", "0.5755993", "0.57455343", "0.5732438", "0.5726102", "0.5699081", "0.56847405", "0.5663309", "0.5656592", "0.5652144", "0.56385136", "0.5636619", "0.56293124", "0.5616655", "0.5609293", "0.56051207", "0.5593139", "0.5557506", "0.55573416", "0.5554679", "0.555141", "0.5544677", "0.5543063", "0.55397636", "0.5531113", "0.55238885", "0.552249", "0.55224055", "0.55201626", "0.5518586", "0.5511151", "0.551087", "0.5509339", "0.54933214", "0.5492184", "0.54913574", "0.5476942", "0.5468102", "0.54647815", "0.54612863", "0.546105", "0.5459652", "0.5458246", "0.5452313", "0.5450827", "0.54469544", "0.5433575", "0.54286337", "0.54270744", "0.5421318", "0.5419671", "0.5419671", "0.5419671", "0.54193264", "0.5410969", "0.540416", "0.540077", "0.539808", "0.5394683", "0.53899646", "0.5387233", "0.5385817", "0.53748506", "0.5372546", "0.5371727", "0.5370638", "0.53679246", "0.5357907", "0.5357295", "0.5356081", "0.53523284", "0.53494686", "0.53491914", "0.53488463", "0.5344488", "0.5343358", "0.53431094" ]
0.6729318
1
Test for different property value.
@Test void testAssertPropertyReflectionEquals_notEqualsDifferentValues() { assertFailing(() -> assertPropertyReflectionEquals("stringProperty", "xxxxxx", testObject) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean isValueAProperty(String name)\n {\n int openIndex = name.indexOf(\"${\");\n\n return openIndex > -1;\n }", "boolean hasValue(PropertyValue<?, ?> value);", "boolean hasProperty2();", "@Test\n public void mainTests(){\n assertTrue(property1.getPropertyId() == id1);\n if(property1.getPropertyId() != id1) {\n property2.setPropertyId(id1);\n }\n else {\n assertTrue(property2.getPropertyId() == id2);\n }\n //Getter works Correct for ID\n }", "Object getPropertyexists();", "boolean hasSetProperty();", "public boolean isProperty();", "boolean hasProperty1();", "String getPropertyExists();", "boolean hasProperty();", "boolean hasProperty();", "boolean hasProperty();", "<T> boolean containsValue(Property<T> property);", "boolean hasProperty0();", "boolean containsProperty(String name);", "boolean hasCustomValue();", "@Test\n @org.junit.Ignore\n public void shouldBeAbleToCallPropertyIfThereIsASingleProperty() {\n }", "boolean hasGetProperty();", "boolean hasPropertyLike(String name);", "public abstract boolean getProperty(String propertyName);", "@Override\n public boolean equals(Object o) {\n if (o instanceof TestElementProperty) {\n if (this == o) {\n return true;\n }\n if (value != null) {\n return value.equals(((JMeterProperty) o).getObjectValue());\n }\n }\n return false;\n }", "public abstract boolean isMatching(Properties p);", "public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {\r\n boolean result = false;\r\n\t\t\r\n\t\t// Ensure Papyrus is the active editor\r\n\t\tIEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();\r\n\t\tif((editor == null) || (!(editor instanceof IMultiDiagramEditor))) {\r\n\t\t\t//Activator.log.info(\"returning false\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tObject currentValue = null;\r\n\t\tif(IS_PLASMA_MODEL.equals(property)) {\r\n\t\t\tcurrentValue = testRobotmlModelNature(receiver);\r\n\t\t\tresult = (currentValue == expectedValue);\r\n\t\t}\r\n\t\t//Activator.log.info(\"returning result: \" + result);\r\n\t\treturn result;\r\n\t}", "public boolean equalsTo(String property) {\n\t\t\treturn this.value.equals(property);\n\t\t}", "Object getPropertytrue();", "public void testAssertPropertyReflectionEquals_notEqualsDifferentValues() {\r\n try {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"xxxxxx\", testObject);\r\n fail(\"Expected AssertionFailedError\");\r\n } catch (AssertionFailedError a) {\r\n // expected\r\n }\r\n }", "public abstract boolean isAllowCustomProperties();", "@Override\n\tpublic boolean hasProperty(String fieldName, String value) {\n\t\tString[] fields = doc.getValues(fieldName);\n\t\tif (fields != null) {\n\t\t\tfor (String field : fields) {\n\t\t\t\tif (value.equals(field)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "@Test\n void getByPropertyEqualSuccess() {\n List<UserRoles> roles = genericDAO.getByPropertyEqual(\"userName\", \"admin\");\n assertEquals(1, roles.size());\n assertEquals(1, roles.get(0).getUserRoleId());\n }", "@Test(expected = IllegalArgumentException.class)\n public void testGetPropertyValueSetEmptyPropertyName1(){\n List<User> list = toList(new User(2L), new User(5L), new User(5L));\n CollectionsUtil.getPropertyValueSet(list, \" \", Integer.class);\n }", "@Test\n\tpublic void testPropertyInSuper() {\n\t\tfinal Valuable valuable = context.mock(Valuable.class);\n\t\tcontext.checking(new PropertyEnabledExpectations() {\n\t\t\t{\n\t\t\t\tallowingProperty(valuable).getId();\n\t\t\t\twill(returnValue(INITIAL));\n\t\t\t}\n\t\t});\n\n\t\tassertEquals(\"Initial value not set\", INITIAL, valuable.getId());\n\t}", "static void checkKey(String firstProperty, String secondProperty) {\n firstProperty = firstProperty.toUpperCase();\n secondProperty = secondProperty.toUpperCase();\n if (!properties.contains(firstProperty) && !properties.contains(secondProperty)\n && !negativeProperties.contains(firstProperty) && !negativeProperties.contains(secondProperty)) {\n System.out.printf(\"The properties [%s, %s] are wrong.\\n\" +\n \"Available properties: %s%n\\n\", firstProperty, secondProperty, properties);\n Start.start();\n }\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<Order> orders = dao.getByPropertyEqual(\"description\", \"February Large Long-Sleeve\");\n assertEquals(1, orders.size());\n assertEquals(2, orders.get(0).getId());\n }", "boolean equalProps(InstanceProperties props) {\n String propsName = props.getString(PROPERTY_NAME, null);\n return propsName != null\n ? propsName.equals(name)\n : name == null;\n }", "public void testGetProperty()\n {\n assertEquals(\"MSM Extension not present, or incorrect specification version -\", MSM_SPECIFICATION_VERSION,\n System.getProperty(MSM_PROPERTY_NAME));\n }", "private boolean isPropertyRelevant(String property) {\n return relevantProperties == null || relevantProperties.contains(property);\n }", "private static boolean hasPropertyV2(int settings, int property){\n\t\tint bit = -1;\n\t\twhile (property > 0) {\n\t\t\tproperty >>= 1;\n\t\t\tbit ++;\n\t\t}\n\t\treturn ItFromBit.getTheBit(settings, bit);\n\t}", "@Test\n void getByPropertyLikeSuccess() {\n List<UserRoles> usersRoles = genericDao.getPropertyByName(\"roleName\", \"user\");\n assertEquals(2, usersRoles.size());\n }", "public void testGetProperty() {\n assertEquals(rootBlog.getName(), rootBlog.getProperty(Blog.NAME_KEY));\n }", "@Override\n\t\tprotected boolean initializeSpecificProperties(Component c, AWTEvent introspectionRequestEvent,\n\t\t\t\tTestEditor testEditor) {\n\t\t\tif (c instanceof CustomComponent) {\n\t\t\t\texpectpedValueOfPropertyToCheck = ((CustomComponent) c).propertyToCheck;\n\t\t\t\tnewValueOfPropertyToChange = ((CustomComponent) c).propertyToChange + 1;\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "boolean shouldReadValue();", "private static boolean hasProperty(int settings, int property){\n\t\tint bit = 0; // log2(property)\n\t\twhile ((property >>= 1) > 0) bit ++;\n\t\treturn ItFromBit.getTheBit(settings, bit);\n\t}", "private boolean readHasCorrespondingIsProperty(Method paramMethod, Class paramClass) {\n/* 294 */ return false;\n/* */ }", "private static boolean isListProperty(String prop) {\n prop = prop.intern();\n for (int i = 0; i < listProperties.length; i++) {\n if (prop == listProperties[i]) {\n return true;\n }\n }\n return false;\n }", "@Test\n public void propertyTest() throws Exception {\n String unMatchedTriples = \"\";\n StmtIterator msIter = propertyMeasuringStick.listStatements();\n while (msIter.hasNext()) {\n Statement msStmt = msIter.nextStatement();\n // TODO: find a more formal way to filter out properties we don't need to test\n if (!msStmt.getPredicate().toString().equals(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\") &&\n !msStmt.getPredicate().toString().equals(\"http://www.w3.org/2000/01/rdf-schema#subPropertyOf\")) {\n StmtIterator poIter = propertyOutput.listStatements();\n boolean match = false;\n while (poIter.hasNext()) {\n Statement outputStmt = poIter.nextStatement();\n if (outputStmt.equals(msStmt)) {\n match = true;\n }\n }\n // If a match is not found then set this statement.\n if (!match) {\n unMatchedTriples += msStmt.getSubject() + \" \" + msStmt.getPredicate().toString() + \" \" + msStmt.getObject().toString() + \" .\\n\";\n }\n }\n }\n // Output assertion with message of results\n if (!unMatchedTriples.equals(\"\"))\n assertTrue(\"\\nThe following triples ARE in \" + propertyOutputFileName + \" but NOT in propertyMeasuringStick.n3:\\n\" + unMatchedTriples\n , false);\n else\n assertTrue(true);\n\n }", "boolean hasProperty(String key);", "private boolean hasCorrespondingReadProperty(Method paramMethod, Class paramClass, String paramString) {\n/* 268 */ String str = paramMethod.getName();\n/* 269 */ Class[] arrayOfClass = paramMethod.getParameterTypes();\n/* 270 */ boolean bool = false;\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ try {\n/* 276 */ String str1 = str.replaceFirst(\"set\", paramString);\n/* 277 */ Method method = paramClass.getMethod(str1, new Class[0]);\n/* */ \n/* */ \n/* */ \n/* 281 */ bool = (isPropertyAccessorMethod(method, paramClass) && method.getReturnType() == arrayOfClass[0]) ? true : false;\n/* */ }\n/* 283 */ catch (Exception exception) {}\n/* */ \n/* */ \n/* */ \n/* 287 */ return bool;\n/* */ }", "protected abstract boolean isSupportedTestType(Properties prop);", "@Test\n void getByPropertySuccess() {\n List<User> users = genericDao.findByPropertyEqual(\"userName\", \"BigAl\");\n // should only find one entry with the username \"BigAl\"\n assertEquals(users.size(), 1);\n }", "public boolean hasProperty( String key );", "public static boolean canTransferToProperty( TestProperty source, TestProperty target )\r\n \t{\r\n \t\treturn false;\r\n \t}", "@Test\n void getByPropertyEqualSuccess() {\n List<Event> events = genericDao.getByPropertyEqual(\"name\", \"Dentist\");\n assertEquals(1, events.size());\n assertEquals(2, events.get(0).getId());\n }", "public void verifyNoMatching(AcProperty e)\n {\n }", "@Test\n public void testGetProperty_String_String() throws Exception {\n String key = \"doesn't exist\";\n String defaultValue = \"default\";\n DatabaseProperties instance = cveDb.getDatabaseProperties();\n String expResult = \"default\";\n String result = instance.getProperty(key, defaultValue);\n assertEquals(expResult, result);\n }", "@Test(expected = IllegalStateException.class)\n @org.junit.Ignore\n public void shouldNotBeAbleToCallPropertyIfThereAreMultipleProperties() {\n }", "@Test\n void getByPropertyExactSuccess() {\n List<Car> carList = carDao.getByPropertyEqual(\"make\", \"Jeep\");\n assertEquals(1, carList.size());\n }", "boolean isSetValue();", "boolean isSetValue();", "@Test\n public void testGetPropertyValueSet(){\n List<User> list = toList(//\n new User(2L),\n new User(5L),\n new User(5L));\n\n Set<Integer> set = CollectionsUtil.getPropertyValueSet(list, \"id\", Integer.class);\n assertThat(set, contains(2, 5));\n }", "@Test\n void getByPropertyEqualSuccess() {\n List<User> users = dao.findByPropertyEqual(\"firstName\", \"Mark\");\n assertEquals(1, users.size());\n assertEquals(2, users.get(0).getId());\n }", "public String verifyCssProperty(String object, String data) {\n\t\ttry {\n\t\t\n\t\t\twaitForPageLoad(driver);\n\t\t\t\n\t\t\tString property[] = data.split(\":\",2);\n\t\t\tString exp_prop = property[0];\n\t\t\tString exp_value = property[1];\n\t\t\tboolean flag = false;\n\t\t\tString prop = wait.until(explicitWaitForElement(By.xpath(OR.getProperty(object)))).getCssValue(exp_prop);\n\t\t\tlogger.debug(prop);\n\t\t\tlogger.debug(exp_value);\n\t\t\tif (prop.trim().equals(exp_value.trim())) \n\t\t\t{\n\t\t\t\tflag = true;\n\t\t\t}\n\t\t\tif (flag)\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \"--actvalue-\" + prop + \"--expectes-\" + exp_value;\n\t\t\telse\n\t\t\t\t\treturn Constants.KEYWORD_FAIL;\n\t\t} \t\ncatch(TimeoutException ex)\n\t\t\n\t\t{\n\t\t\treturn Constants.KEYWORD_FAIL +\"Cause: \"+ ex.getCause();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\n\t\t\treturn Constants.KEYWORD_FAIL + \" \" + e.getMessage();\n\t\t}\n\t}", "boolean isValue();", "@Test(expected = IllegalArgumentException.class)\n public void testGetPropertyValueSetEmptyPropertyName(){\n List<User> list = toList(new User(2L), new User(5L), new User(5L));\n CollectionsUtil.getPropertyValueSet(list, \"\", Integer.class);\n }", "@Override\n\tpublic boolean equals(Object other){\n\t if (other == null) return false;\n\t if (other == this) return true;\n\t if (!(other instanceof Property))return false;\n\t Property otherProperty = (Property)other;\n\t \n\t if(this.number == otherProperty.number) {\n\t \treturn true;\n\t } else {\n\t \treturn false;\n\t }\n\t}", "protected boolean isMultiplePropertiesChanging() {\n return multiplePropertiesChanging;\n }", "@Test\n void getByPropertyEqualUnique() {\n UserRoles role = (UserRoles)genericDAO.getByPropertyEqualUnique(\"userName\", \"admin\");\n assertEquals(\"admin\", role.getUserName());\n }", "boolean hasProperty(String propertyName);", "public static boolean canExpandProperty( ModelItem contextModelItem, TestProperty property )\r\n \t{\r\n \t\tModelItem propertyModelItem = property.getModelItem();\r\n \t\t\r\n \t\t// global / anonymous reference?\r\n \t\tif( propertyModelItem == null || propertyModelItem instanceof Project )\r\n \t\t\treturn true;\r\n \t\t\r\n \t\tif( contextModelItem instanceof TestSuite )\r\n \t\t{\r\n \t\t\treturn propertyModelItem == contextModelItem;\r\n \t\t}\r\n \r\n \t\tif( contextModelItem instanceof TestCase )\r\n \t\t{\r\n \t\t\treturn propertyModelItem == contextModelItem || \r\n \t\t\t\t(propertyModelItem instanceof TestSuite && ((TestCase)contextModelItem).getTestSuite() == propertyModelItem);\r\n \t\t}\r\n \r\n \t\tif( contextModelItem instanceof TestStep )\r\n \t\t{\r\n \t\t\tTestStep testStep = ((TestStep)contextModelItem);\r\n \t\t\t\r\n \t\t\treturn propertyModelItem == contextModelItem || \r\n \t\t\t (propertyModelItem instanceof TestSuite && testStep.getTestCase().getTestSuite() == propertyModelItem) ||\r\n \t\t\t (propertyModelItem instanceof TestCase && testStep.getTestCase() == propertyModelItem) ||\r\n \t\t\t (propertyModelItem instanceof TestStep && testStep.getTestCase() == ((TestStep)propertyModelItem).getTestCase());\r\n \t\t}\r\n \t\t\r\n \t\tif( contextModelItem instanceof MockService )\r\n \t\t{\r\n \t\t\treturn propertyModelItem == contextModelItem;\r\n \t\t}\r\n \t\t\r\n \t\tif( contextModelItem instanceof MockOperation )\r\n \t\t{\r\n \t\t\treturn propertyModelItem == contextModelItem || \r\n \t\t\t(propertyModelItem instanceof MockService && ((MockOperation)contextModelItem).getMockService() == propertyModelItem);\r\n \t\t}\r\n \t\t\r\n \t\tif( contextModelItem instanceof MockResponse )\r\n \t\t{\r\n \t\t\tMockResponse testStep = ((MockResponse)contextModelItem);\r\n \t\t\t\r\n \t\t\treturn propertyModelItem == contextModelItem || \r\n \t\t\t (propertyModelItem instanceof MockService && testStep.getMockOperation().getMockService() == propertyModelItem) ||\r\n \t\t\t (propertyModelItem instanceof MockOperation && testStep.getMockOperation() == propertyModelItem) ||\r\n \t\t\t (propertyModelItem instanceof MockResponse && testStep.getMockOperation() == ((MockResponse)propertyModelItem).getMockOperation());\r\n \t\t}\r\n \t\t\r\n \t\tSystem.out.println( \"property \" + property.getName() + \" can not be transferred to \" + contextModelItem.getName() );\r\n \t\treturn false;\r\n \t}", "@Test\n public void testBooleanProperty() {\n try (ReleasableVariant started = classObject.get(\"Started\")) {\n Assertions.assertTrue(started.booleanValue());\n }\n }", "public abstract Object getValue(Context context) throws PropertyException;", "public void testAssertPropertyReflectionEquals_equals() {\r\n assertPropertyReflectionEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }", "@Override\n\t\tpublic boolean hasProperty(String key) {\n\t\t\treturn false;\n\t\t}", "void updatedProperty(TestResult tr, String name, String value);", "@Test\n public void testGetValue()\n {\n // single default value\n when(m_AttributeModel.getDefaultValues()).thenReturn(Arrays.asList(new String[]{\"one default\"}));\n m_SUT = new ConfigPropModelImpl(m_AttributeModel);\n assertThat(m_SUT.getValue(), is((Object)\"one default\"));\n \n when(m_AttributeModel.getDefaultValues()).thenReturn(Arrays.asList(new String[]{\"default 1\", \"default 2\"}));\n m_SUT = new ConfigPropModelImpl(m_AttributeModel);\n assertThat(m_SUT.getValue(), is((Object)Arrays.asList(new String[]{\"default 1\", \"default 2\"})));\n \n // set a value\n m_SUT.setValue(\"test non-default\");\n assertThat(m_SUT.getValue(), is((Object)\"test non-default\"));\n \n //test empty default value array\n when(m_AttributeModel.getDefaultValues()).thenReturn(Arrays.asList(new String[]{}));\n m_SUT = new ConfigPropModelImpl(m_AttributeModel);\n assertThat(m_SUT.getValue(), is((Object)\"\"));\n \n //ensure that returned type corresponds to given attribute definition type (boolean)\n when(m_AttributeModel.getDefaultValues()).thenReturn(Arrays.asList(new String[]{\"true\"}));\n when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.BOOLEAN);\n m_SUT = new ConfigPropModelImpl(m_AttributeModel);\n Boolean myBool = (Boolean)m_SUT.getValue();\n assertThat(myBool, is(true));\n \n //for good measure, verify bad boolean type will result in exception\n when(m_AttributeModel.getDefaultValues()).thenReturn(Arrays.asList(new String[]{\"not a bool\"}));\n m_SUT = new ConfigPropModelImpl(m_AttributeModel);\n try\n {\n fail(\"illegal argument exception expected. Value is: \"+ m_SUT.getValue());\n }\n catch (IllegalArgumentException e)\n {\n assertThat(e.getMessage(), containsString(\"cannot be parsed to a boolean\"));\n }\n }", "@Test\n\tpublic void testPropertyStateful() {\n\t\tfinal Base base = context.mock(Base.class);\n\t\tcontext.checking(new PropertyEnabledExpectations() {\n\t\t\t{\n\t\t\t\tallowingProperty(base).getId();\n\t\t\t}\n\t\t});\n\n\t\tfinal String key1 = \"something\";\n\t\tfinal String key2 = \"another\";\n\n\t\tbase.setId(key1);\n\t\tassertEquals(key1, base.getId());\n\t\tbase.setId(key2);\n\t\tassertEquals(key2, base.getId());\n\t}", "@Test(expected = NullPointerException.class)\n public void testGetPropertyValueSetNullPropertyName(){\n List<User> list = toList(new User(2L), new User(5L), new User(5L));\n CollectionsUtil.getPropertyValueSet(list, null, Integer.class);\n }", "@Test\n void testAssertPropertyLenientEquals_equals() {\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\n }", "public void _hasPropertyByName() {\n requiredMethod(\"getProperties()\");\n tRes.tested(\"hasPropertyByName()\",\n (\n (oObj.hasPropertyByName(IsThere.Name)) &&\n (!oObj.hasPropertyByName(\"Jupp\")) )\n );\n }", "public boolean equals(Property inProperty){\n return (inProperty.getName().equals(this.getName()));\n }", "@Override\n public boolean equals(Object obj) {\n // this code provided by Dave Houtman [2020] personal communication\n if (!(obj instanceof Property))\n return false;\n Property prop = (Property) obj;\n return this.getXLeft() == prop.getXLeft() && this.getYTop() == prop.getYTop() && hasSameSides(prop);\n }", "public void _getPropertyByName() {\n requiredMethod(\"getProperties()\");\n boolean result;\n try {\n Property prop = oObj.getPropertyByName(IsThere.Name);\n result = (prop != null);\n } catch (com.sun.star.beans.UnknownPropertyException e) {\n log.println(\"Exception occurred while testing\" +\n \" getPropertyByName with existing property\");\n e.printStackTrace(log);\n result = false;\n }\n\n try {\n oObj.getPropertyByName(\"Jupp\");\n log.println(\"No Exception thrown while testing\"+\n \" getPropertyByName with non existing property\");\n result = false;\n }\n catch (UnknownPropertyException e) {\n result = true;\n }\n tRes.tested(\"getPropertyByName()\", result);\n return;\n }", "private boolean compatible(PropertyDescriptor getter, PropertyDescriptor setter) {\n boolean match = setter.getPropertyType().isAssignableFrom(getter.getPropertyType());\n return match;\n }", "public <T> T expectProperty(String name, Class<T> type) {\n return getProperty(name, type).orElseThrow(() -> new IllegalArgumentException(String.format(\n \"Property `%s` is not part of %s, `%s`\", name, getClass().getSimpleName(), this)));\n }", "@Test\n public void testBooleanPropertyQuick() {\n Assertions.assertTrue(classObject.getBoolean(\"Started\"));\n }", "@Test\r\n\tpublic void testComplexProperty() throws Exception {\r\n\t\tAdvancedExampleComponent component = new AdvancedExampleComponent();\r\n\t\tXMLBasedPropertyContainer container = new XMLBasedPropertyContainer(XMLBasedPropertyProvider.getInstance()\r\n\t\t\t\t.getMetaPropertiesSet(component.getClass()), component);\r\n\r\n\t\t// Retreiving value of the property.\r\n\t\tProperty subProperty = container.getProperty(\"complexProperty.stringProperty\");\r\n\t\tassertNotNull(subProperty);\r\n\r\n\t\t// Attaching monitor to the property.\r\n\t\tPropertyMonitorStub monitor = new PropertyMonitorStub();\r\n\t\tcontainer.addPropertyMonitor(\"complexProperty.stringProperty\", monitor);\r\n\t\tsubProperty.setValue(subProperty.getValue() + \" - new value\");\r\n\t\tassertEquals(1, monitor.getPropertyChangedInvokationCounter());\r\n\t\tcontainer.removePropertyMonitor(\"complexProperty.stringProperty\", monitor);\r\n\r\n\t\t// Attaching monitor only to \"complexProperty\"\r\n\t\tmonitor = new PropertyMonitorStub();\r\n\t\tcontainer.addPropertyMonitor(\"complexProperty\", monitor);\r\n\t\tsubProperty.setValue(\"\");\r\n\t\tassertEquals(1, monitor.getPropertyChangedInvokationCounter());\r\n\t\tcontainer.removePropertyMonitor(\"complexProperty\", monitor);\r\n\r\n\t\t// The monitor should not get the message now.\r\n\t\tsubProperty.setValue(\"newValue\");\r\n\t\tassertEquals(1, monitor.getPropertyChangedInvokationCounter());\r\n\t}", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "boolean hasValue();", "public void testAssertPropertyLenientEquals_equals() {\r\n assertPropertyLenientEquals(\"stringProperty\", \"stringValue\", testObject);\r\n }" ]
[ "0.6662793", "0.6644194", "0.65773183", "0.65577364", "0.6453839", "0.64033085", "0.626684", "0.6265566", "0.6160877", "0.6147289", "0.6147289", "0.6147289", "0.61330295", "0.6129642", "0.6126193", "0.61172503", "0.6101284", "0.60974884", "0.60827655", "0.6081974", "0.60794413", "0.60547805", "0.60253537", "0.59635407", "0.5917973", "0.58816695", "0.5876777", "0.58515686", "0.58204526", "0.581781", "0.5817673", "0.581337", "0.5808075", "0.58037645", "0.58008003", "0.5800718", "0.57852703", "0.578517", "0.57715917", "0.5762115", "0.5761012", "0.5747428", "0.5741905", "0.5726337", "0.5715755", "0.5713317", "0.5697929", "0.5696529", "0.56898", "0.56837034", "0.5683158", "0.567382", "0.56619257", "0.56518394", "0.5644391", "0.56337535", "0.5632755", "0.5632755", "0.5630691", "0.5609604", "0.55722576", "0.55561215", "0.55522376", "0.5540184", "0.5537849", "0.5537568", "0.55349547", "0.55347705", "0.55139905", "0.55061966", "0.5471768", "0.5469638", "0.54674053", "0.5459145", "0.5458412", "0.5455691", "0.5454214", "0.5452269", "0.54490393", "0.5445951", "0.54344666", "0.5432945", "0.54304725", "0.54249716", "0.5414151", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.54084957", "0.5407783" ]
0.5703361
46